pub struct CommandContext {
pub request: RequestContext,
/* private fields */
}Expand description
What a command handler gets besides state, data and the command’s meta: the request context, and the command’s time and IDs.
Fields§
§request: RequestContextWho sends the command: check permissions here.
Implementations§
Source§impl CommandContext
impl CommandContext
Sourcepub fn new(
command_id: &str,
request: RequestContext,
received_at: Timestamp,
) -> CommandContext
pub fn new( command_id: &str, request: RequestContext, received_at: Timestamp, ) -> CommandContext
A context for calling a command handler directly, e.g. in a unit test with
Aggregate::handle; its deadline is 30 s after received_at.
Sourcepub fn on(self, aggregate_id: &str, tenant: &str) -> CommandContext
pub fn on(self, aggregate_id: &str, tenant: &str) -> CommandContext
For Aggregate::handle: the aggregate ID and tenant the handler’s CommandMeta
names (default: empty), e.g. for a handler that checks them.
Sourcepub fn now(&self) -> Timestamp
pub fn now(&self) -> Timestamp
When the kernel received the command: the same every time the command runs. Use it instead of the clock.
Trait Implementations§
Source§impl Clone for CommandContext
impl Clone for CommandContext
Auto Trait Implementations§
impl Forget for CommandContext
impl Freeze for CommandContext
impl Move for CommandContext
impl RefUnwindSafe for CommandContext
impl Send for CommandContext
impl Sync for CommandContext
impl Unpin for CommandContext
impl UnsafeUnpin for CommandContext
impl UnwindSafe for CommandContext
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request