pub struct RunCompleted { /* private fields */ }Expand description
One CloudEvents message per completed run.
The default an embedder gets for free, and the shape most services want: a run finished, here is its identity, its outcome and its chain head. Every other record projects to nothing, so the cursor sweeps past a run’s whole history and delivers once.
§Why the outcome is all that travels
Not the answer. A run’s output is domain data with a label on it, and a
projection that shipped it by default would send whatever the run happened to
hold to whatever the operator happened to configure, with no ceiling anybody
declared — an egress decision made by a default. A deployment that wants the
payload writes its own Projection and makes that decision explicitly.
id is the run id and source is the deployment, which is the pair
CloudEvents defines uniqueness by — so a duplicate delivery, which
at-least-once guarantees will happen, is detectable as a duplicate rather
than as a second event. The same id rides in the delivery’s
HEADER_ID header, so a receiver can drop a repeat
before parsing the body and cannot end up with two answers to which
message is this.
subject is the run, which is what the event is about within this
producer. A receiver filtering by run would otherwise have to open data to
find out.
§There is no time, and that is honest
CloudEvents makes it optional, and this crate has nothing true to put in
it. A journal record carries no wall clock: time in a run comes from
journaled clock.now effects, precisely so that a replay sees the instant
the run saw. Reading the ambient clock at delivery would stamp an event
with when the outbox happened to sweep — which for a receiver that was down
for two hours is a lie about when the run finished, told with more precision
than the truth. A deployment that needs the instant projects it from its own
records.
Implementations§
Source§impl RunCompleted
impl RunCompleted
Sourcepub fn new(source: impl Into<String>) -> Self
pub fn new(source: impl Into<String>) -> Self
source is the CloudEvents source URI for this deployment.
Sourcepub fn for_tenant(self, tenant: impl Into<String>) -> Self
pub fn for_tenant(self, tenant: impl Into<String>) -> Self
Stamp every event with a tenantid extension.
For a multi-tenant plane posting to one operator bus: without it, two tenants’ completions are indistinguishable envelopes, and the inbound side of this crate already binds tenants on exactly this extension.
Sourcepub fn event_type(self, event_type: impl Into<String>) -> Self
pub fn event_type(self, event_type: impl Into<String>) -> Self
Override the CloudEvents type.
Trait Implementations§
Source§impl Clone for RunCompleted
impl Clone for RunCompleted
Source§impl Debug for RunCompleted
impl Debug for RunCompleted
Source§impl Projection for RunCompleted
impl Projection for RunCompleted
Source§fn messages<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 Record,
) -> Pin<Box<dyn Future<Output = Result<Vec<PushMessage>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn messages<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 Record,
) -> Pin<Box<dyn Future<Output = Result<Vec<PushMessage>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn namespace(&self) -> PushNamespace
fn namespace(&self) -> PushNamespace
Auto Trait Implementations§
impl Forget for RunCompleted
impl Freeze for RunCompleted
impl RefUnwindSafe for RunCompleted
impl Send for RunCompleted
impl Sync for RunCompleted
impl Unpin for RunCompleted
impl UnsafeUnpin for RunCompleted
impl UnwindSafe for RunCompleted
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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