pub trait IdIndex {
// Required methods
fn resolve(&self, id: &Id) -> Option<PathBuf>;
fn id_for_path(&self, path: &Path) -> Option<Id>;
// Provided method
fn is_known(&self, id: &Id) -> bool { ... }
}Expand description
The query half of an ID index: the three lookups link resolution needs, and no way to change what is stored.
This is the trait crate::graph is generic over, and it is the whole of
what the read core asks of a registry — id: resolution
(resolve), the reverse lookup a census entry is tagged
with (id_for_path), and the tombstone question that
distinguishes “never existed” from “retired”
(is_known).
Split out of prov-store’s IndexStore for the same reason
ReadStorage is split out of that crate’s
Storage: a read-only consumer must be able to depend on traversal without
linking the staging machinery, and IndexStore’s staging half is not merely
unused by the read core — it is stated in write vocabulary, down to
rebase, which only a pending mutation has anything to say to.
Required Methods§
Sourcefn resolve(&self, id: &Id) -> Option<PathBuf>
fn resolve(&self, id: &Id) -> Option<PathBuf>
Resolve an ID to its current path. None for unknown and tombstoned
IDs — use is_known to tell them apart.
Sourcefn id_for_path(&self, path: &Path) -> Option<Id>
fn id_for_path(&self, path: &Path) -> Option<Id>
The ID currently assigned to path, if any.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".