Skip to main content

DecisionLog

Struct DecisionLog 

Source
pub struct DecisionLog { /* private fields */ }
Expand description

The per-run recorder.

Implementations§

Source§

impl DecisionLog

Source

pub fn install(data: &mut StoreData, config: DecisionLogConfig) -> Arc<Self> ⓘ

Wraps the store’s security check in a recording decorator. Returns the log to read results from.

Install it outermost: after any embedder wrapper of the check (such as the server’s audit decorator). Other wrappers do not forward SecurityCheck::recorder, so a recorder installed beneath one is invisible to the host functions that begin calls.

Source

pub fn install_observed( data: &mut StoreData, config: DecisionLogConfig, observer: Option<Arc<dyn RecordObserver>>, ) -> Arc<Self> ⓘ

install, with an observer that sees each record as it is made.

Source

pub fn new( config: DecisionLogConfig, observer: Option<Arc<dyn RecordObserver>>, ) -> Arc<Self> ⓘ

A log not yet attached to a run; wrap a check to record through it. The clock starts now.

Source

pub fn wrap( self: &Arc<Self>, inner: Arc<dyn SecurityCheck>, ) -> Arc<dyn SecurityCheck> ⓘ

inner, with every decision it audits also recorded here. For a check made outside a program run, such as a server’s file tool; a run uses install.

Source

pub fn finish(&self) -> DecisionLogOutput

Takes the run’s records and releases their byte charge. Call once, when the run ends: the truncation flags, drop count, and call numbering describe the whole run, so a later call would not describe only its own records.

Trait Implementations§

Source§

impl DecisionRecorder for DecisionLog

Source§

fn begin_call( &self, caller: &str, capability: &str, line: Option<SourceLine>, ) -> CallTicket

A new host call. line is the program line that led to it, when known.
Source§

fn enter_host_call(&self) -> u64

A host function that can begin calls was entered. Returns the marker its exit_host_call passes back.
Source§

fn exit_host_call(&self, marker: u64, returned: bool)

That host function returned (returned) or failed. Ends every call begun since marker that is still open; a nested host function has ended its own already.
Source§

fn wants_payload(&self, call_index: u64) -> bool

Whether a payload for the call call_index would be kept: the call is open and the payload budget is not spent. Callers check it before building a payload. The default asks for every payload.
Source§

fn call_payload(&self, call_index: u64, side: Side, payload: Payload<'_>)

One side of a call that reached outside the program.
Source§

fn call_usage(&self, call_index: u64, usage: ModelUsage)

Token counts a model provider reported for a call.
Source§

fn wants_line(&self) -> bool

Whether the next call’s source line would be kept. Callers check it before paying for a backtrace; it is false once the decision cap is reached, the byte budget cannot fit even a bare record, a record has been dropped whole for want of bytes, or the frame budget is exceeded. Other truncation (a payload drop, the pair cap) does not turn it off.
Source§

fn note_line_capture(&self, frames: usize)

Counts the frames of a backtrace captured for a line. Past the recorder’s frame budget it marks the run truncated and stops further captures.
Source§

fn mark_last_filtered(&self)

Marks the latest call’s record as a denial the host function treated as a filter.

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more