Loading include/kinetic/blocking_kinetic_connection.h +2 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ class BlockingKineticConnection { /// tells the client the correct cluster version using this method. virtual void SetClientClusterVersion(int64_t cluster_version); virtual KineticStatus NoOp(); virtual KineticStatus Get( const shared_ptr<const string> key, unique_ptr<KineticRecord>& record); Loading include/kinetic/nonblocking_kinetic_connection.h +19 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,24 @@ class SimpleHandler : public HandlerInterface { DISALLOW_COPY_AND_ASSIGN(SimpleHandler); }; class NoOpCallbackInterface { public: virtual ~NoOpCallbackInterface() {} virtual void Success() = 0; virtual void Failure(KineticStatus error) = 0; }; class NoOpHandler : public HandlerInterface { public: explicit NoOpHandler(const shared_ptr<NoOpCallbackInterface> callback); void Handle(const Message &response, unique_ptr<const string> value); void Error(KineticStatus error); private: const shared_ptr<NoOpCallbackInterface> callback_; DISALLOW_COPY_AND_ASSIGN(NoOpHandler); }; class GetCallbackInterface { public: virtual ~GetCallbackInterface() {} Loading Loading @@ -223,6 +241,7 @@ class NonblockingKineticConnection { virtual bool Run(fd_set *read_fds, fd_set *write_fds, int *nfds); virtual void SetClientClusterVersion(int64_t cluster_version); virtual HandlerKey NoOp(const shared_ptr<NoOpCallbackInterface> callback); virtual HandlerKey Get(const string key, const shared_ptr<GetCallbackInterface> callback); virtual HandlerKey Get(const shared_ptr<const string> key, const shared_ptr<GetCallbackInterface> callback); Loading src/integration_test/blocking_smoketest.cc +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ using com::seagate::kinetic::client::proto::Message_Algorithm_SHA1; TEST_F(IntegrationTest, BlockingSmoketest) { BlockingKineticConnection& blocking = connection_->blocking(); ASSERT_TRUE(blocking.NoOp().ok()); auto record1 = make_shared<KineticRecord>(make_shared<string>("value1"), make_shared<string>("v1"), make_shared<string>("t1"), Message_Algorithm_CRC32); KineticStatus kineticStatus = blocking.Put("key1", "", IGNORE_VERSION, *record1); Loading src/main/blocking_kinetic_connection.cc +18 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,24 @@ class BlockingCallbackState { } }; class BlockingNoOpCallback : public NoOpCallbackInterface, public BlockingCallbackState { public: virtual void Success() { OnSuccess(); } virtual void Failure(KineticStatus error) { OnError(error); } private: }; KineticStatus BlockingKineticConnection::NoOp() { auto handler = make_shared<BlockingNoOpCallback>(); return RunOperation(handler, nonblocking_connection_->NoOp(handler)); } class BlockingGetCallback : public GetCallbackInterface, public BlockingCallbackState { public: BlockingGetCallback( Loading src/main/nonblocking_kinetic_connection.cc +19 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ using com::seagate::kinetic::client::proto::Message_MessageType_GETNEXT; using com::seagate::kinetic::client::proto::Message_MessageType_GETPREVIOUS; using com::seagate::kinetic::client::proto::Message_MessageType_GETKEYRANGE; using com::seagate::kinetic::client::proto::Message_MessageType_GETVERSION; using com::seagate::kinetic::client::proto::Message_MessageType_NOOP; using com::seagate::kinetic::client::proto::Message_MessageType_PUT; using com::seagate::kinetic::client::proto::Message_MessageType_SETUP; using com::seagate::kinetic::client::proto::Message_MessageType_GETLOG; Loading Loading @@ -59,6 +60,18 @@ using std::unique_ptr; using std::iterator; using std::move; NoOpHandler::NoOpHandler(const shared_ptr<NoOpCallbackInterface> callback) : callback_(callback) {} void NoOpHandler::Handle(const Message &response, unique_ptr<const string> value) { callback_->Success(); } void NoOpHandler::Error(KineticStatus error) { callback_->Failure(error); } GetHandler::GetHandler(const shared_ptr<GetCallbackInterface> callback) : callback_(callback) {} Loading Loading @@ -232,6 +245,12 @@ unique_ptr<Message> NonblockingKineticConnection::NewMessage(Message_MessageType return move(msg); } HandlerKey NonblockingKineticConnection::NoOp(const shared_ptr<NoOpCallbackInterface> callback){ unique_ptr<NoOpHandler> handler(new NoOpHandler(callback)); unique_ptr<Message> request = NewMessage(Message_MessageType_NOOP); return service_->Submit(move(request), empty_str_, move(handler)); } HandlerKey NonblockingKineticConnection::Get(const shared_ptr<const string> key, const shared_ptr<GetCallbackInterface> callback) { return GenericGet(key, callback, Message_MessageType_GET); Loading Loading
include/kinetic/blocking_kinetic_connection.h +2 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ class BlockingKineticConnection { /// tells the client the correct cluster version using this method. virtual void SetClientClusterVersion(int64_t cluster_version); virtual KineticStatus NoOp(); virtual KineticStatus Get( const shared_ptr<const string> key, unique_ptr<KineticRecord>& record); Loading
include/kinetic/nonblocking_kinetic_connection.h +19 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,24 @@ class SimpleHandler : public HandlerInterface { DISALLOW_COPY_AND_ASSIGN(SimpleHandler); }; class NoOpCallbackInterface { public: virtual ~NoOpCallbackInterface() {} virtual void Success() = 0; virtual void Failure(KineticStatus error) = 0; }; class NoOpHandler : public HandlerInterface { public: explicit NoOpHandler(const shared_ptr<NoOpCallbackInterface> callback); void Handle(const Message &response, unique_ptr<const string> value); void Error(KineticStatus error); private: const shared_ptr<NoOpCallbackInterface> callback_; DISALLOW_COPY_AND_ASSIGN(NoOpHandler); }; class GetCallbackInterface { public: virtual ~GetCallbackInterface() {} Loading Loading @@ -223,6 +241,7 @@ class NonblockingKineticConnection { virtual bool Run(fd_set *read_fds, fd_set *write_fds, int *nfds); virtual void SetClientClusterVersion(int64_t cluster_version); virtual HandlerKey NoOp(const shared_ptr<NoOpCallbackInterface> callback); virtual HandlerKey Get(const string key, const shared_ptr<GetCallbackInterface> callback); virtual HandlerKey Get(const shared_ptr<const string> key, const shared_ptr<GetCallbackInterface> callback); Loading
src/integration_test/blocking_smoketest.cc +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ using com::seagate::kinetic::client::proto::Message_Algorithm_SHA1; TEST_F(IntegrationTest, BlockingSmoketest) { BlockingKineticConnection& blocking = connection_->blocking(); ASSERT_TRUE(blocking.NoOp().ok()); auto record1 = make_shared<KineticRecord>(make_shared<string>("value1"), make_shared<string>("v1"), make_shared<string>("t1"), Message_Algorithm_CRC32); KineticStatus kineticStatus = blocking.Put("key1", "", IGNORE_VERSION, *record1); Loading
src/main/blocking_kinetic_connection.cc +18 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,24 @@ class BlockingCallbackState { } }; class BlockingNoOpCallback : public NoOpCallbackInterface, public BlockingCallbackState { public: virtual void Success() { OnSuccess(); } virtual void Failure(KineticStatus error) { OnError(error); } private: }; KineticStatus BlockingKineticConnection::NoOp() { auto handler = make_shared<BlockingNoOpCallback>(); return RunOperation(handler, nonblocking_connection_->NoOp(handler)); } class BlockingGetCallback : public GetCallbackInterface, public BlockingCallbackState { public: BlockingGetCallback( Loading
src/main/nonblocking_kinetic_connection.cc +19 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ using com::seagate::kinetic::client::proto::Message_MessageType_GETNEXT; using com::seagate::kinetic::client::proto::Message_MessageType_GETPREVIOUS; using com::seagate::kinetic::client::proto::Message_MessageType_GETKEYRANGE; using com::seagate::kinetic::client::proto::Message_MessageType_GETVERSION; using com::seagate::kinetic::client::proto::Message_MessageType_NOOP; using com::seagate::kinetic::client::proto::Message_MessageType_PUT; using com::seagate::kinetic::client::proto::Message_MessageType_SETUP; using com::seagate::kinetic::client::proto::Message_MessageType_GETLOG; Loading Loading @@ -59,6 +60,18 @@ using std::unique_ptr; using std::iterator; using std::move; NoOpHandler::NoOpHandler(const shared_ptr<NoOpCallbackInterface> callback) : callback_(callback) {} void NoOpHandler::Handle(const Message &response, unique_ptr<const string> value) { callback_->Success(); } void NoOpHandler::Error(KineticStatus error) { callback_->Failure(error); } GetHandler::GetHandler(const shared_ptr<GetCallbackInterface> callback) : callback_(callback) {} Loading Loading @@ -232,6 +245,12 @@ unique_ptr<Message> NonblockingKineticConnection::NewMessage(Message_MessageType return move(msg); } HandlerKey NonblockingKineticConnection::NoOp(const shared_ptr<NoOpCallbackInterface> callback){ unique_ptr<NoOpHandler> handler(new NoOpHandler(callback)); unique_ptr<Message> request = NewMessage(Message_MessageType_NOOP); return service_->Submit(move(request), empty_str_, move(handler)); } HandlerKey NonblockingKineticConnection::Get(const shared_ptr<const string> key, const shared_ptr<GetCallbackInterface> callback) { return GenericGet(key, callback, Message_MessageType_GET); Loading