pub struct LauncherSagaLog {
inner: Mutex<BTreeMap<u64, SagaRecord>>,
}Expand description
In-memory launcher saga registry. Owned by SagaCoordinator as
Arc<LauncherSagaLog> (the name is kept from the durable era to
minimize churn at the ~5 coordinator call sites; it IS still a log —
an in-memory, bounded one).
Fields§
§inner: Mutex<BTreeMap<u64, SagaRecord>>Implementations§
Source§impl LauncherSagaLog
impl LauncherSagaLog
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty registry. Infallible — there is no file to open and no schema to migrate.
Sourcepub fn open_in_memory() -> Result<Self, LogError>
pub fn open_in_memory() -> Result<Self, LogError>
Compatibility constructor from the durable era (the registry is always in-memory now). Kept so the coordinator’s tests — written against the old API — compile unchanged.
Sourcepub fn max_saga_id(&self) -> Result<u64, LogError>
pub fn max_saga_id(&self) -> Result<u64, LogError>
Highest existing saga_id, or 0 if empty. The coordinator seeds
next_saga_id from this; for a fresh in-memory registry it is
always 0, so saga ids are per-process correlation ids (which is
all the host’s idempotency LRU and the pipe’s drop-failure
paths ever needed them to be).
Sourcepub fn start_saga(
&self,
saga_id: u64,
name: &str,
input: &Value,
) -> Result<(), LogError>
pub fn start_saga( &self, saga_id: u64, name: &str, input: &Value, ) -> Result<(), LogError>
Insert a fresh saga in running state. A duplicate saga_id is
a bug worth surfacing, not a silent overwrite.
Sourcepub fn terminate_saga(
&self,
saga_id: u64,
outcome: SagaOutcome,
) -> Result<(), LogError>
pub fn terminate_saga( &self, saga_id: u64, outcome: SagaOutcome, ) -> Result<(), LogError>
Write a saga’s terminal state. No-op when the saga_id is unknown (mirrors the durable log’s UPDATE-on-missing-row).
Sourcepub fn start_step(
&self,
saga_id: u64,
step_index: u32,
name: &str,
target: PipeTarget,
cmd: &Command,
) -> Result<(), LogError>
pub fn start_step( &self, saga_id: u64, step_index: u32, name: &str, target: PipeTarget, cmd: &Command, ) -> Result<(), LogError>
Record a pending step before its command is dispatched.
Sourcepub fn finish_step(
&self,
saga_id: u64,
step_index: u32,
output: &Event,
) -> Result<(), LogError>
pub fn finish_step( &self, saga_id: u64, step_index: u32, output: &Event, ) -> Result<(), LogError>
Mark a step succeeded and store the awaited event as JSON.
Sourcepub fn mark_failed_compensation(
&self,
saga_id: u64,
reason: &str,
) -> Result<(), LogError>
pub fn mark_failed_compensation( &self, saga_id: u64, reason: &str, ) -> Result<(), LogError>
Mark a saga failed_compensation. Idempotent; preserves any
existing failure_reason by APPENDING the new reason (post-mortem
preservation, codex P2 PR #647 round 1). No-op on unknown id.
Retained for API parity + diagnostics even though the recovery
walker that was its sole production caller is gone.
Sourcefn enforce_retention(inner: &mut BTreeMap<u64, SagaRecord>)
fn enforce_retention(inner: &mut BTreeMap<u64, SagaRecord>)
Evict the oldest TERMINAL sagas beyond the retention cap.
In-flight sagas are never evicted (they’d vanish from
diagnostics mid-run and their terminal write would silently
no-op). Replaces the durable log’s vacuum_older_than.
fn step_mut<'a>( inner: &'a mut BTreeMap<u64, SagaRecord>, saga_id: u64, step_index: u32, ) -> Option<&'a mut StepRecord>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LauncherSagaLog
impl RefUnwindSafe for LauncherSagaLog
impl Send for LauncherSagaLog
impl Sync for LauncherSagaLog
impl Unpin for LauncherSagaLog
impl UnsafeUnpin for LauncherSagaLog
impl UnwindSafe for LauncherSagaLog
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.