Skip to main content

PathPolicy

Struct PathPolicy 

Source
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

Source

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.

Source

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.

Source

pub fn is_empty(&self) -> bool

Whether nothing is declared, so every path extracts normally.

Source

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.

Source

pub fn exclude_patterns(&self) -> &[String]

The declared exclude globs, in declaration order.

Source

pub fn opaque_patterns(&self) -> &[String]

The declared opaque globs, in declaration order.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PathPolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PathPolicy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for PathPolicy

Source§

impl PartialEq for PathPolicy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PathPolicy

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.