Skip to main content

DiskStore

Struct DiskStore 

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

skif’s disk cache store: the store of one base in a cache location (see the crate documentation).

Namespace files are read when a run first asks for their namespace and kept in memory; finish_run writes what the run used and prunes the memory to it, so a long-lived host (watch mode) reads the files once and writes them after each run.

Implementations§

Source§

impl DiskStore

Source

pub fn open(location: &Path, base: &Path, options: DiskStoreOptions) -> Self

The store of base, an absolute directory, in the cache location. Opening reads nothing and never fails: files are read when a run first asks for their namespace, and a missing or unreadable file is empty.

Source

pub fn location(&self) -> &Path

The cache location.

Source

pub fn dir(&self) -> &Path

The directory of this base’s store inside the location.

Source

pub const fn options(&self) -> DiskStoreOptions

How the store behaves.

Source

pub fn take_notes(&self) -> Vec<String>

Takes the reasons files were ignored since the last call, for a host that shows them under --debug.

Source

pub fn finish_run(&self) -> Result<Finish, StoreError>

Writes, per namespace, exactly the entries the run used, unless they are the entries already stored, then keeps the location under its cap, and prunes the memory of every namespace to what the run used.

§Errors

StoreError when a directory or file could not be created, written or renamed, or the location is below a missing node_modules. The memory is pruned all the same; the run’s report never depends on it.

Source

pub fn finish_failed_run(&self) -> Result<Finish, StoreError>

Ends a run that did not complete (it failed, or linted only a part of what it was asked to): writes, per namespace, the entries the run put next to the ones already stored, and drops none, since what such a run did not use says nothing about what the next one needs.

§Errors

As finish_run.

Trait Implementations§

Source§

impl CacheStore for DiskStore

Source§

fn get(&self, namespace: CacheNamespace, key: &[u8; 32]) -> Option<Arc<[u8]>>

The value stored under key in namespace, if any.
Source§

fn put(&self, namespace: CacheNamespace, key: &[u8; 32], value: Arc<[u8]>)

Stores value under key in namespace.
Source§

impl Debug for DiskStore

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.