Expand description
Ordered scoped-thread parallelism and Git config-driven thread policy.
There is no global pool and no environment reads in this module. Embedders and
the CLI pass an explicit ThreadPolicy (for example --threads) when opening
a crate::repo::Repository.
Library guide: parallelism
use grit_lib::parallel::ThreadPolicy;
let _ = ThreadPolicy::default();Structs§
- Parallel
Options - Resolved worker count and serial-fallback thresholds for one parallel map call.
- Parallelism
- Resolved worker thread count for parallel helpers.
- Thread
Policy - Explicit CLI or embedder overrides layered on top of config resolution.
Enums§
- Parallel
Hash Error - Failure from fallible parallel helpers when a closure returns an error.
- Parallel
Op - Git operation that selects which config keys apply to parallelism.
Functions§
- index_
load_ lazy_ thread_ count - Lazy name-hash thread count from config and Git’s
LAZY_THREAD_COSTthresholds. - index_
pack_ threads_ for_ ingest - Resolve
IngestPackOptions::threadsfrom explicit fetch options, CLI policy, or config. - index_
parallelism_ from_ config - Worker count for index preload / parallel worktree hashing from config alone.
- par_map
- Run
foveritemswith up tooptions.threadsworkers, preserving order. - parallel_
worthwhile - Legacy helper: returns true when parallel hashing is expected to beat a serial loop.
- try_
par_ map - Fallible ordered parallel map; first error cancels the pool.
- try_
par_ map_ force - Like
try_par_map, but ignores batch thresholds (still requiresthreads> 1). - try_
par_ map_ with_ local - Parallel map with local state from
initfor each item.