Struct ActionCx
pub struct ActionCx { /* private fields */ }Expand description
Deterministic services available while an action applies.
Everything here is a pure function of the action and the document it was authored against, so the origin and every replaying replica compute the same ids and see the same time.
Implementations§
§impl ActionCx
impl ActionCx
pub fn for_apply(doc: &AutoCommit, payload: &[u8], now_ms: i64) -> ActionCx
pub fn for_apply(doc: &AutoCommit, payload: &[u8], now_ms: i64) -> ActionCx
A context seeded from the document’s heads and actor (both pinned by the executor) and the action’s own payload.
Inside an ActionGroup the group’s seed and the
member’s position stand in for the heads, which a member cannot read
without committing the members before it as separate changes.
pub fn for_write(doc: &AutoCommit, payload: &[u8]) -> ActionCx
pub fn for_write(doc: &AutoCommit, payload: &[u8]) -> ActionCx
A context for ids minted part-way through an action that has already
written: seeded like Self::for_apply but from the heads the action
started from, so reading them does not commit its writes so far as a
separate change.
pub fn for_person(&self) -> Option<String>
pub fn for_person(&self) -> Option<String>
The person the invoker acted for (an agent’s or a Shortcut’s person),
as the envelope pinned it; None when someone acted for themselves.
pub fn appearance(&self) -> Option<Appearance>
pub fn appearance(&self) -> Option<Appearance>
The name and avatar a bot showed for this action instead of its own,
as the envelope pinned it; None for anyone else’s action.
pub fn actor_kind(&self) -> Option<ActorKind>
pub fn actor_kind(&self) -> Option<ActorKind>
What kind of actor invoked the action (a person, an agent, a Shortcut), as the envelope pinned it.
pub fn now_ms(&self) -> i64
pub fn now_ms(&self) -> i64
When the action was authored, in milliseconds since the Unix epoch, as read once on the origin.
Who the action is by: the person or agent that invoked it, the same
id that participant’s own views read as me. Pinned with the action
like its time, so every replica reads the same author; the payload
need not carry it. None for an action applied with no invoker
(an edit written straight into a document outside the host).
pub const fn invocation(&self) -> Option<InvocationId>
pub const fn invocation(&self) -> Option<InvocationId>
The invocation admitted by the action door, pinned in the action
envelope so origin and replay observe the same correlation identity.
This is not caller authority; use Self::author for that.
pub fn content(&self) -> Option<ContentStore>
pub fn content(&self) -> Option<ContentStore>
The content store of the window applying the action, where the bytes
the record names by hash are kept: the one the host lent that window,
which carries them on the record’s route. Content is not replayed —
a replica that applies the action reads the bytes through its own
window’s store. None where no window applies it (a tool writing a
document directly).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ActionCx
impl RefUnwindSafe for ActionCx
impl Send for ActionCx
impl Sync for ActionCx
impl Unpin for ActionCx
impl UnsafeUnpin for ActionCx
impl UnwindSafe for ActionCx
Blanket Implementations§
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
§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