pub struct WarmStartStore { /* private fields */ }Implementations§
Source§impl WarmStartStore
impl WarmStartStore
Sourcepub fn open(root: PathBuf, opts: StoreOptions) -> Result<Self, StoreError>
pub fn open(root: PathBuf, opts: StoreOptions) -> Result<Self, StoreError>
Open (or create) a store rooted at root.
pub fn root(&self) -> &Path
pub fn options(&self) -> &StoreOptions
Sourcepub fn lookup(
&self,
key: &Fingerprint,
) -> Result<Option<WarmStartEntry>, StoreError>
pub fn lookup( &self, key: &Fingerprint, ) -> Result<Option<WarmStartEntry>, StoreError>
Look up the best entry for key, or None if no valid entry exists.
Selection: lowest objective first; ties prefer EntryKind::Final
over EntryKind::Checkpoint, then latest written_unix_secs. If
every candidate has objective = None, picks the latest write.
Corrupt or schema-mismatched candidates are silently cleaned up and
skipped.
Sourcepub fn lookup_latest(
&self,
key: &Fingerprint,
) -> Result<Option<WarmStartEntry>, StoreError>
pub fn lookup_latest( &self, key: &Fingerprint, ) -> Result<Option<WarmStartEntry>, StoreError>
Look up the newest valid entry for key, or None if no valid entry
exists.
Unlike Self::lookup, this deliberately ignores objective values.
Use this for near-match seed namespaces where entries may come from
different folds, diseases, or row sets, and objective magnitudes are
not comparable. Exact-key resume should keep using Self::lookup.
Sourcepub fn save(
&self,
key: &Fingerprint,
payload: &[u8],
objective: Option<f64>,
iteration: Option<u64>,
kind: EntryKind,
) -> Result<String, StoreError>
pub fn save( &self, key: &Fingerprint, payload: &[u8], objective: Option<f64>, iteration: Option<u64>, kind: EntryKind, ) -> Result<String, StoreError>
Save a new entry with a fresh run-id. Returns the run-id (caller may
hand it to Self::save_overwrite for periodic in-place updates).
Sourcepub fn save_overwrite(
&self,
key: &Fingerprint,
run_id: &str,
payload: &[u8],
objective: Option<f64>,
iteration: Option<u64>,
kind: EntryKind,
) -> Result<(), StoreError>
pub fn save_overwrite( &self, key: &Fingerprint, run_id: &str, payload: &[u8], objective: Option<f64>, iteration: Option<u64>, kind: EntryKind, ) -> Result<(), StoreError>
Save under a specific run-id (overwrites an existing entry with the same id atomically).
Sourcepub fn evict_overflow(&self) -> Result<(), StoreError>
pub fn evict_overflow(&self) -> Result<(), StoreError>
Drop entries older than TTL, then evict by recorded write-time
ascending until total bytes ≤ opts.size_budget_bytes. Idempotent;
safe under concurrent processes (worst case some entries are
double-removed, which is a no-op).
Sort key is the (written_unix_secs, written_nanos) recorded in
each entry’s meta, not the filesystem mtime — at second-resolution
mtime, batches of writes within the same second would sort
arbitrarily and could evict the most recent entry.
Trait Implementations§
Source§impl Clone for WarmStartStore
impl Clone for WarmStartStore
Auto Trait Implementations§
impl !Freeze for WarmStartStore
impl RefUnwindSafe for WarmStartStore
impl Send for WarmStartStore
impl Sync for WarmStartStore
impl Unpin for WarmStartStore
impl UnsafeUnpin for WarmStartStore
impl UnwindSafe for WarmStartStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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