Make input revision params 64 bit

This commit is contained in:
Matthew Fioravante 2021-10-26 22:21:37 -04:00
parent 9a481bf40a
commit 2dfbd385be
5 changed files with 30 additions and 30 deletions

View File

@ -223,7 +223,7 @@ namespace etcd
* @param value is the new value to be set * @param value is the new value to be set
* @param old_index is the expected index of the original value * @param old_index is the expected index of the original value
*/ */
pplx::task<Response> modify_if(std::string const & key, std::string const & value, int old_index, int ttl = 0); pplx::task<Response> modify_if(std::string const & key, std::string const & value, int64_t old_index, int ttl = 0);
/** /**
* Modifies an existing key only if it has a specific modification index value. Fails if the key * Modifies an existing key only if it has a specific modification index value. Fails if the key
@ -233,7 +233,7 @@ namespace etcd
* @param old_index is the expected index of the original value * @param old_index is the expected index of the original value
* @param leaseId is the lease attached to the key * @param leaseId is the lease attached to the key
*/ */
pplx::task<Response> modify_if(std::string const & key, std::string const & value, int old_index, int64_t leaseId); pplx::task<Response> modify_if(std::string const & key, std::string const & value, int64_t old_index, int64_t leaseId);
/** /**
* Removes a single key. The key has to point to a plain, non directory entry. * Removes a single key. The key has to point to a plain, non directory entry.
@ -254,7 +254,7 @@ namespace etcd
* @param key is the key to be deleted * @param key is the key to be deleted
* @param old_index is the expected index of the existing value * @param old_index is the expected index of the existing value
*/ */
pplx::task<Response> rm_if(std::string const & key, int old_index); pplx::task<Response> rm_if(std::string const & key, int64_t old_index);
/** /**
* Gets a directory listing of the directory identified by the key. * Gets a directory listing of the directory identified by the key.
@ -333,7 +333,7 @@ namespace etcd
* @param fromIndex the first index we are interested in * @param fromIndex the first index we are interested in
* @param recursive if true watch a whole subtree * @param recursive if true watch a whole subtree
*/ */
pplx::task<Response> watch(std::string const & key, int fromIndex, bool recursive = false); pplx::task<Response> watch(std::string const & key, int64_t fromIndex, bool recursive = false);
/** /**
* Watches for changes of a range of keys inside [key, range_end). * Watches for changes of a range of keys inside [key, range_end).
@ -362,7 +362,7 @@ namespace etcd
* @param range_end is the end of key range to be removed. * @param range_end is the end of key range to be removed.
* @param fromIndex the first index we are interested in * @param fromIndex the first index we are interested in
*/ */
pplx::task<Response> watch(std::string const & key, std::string const &range_end, int fromIndex); pplx::task<Response> watch(std::string const & key, std::string const &range_end, int64_t fromIndex);
/** /**
* Grants a lease. * Grants a lease.
@ -450,7 +450,7 @@ namespace etcd
* @param value is the new value to set. * @param value is the new value to set.
*/ */
pplx::task<Response> proclaim(std::string const &name, int64_t lease_id, pplx::task<Response> proclaim(std::string const &name, int64_t lease_id,
std::string const &key, int revision, std::string const &value); std::string const &key, int64_t revision, std::string const &value);
/** /**
* Get the current leader proclamation. * Get the current leader proclamation.
@ -497,7 +497,7 @@ namespace etcd
* @param revision is the created revision of key-value returned by @campaign@ * @param revision is the created revision of key-value returned by @campaign@
*/ */
pplx::task<Response> resign(std::string const &name, int64_t lease_id, pplx::task<Response> resign(std::string const &name, int64_t lease_id,
std::string const &key, int revision); std::string const &key, int64_t revision);
private: private:
#if defined(WITH_GRPC_CHANNEL_CLASS) #if defined(WITH_GRPC_CHANNEL_CLASS)

View File

@ -51,11 +51,11 @@ namespace etcd
Response modify(std::string const & key, std::string const & value, int64_t leaseId); Response modify(std::string const & key, std::string const & value, int64_t leaseId);
Response modify_if(std::string const & key, std::string const & value, std::string const & old_value, int ttl = 0); Response modify_if(std::string const & key, std::string const & value, std::string const & old_value, int ttl = 0);
Response modify_if(std::string const & key, std::string const & value, std::string const & old_value, int64_t leaseId); Response modify_if(std::string const & key, std::string const & value, std::string const & old_value, int64_t leaseId);
Response modify_if(std::string const & key, std::string const & value, int old_index, int ttl = 0); Response modify_if(std::string const & key, std::string const & value, int64_t old_index, int ttl = 0);
Response modify_if(std::string const & key, std::string const & value, int old_index, int64_t leaseId); Response modify_if(std::string const & key, std::string const & value, int64_t old_index, int64_t leaseId);
Response rm(std::string const & key); Response rm(std::string const & key);
Response rm_if(std::string const & key, std::string const & old_value); Response rm_if(std::string const & key, std::string const & old_value);
Response rm_if(std::string const & key, int old_index); Response rm_if(std::string const & key, int64_t old_index);
Response ls(std::string const & key); Response ls(std::string const & key);
Response ls(std::string const & key, size_t const limit); Response ls(std::string const & key, size_t const limit);
Response ls(std::string const & key, std::string const &range_end); Response ls(std::string const & key, std::string const &range_end);
@ -71,13 +71,13 @@ namespace etcd
Response campaign(std::string const &name, int64_t lease_id, Response campaign(std::string const &name, int64_t lease_id,
std::string const &value); std::string const &value);
Response proclaim(std::string const &name, int64_t lease_id, Response proclaim(std::string const &name, int64_t lease_id,
std::string const &key, int revision, std::string const &value); std::string const &key, int64_t revision, std::string const &value);
Response leader(std::string const &name); Response leader(std::string const &name);
std::unique_ptr<Client::Observer> observe(std::string const &name, std::unique_ptr<Client::Observer> observe(std::string const &name,
std::function<void(Response)> callback, std::function<void(Response)> callback,
const bool once = false); const bool once = false);
Response resign(std::string const &name, int64_t lease_id, Response resign(std::string const &name, int64_t lease_id,
std::string const &key, int revision); std::string const &key, int64_t revision);
/** /**
* Watches for changes of a key or a subtree. Please note that if you watch e.g. "/testdir" and * Watches for changes of a key or a subtree. Please note that if you watch e.g. "/testdir" and
@ -97,8 +97,8 @@ namespace etcd
* @param fromIndex the first index we are interested in * @param fromIndex the first index we are interested in
* @param recursive if true watch a whole subtree * @param recursive if true watch a whole subtree
*/ */
Response watch(std::string const & key, int fromIndex, bool recursive = false); Response watch(std::string const & key, int64_t fromIndex, bool recursive = false);
Response watch(std::string const & key, std::string const &range_end, int fromIndex); Response watch(std::string const & key, std::string const &range_end, int64_t fromIndex);
protected: protected:
Client client; Client client;

View File

@ -30,8 +30,8 @@ namespace etcdv3
{ {
ActionParameters(); ActionParameters();
bool withPrefix; bool withPrefix;
int revision; int64_t revision;
int old_revision; int64_t old_revision;
int64_t lease_id = 0; // no lease int64_t lease_id = 0; // no lease
int ttl; int ttl;
int limit; int limit;

View File

@ -472,7 +472,7 @@ pplx::task<etcd::Response> etcd::Client::modify_if(std::string const & key, std:
return Response::create(call); return Response::create(call);
} }
pplx::task<etcd::Response> etcd::Client::modify_if(std::string const & key, std::string const & value, int old_index, int ttl) pplx::task<etcd::Response> etcd::Client::modify_if(std::string const & key, std::string const & value, int64_t old_index, int ttl)
{ {
etcdv3::ActionParameters params; etcdv3::ActionParameters params;
params.auth_token.assign(this->auth_token); params.auth_token.assign(this->auth_token);
@ -500,7 +500,7 @@ pplx::task<etcd::Response> etcd::Client::modify_if(std::string const & key, std:
return Response::create(call); return Response::create(call);
} }
pplx::task<etcd::Response> etcd::Client::modify_if(std::string const & key, std::string const & value, int old_index, int64_t leaseid) pplx::task<etcd::Response> etcd::Client::modify_if(std::string const & key, std::string const & value, int64_t old_index, int64_t leaseid)
{ {
etcdv3::ActionParameters params; etcdv3::ActionParameters params;
params.auth_token.assign(this->auth_token); params.auth_token.assign(this->auth_token);
@ -538,7 +538,7 @@ pplx::task<etcd::Response> etcd::Client::rm_if(std::string const & key, std::str
return Response::create(call); return Response::create(call);
} }
pplx::task<etcd::Response> etcd::Client::rm_if(std::string const & key, int old_index) pplx::task<etcd::Response> etcd::Client::rm_if(std::string const & key, int64_t old_index)
{ {
etcdv3::ActionParameters params; etcdv3::ActionParameters params;
params.auth_token.assign(this->auth_token); params.auth_token.assign(this->auth_token);
@ -640,7 +640,7 @@ pplx::task<etcd::Response> etcd::Client::watch(std::string const & key, bool rec
return Response::create(call); return Response::create(call);
} }
pplx::task<etcd::Response> etcd::Client::watch(std::string const & key, int fromIndex, bool recursive) pplx::task<etcd::Response> etcd::Client::watch(std::string const & key, int64_t fromIndex, bool recursive)
{ {
etcdv3::ActionParameters params; etcdv3::ActionParameters params;
params.auth_token.assign(this->auth_token); params.auth_token.assign(this->auth_token);
@ -669,7 +669,7 @@ pplx::task<etcd::Response> etcd::Client::watch(std::string const & key, std::str
return Response::create(call); return Response::create(call);
} }
pplx::task<etcd::Response> etcd::Client::watch(std::string const & key, std::string const & range_end, int fromIndex) pplx::task<etcd::Response> etcd::Client::watch(std::string const & key, std::string const & range_end, int64_t fromIndex)
{ {
etcdv3::ActionParameters params; etcdv3::ActionParameters params;
params.auth_token.assign(this->auth_token); params.auth_token.assign(this->auth_token);
@ -835,7 +835,7 @@ pplx::task<etcd::Response> etcd::Client::campaign(
pplx::task<etcd::Response> etcd::Client::proclaim( pplx::task<etcd::Response> etcd::Client::proclaim(
std::string const &name, int64_t lease_id, std::string const &name, int64_t lease_id,
std::string const &key, int revision, std::string const &value) { std::string const &key, int64_t revision, std::string const &value) {
etcdv3::ActionParameters params; etcdv3::ActionParameters params;
params.auth_token.assign(this->auth_token); params.auth_token.assign(this->auth_token);
params.name = name; params.name = name;
@ -871,7 +871,7 @@ std::unique_ptr<etcd::Client::Observer> etcd::Client::observe(
} }
pplx::task<etcd::Response> etcd::Client::resign( pplx::task<etcd::Response> etcd::Client::resign(
std::string const &name, int64_t lease_id, std::string const &key, int revision) { std::string const &name, int64_t lease_id, std::string const &key, int64_t revision) {
etcdv3::ActionParameters params; etcdv3::ActionParameters params;
params.auth_token.assign(this->auth_token); params.auth_token.assign(this->auth_token);
params.name = name; params.name = name;

View File

@ -78,12 +78,12 @@ etcd::Response etcd::SyncClient::modify_if(std::string const & key, std::string
CHECK_EXCEPTIONS(client.modify_if(key, value, old_value, leaseId).get()); CHECK_EXCEPTIONS(client.modify_if(key, value, old_value, leaseId).get());
} }
etcd::Response etcd::SyncClient::modify_if(std::string const & key, std::string const & value, int old_index, int ttl) etcd::Response etcd::SyncClient::modify_if(std::string const & key, std::string const & value, int64_t old_index, int ttl)
{ {
CHECK_EXCEPTIONS(client.modify_if(key, value, old_index, ttl).get()); CHECK_EXCEPTIONS(client.modify_if(key, value, old_index, ttl).get());
} }
etcd::Response etcd::SyncClient::modify_if(std::string const & key, std::string const & value, int old_index, int64_t leaseId) etcd::Response etcd::SyncClient::modify_if(std::string const & key, std::string const & value, int64_t old_index, int64_t leaseId)
{ {
CHECK_EXCEPTIONS(client.modify_if(key, value, old_index, leaseId).get()); CHECK_EXCEPTIONS(client.modify_if(key, value, old_index, leaseId).get());
} }
@ -98,7 +98,7 @@ etcd::Response etcd::SyncClient::rm_if(std::string const & key, std::string cons
CHECK_EXCEPTIONS(client.rm_if(key, old_value).get()); CHECK_EXCEPTIONS(client.rm_if(key, old_value).get());
} }
etcd::Response etcd::SyncClient::rm_if(std::string const & key, int old_index) etcd::Response etcd::SyncClient::rm_if(std::string const & key, int64_t old_index)
{ {
CHECK_EXCEPTIONS(client.rm_if(key, old_index).get()); CHECK_EXCEPTIONS(client.rm_if(key, old_index).get());
} }
@ -161,7 +161,7 @@ etcd::Response etcd::SyncClient::campaign(std::string const &name, int64_t lease
} }
etcd::Response etcd::SyncClient::proclaim(std::string const &name, int64_t lease_id, etcd::Response etcd::SyncClient::proclaim(std::string const &name, int64_t lease_id,
std::string const &key, int revision, std::string const &key, int64_t revision,
std::string const &value) std::string const &value)
{ {
CHECK_EXCEPTIONS(client.proclaim(name, lease_id, key, revision, value).get()); CHECK_EXCEPTIONS(client.proclaim(name, lease_id, key, revision, value).get());
@ -180,7 +180,7 @@ std::unique_ptr<etcd::Client::Observer> etcd::SyncClient::observe(
} }
etcd::Response etcd::SyncClient::resign(std::string const &name, int64_t lease_id, etcd::Response etcd::SyncClient::resign(std::string const &name, int64_t lease_id,
std::string const &key, int revision) std::string const &key, int64_t revision)
{ {
CHECK_EXCEPTIONS(client.resign(name, lease_id, key, revision).get()); CHECK_EXCEPTIONS(client.resign(name, lease_id, key, revision).get());
} }
@ -190,7 +190,7 @@ etcd::Response etcd::SyncClient::watch(std::string const & key, bool recursive)
CHECK_EXCEPTIONS(client.watch(key, recursive).get()); CHECK_EXCEPTIONS(client.watch(key, recursive).get());
} }
etcd::Response etcd::SyncClient::watch(std::string const & key, int fromIndex, bool recursive) etcd::Response etcd::SyncClient::watch(std::string const & key, int64_t fromIndex, bool recursive)
{ {
CHECK_EXCEPTIONS(client.watch(key, fromIndex, recursive).get()); CHECK_EXCEPTIONS(client.watch(key, fromIndex, recursive).get());
} }
@ -205,7 +205,7 @@ etcd::Response etcd::SyncClient::watch(std::string const & key, std::string cons
CHECK_EXCEPTIONS(client.watch(key, range_end).get()); CHECK_EXCEPTIONS(client.watch(key, range_end).get());
} }
etcd::Response etcd::SyncClient::watch(std::string const & key, std::string const &range_end, int fromIndex) etcd::Response etcd::SyncClient::watch(std::string const & key, std::string const &range_end, int64_t fromIndex)
{ {
CHECK_EXCEPTIONS(client.watch(key, range_end, fromIndex).get()); CHECK_EXCEPTIONS(client.watch(key, range_end, fromIndex).get());
} }