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§
Sourcefn load_session(
&self,
address: Address,
) -> Result<Option<SerializedSession>, InternalError>
fn load_session( &self, address: Address, ) -> Result<Option<SerializedSession>, InternalError>
Get a copy of the serialized session record corresponding to the
provided recipient Address
.
Sourcefn get_sub_device_sessions(
&self,
name: &[u8],
) -> Result<Vec<i32>, InternalError>
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.
Sourcefn contains_session(&self, addr: Address) -> Result<bool, InternalError>
fn contains_session(&self, addr: Address) -> Result<bool, InternalError>
Determine whether there is a committed session record for a recipient ID + device ID tuple.
Sourcefn store_session(
&self,
addr: Address,
session: SerializedSession,
) -> Result<(), InternalError>
fn store_session( &self, addr: Address, session: SerializedSession, ) -> Result<(), InternalError>
Commit to storage the session record for a given recipient ID + device ID tuple.
Sourcefn delete_session(&self, addr: Address) -> Result<(), InternalError>
fn delete_session(&self, addr: Address) -> Result<(), InternalError>
Remove a session record for a recipient ID + device ID tuple.
Sourcefn delete_all_sessions(&self, name: &[u8]) -> Result<usize, InternalError>
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.