Skip to main content

XmtpSharedContext

Trait XmtpSharedContext 

Source
pub trait XmtpSharedContext
where Self: MaybeSend + MaybeSync + Sized + Clone,
{ type Db: XmtpDb; type ApiClient: XmtpApi; type MlsStorage: XmtpMlsStorageProvider; type ContextReference: XmtpSharedContext<Db = Self::Db, ApiClient = Self::ApiClient, MlsStorage = Self::MlsStorage> + 'static;
Show 32 methods // Required methods fn context_ref(&self) -> &Self::ContextReference; fn db(&self) -> <Self::Db as XmtpDb>::DbQuery; fn api(&self) -> &ApiClientWrapper<Self::ApiClient>; fn scw_verifier(&self) -> Arc<Box<dyn SmartContractSignatureVerifier>> ; fn device_sync(&self) -> &DeviceSync; fn fork_recovery_opts(&self) -> &ForkRecoveryOpts; fn worker_config(&self) -> &WorkerConfig; fn mls_storage(&self) -> &Self::MlsStorage; fn identity(&self) -> &Identity; fn version_info(&self) -> &VersionInfo; fn server_configuration(&self) -> &ServerConfigurationHandle; fn worker_events(&self) -> &Sender<SyncWorkerEvent>; fn local_events(&self) -> &Sender<LocalEvents>; fn delivery_owner(&self) -> &Mutex<Option<DeliveryOwner>>; fn task_channels(&self) -> &TaskWorkerChannels; fn disappearing_channels(&self) -> &DisappearingChannels; fn change_callbacks(&self) -> &UnstableChangeCallbacks; fn incoming_runtime(&self) -> &IncomingRuntime; fn identity_resolution_registry(&self) -> &IdentityResolutionRegistry; fn sync_metrics(&self) -> Option<Arc<WorkerMetrics<SyncMetric>>>; fn mutexes(&self) -> &MutexRegistry; fn cancellation_token(&self) -> &CancellationToken; fn shutdown_complete(&self) -> bool; fn mark_shutdown_complete(&self); // Provided methods fn device_sync_worker_enabled(&self) -> bool { ... } fn worker_interval( &self, kind: WorkerKind, const_default: Duration, ) -> (Duration, Duration) { ... } fn mls_provider(&self) -> XmtpOpenMlsProviderRef<'_, Self::MlsStorage> { ... } fn signature_request(&self) -> Option<SignatureRequest> { ... } fn inbox_id(&self) -> InboxIdRef<'_> { ... } fn installation_id(&self) -> InstallationId { ... } fn close_message_delivery(&self) -> Result<(), StorageError> { ... } fn is_closed(&self) -> bool { ... }
}

Required Associated Types§

Source

type Db: XmtpDb

Source

type ApiClient: XmtpApi

Source

type MlsStorage: XmtpMlsStorageProvider

Source

type ContextReference: XmtpSharedContext<Db = Self::Db, ApiClient = Self::ApiClient, MlsStorage = Self::MlsStorage> + 'static

Owned, cloneable handle for background work; it cannot borrow short-lived resources.

Required Methods§

Source

fn context_ref(&self) -> &Self::ContextReference

Return the handle to clone when work can outlive this context borrow.

Source

fn db(&self) -> <Self::Db as XmtpDb>::DbQuery

Source

fn api(&self) -> &ApiClientWrapper<Self::ApiClient>

Source

fn scw_verifier(&self) -> Arc<Box<dyn SmartContractSignatureVerifier>>

Source

fn device_sync(&self) -> &DeviceSync

Source

fn fork_recovery_opts(&self) -> &ForkRecoveryOpts

Source

fn worker_config(&self) -> &WorkerConfig

Source

fn mls_storage(&self) -> &Self::MlsStorage

Source

fn identity(&self) -> &Identity

Source

fn version_info(&self) -> &VersionInfo

Source

fn server_configuration(&self) -> &ServerConfigurationHandle

The configuration snapshot every consumer in spec 006 section 6.4 reads.

Source

fn worker_events(&self) -> &Sender<SyncWorkerEvent>

Source

fn local_events(&self) -> &Sender<LocalEvents>

Source

fn delivery_owner(&self) -> &Mutex<Option<DeliveryOwner>>

This context’s default-consumer token; the database is the ownership authority.

Source

fn task_channels(&self) -> &TaskWorkerChannels

Source

fn disappearing_channels(&self) -> &DisappearingChannels

Source

fn change_callbacks(&self) -> &UnstableChangeCallbacks

Unstable: the host’s registered group-change callbacks.

Source

fn incoming_runtime(&self) -> &IncomingRuntime

Shared incoming runtime. Its limits and transport are internal client policy.

Source

fn identity_resolution_registry(&self) -> &IdentityResolutionRegistry

Coalesces exact identity lookups without treating a newer snapshot as the requested one.

Source

fn sync_metrics(&self) -> Option<Arc<WorkerMetrics<SyncMetric>>>

Source

fn mutexes(&self) -> &MutexRegistry

Source

fn cancellation_token(&self) -> &CancellationToken

Source

fn shutdown_complete(&self) -> bool

Returns true only after Client::close has fully torn the client down (workers drained + DB disconnected). Distinct from Self::is_closed which fires the moment shutdown begins — this guards close’s idempotency check so a mid-shutdown failure stays retryable.

Source

fn mark_shutdown_complete(&self)

Provided Methods§

Source

fn device_sync_worker_enabled(&self) -> bool

Source

fn worker_interval( &self, kind: WorkerKind, const_default: Duration, ) -> (Duration, Duration)

Resolve (base, jitter) for a worker from the configured WorkerConfig, falling back to the worker’s compiled-in const.

Source

fn mls_provider(&self) -> XmtpOpenMlsProviderRef<'_, Self::MlsStorage>

Creates a new MLS Provider

Source

fn signature_request(&self) -> Option<SignatureRequest>

Source

fn inbox_id(&self) -> InboxIdRef<'_>

Source

fn installation_id(&self) -> InstallationId

Source

fn close_message_delivery(&self) -> Result<(), StorageError>

Release this context’s message consumer before disconnecting its database.

Source

fn is_closed(&self) -> bool

Returns true once Client::close has been called on this context.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> XmtpSharedContext for &T

Source§

type Db = <T as XmtpSharedContext>::Db

Source§

type ApiClient = <T as XmtpSharedContext>::ApiClient

Source§

type MlsStorage = <T as XmtpSharedContext>::MlsStorage

Source§

type ContextReference = <T as XmtpSharedContext>::ContextReference

Source§

fn context_ref(&self) -> &Self::ContextReference

Source§

fn db(&self) -> <Self::Db as XmtpDb>::DbQuery

Source§

fn api(&self) -> &ApiClientWrapper<Self::ApiClient>

Source§

fn scw_verifier(&self) -> Arc<Box<dyn SmartContractSignatureVerifier>>

Source§

fn device_sync(&self) -> &DeviceSync

Source§

fn device_sync_worker_enabled(&self) -> bool

Source§

fn fork_recovery_opts(&self) -> &ForkRecoveryOpts

Source§

fn worker_config(&self) -> &WorkerConfig

Source§

fn mls_storage(&self) -> &Self::MlsStorage

Source§

fn identity(&self) -> &Identity

Source§

fn version_info(&self) -> &VersionInfo

Source§

fn server_configuration(&self) -> &ServerConfigurationHandle

Source§

fn worker_events(&self) -> &Sender<SyncWorkerEvent>

Source§

fn local_events(&self) -> &Sender<LocalEvents>

Source§

fn delivery_owner(&self) -> &Mutex<Option<DeliveryOwner>>

Source§

fn task_channels(&self) -> &TaskWorkerChannels

Source§

fn disappearing_channels(&self) -> &DisappearingChannels

Source§

fn change_callbacks(&self) -> &UnstableChangeCallbacks

Source§

fn incoming_runtime(&self) -> &IncomingRuntime

Source§

fn identity_resolution_registry(&self) -> &IdentityResolutionRegistry

Source§

fn sync_metrics(&self) -> Option<Arc<WorkerMetrics<SyncMetric>>>

Source§

fn mutexes(&self) -> &MutexRegistry

Source§

fn cancellation_token(&self) -> &CancellationToken

Source§

fn shutdown_complete(&self) -> bool

Source§

fn mark_shutdown_complete(&self)

Source§

impl<XApiClient, XDb, XMls> XmtpSharedContext for Arc<XmtpMlsLocalContext<XApiClient, XDb, XMls>>
where XApiClient: XmtpApi + 'static, XDb: XmtpDb + 'static, XMls: XmtpMlsStorageProvider + 'static,

Source§

fn mls_storage(&self) -> &Self::MlsStorage

a reference to the MLS Storage Type This can be related to ‘db()’ but may also be separate

Source§

type Db = XDb

Source§

type ApiClient = XApiClient

Source§

type MlsStorage = XMls

Source§

type ContextReference = Arc<XmtpMlsLocalContext<XApiClient, XDb, XMls>>

Source§

fn context_ref(&self) -> &Self::ContextReference

Source§

fn db(&self) -> <Self::Db as XmtpDb>::DbQuery

Source§

fn api(&self) -> &ApiClientWrapper<Self::ApiClient>

Source§

fn scw_verifier(&self) -> Arc<Box<dyn SmartContractSignatureVerifier>>

Source§

fn device_sync(&self) -> &DeviceSync

Source§

fn fork_recovery_opts(&self) -> &ForkRecoveryOpts

Source§

fn worker_config(&self) -> &WorkerConfig

Source§

fn identity(&self) -> &Identity

Source§

fn version_info(&self) -> &VersionInfo

Source§

fn server_configuration(&self) -> &ServerConfigurationHandle

Source§

fn worker_events(&self) -> &Sender<SyncWorkerEvent>

Source§

fn local_events(&self) -> &Sender<LocalEvents>

Source§

fn delivery_owner(&self) -> &Mutex<Option<DeliveryOwner>>

Source§

fn task_channels(&self) -> &TaskWorkerChannels

Source§

fn disappearing_channels(&self) -> &DisappearingChannels

Source§

fn change_callbacks(&self) -> &UnstableChangeCallbacks

Source§

fn incoming_runtime(&self) -> &IncomingRuntime

Source§

fn identity_resolution_registry(&self) -> &IdentityResolutionRegistry

Source§

fn sync_metrics(&self) -> Option<Arc<WorkerMetrics<SyncMetric>>>

Source§

fn mutexes(&self) -> &MutexRegistry

Source§

fn cancellation_token(&self) -> &CancellationToken

Source§

fn shutdown_complete(&self) -> bool

Source§

fn mark_shutdown_complete(&self)

Implementors§