pub struct Manager<NI: NetworkIdentity, D: Data, VCU: ValidatorAddressCacheUpdater> {
    network_identity: NI,
    connections: Connections<NI::PeerId>,
    sessions: HashMap<SessionId, Session<D, NI::AddressingInformation>>,
    validator_address_cache_updater: VCU,
    discovery_cooldown: Duration,
}Expand description
The connection manager. It handles the abstraction over the network we build to support separate sessions. This includes:
- Starting and ending specific sessions on user demand.
- Forwarding in-session user messages to the network using session handlers for address translation.
- Handling network messages:
- In-session messages are forwarded to the user.
- Authentication messages forwarded to session handlers.
 
- Running periodic maintenance, mostly related to node discovery.
Fields§
§network_identity: NI§connections: Connections<NI::PeerId>§sessions: HashMap<SessionId, Session<D, NI::AddressingInformation>>§validator_address_cache_updater: VCU§discovery_cooldown: DurationImplementations§
source§impl<NI: NetworkIdentity, D: Data, VCU: ValidatorAddressCacheUpdater> Manager<NI, D, VCU>
 
impl<NI: NetworkIdentity, D: Data, VCU: ValidatorAddressCacheUpdater> Manager<NI, D, VCU>
sourcepub fn new(
    network_identity: NI,
    validator_address_cache_updater: VCU,
    discovery_cooldown: Duration
) -> Self
 
pub fn new( network_identity: NI, validator_address_cache_updater: VCU, discovery_cooldown: Duration ) -> Self
Create a new connection manager.
fn delete_reserved( to_remove: HashSet<NI::PeerId> ) -> Option<ConnectionCommand<NI::AddressingInformation>>
sourcepub fn finish_session(
    &mut self,
    session_id: SessionId
) -> ManagerActions<NI::AddressingInformation>
 
pub fn finish_session( &mut self, session_id: SessionId ) -> ManagerActions<NI::AddressingInformation>
Ends a session.
sourcepub fn discovery(&mut self) -> Vec<Authentication<NI::AddressingInformation>>
 
pub fn discovery(&mut self) -> Vec<Authentication<NI::AddressingInformation>>
Returns all the network messages that should be sent as part of discovery at this moment.
fn start_validator_session( &mut self, pre_session: PreValidatorSession, address: NI::AddressingInformation ) -> (Option<Authentication<NI::AddressingInformation>>, UnboundedReceiver<D>)
sourcepub fn update_validator_session(
    &mut self,
    pre_session: PreValidatorSession
) -> Result<(ManagerActions<NI::AddressingInformation>, UnboundedReceiver<D>), SessionHandlerError>
 
pub fn update_validator_session( &mut self, pre_session: PreValidatorSession ) -> Result<(ManagerActions<NI::AddressingInformation>, UnboundedReceiver<D>), SessionHandlerError>
Starts or updates a validator session.
fn start_nonvalidator_session( &mut self, pre_session: PreNonvalidatorSession, address: NI::AddressingInformation )
sourcepub fn update_nonvalidator_session(
    &mut self,
    pre_session: PreNonvalidatorSession
) -> Result<ManagerActions<NI::AddressingInformation>, SessionHandlerError>
 
pub fn update_nonvalidator_session( &mut self, pre_session: PreNonvalidatorSession ) -> Result<ManagerActions<NI::AddressingInformation>, SessionHandlerError>
Starts or updates a nonvalidator session.
sourcepub fn on_user_message(
    &self,
    data: D,
    session_id: SessionId,
    recipient: Recipient
) -> Vec<(DataInSession<D>, NI::PeerId)>
 
pub fn on_user_message( &self, data: D, session_id: SessionId, recipient: Recipient ) -> Vec<(DataInSession<D>, NI::PeerId)>
Handle a user request for sending data. Returns a list of data to be sent over the network.
sourcepub fn on_discovery_message(
    &mut self,
    message: Authentication<NI::AddressingInformation>
) -> ManagerActions<NI::AddressingInformation>
 
pub fn on_discovery_message( &mut self, message: Authentication<NI::AddressingInformation> ) -> ManagerActions<NI::AddressingInformation>
Handle a discovery message. Returns actions the manager wants to take.
sourcepub fn send_session_data(
    &self,
    session_id: &SessionId,
    data: D
) -> Result<(), SendError>
 
pub fn send_session_data( &self, session_id: &SessionId, data: D ) -> Result<(), SendError>
Sends the data to the identified session.
pub fn status_report(&self)
Auto Trait Implementations§
impl<NI, D, VCU> !RefUnwindSafe for Manager<NI, D, VCU>
impl<NI, D, VCU> Send for Manager<NI, D, VCU>
impl<NI, D, VCU> Sync for Manager<NI, D, VCU>
impl<NI, D, VCU> Unpin for Manager<NI, D, VCU>where
    NI: Unpin,
    VCU: Unpin,
    <NI as NetworkIdentity>::AddressingInformation: Unpin,
    <NI as NetworkIdentity>::PeerId: Unpin,
impl<NI, D, VCU> !UnwindSafe for Manager<NI, D, VCU>
Blanket Implementations§
§impl<T> AnySync for T
 
impl<T> AnySync for T
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
§impl<T> CheckedConversion for T
 
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
    Self: TryFrom<T>,
 
fn checked_from<T>(t: T) -> Option<Self>where
    Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
    Self: TryInto<T>,
 
fn checked_into<T>(self) -> Option<T>where
    Self: TryInto<T>,
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> IsType<T> for T
 
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
 
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
 
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
 
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
    Self: UniqueSaturatedFrom<T>,
 
fn saturated_from<T>(t: T) -> Selfwhere
    Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
    Self: UniqueSaturatedInto<T>,
 
fn saturated_into<T>(self) -> Twhere
    Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of 
T. Read more§impl<S, T> UncheckedInto<T> for Swhere
    T: UncheckedFrom<S>,
 
impl<S, T> UncheckedInto<T> for Swhere
    T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
 
fn unchecked_into(self) -> T
The counterpart to 
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for S
 
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
 
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of 
T.