Update Action class
This commit is contained in:
parent
c2af35f20b
commit
6dad838545
Binary file not shown.
|
|
@ -34,16 +34,8 @@ namespace etcdv3
|
|||
class Action
|
||||
{
|
||||
public:
|
||||
Status status;
|
||||
ClientContext context;
|
||||
CompletionQueue cq_;
|
||||
void waitForResponse();
|
||||
};
|
||||
|
||||
class Actionv2
|
||||
{
|
||||
public:
|
||||
Actionv2(etcdv3::ActionParameters params);
|
||||
Action(etcdv3::ActionParameters params);
|
||||
Action(){};
|
||||
Status status;
|
||||
ClientContext context;
|
||||
CompletionQueue cq_;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using etcdserverpb::KV;
|
|||
|
||||
namespace etcdv3
|
||||
{
|
||||
class AsyncCompareAndDeleteAction : public etcdv3::Actionv2
|
||||
class AsyncCompareAndDeleteAction : public etcdv3::Action
|
||||
{
|
||||
public:
|
||||
AsyncCompareAndDeleteAction(etcdv3::ActionParameters param, etcdv3::Atomicity_Type type);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using etcdserverpb::KV;
|
|||
|
||||
namespace etcdv3
|
||||
{
|
||||
class AsyncCompareAndSwapAction : public etcdv3::Actionv2
|
||||
class AsyncCompareAndSwapAction : public etcdv3::Action
|
||||
{
|
||||
public:
|
||||
AsyncCompareAndSwapAction(etcdv3::ActionParameters param, etcdv3::Atomicity_Type type);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using etcdserverpb::KV;
|
|||
|
||||
namespace etcdv3
|
||||
{
|
||||
class AsyncDeleteAction : public etcdv3::Actionv2
|
||||
class AsyncDeleteAction : public etcdv3::Action
|
||||
{
|
||||
public:
|
||||
AsyncDeleteAction(etcdv3::ActionParameters param);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using etcdserverpb::KV;
|
|||
|
||||
namespace etcdv3
|
||||
{
|
||||
class AsyncGetAction : public etcdv3::Actionv2
|
||||
class AsyncGetAction : public etcdv3::Action
|
||||
{
|
||||
public:
|
||||
AsyncGetAction(etcdv3::ActionParameters param);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using etcdserverpb::KV;
|
|||
|
||||
namespace etcdv3
|
||||
{
|
||||
class AsyncSetAction : public etcdv3::Actionv2
|
||||
class AsyncSetAction : public etcdv3::Action
|
||||
{
|
||||
public:
|
||||
AsyncSetAction(etcdv3::ActionParameters param, bool isCreate=false);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using etcdserverpb::KV;
|
|||
|
||||
namespace etcdv3
|
||||
{
|
||||
class AsyncUpdateAction : public etcdv3::Actionv2
|
||||
class AsyncUpdateAction : public etcdv3::Action
|
||||
{
|
||||
public:
|
||||
AsyncUpdateAction(etcdv3::ActionParameters param);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ using etcdserverpb::WatchResponse;
|
|||
|
||||
namespace etcdv3
|
||||
{
|
||||
class AsyncWatchAction : public etcdv3::Actionv2
|
||||
class AsyncWatchAction : public etcdv3::Action
|
||||
{
|
||||
public:
|
||||
AsyncWatchAction(etcdv3::ActionParameters param);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
#include "v3/include/Action.hpp"
|
||||
|
||||
etcdv3::Action::Action(etcdv3::ActionParameters params)
|
||||
{
|
||||
parameters = params;
|
||||
}
|
||||
|
||||
void etcdv3::Action::waitForResponse()
|
||||
{
|
||||
void* got_tag;
|
||||
|
|
@ -8,17 +13,3 @@ void etcdv3::Action::waitForResponse()
|
|||
cq_.Next(&got_tag, &ok);
|
||||
GPR_ASSERT(got_tag == (void*)this);
|
||||
}
|
||||
|
||||
void etcdv3::Actionv2::waitForResponse()
|
||||
{
|
||||
void* got_tag;
|
||||
bool ok = false;
|
||||
|
||||
cq_.Next(&got_tag, &ok);
|
||||
GPR_ASSERT(got_tag == (void*)this);
|
||||
}
|
||||
|
||||
etcdv3::Actionv2::Actionv2(etcdv3::ActionParameters params)
|
||||
{
|
||||
parameters = params;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using etcdserverpb::ResponseOp;
|
|||
using etcdserverpb::TxnRequest;
|
||||
|
||||
etcdv3::AsyncCompareAndDeleteAction::AsyncCompareAndDeleteAction(etcdv3::ActionParameters param, etcdv3::Atomicity_Type type)
|
||||
:etcdv3::Actionv2(param)
|
||||
:etcdv3::Action(param)
|
||||
{
|
||||
etcdv3::Transaction transaction(parameters.key);
|
||||
if(type == etcdv3::Atomicity_Type::PREV_VALUE)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using etcdserverpb::ResponseOp;
|
|||
using etcdserverpb::TxnRequest;
|
||||
|
||||
etcdv3::AsyncCompareAndSwapAction::AsyncCompareAndSwapAction(etcdv3::ActionParameters param, etcdv3::Atomicity_Type type)
|
||||
: etcdv3::Actionv2(param)
|
||||
: etcdv3::Action(param)
|
||||
{
|
||||
etcdv3::Transaction transaction(parameters.key);
|
||||
if(type == etcdv3::Atomicity_Type::PREV_VALUE)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
using etcdserverpb::Compare;
|
||||
|
||||
etcdv3::AsyncDeleteAction::AsyncDeleteAction(ActionParameters param)
|
||||
: etcdv3::Actionv2(param)
|
||||
: etcdv3::Action(param)
|
||||
{
|
||||
etcdv3::Transaction transaction(parameters.key);
|
||||
transaction.init_compare(Compare::CompareResult::Compare_CompareResult_GREATER,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
using etcdserverpb::RangeRequest;
|
||||
|
||||
etcdv3::AsyncGetAction::AsyncGetAction(etcdv3::ActionParameters param)
|
||||
: etcdv3::Actionv2(param)
|
||||
: etcdv3::Action(param)
|
||||
{
|
||||
RangeRequest get_request;
|
||||
get_request.set_key(parameters.key);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using etcdserverpb::ResponseOp;
|
|||
using etcdserverpb::TxnRequest;
|
||||
|
||||
etcdv3::AsyncSetAction::AsyncSetAction(etcdv3::ActionParameters param, bool create)
|
||||
: etcdv3::Actionv2(param)
|
||||
: etcdv3::Action(param)
|
||||
{
|
||||
etcdv3::Transaction transaction(parameters.key);
|
||||
isCreate = create;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using etcdserverpb::ResponseOp;
|
|||
using etcdserverpb::TxnRequest;
|
||||
|
||||
etcdv3::AsyncUpdateAction::AsyncUpdateAction(etcdv3::ActionParameters param)
|
||||
: etcdv3::Actionv2(param)
|
||||
: etcdv3::Action(param)
|
||||
{
|
||||
etcdv3::Transaction transaction(parameters.key);
|
||||
transaction.init_compare(Compare::CompareResult::Compare_CompareResult_GREATER,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using etcdserverpb::RangeResponse;
|
|||
using etcdserverpb::WatchCreateRequest;
|
||||
|
||||
etcdv3::AsyncWatchAction::AsyncWatchAction(etcdv3::ActionParameters param)
|
||||
: etcdv3::Actionv2(param)
|
||||
: etcdv3::Action(param)
|
||||
{
|
||||
stream = parameters.watch_stub->AsyncWatch(&context,&cq_,(void*)"create");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue