Skip to main content

Store

Struct Store 

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

Content-addressed trace store.

root should be an existing directory (typically .shadow/traces/). This struct does NOT create the root on construction — callers can choose whether to pre-create it.

Implementations§

Source§

impl Store

Source

pub fn new(root: impl Into<PathBuf>) -> Self

Wrap an existing root directory. See SPEC §8 for the layout.

Source

pub fn root(&self) -> &Path

The root directory wrapped by this store.

Source

pub fn put(&self, trace: &[Record]) -> Result<String>

Put a trace. Returns the trace’s root id (the first record’s id).

Writes atomically: the final path does not appear until the write has fully completed and flushed to disk.

Source

pub fn get(&self, trace_id: &str) -> Result<Vec<Record>>

Read a trace by its root content id.

Source

pub fn exists(&self, trace_id: &str) -> bool

Whether a trace with this id is stored.

Source

pub fn list(&self) -> Result<Vec<String>>

Iterate over all trace ids currently in the store.

Walk order is undefined; callers that need a deterministic order should collect and sort.

Source

pub fn path_for(&self, trace_id: &str) -> Result<PathBuf>

Compute the on-disk path for a given trace id. Does NOT create directories or check whether the file exists.

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Ungil for T
where T: Send,