pub struct FoldContext {
pub as_of: DateTime<Utc>,
pub correlation_id: Option<Uuid>,
pub extra: SharedJson,
}Expand description
Context for fold operations.
The context parameterizes fold behavior — same entries with different contexts may produce different derived states.
as_of defaults to the Unix epoch (DateTime::<Utc>::default()).
Callers that need “now” must pass it explicitly via FoldContext::at.
This preserves the ADR-024 “no clock” invariant for the foundation layer.
Fields§
§as_of: DateTime<Utc>Point in time to evaluate (for temporal queries)
correlation_id: Option<Uuid>Correlation ID for tracing
extra: SharedJsonAdditional context as shared JSON.
Uses SharedJson (Arc-backed) so clones are cheap in hot paths.
Implementations§
Source§impl FoldContext
impl FoldContext
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new context with the Unix epoch as as_of.
Per ADR-024 (“no clock”), the foundation layer does not call Utc::now().
Pass an explicit timestamp via FoldContext::at when a real wall-clock
instant is needed.
Sourcepub fn with_correlation_id(self, id: Uuid) -> Self
pub fn with_correlation_id(self, id: Uuid) -> Self
Set the correlation ID.
Sourcepub fn with_extra(self, extra: impl Into<SharedJson>) -> Self
pub fn with_extra(self, extra: impl Into<SharedJson>) -> Self
Set extra context.
Trait Implementations§
Source§impl Clone for FoldContext
impl Clone for FoldContext
Source§fn clone(&self) -> FoldContext
fn clone(&self) -> FoldContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more