pub struct ConsensusEngine { /* private fields */ }Expand description
Consensus engine
Implementations§
Source§impl ConsensusEngine
impl ConsensusEngine
Sourcepub async fn register_agent(&self, agent_id: String, weight: f64)
pub async fn register_agent(&self, agent_id: String, weight: f64)
Register agent
Sourcepub async fn submit_proposal(&self, proposal: Proposal) -> String
pub async fn submit_proposal(&self, proposal: Proposal) -> String
Submit proposal
Sourcepub async fn vote(&self, vote: Vote) -> Result<ConsensusResult>
pub async fn vote(&self, vote: Vote) -> Result<ConsensusResult>
Vote on proposal
Sourcepub async fn get_result(&self, proposal_id: &str) -> Option<ConsensusResult>
pub async fn get_result(&self, proposal_id: &str) -> Option<ConsensusResult>
Get proposal result
Sourcepub async fn get_proposal(&self, proposal_id: &str) -> Option<Proposal>
pub async fn get_proposal(&self, proposal_id: &str) -> Option<Proposal>
Get proposal details
Sourcepub async fn list_proposals(&self) -> Vec<Proposal>
pub async fn list_proposals(&self) -> Vec<Proposal>
List all proposals
Sourcepub async fn cleanup_old(&self, max_age: Duration)
pub async fn cleanup_old(&self, max_age: Duration)
Cleanup old proposals
Sourcepub async fn agent_count(&self) -> usize
pub async fn agent_count(&self) -> usize
Get agent count
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConsensusEngine
impl !RefUnwindSafe for ConsensusEngine
impl Send for ConsensusEngine
impl Sync for ConsensusEngine
impl Unpin for ConsensusEngine
impl !UnwindSafe for ConsensusEngine
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