Skip to main content

KeptOutputs

Trait KeptOutputs 

pub trait KeptOutputs:
    Send
    + Sync
    + 'static {
    // Required methods
    fn keep<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        run: &'life1 str,
        id: &'life2 str,
        text: &'life3 str,
        omitted: u64,
    ) -> Pin<Box<dyn Future<Output = Result<KeptInfo, KeptError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             Self: 'async_trait;
    fn page<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        run: &'life1 str,
        id: &'life2 str,
        offset: i64,
        limit: u32,
    ) -> Pin<Box<dyn Future<Output = Result<String, KeptError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
}
Expand description

A place that keeps outputs for ReadOutput. Put in the agent’s state as a KeptStore.

An implementation scrubs what it keeps (what it keeps is what it shows), keeps at most MAX_KEPT_BYTES, refuses an id that is not an is_output_id, never lets one run read another’s output, and keeps what a worker that takes the run over can read. kept_outputs_conformance checks it.

Required Methods§

fn keep<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, run: &'life1 str, id: &'life2 str, text: &'life3 str, omitted: u64, ) -> Pin<Box<dyn Future<Output = Result<KeptInfo, KeptError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Keep text under id for run (the root run), replacing what that id held (a call that is run again keeps the same text). omitted is how many bytes of the output the caller left out before it gave text (0 when it gave all of it): when it is not 0, the kept text ends with a line that says so, and KeptInfo::cut is set. (Scrubbing changes lengths, so the count is of what was left out and not of what was printed.)

A text with omitted not 0 is the first part of a longer output, so it may end in the first half of a secret that scrubbing cannot recognise. The keeper cuts such a text back at its end with scrub_open_end (it keeps no more than the text less SCRUB_OVERLAP bytes), and a producer gives it unscrubbed.

§Errors

KeptError::Malformed for an id that is not one, KeptError::Refused when a bound is reached, KeptError::Io.

fn page<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, run: &'life1 str, id: &'life2 str, offset: i64, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<String, KeptError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

The page of the output id of run from offset (1-based; negative: from the end) of at most limit lines, rendered as Page::render does: its lines, then one final line.

§Errors

KeptError::Malformed, KeptError::NotFound (another run’s id is a miss like any other: no store scans for it), KeptError::Window, KeptError::Io.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§