pub struct HttpNetwork<C: RaftTypeConfig<NodeId = NodeId>> { /* private fields */ }Expand description
Network factory that creates HTTP connections to Raft peers.
Generic over the RaftTypeConfig so any application can use it.
Implementations§
Source§impl<C: RaftTypeConfig<NodeId = NodeId>> HttpNetwork<C>
impl<C: RaftTypeConfig<NodeId = NodeId>> HttpNetwork<C>
Sourcepub fn with_client(client: RaftHttpClient) -> Self
pub fn with_client(client: RaftHttpClient) -> Self
Create a new network layer with a custom client.
Sourcepub fn with_timeouts(rpc_timeout: Duration, snapshot_timeout: Duration) -> Self
pub fn with_timeouts(rpc_timeout: Duration, snapshot_timeout: Duration) -> Self
Create a new network layer with custom timeouts.
Sourcepub fn with_timeouts_and_auth(
rpc_timeout: Duration,
snapshot_timeout: Duration,
auth_token: Option<String>,
) -> Self
pub fn with_timeouts_and_auth( rpc_timeout: Duration, snapshot_timeout: Duration, auth_token: Option<String>, ) -> Self
Create a new network layer with custom timeouts and an optional auth token.
Sourcepub async fn remove_peer(&self, node_id: NodeId)
pub async fn remove_peer(&self, node_id: NodeId)
Remove a peer.
Trait Implementations§
Source§impl<C: RaftTypeConfig<NodeId = NodeId>> Clone for HttpNetwork<C>
impl<C: RaftTypeConfig<NodeId = NodeId>> Clone for HttpNetwork<C>
Source§impl<C: RaftTypeConfig<NodeId = NodeId>> Default for HttpNetwork<C>
impl<C: RaftTypeConfig<NodeId = NodeId>> Default for HttpNetwork<C>
Source§impl<C> RaftNetworkFactory<C> for HttpNetwork<C>where
C: RaftTypeConfig<NodeId = NodeId, Node = BasicNode, SnapshotData = Cursor<Vec<u8>>>,
C::D: Serialize + DeserializeOwned,
C::R: Serialize + DeserializeOwned,
C::Entry: Serialize + DeserializeOwned,
impl<C> RaftNetworkFactory<C> for HttpNetwork<C>where
C: RaftTypeConfig<NodeId = NodeId, Node = BasicNode, SnapshotData = Cursor<Vec<u8>>>,
C::D: Serialize + DeserializeOwned,
C::R: Serialize + DeserializeOwned,
C::Entry: Serialize + DeserializeOwned,
Auto Trait Implementations§
impl<C> Freeze for HttpNetwork<C>
impl<C> !RefUnwindSafe for HttpNetwork<C>
impl<C> Send for HttpNetwork<C>
impl<C> Sync for HttpNetwork<C>
impl<C> Unpin for HttpNetwork<C>where
C: Unpin,
impl<C> UnsafeUnpin for HttpNetwork<C>
impl<C> !UnwindSafe for HttpNetwork<C>
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