Skip to main content

Settings

Struct Settings 

Source
pub struct Settings { /* private fields */ }
Expand description

Everything this process resolved once about configuration: the trusted repository policy, and the reads memoised on top of it.

This replaces a process-global OnceLock<Policy>. The global was correct for the hook path — one process means one repository — but it made a rule the compiler could not see. A multi-repo walker had to KNOW not to seed it, and amont-fleet carried that knowledge as a comment with no test able to assert it, because asserting it would have meant seeding it.

Owned high and borrowed everywhere — the shape Ctx already uses for manifest and push — the rule stops needing to be remembered: there is no store to seed. The memo fields keep the per-process caching these reads have always had, which spawn_budget measures; one Settings per process buys the same number of git spawns the statics did.

Implementations§

Source§

impl Settings

Source

pub fn new(policy: Policy) -> Self

The policy a trusted manifest declared — empty when nothing was declared or the manifest was not trusted. manifest::load decides that and hands the answer here.

Source

pub fn policy(&self) -> &Policy

Source

pub fn for_thread(&self) -> Settings

A fresh Settings over the same policy, with empty caches.

For a spawned thread, which cannot borrow this one. It resolves the same answers — same policy, same git config — and it resolves them LAZILY, which is the property that matters: a paint or heartbeat thread that never lives long enough to read a budget must not have cost a git config spawn for it up front. Handing the thread pre-resolved numbers did exactly that, and spawn_budget said so.

Trait Implementations§

Source§

impl Debug for Settings

Source§

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

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

impl Default for Settings

Source§

fn default() -> Settings

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

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> 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, 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.