Struct oasis_core_runtime::enclave_rpc::sessions::Sessions
source · pub struct Sessions<PeerID: Clone + Ord + Hash> { /* private fields */ }
Expand description
Session indices and management operations.
Implementations§
source§impl<PeerID> Sessions<PeerID>
impl<PeerID> Sessions<PeerID>
sourcepub fn new(
builder: Builder,
max_sessions: usize,
max_sessions_per_peer: usize,
stale_session_timeout: i64,
) -> Self
pub fn new( builder: Builder, max_sessions: usize, max_sessions_per_peer: usize, stale_session_timeout: i64, ) -> Self
Create a new session management instance.
sourcepub fn set_builder(&mut self, builder: Builder)
pub fn set_builder(&mut self, builder: Builder)
Set the session builder to use.
sourcepub fn update_enclaves(
&mut self,
enclaves: Option<HashSet<EnclaveIdentity>>,
) -> Vec<SharedSession<PeerID>>
pub fn update_enclaves( &mut self, enclaves: Option<HashSet<EnclaveIdentity>>, ) -> Vec<SharedSession<PeerID>>
Update remote enclave identity verification in the session builder and clear all sessions if the identity has changed.
sourcepub fn update_quote_policy(
&mut self,
policy: QuotePolicy,
) -> Vec<SharedSession<PeerID>>
pub fn update_quote_policy( &mut self, policy: QuotePolicy, ) -> Vec<SharedSession<PeerID>>
Update quote policy used for remote quote verification in the session builder and clear all sessions if the policy has changed.
sourcepub fn update_runtime_id(
&mut self,
id: Option<Namespace>,
) -> Vec<SharedSession<PeerID>>
pub fn update_runtime_id( &mut self, id: Option<Namespace>, ) -> Vec<SharedSession<PeerID>>
Update remote runtime ID for node identity verification in the session builder and clear all sessions if the runtime ID has changed.
sourcepub fn create_responder(
&mut self,
peer_id: PeerID,
session_id: SessionID,
) -> MultiplexedSession<PeerID>
pub fn create_responder( &mut self, peer_id: PeerID, session_id: SessionID, ) -> MultiplexedSession<PeerID>
Create a new multiplexed responder session.
sourcepub fn create_initiator(&self, peer_id: PeerID) -> MultiplexedSession<PeerID>
pub fn create_initiator(&self, peer_id: PeerID) -> MultiplexedSession<PeerID>
Create a new multiplexed initiator session.
sourcepub fn get(
&mut self,
peer_id: &PeerID,
session_id: &SessionID,
) -> Option<SharedSession<PeerID>>
pub fn get( &mut self, peer_id: &PeerID, session_id: &SessionID, ) -> Option<SharedSession<PeerID>>
Fetch an existing session given its identifier.
sourcepub fn find(&mut self, peer_ids: &[PeerID]) -> Option<SharedSession<PeerID>>
pub fn find(&mut self, peer_ids: &[PeerID]) -> Option<SharedSession<PeerID>>
Fetch an existing session from one of the given peers. If no peers are provided, a session from any peer will be returned.
sourcepub fn find_any(&mut self) -> Option<SharedSession<PeerID>>
pub fn find_any(&mut self) -> Option<SharedSession<PeerID>>
Fetch an existing session from any peer.
sourcepub fn find_one(&mut self, peer_ids: &[PeerID]) -> Option<SharedSession<PeerID>>
pub fn find_one(&mut self, peer_ids: &[PeerID]) -> Option<SharedSession<PeerID>>
Fetch an existing session from one of the given peers.
sourcepub fn remove_for(
&mut self,
peer_id: &PeerID,
now: i64,
) -> Result<Option<OwnedMutexGuard<MultiplexedSession<PeerID>>>, Error>
pub fn remove_for( &mut self, peer_id: &PeerID, now: i64, ) -> Result<Option<OwnedMutexGuard<MultiplexedSession<PeerID>>>, Error>
Remove one session to free up a slot for the given peer.
sourcepub fn remove_from(
&mut self,
peer_id: &PeerID,
) -> Result<Option<OwnedMutexGuard<MultiplexedSession<PeerID>>>, Error>
pub fn remove_from( &mut self, peer_id: &PeerID, ) -> Result<Option<OwnedMutexGuard<MultiplexedSession<PeerID>>>, Error>
Remove one existing session from the given peer if the peer has reached the maximum number of sessions or if the total number of sessions exceeds the global session limit.
sourcepub fn remove_one(
&mut self,
now: i64,
) -> Result<Option<OwnedMutexGuard<MultiplexedSession<PeerID>>>, Error>
pub fn remove_one( &mut self, now: i64, ) -> Result<Option<OwnedMutexGuard<MultiplexedSession<PeerID>>>, Error>
Remove one stale session if the total number of sessions exceeds the global session limit.
sourcepub fn add(
&mut self,
session: MultiplexedSession<PeerID>,
now: i64,
) -> Result<SharedSession<PeerID>, Error>
pub fn add( &mut self, session: MultiplexedSession<PeerID>, now: i64, ) -> Result<SharedSession<PeerID>, Error>
Add a session if there is an available spot.
sourcepub fn remove(&mut self, session: &OwnedMutexGuard<MultiplexedSession<PeerID>>)
pub fn remove(&mut self, session: &OwnedMutexGuard<MultiplexedSession<PeerID>>)
Remove a session that must be currently owned by the caller.
sourcepub fn drain(&mut self) -> Vec<SharedSession<PeerID>>
pub fn drain(&mut self) -> Vec<SharedSession<PeerID>>
Removes and returns all sessions.