Skip to main content

FileSplitStore

Struct FileSplitStore 

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

File-backed split store for persistent runs.

Persists assignment metadata, epoch state, and sampler runtime state.

The store always works against a private temporary copy of the source snapshot. All reads and mutations accumulate in the temp file. State is published to permanent storage only when SamplerStateStore::save_sampler_state is called:

  • save_to == None → publish temp to save_path (may overwrite).
  • save_to == Some(p) → publish temp to p only; save_path is left untouched.

This guarantees that the original source file is never modified and that no partial state leaks to the target before an explicit save.

Implementations§

Source§

impl FileSplitStore

Source

pub fn open<P: Into<PathBuf>>( path: P, ratios: SplitRatios, seed: u64, ) -> Result<Self, SamplerError>

Open (or create) a file-backed split store at path.

Source

pub fn open_with_load_path<LP: Into<PathBuf>, SP: Into<PathBuf>>( load_path: Option<LP>, save_path: SP, ratios: SplitRatios, seed: u64, ) -> Result<Self, SamplerError>

Open (or create) a file-backed split store at save_path, optionally bootstrapping initial state from load_path.

Always stages through a private temporary file. The source used to seed the temp is chosen as follows:

  1. load_path if supplied and it exists.
  2. save_path if it already exists.
  3. Nothing — a fresh empty store is created in the temp.

All mutations accumulate in the temp. State is published to permanent storage only when SamplerStateStore::save_sampler_state is called. The original source file is never modified.

Trait Implementations§

Source§

impl Debug for FileSplitStore

Source§

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

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

impl EpochStateStore for FileSplitStore

Source§

fn load_epoch_meta( &self, ) -> Result<HashMap<SplitLabel, PersistedSplitMeta>, SamplerError>

Load split→epoch metadata map.
Source§

fn load_epoch_hashes( &self, label: SplitLabel, ) -> Result<Option<PersistedSplitHashes>, SamplerError>

Load persisted epoch hashes for one split, if available.
Source§

fn save_epoch_meta( &self, meta: &HashMap<SplitLabel, PersistedSplitMeta>, ) -> Result<(), SamplerError>

Persist split→epoch metadata map.
Source§

fn save_epoch_hashes( &self, label: SplitLabel, hashes: &PersistedSplitHashes, ) -> Result<(), SamplerError>

Persist epoch hash list for one split.
Source§

impl SamplerStateStore for FileSplitStore

Source§

fn save_sampler_state( &self, state: &PersistedSamplerState, save_to: Option<&Path>, ) -> Result<(), SamplerError>

Persist state to the working temp store and publish to the destination.

  • save_to == None → publish temp to save_path (may overwrite).
  • save_to == Some(p) → publish temp to p only; save_path is left untouched. p must not already exist.
Source§

fn load_sampler_state( &self, ) -> Result<Option<PersistedSamplerState>, SamplerError>

Load persisted sampler runtime state, if present.
Source§

impl SplitStore for FileSplitStore

Source§

fn label_for(&self, id: &RecordId) -> Option<SplitLabel>

Return split label for id if known/derivable.
Source§

fn upsert(&self, id: RecordId, label: SplitLabel) -> Result<(), SamplerError>

Persist an explicit split assignment for id.
Source§

fn ratios(&self) -> SplitRatios

Return configured split ratios.
Source§

fn ensure(&self, id: RecordId) -> Result<SplitLabel, SamplerError>

Return the split label for id, creating/deriving one when needed.

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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, 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