pub struct EngineCfg {
pub try_only: bool,
pub max_retry: u32,
pub backoff_ms_step: u64,
pub max_hold_ms: u128,
pub token_secret: Vec<u8>,
pub long_hold: LongHoldConfig,
pub max_spawn_depth: u32,
}Expand description
Lock acquisition + max-hold guard configuration.
Fields§
§try_only: boolWhen true, Engine::with_state never retries on a busy lock — it
fails fast with EngineError::LockBusy on the very first
try_lock miss instead of backing off and retrying.
max_retry: u32Max number of try_lock retries before giving up with
EngineError::LockBusyAfterRetry (ignored when try_only = true).
backoff_ms_step: u64Linear backoff step (ms) between retries; the sleep duration for
attempt n is backoff_ms_step * (n + 1).
max_hold_ms: u128R4 guard threshold: if a single with_state closure holds the lock
longer than this (ms), with_state panics — a signal that a long
operation leaked inside the lock in violation of the R3 discipline.
token_secret: Vec<u8>HMAC secret used by TokenSigner to sign/verify CapTokens.
Default generates this fresh (32 random bytes from the OS RNG) on
every call when the caller does not supply one — set it explicitly
for tokens to stay valid across restarts, or when multiple
independently-constructed engines/signers must accept each other’s
tokens.
long_hold: LongHoldConfigLong-hold session tuning (idle keepalive, heartbeat cadence).
max_spawn_depth: u32Worker recursive spawn depth ceiling (guards against unbounded spawn).
When Ctx.meta.runtime["spawn_depth"] has already reached this value
and a Worker token tries to call start_task, the engine raises
EngineError::SpawnDepthExceeded. 0 = root (a task launched
directly by an Operator); 4 = default, which allows four levels of
nested sub-tasks.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EngineCfg
impl RefUnwindSafe for EngineCfg
impl Send for EngineCfg
impl Sync for EngineCfg
impl Unpin for EngineCfg
impl UnsafeUnpin for EngineCfg
impl UnwindSafe for EngineCfg
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