Skip to main content

Scratchpad

Struct Scratchpad 

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

Scratchpad for interrupt handling and transient data storage

Used by the HITL system to track processed interrupts, maintain an audit trail, and store transient data during interrupt handling.

Implementations§

Source§

impl Scratchpad

Source

pub fn new() -> Self

Create a new empty scratchpad

Source

pub fn is_interrupt_processed(&self, id: &str) -> bool

Check if an interrupt has been processed

§Arguments
  • id - The interrupt ID to check
§Returns

true if the interrupt has been processed, false otherwise

Source

pub fn get_null_resume(&self, interrupt_id: &str) -> bool

Check if a confirmation-only resume is valid for the given interrupt.

Returns true when the interrupt has already been processed, meaning the caller can resume without providing an explicit value.

Source

pub fn mark_interrupt_processed(&mut self, id: &str)

Mark an interrupt as processed

§Arguments
  • id - The interrupt ID to mark as processed
Source

pub fn get_data(&self, key: &str) -> Option<&Value>

Get transient data by key

§Arguments
  • key - The data key
§Returns

The stored value, if it exists

Source

pub fn set_data(&mut self, key: String, value: Value)

Set transient data

§Arguments
  • key - The data key
  • value - The value to store
Source

pub fn record_interrupt(&mut self, id: String, node: String, payload: Value)

Record an interrupt event in the audit trail

Creates a new record with the current timestamp and adds it to the interrupt history.

§Arguments
  • id - The interrupt ID
  • node - The node name where the interrupt occurred
  • payload - The interrupt payload
Source

pub fn record_resume(&mut self, id: &str, value: Value)

Record that an interrupt was resumed

Finds the interrupt record by ID and updates it with the resume timestamp and value.

§Arguments
  • id - The interrupt ID to mark as resumed
  • value - The resume value provided
Source

pub fn interrupt_history(&self) -> &[InterruptRecord]

Get the complete interrupt history

Returns all interrupt records in chronological order.

§Returns

A slice of all interrupt records

Source

pub fn clear_transient(&mut self)

Clear transient scratchpad entries

Removes entries that are not persistent (entries not prefixed with null_resume:). Persistent entries are preserved.

Trait Implementations§

Source§

impl Clone for Scratchpad

Source§

fn clone(&self) -> Scratchpad

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Scratchpad

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Scratchpad

Source§

fn default() -> Scratchpad

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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