pub struct InMemoryStorage { /* private fields */ }Expand description
In-memory storage: trials kept in a BTreeMap per study (ordered by trial
number) behind a Mutex. Fast and dependency-free, but everything is lost
when the process exits. This is the Phase 1–2 default.
Implementations§
Source§impl InMemoryStorage
impl InMemoryStorage
pub fn new() -> InMemoryStorage
Trait Implementations§
Source§impl Default for InMemoryStorage
impl Default for InMemoryStorage
Source§fn default() -> InMemoryStorage
fn default() -> InMemoryStorage
Returns the “default value” for a type. Read more
Source§impl Storage for InMemoryStorage
impl Storage for InMemoryStorage
Source§fn save_trial(
&self,
study_name: &str,
trial: &Trial,
) -> Result<(), StorageError>
fn save_trial( &self, study_name: &str, trial: &Trial, ) -> Result<(), StorageError>
Insert or update a trial for the given study.
Source§fn load_trials(&self, study_name: &str) -> Result<Vec<Trial>, StorageError>
fn load_trials(&self, study_name: &str) -> Result<Vec<Trial>, StorageError>
Load all trials for a study, in trial-number order. Returns an empty
vec for a study that exists but has no trials yet.
Source§fn save_study_metadata(&self, meta: &StudyMetadata) -> Result<(), StorageError>
fn save_study_metadata(&self, meta: &StudyMetadata) -> Result<(), StorageError>
Insert or update study-level metadata.
Source§fn load_study_metadata(
&self,
study_name: &str,
) -> Result<Option<StudyMetadata>, StorageError>
fn load_study_metadata( &self, study_name: &str, ) -> Result<Option<StudyMetadata>, StorageError>
Fetch study-level metadata, or
None if the study is unknown.Auto Trait Implementations§
impl !Freeze for InMemoryStorage
impl RefUnwindSafe for InMemoryStorage
impl Send for InMemoryStorage
impl Sync for InMemoryStorage
impl Unpin for InMemoryStorage
impl UnsafeUnpin for InMemoryStorage
impl UnwindSafe for InMemoryStorage
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
Mutably borrows from an owned value. Read more