Skip to main content

Engine

Struct Engine 

Source
pub struct Engine {
    pub protect: ProtectContext,
    pub rule_errors: Vec<String>,
    /* private fields */
}

Fields§

§protect: ProtectContext§rule_errors: Vec<String>

Implementations§

Source§

impl Engine

Source

pub fn live( cfg: &Config, state: Option<StateDb>, on_demand: bool, offline: bool, ) -> Self

Live engine for this machine (user rules from the default config dir).

Source

pub fn live_in( cfg: &Config, state: Option<StateDb>, on_demand: bool, offline: bool, config_dir: Option<&Path>, ) -> Self

Live engine reading user rules from config_dir/rules.d (--config moves the config dir).

Source

pub fn replay(cfg: &Config, path: &Path) -> Result<Self, String>

Engine replaying a fixture file (--replay).

Source

pub fn replay_in( cfg: &Config, path: &Path, config_dir: Option<&Path>, ) -> Result<Self, String>

Replay engine with user rules from config_dir/rules.d. Never persists state, never probes adapters.

Source

pub fn rule_warnings(&self, allowlist: &[String]) -> Vec<String>

Rule-file lint (doctor): e.g. match.env keys outside the marker allowlist, which can never match.

Source

pub fn lineage_len(&self) -> usize

In-memory lineage entries (tests, doctor).

Source

pub fn flush(&mut self)

Persists the lineage journal (entries seen since the last flush) and anything else the state store has queued.

Source

pub fn set_learning(&mut self, learn: bool)

--no-learn: the machine profile is not refreshed and the state store records no learning signals. The lineage journal is attribution, not learning, and is always kept.

Source

pub fn set_state_read_only(&mut self)

Read the state store but never write it (reclaim --dry-run). Not reversible for this engine.

Source

pub fn replay_done(&self) -> bool

True once a replay has handed out its last frame (further snapshots repeat it); always false live.

Source

pub fn is_live(&self) -> bool

True for a live engine (actions may be executed); false when replaying a fixture.

Source

pub fn enrich(&mut self, s: Snapshot) -> Snapshot

Full enrichment pipeline on one raw snapshot.

Source

pub fn self_group(s: &Snapshot) -> Option<String>

Group id containing oomtop itself (for MCP: the calling agent’s session).

Source

pub fn state_mut(&mut self) -> Option<&mut StateDb>

Trait Implementations§

Source§

impl Drop for Engine

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl SnapshotProvider for Engine

Source§

fn snapshot(&mut self) -> Snapshot

Takes a fresh sample (the TUI/serve call this on their refresh cadence; MCP per call).
Source§

fn snapshot_now(&mut self) -> Snapshot

Like Self::snapshot but samples every source now, ignoring the cadence (the TUI’s second sample 500 ms after start, so CPU % appears within a second; a refresh right after an action).
Source§

fn history(&self) -> &History

History ring buffer of samples taken so far (may be empty for one-shot providers).
Source§

fn headroom_config(&self) -> HeadroomConfig

Headroom tunables from config.

Auto Trait Implementations§

§

impl !Freeze for Engine

§

impl !RefUnwindSafe for Engine

§

impl !Sync for Engine

§

impl !UnwindSafe for Engine

§

impl Forget for Engine

§

impl Move for Engine

§

impl Send for Engine
where BoxRaw<Sampler>: Send, RawVecInner: Send, NodeRef<Owned, String, SourceStatus, LeafOrInternal>: Send, BoxRaw<(String, SourceStatus)>: Send, NodeRef<Owned, String, u32, LeafOrInternal>: Send, BoxRaw<(String, u32)>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, Mutex<Memo>: Send, RawTable<(Vec<u8>, Vec<usize>)>: Send, Arc<dyn AcAutomaton>: Send, RawTable<(Vec<u8>, Vec<(usize, Regex)>)>: Send, Arc<RegexI>: Send, BoxRaw<Pool<Cache, Box<dyn Fn() -> Cache + Send + UnwindSafe + Sync + RefUnwindSafe>>>: Send, Arc<Pool<PatternSet, Box<dyn Fn() -> PatternSet + Send + UnwindSafe + Sync + RefUnwindSafe>>>: Send, Arc<str>: Send, Arc<[String]>: Send, Mutex<Option<(u64, Vec<Group>)>>: Send, Connection: Send, RawTable<(String, String)>: Send, NodeRef<Owned, ProcId, LineageEntry, LeafOrInternal>: Send, BoxRaw<(ProcId, LineageEntry)>: Send, NodeRef<Owned, String, (String, u64, u64), LeafOrInternal>: Send, BoxRaw<(String, (String, u64, u64))>: Send, NodeRef<Owned, String, (u64, u64), LeafOrInternal>: Send, BoxRaw<(String, (u64, u64))>: Send, RawTable<(ProcId, u64)>: Send, RawTable<(ProcId, (Option<u64>, Option<u64>))>: Send, RawTable<(ProcId, ())>: Send, NodeRef<Owned, String, (u64, Option<EndedSession>), LeafOrInternal>: Send, BoxRaw<(String, (u64, Option<EndedSession>))>: Send, NodeRef<Owned, String, u16, LeafOrInternal>: Send, BoxRaw<(String, u16)>: Send, NodeRef<Owned, String, Series, LeafOrInternal>: Send, BoxRaw<(String, Series)>: Send, NodeRef<Owned, String, CpuObs, LeafOrInternal>: Send, BoxRaw<(String, CpuObs)>: Send,

§

impl Unpin for Engine
where Box<Sampler>: Unpin, *const u8 is !null: Unpin, *const LeafNode<String, SourceStatus> is !null: Unpin, Box<(String, SourceStatus)>: Unpin, *const LeafNode<String, u32> is !null: Unpin, Box<(String, u32)>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin, Arc<dyn AcAutomaton>: Unpin, Arc<RegexI>: Unpin, Box<Pool<Cache, Box<dyn Fn() -> Cache + Send + UnwindSafe + Sync + RefUnwindSafe>>>: Unpin, Arc<Pool<PatternSet, Box<dyn Fn() -> PatternSet + Send + UnwindSafe + Sync + RefUnwindSafe>>>: Unpin, Arc<str>: Unpin, Arc<[String]>: Unpin, *mut sqlite3: Unpin, Arc<Mutex<*mut sqlite3>>: Unpin, *const Node<Arc<str>, RawStatement> is !null: Unpin, *const LeafNode<ProcId, LineageEntry> is !null: Unpin, Box<(ProcId, LineageEntry)>: Unpin, *const LeafNode<String, (String, u64, u64)> is !null: Unpin, Box<(String, (String, u64, u64))>: Unpin, *const LeafNode<String, (u64, u64)> is !null: Unpin, Box<(String, (u64, u64))>: Unpin, *const LeafNode<String, (u64, Option<EndedSession>)> is !null: Unpin, Box<(String, (u64, Option<EndedSession>))>: Unpin, *const LeafNode<String, u16> is !null: Unpin, Box<(String, u16)>: Unpin, *const LeafNode<String, Series> is !null: Unpin, Box<(String, Series)>: Unpin, *const LeafNode<String, CpuObs> is !null: Unpin, Box<(String, CpuObs)>: Unpin,

§

impl UnsafeUnpin for Engine
where *const Sampler is !null: UnsafeUnpin, PhantomData<Sampler>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<Snapshot>: UnsafeUnpin, PhantomData<Rule>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, PhantomData<(u64, Option<usize>)>: UnsafeUnpin, PhantomData<((u64, GroupKind), String)>: UnsafeUnpin, PhantomData<((u64, Option<u32>, u32), (GroupKind, String))>: UnsafeUnpin, PhantomData<CompiledRule>: UnsafeUnpin, PhantomData<GlobSetMatchStrategy>: UnsafeUnpin, PhantomData<Glob>: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, *const ArcInner<RegexI> is !null: UnsafeUnpin, PhantomData<ArcInner<RegexI>>: UnsafeUnpin, *const Pool<Cache, Box<dyn Fn() -> Cache + Send + UnwindSafe + Sync + RefUnwindSafe>> is !null: UnsafeUnpin, PhantomData<Pool<Cache, Box<dyn Fn() -> Cache + Send + UnwindSafe + Sync + RefUnwindSafe>>>: UnsafeUnpin, *const ArcInner<[String]> is !null: UnsafeUnpin, PhantomData<ArcInner<[String]>>: UnsafeUnpin, PhantomData<Group>: UnsafeUnpin, *mut sqlite3: UnsafeUnpin, *const ArcInner<Mutex<*mut sqlite3>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<*mut sqlite3>>>: UnsafeUnpin, PhantomData<NonNull<Node<Arc<str>, RawStatement>>>: UnsafeUnpin, *const Node<Arc<str>, RawStatement> is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<(String, String)>: UnsafeUnpin, *const LeafNode<ProcId, LineageEntry> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(ProcId, LineageEntry)>>: UnsafeUnpin, *const LeafNode<String, (String, u64, u64)> is !null: UnsafeUnpin, PhantomData<Box<(String, (String, u64, u64))>>: UnsafeUnpin, PhantomData<(String, EventKind, u64, Option<String>)>: UnsafeUnpin, PhantomData<Impression>: UnsafeUnpin, *const LeafNode<String, (u64, u64)> is !null: UnsafeUnpin, PhantomData<Box<(String, (u64, u64))>>: UnsafeUnpin, PhantomData<(ProcId, u64)>: UnsafeUnpin, PhantomData<(ProcId, (Option<u64>, Option<u64>))>: UnsafeUnpin, PhantomData<(ProcId, ())>: UnsafeUnpin, *const LeafNode<String, (u64, Option<EndedSession>)> is !null: UnsafeUnpin, PhantomData<Box<(String, (u64, Option<EndedSession>))>>: UnsafeUnpin, PhantomData<HistoryPoint>: UnsafeUnpin, *const LeafNode<String, u16> is !null: UnsafeUnpin, PhantomData<Box<(String, u16)>>: UnsafeUnpin, PhantomData<String>: UnsafeUnpin, PhantomData<PathBuf>: UnsafeUnpin, PhantomData<ModelServer>: UnsafeUnpin, PhantomData<Sandbox>: UnsafeUnpin, PhantomData<u32>: UnsafeUnpin, *const LeafNode<String, Series> is !null: UnsafeUnpin, PhantomData<Box<(String, Series)>>: UnsafeUnpin, *const LeafNode<String, CpuObs> is !null: UnsafeUnpin, PhantomData<Box<(String, CpuObs)>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.