Skip to main content

HealthStore

Struct HealthStore 

Source
pub struct HealthStore {
    pub version: u32,
    pub updated_at: DateTime<Utc>,
    pub records: BTreeMap<String, ModelVerification>,
}
Expand description

The versioned health store: one ModelVerification per model id, keyed by model_id. Lives at Config::cache_dir()/model-health.json, written atomically (sibling .tmp + rename, 0o600).

Fields§

§version: u32

File layout version (HEALTH_STORE_VERSION).

§updated_at: DateTime<Utc>

Last write time (RFC 3339).

§records: BTreeMap<String, ModelVerification>

Verification records keyed by model id.

Implementations§

Source§

impl HealthStore

Source

pub fn new() -> Self

An empty store at the current version.

Source

pub fn upsert(&mut self, verification: ModelVerification)

Insert or replace one model’s verification record and bump updated_at. Other models’ records are preserved.

Source

pub fn get(&self, model_id: &str) -> Option<&ModelVerification>

Read one model’s record.

Trait Implementations§

Source§

impl Clone for HealthStore

Source§

fn clone(&self) -> HealthStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HealthStore

Source§

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

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

impl Default for HealthStore

Source§

fn default() -> Self

Self::new - a store with no records is the natural default state.

Source§

impl<'de> Deserialize<'de> for HealthStore

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HealthStore

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.