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>
where PeerID: Clone + Ord + Hash,

source

pub fn new( builder: Builder, max_sessions: usize, max_sessions_per_peer: usize, stale_session_timeout: i64, ) -> Self

Create a new session management instance.

source

pub fn set_builder(&mut self, builder: Builder)

Set the session builder to use.

source

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.

source

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.

source

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.

source

pub fn create_responder( &mut self, peer_id: PeerID, session_id: SessionID, ) -> MultiplexedSession<PeerID>

Create a new multiplexed responder session.

source

pub fn create_initiator(&self, peer_id: PeerID) -> MultiplexedSession<PeerID>

Create a new multiplexed initiator session.

source

pub fn get( &mut self, peer_id: &PeerID, session_id: &SessionID, ) -> Option<SharedSession<PeerID>>

Fetch an existing session given its identifier.

source

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.

source

pub fn find_any(&mut self) -> Option<SharedSession<PeerID>>

Fetch an existing session from any peer.

source

pub fn find_one(&mut self, peer_ids: &[PeerID]) -> Option<SharedSession<PeerID>>

Fetch an existing session from one of the given peers.

source

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.

source

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.

source

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.

source

pub fn add( &mut self, session: MultiplexedSession<PeerID>, now: i64, ) -> Result<SharedSession<PeerID>, Error>

Add a session if there is an available spot.

source

pub fn remove(&mut self, session: &OwnedMutexGuard<MultiplexedSession<PeerID>>)

Remove a session that must be currently owned by the caller.

source

pub fn drain(&mut self) -> Vec<SharedSession<PeerID>>

Removes and returns all sessions.

Auto Trait Implementations§

§

impl<PeerID> Freeze for Sessions<PeerID>

§

impl<PeerID> !RefUnwindSafe for Sessions<PeerID>

§

impl<PeerID> Send for Sessions<PeerID>
where PeerID: Send,

§

impl<PeerID> Sync for Sessions<PeerID>
where PeerID: Sync + Send,

§

impl<PeerID> Unpin for Sessions<PeerID>
where PeerID: Unpin,

§

impl<PeerID> !UnwindSafe for Sessions<PeerID>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T