pub struct ConsensusNodeBuilder { /* private fields */ }Expand description
Implementations§
Source§impl ConsensusNodeBuilder
impl ConsensusNodeBuilder
Sourcepub fn new(node_id: NodeId, address: String) -> Self
pub fn new(node_id: NodeId, address: String) -> Self
Create a new builder for the given node ID and address.
Sourcepub fn with_config(self, config: ConsensusConfig) -> Self
pub fn with_config(self, config: ConsensusConfig) -> Self
Set the consensus configuration.
Sourcepub async fn build_with<C, LS, SM, N>(
self,
log_store: LS,
state_machine: SM,
network: N,
) -> Result<ConsensusNode<C>>where
C: RaftTypeConfig<NodeId = NodeId, Node = BasicNode, Responder = OneshotResponder<C>>,
LS: RaftLogStorage<C>,
SM: RaftStateMachine<C>,
N: RaftNetworkFactory<C>,
pub async fn build_with<C, LS, SM, N>(
self,
log_store: LS,
state_machine: SM,
network: N,
) -> Result<ConsensusNode<C>>where
C: RaftTypeConfig<NodeId = NodeId, Node = BasicNode, Responder = OneshotResponder<C>>,
LS: RaftLogStorage<C>,
SM: RaftStateMachine<C>,
N: RaftNetworkFactory<C>,
Build the ConsensusNode with the provided storage and network implementations.
This is the most flexible build method – you provide all three components.
§Errors
Returns ConsensusError::Fatal if the Raft instance fails to start, or
a configuration error if the consensus config is invalid.
Auto Trait Implementations§
impl Freeze for ConsensusNodeBuilder
impl RefUnwindSafe for ConsensusNodeBuilder
impl Send for ConsensusNodeBuilder
impl Sync for ConsensusNodeBuilder
impl Unpin for ConsensusNodeBuilder
impl UnsafeUnpin for ConsensusNodeBuilder
impl UnwindSafe for ConsensusNodeBuilder
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