d_engine_proto/generated/
d_engine.common.rs

1// This file is @generated by prost-build.
2/// Basic definitions shared across modules
3#[derive(serde::Serialize, serde::Deserialize)]
4#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5pub struct LogId {
6    #[prost(uint64, tag = "1")]
7    pub term: u64,
8    #[prost(uint64, tag = "2")]
9    pub index: u64,
10}
11/// Raft log entry
12#[derive(serde::Serialize, serde::Deserialize)]
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct Entry {
15    #[prost(uint64, tag = "1")]
16    pub index: u64,
17    #[prost(uint64, tag = "2")]
18    pub term: u64,
19    #[prost(message, optional, tag = "3")]
20    pub payload: ::core::option::Option<EntryPayload>,
21}
22/// Log entry payload
23#[derive(serde::Serialize, serde::Deserialize)]
24#[derive(Clone, PartialEq, ::prost::Message)]
25pub struct EntryPayload {
26    #[prost(oneof = "entry_payload::Payload", tags = "1, 2, 3")]
27    pub payload: ::core::option::Option<entry_payload::Payload>,
28}
29/// Nested message and enum types in `EntryPayload`.
30pub mod entry_payload {
31    #[derive(serde::Serialize, serde::Deserialize)]
32    #[derive(Clone, PartialEq, ::prost::Oneof)]
33    pub enum Payload {
34        /// No operation (internal to the protocol)
35        #[prost(message, tag = "1")]
36        Noop(super::Noop),
37        /// Business write operation
38        #[prost(bytes, tag = "2")]
39        Command(::prost::bytes::Bytes),
40        /// Cluster configuration change
41        #[prost(message, tag = "3")]
42        Config(super::MembershipChange),
43    }
44}
45/// Internal operation of the protocol
46#[derive(serde::Serialize, serde::Deserialize)]
47#[derive(Clone, Copy, PartialEq, ::prost::Message)]
48pub struct Noop {}
49/// Cluster configuration change
50#[derive(serde::Serialize, serde::Deserialize)]
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct MembershipChange {
53    #[prost(oneof = "membership_change::Change", tags = "1, 2, 3, 4, 5")]
54    pub change: ::core::option::Option<membership_change::Change>,
55}
56/// Nested message and enum types in `MembershipChange`.
57pub mod membership_change {
58    #[derive(serde::Serialize, serde::Deserialize)]
59    #[derive(Clone, PartialEq, ::prost::Oneof)]
60    pub enum Change {
61        #[prost(message, tag = "1")]
62        AddNode(super::AddNode),
63        #[prost(message, tag = "2")]
64        RemoveNode(super::RemoveNode),
65        #[prost(message, tag = "3")]
66        Promote(super::PromoteLearner),
67        #[prost(message, tag = "4")]
68        BatchPromote(super::BatchPromote),
69        #[prost(message, tag = "5")]
70        BatchRemove(super::BatchRemove),
71    }
72}
73#[derive(serde::Serialize, serde::Deserialize)]
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct AddNode {
76    #[prost(uint32, tag = "1")]
77    pub node_id: u32,
78    #[prost(string, tag = "2")]
79    pub address: ::prost::alloc::string::String,
80    /// Status of the node being added (PROMOTABLE or READ_ONLY)
81    #[prost(enumeration = "NodeStatus", tag = "3")]
82    pub status: i32,
83}
84#[derive(serde::Serialize, serde::Deserialize)]
85#[derive(Clone, Copy, PartialEq, ::prost::Message)]
86pub struct RemoveNode {
87    #[prost(uint32, tag = "1")]
88    pub node_id: u32,
89}
90#[derive(serde::Serialize, serde::Deserialize)]
91#[derive(Clone, Copy, PartialEq, ::prost::Message)]
92pub struct PromoteLearner {
93    #[prost(uint32, tag = "1")]
94    pub node_id: u32,
95    #[prost(enumeration = "NodeStatus", tag = "2")]
96    pub status: i32,
97}
98#[derive(serde::Serialize, serde::Deserialize)]
99#[derive(Clone, PartialEq, ::prost::Message)]
100pub struct BatchPromote {
101    #[prost(uint32, repeated, tag = "1")]
102    pub node_ids: ::prost::alloc::vec::Vec<u32>,
103    #[prost(enumeration = "NodeStatus", tag = "2")]
104    pub new_status: i32,
105}
106#[derive(serde::Serialize, serde::Deserialize)]
107#[derive(Clone, PartialEq, ::prost::Message)]
108pub struct BatchRemove {
109    #[prost(uint32, repeated, tag = "1")]
110    pub node_ids: ::prost::alloc::vec::Vec<u32>,
111}
112#[derive(serde::Serialize, serde::Deserialize)]
113#[derive(Clone, PartialEq, ::prost::Message)]
114pub struct SnapshotEntry {
115    #[prost(bytes = "bytes", tag = "1")]
116    pub key: ::prost::bytes::Bytes,
117    #[prost(bytes = "bytes", tag = "2")]
118    pub value: ::prost::bytes::Bytes,
119}
120#[derive(serde::Serialize, serde::Deserialize)]
121#[derive(Clone, Copy, PartialEq, ::prost::Message)]
122pub struct SnapshotMeta {
123    #[prost(uint64, tag = "1")]
124    pub version_high: u64,
125    #[prost(uint64, tag = "2")]
126    pub version_low: u64,
127    #[prost(uint64, tag = "3")]
128    pub created_at_high: u64,
129    #[prost(uint64, tag = "4")]
130    pub created_at_low: u64,
131    #[prost(uint32, tag = "5")]
132    pub author_id: u32,
133    #[prost(message, optional, tag = "6")]
134    pub last_included: ::core::option::Option<LogId>,
135}
136#[derive(serde::Serialize, serde::Deserialize)]
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct Snapshot {
139    #[prost(message, optional, tag = "1")]
140    pub meta: ::core::option::Option<SnapshotMeta>,
141    #[prost(message, repeated, tag = "2")]
142    pub data: ::prost::alloc::vec::Vec<SnapshotEntry>,
143}
144/// Leader election information
145/// Used at: Application layer (internal Raft protocol notifications)
146/// Purpose: Notify applications about leader changes via watch channel
147/// Fields: Minimal - only what Raft protocol needs
148#[derive(serde::Serialize, serde::Deserialize)]
149#[derive(Clone, Copy, PartialEq, ::prost::Message)]
150pub struct LeaderInfo {
151    /// Current leader node ID
152    #[prost(uint32, tag = "1")]
153    pub leader_id: u32,
154    /// Current Raft term
155    #[prost(uint64, tag = "2")]
156    pub term: u64,
157}
158/// Leader hint for client redirection
159/// Used at: Network layer (gRPC error responses)
160/// Purpose: Help clients redirect requests to the current leader
161/// Fields: Includes network address for immediate retry
162#[derive(serde::Serialize, serde::Deserialize)]
163#[derive(Clone, PartialEq, ::prost::Message)]
164pub struct LeaderHint {
165    /// Current leader node ID
166    #[prost(uint32, tag = "1")]
167    pub leader_id: u32,
168    /// Leader's network address (e.g., "127.0.0.1:5001")
169    #[prost(string, tag = "2")]
170    pub address: ::prost::alloc::string::String,
171}
172#[derive(serde::Serialize, serde::Deserialize)]
173#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
174#[repr(i32)]
175pub enum NodeStatus {
176    /// Learner states
177    ///
178    /// Learner that CAN be promoted to voter
179    Promotable = 0,
180    /// Learner that will NEVER be promoted (permanent analytics node)
181    ReadOnly = 1,
182    /// Voter state
183    ///
184    /// Voting member (Follower, Candidate, or Leader)
185    Active = 2,
186}
187impl NodeStatus {
188    /// String value of the enum field names used in the ProtoBuf definition.
189    ///
190    /// The values are not transformed in any way and thus are considered stable
191    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
192    pub fn as_str_name(&self) -> &'static str {
193        match self {
194            Self::Promotable => "PROMOTABLE",
195            Self::ReadOnly => "READ_ONLY",
196            Self::Active => "ACTIVE",
197        }
198    }
199    /// Creates an enum from field names used in the ProtoBuf definition.
200    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
201        match value {
202            "PROMOTABLE" => Some(Self::Promotable),
203            "READ_ONLY" => Some(Self::ReadOnly),
204            "ACTIVE" => Some(Self::Active),
205            _ => None,
206        }
207    }
208}
209#[derive(serde::Serialize, serde::Deserialize)]
210#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
211#[repr(i32)]
212pub enum NodeRole {
213    Follower = 0,
214    Candidate = 1,
215    Leader = 2,
216    Learner = 3,
217}
218impl NodeRole {
219    /// String value of the enum field names used in the ProtoBuf definition.
220    ///
221    /// The values are not transformed in any way and thus are considered stable
222    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
223    pub fn as_str_name(&self) -> &'static str {
224        match self {
225            Self::Follower => "FOLLOWER",
226            Self::Candidate => "CANDIDATE",
227            Self::Leader => "LEADER",
228            Self::Learner => "LEARNER",
229        }
230    }
231    /// Creates an enum from field names used in the ProtoBuf definition.
232    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
233        match value {
234            "FOLLOWER" => Some(Self::Follower),
235            "CANDIDATE" => Some(Self::Candidate),
236            "LEADER" => Some(Self::Leader),
237            "LEARNER" => Some(Self::Learner),
238            _ => None,
239        }
240    }
241}