pub struct PathPolicy { /* private fields */ }Expand description
The repository’s declared path policy: which paths are excluded from the
scan, and which are read as opaque bytes (ADR-0007 [paths]).
Empty by default, and an empty policy is exactly today’s behaviour — see
PathPolicy::fingerprint, which returns 0 for one so that declaring
nothing leaves every existing extraction-cache key untouched.
§There is no built-in default, and that is a decision
No path is excluded unless a repository says so — not raw/, not
manifest/, not vendor/. A built-in default would be a silent behaviour
change: any existing repository that happens to have a directory of that
name would lose it from its graph on upgrade, with nothing said. Opting in is
a declaration somebody wrote and a reviewer can see; opting out of a default
requires knowing the default exists. ADR-0026’s raw/ exclusion is therefore
a line in roteiro.toml, not a constant here.
Implementations§
Source§impl PathPolicy
impl PathPolicy
Sourcepub fn new(exclude: Vec<String>, opaque: Vec<String>) -> Self
pub fn new(exclude: Vec<String>, opaque: Vec<String>) -> Self
A policy from the two declared glob lists.
Patterns are matched anchored end-to-end against the whole repo-relative
path, with the same semantics [debt] ignore uses — see glob_match,
which is the one implementation both consult.
Sourcepub fn empty() -> &'static Self
pub fn empty() -> &'static Self
The empty policy: every path is PathClass::Extract.
Returned by reference and 'static so crate::IngestConfig can stay
Copy while carrying a policy — the default it borrows outlives every
caller.
Sourcepub fn classify(&self, path: &str) -> PathClass
pub fn classify(&self, path: &str) -> PathClass
How path (repo-relative, slash-separated) is read.
exclude is tested first, so a path matching both lists is excluded:
between two declarations the narrower one wins, because a repository that
said “never read this” should not have that undone by a second, weaker
statement about the same bytes.
Sourcepub fn exclude_patterns(&self) -> &[String]
pub fn exclude_patterns(&self) -> &[String]
The declared exclude globs, in declaration order.
Sourcepub fn opaque_patterns(&self) -> &[String]
pub fn opaque_patterns(&self) -> &[String]
The declared opaque globs, in declaration order.
Sourcepub fn fingerprint(&self) -> u64
pub fn fingerprint(&self) -> u64
A cache-key contribution that is 0 for an empty policy, so a
repository declaring nothing keeps every extraction-cache key it already
has — the same property crate::IngestConfig’s toggles have.
This is load-bearing rather than an optimisation. Extraction is cached by
(path, blob id, env), and the policy changes what an unchanged blob
extracts to: without it in env, adding manifest/** to opaque would
serve the previously-mined config_key nodes straight back out of the
cache, and sync would report itself up to date while the graph still
held everything the declaration was written to remove.
Trait Implementations§
Source§impl Clone for PathPolicy
impl Clone for PathPolicy
Source§impl Debug for PathPolicy
impl Debug for PathPolicy
Source§impl Default for PathPolicy
impl Default for PathPolicy
impl Eq for PathPolicy
Source§impl PartialEq for PathPolicy
impl PartialEq for PathPolicy
impl StructuralPartialEq for PathPolicy
Auto Trait Implementations§
impl Freeze for PathPolicy
impl RefUnwindSafe for PathPolicy
impl Send for PathPolicy
impl Sync for PathPolicy
impl Unpin for PathPolicy
impl UnsafeUnpin for PathPolicy
impl UnwindSafe for PathPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.