Return complete meta information of HEAD. (#123)
* Return complete meta information of HEAD. * Fixes the CI by revisiting the LD_LIBRARY_PATH. Signed-off-by: Tao He <sighingnow@gmail.com>
This commit is contained in:
parent
767f0b1c65
commit
d4975f84b3
|
|
@ -129,7 +129,7 @@ jobs:
|
|||
|
||||
- name: Build
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib/x86_64-linux-gnu
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
|
@ -148,7 +148,7 @@ jobs:
|
|||
|
||||
- name: Test
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib/x86_64-linux-gnu
|
||||
|
||||
# use etcd v3 api
|
||||
export ETCDCTL_API="3"
|
||||
|
|
@ -171,7 +171,7 @@ jobs:
|
|||
|
||||
- name: Authentication Test
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib/x86_64-linux-gnu
|
||||
|
||||
# use etcd v3 api
|
||||
export ETCDCTL_API="3"
|
||||
|
|
@ -212,7 +212,7 @@ jobs:
|
|||
|
||||
- name: Transport Security and Authentication Test
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib/x86_64-linux-gnu
|
||||
|
||||
# use etcd v3 api
|
||||
export ETCDCTL_API="3"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ option(BUILD_ETCD_TESTS "Build test cases" OFF)
|
|||
|
||||
# reference: https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling#always-full-rpath
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib64")
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib64:${CMAKE_INSTALL_PREFIX}/lib/x86_64-linux-gnu")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
if(MSVC)
|
||||
|
|
|
|||
|
|
@ -171,6 +171,21 @@ namespace etcd
|
|||
*/
|
||||
std::chrono::microseconds const & duration() const;
|
||||
|
||||
/**
|
||||
* Returns the current cluster id.
|
||||
*/
|
||||
uint64_t cluster_id() const;
|
||||
|
||||
/**
|
||||
* Returns the current member id.
|
||||
*/
|
||||
uint64_t member_id() const;
|
||||
|
||||
/**
|
||||
* Returns ther current raft term.
|
||||
*/
|
||||
uint64_t raft_term() const;
|
||||
|
||||
protected:
|
||||
Response(const etcdv3::V3Response& response, std::chrono::microseconds const& duration);
|
||||
Response(int error_code, char const * error_message);
|
||||
|
|
@ -190,6 +205,10 @@ namespace etcd
|
|||
// execute duration (in microseconds), during the action created and response parsed
|
||||
std::chrono::microseconds _duration;
|
||||
|
||||
uint64_t _cluster_id;
|
||||
uint64_t _member_id;
|
||||
uint64_t _raft_term;
|
||||
|
||||
friend class Client;
|
||||
friend class SyncClient;
|
||||
friend class etcdv3::AsyncWatchAction;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ namespace etcdv3
|
|||
void set_name(std::string const &name);
|
||||
std::string const &get_name() const;
|
||||
std::vector<mvccpb::Event> const & get_events() const;
|
||||
uint64_t get_cluster_id() const;
|
||||
uint64_t get_member_id() const;
|
||||
uint64_t get_raft_term() const;
|
||||
protected:
|
||||
int error_code;
|
||||
int64_t index;
|
||||
|
|
@ -44,6 +47,9 @@ namespace etcdv3
|
|||
std::string lock_key; // for lock
|
||||
std::string name; // for campaign (in v3election)
|
||||
std::vector<mvccpb::Event> events; // for watch
|
||||
uint64_t cluster_id;
|
||||
uint64_t member_id;
|
||||
uint64_t raft_term;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@ etcd::Response::Response(const etcdv3::V3Response& reply, std::chrono::microseco
|
|||
|
||||
// duration
|
||||
_duration = duration;
|
||||
|
||||
// etcd head
|
||||
_cluster_id = reply.get_cluster_id();
|
||||
_member_id = reply.get_member_id();
|
||||
_raft_term = reply.get_raft_term();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -130,3 +135,15 @@ std::vector<etcd::Event> const & etcd::Response::events() const {
|
|||
std::chrono::microseconds const& etcd::Response::duration() const {
|
||||
return this->_duration;
|
||||
}
|
||||
|
||||
uint64_t etcd::Response::cluster_id() const {
|
||||
return this->_cluster_id;
|
||||
}
|
||||
|
||||
uint64_t etcd::Response::member_id() const {
|
||||
return this->_member_id;
|
||||
}
|
||||
|
||||
uint64_t etcd::Response::raft_term() const {
|
||||
return this->_raft_term;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,8 @@
|
|||
|
||||
void etcdv3::AsyncHeadResponse::ParseResponse(RangeResponse& resp)
|
||||
{
|
||||
cluster_id = resp.header().cluster_id();
|
||||
member_id = resp.header().member_id();
|
||||
index = resp.header().revision();
|
||||
raft_term = resp.header().raft_term();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,3 +85,15 @@ std::string const & etcdv3::V3Response::get_name() const {
|
|||
std::vector<mvccpb::Event> const & etcdv3::V3Response::get_events() const {
|
||||
return this->events;
|
||||
}
|
||||
|
||||
uint64_t etcdv3::V3Response::get_cluster_id() const {
|
||||
return this->cluster_id;
|
||||
}
|
||||
|
||||
uint64_t etcdv3::V3Response::get_member_id() const {
|
||||
return this->member_id;
|
||||
}
|
||||
|
||||
uint64_t etcdv3::V3Response::get_raft_term() const {
|
||||
return this->raft_term;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue