Skip to main content

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 (NODE_STATUS_UNSPECIFIED, NODE_STATUS_PROMOTABLE, or NODE_STATUS_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    /// Zero value: unspecified/default state (buf lint: ENUM_ZERO_VALUE_SUFFIX)
177    /// Nodes in this state should explicitly set their status before joining cluster
178    Unspecified = 0,
179    /// Learner states
180    ///
181    /// Learner that CAN be promoted to voter
182    Promotable = 1,
183    /// Learner that will NEVER be promoted (permanent analytics node)
184    ReadOnly = 2,
185    /// Voter state
186    ///
187    /// Voting member (Follower, Candidate, or Leader)
188    Active = 3,
189}
190impl NodeStatus {
191    /// String value of the enum field names used in the ProtoBuf definition.
192    ///
193    /// The values are not transformed in any way and thus are considered stable
194    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
195    pub fn as_str_name(&self) -> &'static str {
196        match self {
197            Self::Unspecified => "NODE_STATUS_UNSPECIFIED",
198            Self::Promotable => "NODE_STATUS_PROMOTABLE",
199            Self::ReadOnly => "NODE_STATUS_READ_ONLY",
200            Self::Active => "NODE_STATUS_ACTIVE",
201        }
202    }
203    /// Creates an enum from field names used in the ProtoBuf definition.
204    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
205        match value {
206            "NODE_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
207            "NODE_STATUS_PROMOTABLE" => Some(Self::Promotable),
208            "NODE_STATUS_READ_ONLY" => Some(Self::ReadOnly),
209            "NODE_STATUS_ACTIVE" => Some(Self::Active),
210            _ => None,
211        }
212    }
213}
214#[derive(serde::Serialize, serde::Deserialize)]
215#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
216#[repr(i32)]
217pub enum NodeRole {
218    Unspecified = 0,
219    Follower = 1,
220    Candidate = 2,
221    Leader = 3,
222    Learner = 4,
223}
224impl NodeRole {
225    /// String value of the enum field names used in the ProtoBuf definition.
226    ///
227    /// The values are not transformed in any way and thus are considered stable
228    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
229    pub fn as_str_name(&self) -> &'static str {
230        match self {
231            Self::Unspecified => "NODE_ROLE_UNSPECIFIED",
232            Self::Follower => "NODE_ROLE_FOLLOWER",
233            Self::Candidate => "NODE_ROLE_CANDIDATE",
234            Self::Leader => "NODE_ROLE_LEADER",
235            Self::Learner => "NODE_ROLE_LEARNER",
236        }
237    }
238    /// Creates an enum from field names used in the ProtoBuf definition.
239    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
240        match value {
241            "NODE_ROLE_UNSPECIFIED" => Some(Self::Unspecified),
242            "NODE_ROLE_FOLLOWER" => Some(Self::Follower),
243            "NODE_ROLE_CANDIDATE" => Some(Self::Candidate),
244            "NODE_ROLE_LEADER" => Some(Self::Leader),
245            "NODE_ROLE_LEARNER" => Some(Self::Learner),
246            _ => None,
247        }
248    }
249}