Skip to main content

Snapshotter

Struct Snapshotter 

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

Atomic four-layer snapshot orchestrator.

Constructed with one LayerCapture per layer (model, cache, world, effects, trace). Captures run concurrently on stdlib threads (not tokio: each capture is CPU-bound by hashing/compression, not I/O-bound; threads outperform a runtime).

use std::sync::Arc;
use pf_core::{
    snapshot::{Snapshotter, LayerCapture, LayerDescriptor, LayerKind},
    store::PfStore,
    manifest::AgentInfo,
};
let agent = AgentInfo {
    kind: "demo".into(), version: "0".into(), fingerprint: "abc".into(),
};
let snapper = Snapshotter::new(agent, model, cache, world, effects, trace);
// let cid = snapper.snapshot(&store, vec![]).unwrap();

Implementations§

Source§

impl Snapshotter

Source

pub fn new( agent: AgentInfo, model: Arc<dyn LayerCapture>, cache: Arc<dyn LayerCapture>, world: Arc<dyn LayerCapture>, effects: Arc<dyn LayerCapture>, trace: Arc<dyn LayerCapture>, ) -> Self

Construct a snapshotter with one capture per layer.

Source

pub fn snapshot( &self, store: &PfStore, parents: Vec<Digest256>, ) -> Result<Digest256>

Run all five captures concurrently, assemble the manifest, persist it via store, and return its content-id. parents becomes the manifest’s parents field (use vec![] for a root snapshot).

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, 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> 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 = 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.