Expand description
DeterministicBrick: Pure functional brick execution (PROBAR-SPEC-009-P11)
Provides deterministic execution with:
- Pure functional design: (State, Input) → (State, Output)
- Persistent data structures for O(1) snapshots
- Time-travel debugging
- Jidoka guards for invariant checking
§Design Philosophy
DeterministicBrick applies WOS (WebAssembly Operating System) patterns to ensure reproducible brick execution.
§Example
ⓘ
use probar::brick::deterministic::{DeterministicBrick, BrickHistory};
impl DeterministicBrick for MelSpectrogramBrick {
type State = ComputeState;
type Input = AudioChunk;
type Output = MelFrames;
fn execute_pure(
state: Self::State,
input: Self::Input,
) -> Result<(Self::State, Self::Output), BrickError> {
let mel = compute_mel(&input, &state.filterbank)?;
let new_state = state.with_frame_count(state.frame_count + 1);
Ok((new_state, mel))
}
}Structs§
- Brick
History - History for time-travel debugging
- Brick
State - Brick state snapshot with structural sharing
- Deterministic
Clock - Deterministic clock for reproducibility
- Deterministic
Rng - Deterministic random number generator (for reproducibility)
- Execution
Trace - Execution trace entry for time-travel debugging
- Guard
Violation - Guard violation error
- Guarded
Brick - Wrapper that adds invariant checking to a brick
- Invariant
Guard - Invariant guard for Jidoka pattern
Enums§
- Guard
Severity - Severity level for invariant violations
- State
Value - Value types for state metadata
Traits§
- Deterministic
Brick - Trait for bricks with deterministic, pure functional execution