pub trait SessionTracker<I, N, T, D> where
    I: Instant
{ fn get(&self, node: N) -> Option<&Session<I, T, D>>; fn get_mut(&mut self, node: N) -> Option<&mut Session<I, T, D>>; fn get_mut_or_insert_with<F>(
        &mut self,
        node: N,
        generator: F
    ) -> Result<&mut Session<I, T, D>, OutOfMemoryError>
    where
        N: Clone,
        F: FnOnce() -> Session<I, T, D>
; fn insert(
        &mut self,
        node: N,
        session: Session<I, T, D>
    ) -> Result<(), OutOfMemoryError>; fn remove_expired(&mut self, now: I); }
Expand description

Something that can keep track of receive sessions associated with other nodes

This is some kind of map from node ID to session.

Type parameters:

  • I: A time instant
  • N: A node ID
  • T: A transfer ID
  • D: Additional transport-specific session data

Required methods

Returns a reference to the session for the provided node, if one exists

Returns a mutable reference to the session for the provided node, if one exists

Returns a mutable reference to the session for the provided node

If no session exists, this function calls the provided function, inserts the result, and returns a mutable reference to it.

Inserts a session

If another session with the same node already exists, it is removed.

Removes all sessions that have expired

Implementors