pub struct StateTx<'a, T> { /* private fields */ }Expand description
A capability created only after an immediate write transaction starts.
Keep network requests and callbacks outside this capability. A group is loaded for one synchronous operation and is dropped before the transaction ends. A retry must enter a new transaction and load the group again.
Implementations§
Source§impl<T> StateTx<'_, T>where
T: TransactionalKeyStore,
impl<T> StateTx<'_, T>where
T: TransactionalKeyStore,
Sourcepub fn with_group<R, E>(
&mut self,
group_id: GroupId,
operation: impl FnOnce(&mut MlsGroup, &<T as TransactionalKeyStore>::Store<'_>) -> Result<R, E>,
) -> Result<R, E>
pub fn with_group<R, E>( &mut self, group_id: GroupId, operation: impl FnOnce(&mut MlsGroup, &<T as TransactionalKeyStore>::Store<'_>) -> Result<R, E>, ) -> Result<R, E>
Load current state after the database writer has been acquired.
The operation borrows the group. It cannot return the mutable group or a future that borrows it. All storage access uses this transaction.
Sourcepub fn storage(&mut self) -> <T as TransactionalKeyStore>::Store<'_>
pub fn storage(&mut self) -> <T as TransactionalKeyStore>::Store<'_>
Access keys and records for a state operation that does not load a group.
Sourcepub fn savepoint<R, E>(
&mut self,
operation: impl FnOnce(&mut StateTx<'_, <<T as TransactionalKeyStore>::Store<'_> as XmtpMlsStorageProvider>::TxQuery>) -> Result<TransactionOutcome<R>, E>,
) -> Result<TransactionOutcome<R>, E>
pub fn savepoint<R, E>( &mut self, operation: impl FnOnce(&mut StateTx<'_, <<T as TransactionalKeyStore>::Store<'_> as XmtpMlsStorageProvider>::TxQuery>) -> Result<TransactionOutcome<R>, E>, ) -> Result<TransactionOutcome<R>, E>
Roll back a failed attempt while retaining the outer writer lock.
The failed attempt’s group is dropped before the caller can load state to record a rejection. This also discards OpenMLS ratchet caches.
Auto Trait Implementations§
impl<'a, T> Freeze for StateTx<'a, T>
impl<'a, T> RefUnwindSafe for StateTx<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for StateTx<'a, T>where
T: Send,
impl<'a, T> Sync for StateTx<'a, T>where
T: Sync,
impl<'a, T> Unpin for StateTx<'a, T>
impl<'a, T> UnsafeUnpin for StateTx<'a, T>
impl<'a, T> !UnwindSafe for StateTx<'a, T>
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].