pub struct GraphCacheStore {
pub version: u32,
pub manifest: GraphCacheManifest,
pub graph: ModuleGraph,
pub resolved_project: CachedResolvedProject,
}Expand description
On-disk graph cache entry: a manifest plus the graph it validates.
Fields§
§version: u32Schema version. Checked on load; a mismatch misses so a stale file from an older binary is never deserialized into the wrong shape.
manifest: GraphCacheManifestInputs that must match the current run for the graph to be trusted.
graph: ModuleGraphThe previously-built graph. Its namespace_imported bitset is
#[serde(skip)], so the loader reconstructs it from the edge set.
resolved_project: CachedResolvedProjectResolver output aligned with the cached graph. Exact manifest hits use
it alongside the graph; stable-key resolver hits remap it and rebuild
the graph with current FileIds.
Implementations§
Source§impl GraphCacheStore
impl GraphCacheStore
Sourcepub fn load(cache_dir: &Path) -> Result<Self, CacheRejection>
pub fn load(cache_dir: &Path) -> Result<Self, CacheRejection>
Load the persisted graph cache from cache_dir.
§Errors
Returns the CacheRejection that decided against reuse: the file is
missing, undecodable, or written for a different
GRAPH_CACHE_VERSION. The caller compares the loaded manifest against
the current inputs before trusting the graph or resolver payload, and
reports its own rejection reason for that comparison.
The version is read from the file header BEFORE the payload is
decoded. A format bump changes the encoded shape, so a blob
from the previous release fails to decode and a version comparison made
afterwards is unreachable on the one event that triggers it most: an
upgrade. fallow doctor reports this reason verbatim, so a routine
version bump must not read as corruption, and a file that is not a
fallow cache at all must not read as a version bump.
A file that existed and was then refused logs at warn: the run paid the read and the decode and reused nothing. A missing file stays quiet.
Sourcepub fn save(&self, cache_dir: &Path)
pub fn save(&self, cache_dir: &Path)
Persist this graph cache to cache_dir, best-effort.
Creates the cache directory, writes a .gitignore, encodes the store
with postcard, and writes graph-cache.bin atomically. Every IO error
is logged at debug and swallowed; the graph cache must never fail the
surrounding analysis run.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GraphCacheStore
impl<'de> Deserialize<'de> for GraphCacheStore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for GraphCacheStore
impl RefUnwindSafe for GraphCacheStore
impl Send for GraphCacheStore
impl Sync for GraphCacheStore
impl Unpin for GraphCacheStore
impl UnsafeUnpin for GraphCacheStore
impl UnwindSafe for GraphCacheStore
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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