pub struct RaftController { /* private fields */ }Expand description
Raft controller - replaces Java DLedger
This component provides distributed consensus using the Raft algorithm. It manages:
- Leader election
- Log replication
- Snapshot management
- State machine application
- Network communication
Implementations§
Source§impl RaftController
impl RaftController
Sourcepub async fn new(config: Arc<ControllerConfig>) -> Result<Self>
pub async fn new(config: Arc<ControllerConfig>) -> Result<Self>
Create a new Raft controller
Sourcepub async fn propose(&self, data: Vec<u8>) -> Result<Vec<u8>>
pub async fn propose(&self, data: Vec<u8>) -> Result<Vec<u8>>
Propose a new entry (write operation)
Sourcepub async fn query(&self, data: Vec<u8>) -> Result<Vec<u8>>
pub async fn query(&self, data: Vec<u8>) -> Result<Vec<u8>>
Query current state (read-only operation)
Sourcepub async fn get_leader(&self) -> Option<u64>
pub async fn get_leader(&self) -> Option<u64>
Get the current leader ID
Auto Trait Implementations§
impl Freeze for RaftController
impl !RefUnwindSafe for RaftController
impl Send for RaftController
impl Sync for RaftController
impl Unpin for RaftController
impl !UnwindSafe for RaftController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more