Storage

Struct Storage 

Source
pub struct Storage { /* private fields */ }

Implementations§

Source§

impl Storage

Source

pub async fn migrate(&self) -> Result<(), StorageError>

Applies bundled migrations to PostgreSQL.

Source

pub async fn readiness(&self) -> Result<(), StorageError>

Executes lightweight probes across PostgreSQL and Redis.

Source

pub async fn upsert_device( &self, record: &DeviceRecord, ) -> Result<(), StorageError>

Registers or rotates a device key.

Source

pub async fn record_device_key_event( &self, event: &DeviceKeyEvent, ) -> Result<(), StorageError>

Persists an audit trail entry for device key material.

Source

pub async fn latest_device_key_event( &self, device_id: &str, ) -> Result<Option<DeviceKeyEvent>, StorageError>

Fetches the newest device key event for a device identifier.

Source

pub async fn record_session( &self, session: &SessionRecord, ) -> Result<(), StorageError>

Creates a session binding a device to a TLS fingerprint.

Source

pub async fn load_device( &self, device_id: &str, ) -> Result<DeviceRecord, StorageError>

Fetches device metadata by identifier.

Source

pub async fn create_user( &self, profile: &NewUserProfile, ) -> Result<UserProfile, StorageError>

Creates a new user profile entry.

Source

pub async fn load_user( &self, user_id: &str, ) -> Result<UserProfile, StorageError>

Loads a user profile by identifier.

Source

pub async fn load_user_by_handle( &self, handle: &str, ) -> Result<UserProfile, StorageError>

Loads a user profile by handle.

Source

pub async fn update_user_profile( &self, user_id: &str, display_name: Option<&str>, avatar_url: Option<&str>, ) -> Result<(), StorageError>

Applies partial updates to user profile metadata.

Source

pub async fn create_group(&self, group: &ChatGroup) -> Result<(), StorageError>

Creates a chat group entry and enrolls the owner as a member.

Source

pub async fn add_group_member( &self, member: &GroupMember, ) -> Result<(), StorageError>

Adds or updates group membership information.

Source

pub async fn remove_group_member( &self, group_id: &str, device_id: &str, ) -> Result<(), StorageError>

Removes a member from the given group.

Source

pub async fn list_group_members( &self, group_id: &str, ) -> Result<Vec<GroupMember>, StorageError>

Lists all members of a group ordered by join time.

Source

pub async fn load_group( &self, group_id: &str, ) -> Result<ChatGroup, StorageError>

Loads group metadata by identifier.

Source

pub async fn list_groups_for_device( &self, device_id: &str, ) -> Result<Vec<ChatGroup>, StorageError>

Lists groups that include the target device.

Source

pub async fn upsert_federation_peer( &self, peer: &FederationPeerRecord, ) -> Result<(), StorageError>

Upserts federation peer descriptors for S2S routing.

Source

pub async fn load_federation_peer( &self, domain: &str, ) -> Result<FederationPeerRecord, StorageError>

Loads a federation peer by domain.

Source

pub async fn list_federation_peers( &self, ) -> Result<Vec<FederationPeerRecord>, StorageError>

Enumerates all known federation peers.

Source

pub async fn set_federation_peer_status( &self, domain: &str, status: FederationPeerStatus, ) -> Result<(), StorageError>

Sets the peer status and refresh timestamp.

Source

pub async fn enqueue_relay( &self, envelope: &RelayEnvelope, ) -> Result<(), StorageError>

Schedules an encrypted relay envelope for delivery.

Source

pub async fn claim_envelopes( &self, channel_id: &str, limit: i64, ) -> Result<Vec<RelayEnvelope>, StorageError>

Claims pending relay envelopes for a channel.

Source

pub async fn store_inbox_offset( &self, offset: &InboxOffset, ) -> Result<(), StorageError>

Stores the last delivered envelope reference for an entity/channel pair.

Source

pub async fn read_inbox_offset( &self, entity_id: &str, channel_id: &str, ) -> Result<Option<InboxOffset>, StorageError>

Reads the stored inbox offset if present.

Source

pub async fn store_idempotency( &self, key: &IdempotencyKey, ) -> Result<(), StorageError>

Records an idempotency key for deduplication.

Source

pub async fn publish_presence( &self, snapshot: &PresenceSnapshot, ) -> Result<(), StorageError>

Publishes local presence information into Redis.

Source

pub async fn read_presence( &self, entity: &str, ) -> Result<Option<PresenceSnapshot>, StorageError>

Reads presence state from Redis.

Source

pub async fn register_route( &self, entity: &str, session_id: &str, ttl_seconds: i64, ) -> Result<(), StorageError>

Registers a routing entry in Redis for direct message delivery.

Source

pub async fn clear_route(&self, entity: &str) -> Result<(), StorageError>

Removes a routing entry from Redis.

Auto Trait Implementations§

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
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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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