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
impl DiskStore
Sourcepub fn open(location: &Path, base: &Path, options: DiskStoreOptions) -> Self
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.
Sourcepub const fn options(&self) -> DiskStoreOptions
pub const fn options(&self) -> DiskStoreOptions
How the store behaves.
Sourcepub fn take_notes(&self) -> Vec<String>
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.
Sourcepub fn finish_run(&self) -> Result<Finish, StoreError>
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.
Sourcepub fn finish_failed_run(&self) -> Result<Finish, StoreError>
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.