pub fn new(id: NodeId, config: Arc<Config>, network: Arc<N>, storage: Arc<S>) -> Self {
        let (tx_api, rx_api) = mpsc::unbounded_channel();
        let (tx_metrics, rx_metrics) = watch::channel(RaftMetrics::new_initial(id));
        let (tx_shutdown, rx_shutdown) = oneshot::channel();
        let raft_handle = RaftCore::spawn(
            id,
            config,
            network,
            storage,
            rx_api,
            tx_metrics,
            rx_shutdown,
        );
        let inner = RaftInner {
            tx_api,
            rx_metrics,
            raft_handle: Mutex::new(Some(raft_handle)),
            tx_shutdown: Mutex::new(Some(tx_shutdown)),
            marker_n: std::marker::PhantomData,
            marker_s: std::marker::PhantomData,
        };
        Self {
            inner: Arc::new(inner),
        }
    }
/// Create and spawn a new Raft task.
///
/// ### `id`
/// The ID which the spawned Raft task will use to identify itself within the cluster.
/// Applications must guarantee that the ID provided to this function is stable, and should be
/// persisted in a well known location, probably alongside the Raft log and the application's
/// state machine. This ensures that restarts of the node will yield the same ID every time.
///
/// ### `config`
/// Raft's runtime config. See the docs on the `Config` object for more details.
///
/// ### `network`
/// An implementation of the `RaftNetwork` trait which will be used by Raft for sending RPCs to
/// peer nodes within the cluster. See the docs on the `RaftNetwork` trait for more details.
///
/// ### `storage`
/// An implementation of the `RaftStorage` trait which will be used by Raft for data storage.
/// See the docs on the `RaftStorage` trait for more details.
Create and spawn a new Raft task.
Create and spawn a new Raft task .
pub fn new(id: NodeId, config: Arc<Config>, network: Arc<N>, storage: Arc<S>) -> Self {
        let (tx_api, rx_api) = mpsc::unbounded_channel();
        let (tx_metrics, rx_metrics) = watch::channel(RaftMetrics::new_initial(id));
        let (tx_shutdown, rx_shutdown) = oneshot::channel();
        let raft_handle = RaftCore::spawn(
            id,
            config,
            network,
            storage,
            rx_api,
            tx_metrics,
            rx_shutdown,
        );
        let inner = RaftInner {
            tx_api,
            rx_metrics,
            raft_handle: Mutex::new(Some(raft_handle)),
            tx_shutdown: Mutex::new(Some(tx_shutdown)),
            marker_n: std::marker::PhantomData,
            marker_s: std::marker::PhantomData,
        };
        Self {
            inner: Arc::new(inner),
        }
    }
pub fn new ( id : NodeId , config : Arc < Config > , network : Arc < N > , storage : Arc < S > ) -> Self { let ( tx_api , rx_api ) = mpsc :: unbounded_channel ( ) ; let ( tx_metrics , rx_metrics ) = watch :: channel ( RaftMetrics :: new_initial ( id ) ) ; let ( tx_shutdown , rx_shutdown ) = oneshot :: channel ( ) ; let raft_handle = RaftCore :: spawn ( id , config , network , storage , rx_api , tx_metrics , rx_shutdown , ) ; let inner = RaftInner { tx_api , rx_metrics , raft_handle : Mutex :: new ( Some ( raft_handle ) ) , tx_shutdown : Mutex :: new ( Some ( tx_shutdown ) ) , marker_n : std :: marker :: PhantomData , marker_s : std :: marker :: PhantomData , } ; Self { inner : Arc :: new ( inner ) , } }
Create and spawn a new Raft task.
Create and spawn a new Raft task .
id
NodeId
config
Arc<Config>
network
Arc<N>
storage
Arc<S>
id
NodeId
config
Arc<Config>
network
Arc<N>
storage
Arc<S>
`id`
The ID which the spawned Raft task will use to identify itself within the cluster.
Applications must guarantee that the ID provided to this function is stable, and should be
persisted in a well known location, probably alongside the Raft log and the application's
state machine. This ensures that restarts of the node will yield the same ID every time.
The ID which the spawned Raft task will use to identify itself within the cluster . Applications must guarantee that the ID provided to this function is stable and should be persisted in a well known location probably alongside the Raft log and the application ' s state machine . This ensures that restarts of the node will yield the same ID every time .
`config`
Raft's runtime config. See the docs on the `Config` object for more details.
Raft ' s runtime config . See the docs on the ` Config ` object for more details .
`network`
An implementation of the `RaftNetwork` trait which will be used by Raft for sending RPCs to
peer nodes within the cluster. See the docs on the `RaftNetwork` trait for more details.
An implementation of the ` RaftNetwork ` trait which will be used by Raft for sending RPCs to peer nodes within the cluster . See the docs on the ` RaftNetwork ` trait for more details .
`storage`
An implementation of the `RaftStorage` trait which will be used by Raft for data storage.
See the docs on the `RaftStorage` trait for more details.
An implementation of the ` RaftStorage ` trait which will be used by Raft for data storage . See the docs on the ` RaftStorage ` trait for more details .