pub struct LocalContext<ApiClient, Db, S, F> {Show 25 fields
pub identity: Identity,
pub api_client: ApiClientWrapper<ApiClient>,
pub store: Db,
pub mls_storage: S,
pub mutexes: MutexRegistry,
pub hooks: HookState,
pub version_info: VersionInfo,
pub server_configuration: ServerConfigurationHandle,
pub events: EventBus<InternalEvent>,
pub public_event_writer: Arc<dyn EventWriter>,
pub registration_event_pending: Arc<Atomic<bool>>,
pub delivery_owner: Arc<Mutex<RawMutex, Option<DeliveryOwner>>>,
pub retired_delivery_owner: Arc<Mutex<RawMutex, Option<DeliveryOwner>>>,
pub scw_verifier: Arc<Box<dyn SmartContractSignatureVerifier>>,
pub device_sync: DeviceSync,
pub fork_recovery_opts: ForkRecoveryOpts,
pub change_callbacks: UnstableChangeCallbacks,
pub stream_policy: StreamPolicy,
pub worker_config: WorkerConfig,
pub worker_metrics: Arc<Mutex<RawMutex, Option<Arc<WorkerMetrics<SyncMetric>>>>>,
pub task_channels: TaskWorkerChannels,
pub cancellation_token: CancellationToken,
pub shutdown_complete: Arc<Atomic<bool>>,
pub foreground_calls: Arc<ForegroundCalls>,
pub features: F,
}Expand description
The local context a XMTP MLS needs to function:
- Sqlite Database
- Identity for the User
F holds what the crates above core add to it.
Fields§
§identity: IdentityXMTP Identity
api_client: ApiClientWrapper<ApiClient>The XMTP Api Client
store: DbXMTP Local Storage
mls_storage: SMLS key and group state storage.
mutexes: MutexRegistryPer-key locks shared by the client’s operations.
hooks: HookStateTest hook state and the wasm send clock.
version_info: VersionInfoThe client’s version, sent with API requests.
server_configuration: ServerConfigurationHandleWhat this deployment published about itself, resolved once at build plus the blocked connection a refresh may set.
events: EventBus<InternalEvent>The internal event bus.
public_event_writer: Arc<dyn EventWriter>The writer for events the host reads.
registration_event_pending: Arc<Atomic<bool>>Set by a new registration and cleared after its visibility event.
delivery_owner: Arc<Mutex<RawMutex, Option<DeliveryOwner>>>The delivery ownership this client holds, if any.
retired_delivery_owner: Arc<Mutex<RawMutex, Option<DeliveryOwner>>>A closed reader’s delivery ownership whose release failed, kept until a
storage repair releases it. Lock it only while holding delivery_owner.
scw_verifier: Arc<Box<dyn SmartContractSignatureVerifier>>Verifies smart contract wallet signatures.
device_sync: DeviceSyncDevice sync settings.
fork_recovery_opts: ForkRecoveryOptsFork recovery settings.
change_callbacks: UnstableChangeCallbacksUnstable: SDK-registered notifications for group-state changes. Empty unless the host opted in at build time.
stream_policy: StreamPolicyThe limits on incoming work; the incoming runtime holds the same policy.
worker_config: WorkerConfigWorker settings.
worker_metrics: Arc<Mutex<RawMutex, Option<Arc<WorkerMetrics<SyncMetric>>>>>The sync worker’s metrics once it starts.
task_channels: TaskWorkerChannelsState the task worker shares with inline calls.
cancellation_token: CancellationTokenCancelled when shutdown starts.
shutdown_complete: Arc<Atomic<bool>>Set once Client::close stops the workers and disconnects the database.
foreground_calls: Arc<ForegroundCalls>Counts foreground calls in flight.
features: FWhat the crates above core add.
Implementations§
Source§impl<ApiClient, Db, S, F> LocalContext<ApiClient, Db, S, F>where
Db: XmtpDb + 'static,
ApiClient: XmtpApi + 'static,
S: XmtpMlsStorageProvider + 'static,
impl<ApiClient, Db, S, F> LocalContext<ApiClient, Db, S, F>where
Db: XmtpDb + 'static,
ApiClient: XmtpApi + 'static,
S: XmtpMlsStorageProvider + 'static,
Sourcepub fn db(&self) -> <Db as XmtpDb>::DbQuery
pub fn db(&self) -> <Db as XmtpDb>::DbQuery
get a reference to the monolithic Database object where higher-level queries are defined
Sourcepub fn mls_provider(&self) -> XmtpOpenMlsProviderRef<'_, S>
pub fn mls_provider(&self) -> XmtpOpenMlsProviderRef<'_, S>
Creates a new MLS Provider
pub fn store(&self) -> &Db
pub fn scw_verifier(&self) -> &Arc<Box<dyn SmartContractSignatureVerifier>> ⓘ
pub fn device_sync_worker_enabled(&self) -> bool
Source§impl<ApiClient, Db, S, F> LocalContext<ApiClient, Db, S, F>
impl<ApiClient, Db, S, F> LocalContext<ApiClient, Db, S, F>
pub fn replace_mls_store<S2>( self, mls_store: S2, ) -> LocalContext<ApiClient, Db, S2, F>
Source§impl<ApiClient, Db, S, F> LocalContext<ApiClient, Db, S, F>
impl<ApiClient, Db, S, F> LocalContext<ApiClient, Db, S, F>
Sourcepub fn installation_public_key(&self) -> InstallationId
pub fn installation_public_key(&self) -> InstallationId
The installation public key is the primary identifier for an installation
Sourcepub fn installation_id(&self) -> InstallationId
pub fn installation_id(&self) -> InstallationId
The installation public key is the primary identifier for an installation
Sourcepub fn inbox_id(&self) -> &str
pub fn inbox_id(&self) -> &str
Get the account address of the blockchain account associated with this client
Sourcepub fn signature_request(&self) -> Option<SignatureRequest>
pub fn signature_request(&self) -> Option<SignatureRequest>
Integrators should always check the signature_request return value of this function before calling register_identity.
If signature_request returns None, then the wallet signature is not required and register_identity can be called with None as an argument.
pub fn sign_with_public_context( &self, text: impl AsRef<str>, ) -> Result<Vec<u8>, IdentityError>
pub fn sync_metrics(&self) -> Option<Arc<WorkerMetrics<SyncMetric>>>
pub fn cancellation_token(&self) -> &CancellationToken
pub fn shutdown_complete(&self) -> bool
pub fn mark_shutdown_complete(&self)
Auto Trait Implementations§
impl<ApiClient, Db, S, F> !Freeze for LocalContext<ApiClient, Db, S, F>
impl<ApiClient, Db, S, F> !RefUnwindSafe for LocalContext<ApiClient, Db, S, F>
impl<ApiClient, Db, S, F> Send for LocalContext<ApiClient, Db, S, F>
impl<ApiClient, Db, S, F> Sync for LocalContext<ApiClient, Db, S, F>
impl<ApiClient, Db, S, F> Unpin for LocalContext<ApiClient, Db, S, F>
impl<ApiClient, Db, S, F> UnsafeUnpin for LocalContext<ApiClient, Db, S, F>
impl<ApiClient, Db, S, F> !UnwindSafe for LocalContext<ApiClient, Db, S, F>
Blanket Implementations§
§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read more§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read more§fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
fn aggregate_filter<P>(self, f: P) -> Self::Outputwhere
P: AsExpression<Bool>,
Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,
§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].