pub struct NetworkWorker<T>{ /* private fields */ }Expand description
Main network worker. Must be polled in order for the network to advance.
The worker is responsible for handling the network events and commands.
Implementations§
Source§impl<T: Debug + Serialize> NetworkWorker<T>
impl<T: Debug + Serialize> NetworkWorker<T>
Sourcepub fn new(
keys: &KeyPair,
config: Config,
monitor: Option<ActorRef<Monitor>>,
graceful_token: CancellationToken,
crash_token: CancellationToken,
machine_spec: Option<MachineSpec>,
metrics: Option<Arc<NetworkMetrics>>,
) -> Result<Self, Error>
pub fn new( keys: &KeyPair, config: Config, monitor: Option<ActorRef<Monitor>>, graceful_token: CancellationToken, crash_token: CancellationToken, machine_spec: Option<MachineSpec>, metrics: Option<Arc<NetworkMetrics>>, ) -> Result<Self, Error>
Create a new NetworkWorker.
Sourcepub fn add_helper_sender(&mut self, helper_sender: Sender<CommandHelper<T>>)
pub fn add_helper_sender(&mut self, helper_sender: Sender<CommandHelper<T>>)
Add sender helper
Sourcepub const fn local_peer_id(&self) -> PeerId
pub const fn local_peer_id(&self) -> PeerId
Get the local peer ID.
Sourcepub fn service(&self) -> NetworkService
pub fn service(&self) -> NetworkService
Get the network service.
Sourcepub async fn run_connection(&mut self) -> Result<(), Error>
pub async fn run_connection(&mut self) -> Result<(), Error>
Run connection to bootstrap node.
Auto Trait Implementations§
impl<T> !Freeze for NetworkWorker<T>
impl<T> !RefUnwindSafe for NetworkWorker<T>
impl<T> Send for NetworkWorker<T>where
T: Send,
impl<T> !Sync for NetworkWorker<T>
impl<T> Unpin for NetworkWorker<T>
impl<T> UnsafeUnpin for NetworkWorker<T>
impl<T> !UnwindSafe for NetworkWorker<T>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more