rqlite_rs/node.rs
1use serde::{Deserialize, Serialize};
2
3/// A node in the rqlite cluster.
4#[derive(Debug, Deserialize)]
5pub struct Node {
6 /// The unique identifier for the node.
7 pub id: String,
8 /// The address of the node's API.
9 pub api_addr: String,
10 /// The address of the node's Raft service.
11 #[serde(rename = "addr")]
12 pub raft_addr: String,
13 ///If the node is a voter.
14 pub voter: bool,
15 /// If the node is reachable.
16 pub reachable: bool,
17 /// If the node is the leader.
18 pub leader: bool,
19 /// Latency to the node.
20 pub time: f64,
21 /// If there was an error reaching the node,
22 /// this will contain the error message.
23 pub error: Option<String>,
24}
25
26#[derive(Deserialize)]
27pub(crate) struct NodeResponse {
28 pub(crate) nodes: Vec<Node>,
29}
30
31#[derive(Serialize)]
32pub(crate) struct RemoveNodeRequest {
33 pub(crate) id: String,
34}