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
impl Settings
Sourcepub fn new(policy: Policy) -> Self
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.
pub fn policy(&self) -> &Policy
Sourcepub fn for_thread(&self) -> Settings
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.