etcd_rs/
response_header.rs

1use crate::proto::etcdserverpb;
2
3#[derive(Debug, Clone)]
4pub struct ResponseHeader {
5    proto: crate::proto::etcdserverpb::ResponseHeader,
6}
7
8impl ResponseHeader {
9    /// Get the ID of the cluster which sent the response.
10    pub fn cluster_id(&self) -> u64 {
11        self.proto.cluster_id
12    }
13
14    /// Get the ID of the member which sent the response.
15    pub fn member_id(&self) -> u64 {
16        self.proto.member_id
17    }
18
19    /// Get the key-value store revision when the request was applied.
20    pub fn revision(&self) -> i64 {
21        self.proto.revision
22    }
23
24    /// Get the raft term when the request was applied.
25    pub fn raft_term(&self) -> u64 {
26        self.proto.raft_term
27    }
28}
29
30impl From<etcdserverpb::ResponseHeader> for ResponseHeader {
31    fn from(proto: etcdserverpb::ResponseHeader) -> Self {
32        Self { proto }
33    }
34}