Trait SessionStore

Source
pub trait SessionStore: RefUnwindSafe {
    // Required methods
    fn load_session(
        &self,
        address: Address,
    ) -> Result<Option<SerializedSession>, InternalError>;
    fn get_sub_device_sessions(
        &self,
        name: &[u8],
    ) -> Result<Vec<i32>, InternalError>;
    fn contains_session(&self, addr: Address) -> Result<bool, InternalError>;
    fn store_session(
        &self,
        addr: Address,
        session: SerializedSession,
    ) -> Result<(), InternalError>;
    fn delete_session(&self, addr: Address) -> Result<(), InternalError>;
    fn delete_all_sessions(&self, name: &[u8]) -> Result<usize, InternalError>;
}
Expand description

Something which can store the sessions established with recipients.

Required Methods§

Source

fn load_session( &self, address: Address, ) -> Result<Option<SerializedSession>, InternalError>

Get a copy of the serialized session record corresponding to the provided recipient Address.

Source

fn get_sub_device_sessions( &self, name: &[u8], ) -> Result<Vec<i32>, InternalError>

Get the IDs of all known devices with active sessions for a recipient.

Source

fn contains_session(&self, addr: Address) -> Result<bool, InternalError>

Determine whether there is a committed session record for a recipient ID + device ID tuple.

Source

fn store_session( &self, addr: Address, session: SerializedSession, ) -> Result<(), InternalError>

Commit to storage the session record for a given recipient ID + device ID tuple.

Source

fn delete_session(&self, addr: Address) -> Result<(), InternalError>

Remove a session record for a recipient ID + device ID tuple.

Source

fn delete_all_sessions(&self, name: &[u8]) -> Result<usize, InternalError>

Remove the session records corresponding to all devices of a recipient ID.

Returns the number of deleted sessions.

Implementors§