Mercurial > hg
changeset 52170:1a8466fd904a
hg-core: add fncache module
For now it's only a super simple trait. It will be used for calling back into
Python soon, and later will be fleshed out into a full fncache.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 29 Jul 2024 20:28:42 +0200 |
parents | 84b5802ba7d3 |
children | 7be39c5110c9 |
files | rust/hg-core/src/fncache.rs rust/hg-core/src/lib.rs |
diffstat | 2 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust/hg-core/src/fncache.rs Mon Jul 29 20:28:42 2024 +0200 @@ -0,0 +1,26 @@ +use std::path::Path; + +use dyn_clone::DynClone; + +/// The FnCache stores the list of most files contained in the store and is +/// used for stream/copy clones. +/// +/// It keeps track of the name of "all" indexes and data files for all revlogs. +/// The names are relative to the store roots and are stored before any +/// encoding or path compression. +/// +/// Despite its name, the FnCache is *NOT* a cache, it keep tracks of +/// information that is not easily available elsewhere. It has no mechanism +/// for detecting isn't up to date, and de-synchronization with the actual +/// contents of the repository will lead to a corrupted clone and possibly +/// other corruption during maintenance operations. +/// Strictly speaking, it could be recomputed by looking at the contents of all +/// manifests AND actual store files on disk, however that is a +/// prohibitively expensive operation. +pub trait FnCache: Sync + Send + DynClone { + /// Whether the fncache was loaded from disk + fn is_loaded(&self) -> bool; + /// Add a path to be tracked in the fncache + fn add(&self, path: &Path); + // TODO add more methods once we start doing more with the FnCache +}
--- a/rust/hg-core/src/lib.rs Thu Sep 26 13:55:26 2024 +0200 +++ b/rust/hg-core/src/lib.rs Mon Jul 29 20:28:42 2024 +0200 @@ -14,6 +14,7 @@ pub mod dirstate_tree; pub mod discovery; pub mod exit_codes; +pub mod fncache; pub mod requirements; pub mod testing; // unconditionally built, for use from integration tests pub use dirstate::{