diff --git a/etcd/Response.hpp b/etcd/Response.hpp index 435936a..290fd22 100644 --- a/etcd/Response.hpp +++ b/etcd/Response.hpp @@ -85,6 +85,8 @@ namespace etcd Response(); + Response(const Response &); + /** * Returns true if this is a successful response */ @@ -192,13 +194,13 @@ namespace etcd int _error_code; std::string _error_message; - int64_t _index; + int64_t _index; std::string _action; Value _value; Value _prev_value; Values _values; Keys _keys; - int64_t _compact_revision = -1; // for watch + int64_t _compact_revision = -1; // for watch std::string _lock_key; // for lock std::string _name; // for campaign (in v3election) std::vector _events; // for watch diff --git a/src/Response.cpp b/src/Response.cpp index b065f8f..66972f3 100644 --- a/src/Response.cpp +++ b/src/Response.cpp @@ -3,6 +3,32 @@ #include +etcd::Response::Response() + : _error_code(0), + _index(0) +{ +} + +etcd::Response::Response(const etcd::Response & response) { + this->_error_code = response._error_code; + this->_error_message = response._error_message; + this->_index = response._index; + this->_action = response._action; + this->_value = response._value; + this->_prev_value = response._prev_value; + this->_values = response._values; + this->_keys = response._keys; + this->_compact_revision = response._compact_revision; + this->_lock_key = response._lock_key; + this->_name = response._name; + this->_events = response._events; + this->_duration = response._duration; + + this->_cluster_id = response._cluster_id; + this->_member_id = response._member_id; + this->_raft_term = response._raft_term; +} + etcd::Response::Response(const etcdv3::V3Response& reply, std::chrono::microseconds const& duration) { _index = reply.get_index(); @@ -41,13 +67,6 @@ etcd::Response::Response(const etcdv3::V3Response& reply, std::chrono::microseco _raft_term = reply.get_raft_term(); } - -etcd::Response::Response() - : _error_code(0), - _index(0) -{ -} - etcd::Response::Response(int error_code, char const * error_message) : _error_code(error_code), _error_message(error_message),