Skip to main content

ClientBuilder

Struct ClientBuilder 

Source
pub struct ClientBuilder<ApiClient, S, Db = DefaultStore> { /* private fields */ }

Implementations§

Source§

impl<ApiClient, S, Db> ClientBuilder<ApiClient, S, Db>

Source

pub fn new(identity_strategy: IdentityStrategy) -> Self

Source§

impl<ApiClient, S, Db> ClientBuilder<ApiClient, S, Db>

Source

pub fn build_offline( self, ) -> Result<Client<Arc<XmtpMlsLocalContext<ApiClient, Db, S>>>, ClientBuilderError>
where ApiClient: XmtpApi + 'static, Db: XmtpDb + 'static, S: XmtpMlsStorageProvider + 'static,

build a client in offline mode. returns an error if the client failed to build as offline

Source

pub async fn build( self, ) -> Result<Client<Arc<XmtpMlsLocalContext<ApiClient, Db, S>>>, ClientBuilderError>
where ApiClient: XmtpApi + 'static, Db: XmtpDb + 'static, S: XmtpMlsStorageProvider + 'static,

Build the client. When the identity strategy carries an identifier, the build requires it to belong to the inbox of the identity it loads, including a stored one: it checks the newest association state after it loads the inbox’s identity updates and before it starts any worker. An offline build loads none and checks the newest state the database stores, which can predate a revocation. Before the inbox’s first identity update, only the identifier whose inbox at the strategy’s nonce is that inbox belongs to it. A failure is IdentityError::IdentifierNotInInbox.

Source

pub fn identity(self, identity: Identity) -> Self

Source

pub fn attachments_dir(self, path: impl Into<PathBuf>) -> Self

Source

pub fn attachment_options(self, options: AttachmentOptions) -> Self

Source

pub async fn data_location( self, location: StorageLocation, key: EncryptionKey, ) -> Result<ClientBuilder<ApiClient, S, DefaultStore>, ClientBuilderError>

Save a deployment-scoped location. build resolves it after all options are set.

Native only. Browser builds have no encrypted storage; call data_location_with and open the store with WasmDb::new_strict.

Source

pub fn data_location_with<NewDb>( self, location: StorageLocation, opener: impl FnOnce(ResolvedPaths) -> BoxDynFuture<'static, Result<NewDb, ClientBuilderError>> + MaybeSend + MaybeSync + 'static, ) -> Result<ClientBuilder<ApiClient, S, NewDb>, ClientBuilderError>

Save a deployment-scoped location that opener opens. build resolves the paths after all options are set and passes them to opener, so a host can open the store with its own connection options.

Source

pub fn unstable_change_callbacks( self, change_callbacks: UnstableChangeCallbacks, ) -> Self

Unstable: register callbacks notified when group state changes.

Registration is construction-time by necessity — the changes these report arrive from the stream and sync paths, where no SDK call is on the stack. Passing UnstableChangeCallbacks::default (nothing set) is equivalent to not calling this at all.

See crate::groups::change_callbacks for the delivery contract.

Source

pub fn store<NewDb>(self, db: NewDb) -> ClientBuilder<ApiClient, S, NewDb>

Source

pub fn default_mls_store( self, ) -> Result<ClientBuilder<ApiClient, SqlKeyStore<<Db as XmtpDb>::DbQuery>, Db>, ClientBuilderError>
where Db: XmtpDb,

Use the default SQlite MLS Key-Value Store

Source

pub fn mls_storage<NewS>( self, mls_storage: NewS, ) -> ClientBuilder<ApiClient, NewS, Db>

Source

pub fn with_disable_workers(self, disable_workers: bool) -> Self

Source

pub fn with_device_sync_worker_mode(self, mode: Option<DeviceSyncMode>) -> Self

Source

pub fn device_sync_worker_mode(self, mode: DeviceSyncMode) -> Self

Source

pub fn fork_recovery_opts(self, opts: ForkRecoveryOpts) -> Self

Source

pub fn worker_config(self, cfg: WorkerConfig) -> Self

Configure background-worker intervals, jitter, and per-worker enablement. See crate::worker::WorkerConfig.

Source

pub fn config_provider(self, provider: Arc<dyn ConfigProvider>) -> Self

Supply the server configuration instead of reading it.

With a provider in place the client does not fetch, store, or refresh the configuration. A data directory still checks its deployment identifier. Rust callers only; the bindings do not expose this.

Source

pub fn api_client<A>(self, api_client: A) -> ClientBuilder<A, S, Db>

Attach a query-only API client. Receipt uses ordered Query pages. Standard streaming clients use api_client_with_streams at construction.

Source

pub fn api_client_with_streams<A>( self, api_client: A, ) -> ClientBuilder<A, S, Db>
where A: XmtpMlsBidiStreams + ApiClientIdentity + Clone + Send + Sync + 'static, A::SubscribeStream: 'static,

Attach a native API client with a lazy shared Bidi receiver. No transport task or connection starts until the first receiving interest.

Source

pub fn maybe_version( self, version: Option<VersionInfo>, ) -> ClientBuilder<ApiClient, S, Db>

Source

pub fn version( self, version_info: VersionInfo, ) -> ClientBuilder<ApiClient, S, Db>

Source

pub fn with_allow_offline( self, allow_offline: Option<bool>, ) -> ClientBuilder<ApiClient, S, Db>

Skip network calls when building a client. An offline build loads no identity update, so its identifier check (see Self::build) uses the newest state the database stores, which can predate a revocation.

Source

pub fn enable_api_stats( self, ) -> Result<ClientBuilder<TrackedStatsClient<ApiClient>, S, Db>, ClientBuilderError>

Source

pub fn with_scw_verifier( self, verifier: impl SmartContractSignatureVerifier + 'static, ) -> ClientBuilder<ApiClient, S, Db>

Source

pub fn with_remote_verifier( self, ) -> Result<ClientBuilder<ApiClient, S, Db>, ClientBuilderError>
where ApiClient: Clone + XmtpApi + 'static,

Build the client with a default remote verifier requires the ‘api’ to be set.

Auto Trait Implementations§

§

impl<ApiClient, S, Db = EncryptedMessageStore<NativeDb>> !Freeze for ClientBuilder<ApiClient, S, Db>

§

impl<ApiClient, S, Db = EncryptedMessageStore<NativeDb>> !RefUnwindSafe for ClientBuilder<ApiClient, S, Db>

§

impl<ApiClient, S, Db> Send for ClientBuilder<ApiClient, S, Db>
where ApiClient: Send, Db: Send, S: Send,

§

impl<ApiClient, S, Db> Sync for ClientBuilder<ApiClient, S, Db>
where ApiClient: Sync, Db: Sync, S: Sync,

§

impl<ApiClient, S, Db> Unpin for ClientBuilder<ApiClient, S, Db>
where ApiClient: Unpin, Db: Unpin, S: Unpin,

§

impl<ApiClient, S, Db> UnsafeUnpin for ClientBuilder<ApiClient, S, Db>
where ApiClient: UnsafeUnpin, Db: UnsafeUnpin, S: UnsafeUnpin,

§

impl<ApiClient, S, Db = EncryptedMessageStore<NativeDb>> !UnwindSafe for ClientBuilder<ApiClient, S, Db>

Blanket Implementations§

§

impl<T> AggregateExpressionMethods for T

§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for T
where T: ?Sized,

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

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

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> IntoSql for T

§

fn into_sql<T>(self) -> Self::Expression
where Self: Sized + AsExpression<T>, T: SqlType + TypedExpressionType,

Convert self to an expression for Diesel’s query builder. Read more
§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

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

§

fn vzip(self) -> V

§

impl<T> WindowExpressionMethods for T

§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> MaybeSend for T
where T: Send + ?Sized,

§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,