21 #ifndef NONBLOCKING_KINETIC_CONNECTION_INTERFACE_H_
22 #define NONBLOCKING_KINETIC_CONNECTION_INTERFACE_H_
24 #include "kinetic/common.h"
25 #include "kinetic_client.pb.h"
26 #include "kinetic/kinetic_record.h"
27 #include "kinetic/drive_log.h"
28 #include "kinetic/acls.h"
29 #include "kinetic/kinetic_connection.h"
30 #include "kinetic/kinetic_status.h"
31 #include "kinetic/nonblocking_packet_service_interface.h"
39 using com::seagate::kinetic::client::proto::Command;
40 using com::seagate::kinetic::client::proto::Command_MessageType;
41 using com::seagate::kinetic::client::proto::Command_P2POperation;
42 using com::seagate::kinetic::client::proto::Command_Synchronization;
43 using com::seagate::kinetic::client::proto::Command_GetLog_Type;
45 using std::shared_ptr;
46 using std::unique_ptr;
48 using std::make_shared;
57 virtual void Success() = 0;
63 explicit SimpleHandler(
const shared_ptr<SimpleCallbackInterface> callback);
64 void Handle(
const Command &response, unique_ptr<const string> value);
65 void Error(
KineticStatus error, Command
const *
const response);
68 const shared_ptr<SimpleCallbackInterface> callback_;
75 virtual void Success(
const std::string &key, std::unique_ptr<KineticRecord> record) = 0;
81 explicit GetHandler(
const shared_ptr<GetCallbackInterface> callback);
82 void Handle(
const Command &response, unique_ptr<const string> value);
83 void Error(
KineticStatus error, Command
const *
const response);
86 const shared_ptr<GetCallbackInterface> callback_;
93 virtual void Success(
const std::string &version) = 0;
99 explicit GetVersionHandler(
const shared_ptr<GetVersionCallbackInterface> callback);
100 void Handle(
const Command &response, unique_ptr<const string> value);
101 void Error(
KineticStatus error, Command
const *
const response);
104 const shared_ptr<GetVersionCallbackInterface> callback_;
111 virtual void Success(unique_ptr<vector<string>> keys) = 0;
118 void Handle(
const Command &response, unique_ptr<const string> value);
119 void Error(
KineticStatus error, Command
const *
const response);
122 const shared_ptr<GetKeyRangeCallbackInterface> callback_;
129 virtual void Success() = 0;
136 explicit PutHandler(
const shared_ptr<PutCallbackInterface> callback);
137 void Handle(
const Command &response, unique_ptr<const string> value);
138 void Error(
KineticStatus error, Command
const *
const response);
141 const shared_ptr<PutCallbackInterface> callback_;
148 virtual void Success(unique_ptr<DriveLog> drive_log) = 0;
154 explicit GetLogHandler(
const shared_ptr<GetLogCallbackInterface> callback);
155 void Handle(
const Command& response, unique_ptr<const string> value);
156 void Error(
KineticStatus error, Command
const *
const response);
159 const shared_ptr<GetLogCallbackInterface> callback_;
166 virtual void Success(unique_ptr<vector<KineticStatus>> operation_statuses,
const Command& response) = 0;
167 virtual void Failure(
KineticStatus error, Command
const *
const response) = 0;
172 explicit P2PPushHandler(
const shared_ptr<P2PPushCallbackInterface> callback);
173 void Handle(
const Command& response, unique_ptr<const string> value);
174 void Error(
KineticStatus error, Command
const *
const response);
177 const shared_ptr<P2PPushCallbackInterface> callback_;
222 virtual void SetClientClusterVersion(int64_t cluster_version) = 0;
223 virtual bool Run(fd_set *read_fds, fd_set *write_fds,
int *nfds) = 0;
224 virtual bool RemoveHandler(HandlerKey handler_key) = 0;
226 virtual HandlerKey NoOp(
const shared_ptr<SimpleCallbackInterface> callback) = 0;
227 virtual HandlerKey Get(
const string key,
const shared_ptr<GetCallbackInterface> callback) = 0;
228 virtual HandlerKey Get(
const shared_ptr<const string> key,
229 const shared_ptr<GetCallbackInterface> callback) = 0;
230 virtual HandlerKey GetNext(
const shared_ptr<const string> key,
231 const shared_ptr<GetCallbackInterface> callback) = 0;
232 virtual HandlerKey GetNext(
const string key,
233 const shared_ptr<GetCallbackInterface> callback) = 0;
234 virtual HandlerKey GetPrevious(
const shared_ptr<const string> key,
235 const shared_ptr<GetCallbackInterface> callback) = 0;
236 virtual HandlerKey GetPrevious(
const string key,
237 const shared_ptr<GetCallbackInterface> callback) = 0;
238 virtual HandlerKey GetVersion(
const shared_ptr<const string> key,
239 const shared_ptr<GetVersionCallbackInterface> callback) = 0;
240 virtual HandlerKey GetVersion(
const string key,
241 const shared_ptr<GetVersionCallbackInterface> callback) = 0;
242 virtual HandlerKey GetKeyRange(
const shared_ptr<const string> start_key,
243 bool start_key_inclusive,
244 const shared_ptr<const string> end_key,
245 bool end_key_inclusive,
246 bool reverse_results,
248 const shared_ptr<GetKeyRangeCallbackInterface> callback) = 0;
249 virtual HandlerKey GetKeyRange(
const string start_key,
250 bool start_key_inclusive,
251 const string end_key,
252 bool end_key_inclusive,
253 bool reverse_results,
255 const shared_ptr<GetKeyRangeCallbackInterface> callback) = 0;
256 virtual HandlerKey Put(
const shared_ptr<const string> key,
257 const shared_ptr<const string> current_version, WriteMode mode,
258 const shared_ptr<const KineticRecord> record,
259 const shared_ptr<PutCallbackInterface> callback) = 0;
260 virtual HandlerKey Put(
const string key,
261 const string current_version, WriteMode mode,
262 const shared_ptr<const KineticRecord> record,
263 const shared_ptr<PutCallbackInterface> callback) = 0;
264 virtual HandlerKey Put(
const shared_ptr<const string> key,
265 const shared_ptr<const string> current_version, WriteMode mode,
266 const shared_ptr<const KineticRecord> record,
267 const shared_ptr<PutCallbackInterface> callback,
268 PersistMode persistMode) = 0;
269 virtual HandlerKey Put(
const string key,
270 const string current_version, WriteMode mode,
271 const shared_ptr<const KineticRecord> record,
272 const shared_ptr<PutCallbackInterface> callback,
273 PersistMode persistMode) = 0;
274 virtual HandlerKey Delete(
const shared_ptr<const string> key,
275 const shared_ptr<const string> version, WriteMode mode,
276 const shared_ptr<SimpleCallbackInterface> callback, PersistMode persistMode) = 0;
277 virtual HandlerKey Delete(
const string key,
const string version, WriteMode mode,
278 const shared_ptr<SimpleCallbackInterface> callback, PersistMode persistMode) = 0;
279 virtual HandlerKey Delete(
const shared_ptr<const string> key,
280 const shared_ptr<const string> version, WriteMode mode,
281 const shared_ptr<SimpleCallbackInterface> callback) = 0;
282 virtual HandlerKey Delete(
const string key,
const string version, WriteMode mode,
283 const shared_ptr<SimpleCallbackInterface> callback) = 0;
285 const shared_ptr<P2PPushCallbackInterface> callback) = 0;
286 virtual HandlerKey P2PPush(
const shared_ptr<const P2PPushRequest> push_request,
287 const shared_ptr<P2PPushCallbackInterface> callback) = 0;
288 virtual HandlerKey GetLog(
const shared_ptr<GetLogCallbackInterface> callback) = 0;
289 virtual HandlerKey GetLog(
const vector<Command_GetLog_Type>& types,
290 const shared_ptr<GetLogCallbackInterface> callback) = 0;
292 virtual HandlerKey UpdateFirmware(
const shared_ptr<const string> new_firmware,
293 const shared_ptr<SimpleCallbackInterface> callback) = 0;
294 virtual HandlerKey SetClusterVersion(int64_t new_cluster_version,
295 const shared_ptr<SimpleCallbackInterface> callback) = 0;
297 virtual HandlerKey SetACLs(
const shared_ptr<
const list<ACL>> acls,
298 const shared_ptr<SimpleCallbackInterface> callback) = 0;
299 virtual HandlerKey SetErasePIN(
const shared_ptr<const string> new_pin,
300 const shared_ptr<const string> current_pin,
301 const shared_ptr<SimpleCallbackInterface> callback) = 0;
302 virtual HandlerKey SetErasePIN(
const string new_pin,
303 const string current_pin,
304 const shared_ptr<SimpleCallbackInterface> callback) = 0;
305 virtual HandlerKey SetLockPIN(
const shared_ptr<const string> new_pin,
306 const shared_ptr<const string> current_pin,
307 const shared_ptr<SimpleCallbackInterface> callback) = 0;
308 virtual HandlerKey SetLockPIN(
const string new_pin,
309 const string current_pin,
310 const shared_ptr<SimpleCallbackInterface> callback) = 0;
312 virtual HandlerKey InstantErase(
const shared_ptr<string> pin,
313 const shared_ptr<SimpleCallbackInterface> callback) = 0;
314 virtual HandlerKey InstantErase(
const string pin,
315 const shared_ptr<SimpleCallbackInterface> callback) = 0;
316 virtual HandlerKey SecureErase(
const shared_ptr<string> pin,
317 const shared_ptr<SimpleCallbackInterface> callback) = 0;
318 virtual HandlerKey SecureErase(
const string pin,
319 const shared_ptr<SimpleCallbackInterface> callback) = 0;
320 virtual HandlerKey LockDevice(
const shared_ptr<string> pin,
321 const shared_ptr<SimpleCallbackInterface> callback) = 0;
322 virtual HandlerKey LockDevice(
const string pin,
323 const shared_ptr<SimpleCallbackInterface> callback) = 0;
324 virtual HandlerKey UnlockDevice(
const shared_ptr<string> pin,
325 const shared_ptr<SimpleCallbackInterface> callback) = 0;
326 virtual HandlerKey UnlockDevice(
const string pin,
327 const shared_ptr<SimpleCallbackInterface> callback) = 0;
Represents a collection of P2P operations.
vector< P2PPushOperation > operations
Operations to perform against the drive specified above.
Represents a single P2P copy operation.
string newKey
Optionally specify that the key should be copied to a different key on the remote drive...
shared_ptr< P2PPushRequest > request
P2P operations to execute on the drive specified in the request. This lets you set up a pipeline of P...
bool force
Ignore version on the remote drive. The same as specifying force with a regular put.
string key
The key to copy.
Indicates whether a Kinetic operation (get, put, security, etc) put succeeded or failed. Unlike Status it provides details like whether the failure resulted from a version or an HMAC error.
string host
Host/IP address of the target drive.
int port
Port of the target drive.
string version
The expected version on the remote peer. The same as specifying a version with a regular put...