Skip to main content

Module parallel

Module parallel 

Source
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§

ParallelOptions
Resolved worker count and serial-fallback thresholds for one parallel map call.
Parallelism
Resolved worker thread count for parallel helpers.
ThreadPolicy
Explicit CLI or embedder overrides layered on top of config resolution.

Enums§

ParallelHashError
Failure from fallible parallel helpers when a closure returns an error.
ParallelOp
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_COST thresholds.
index_pack_threads_for_ingest
Resolve IngestPackOptions::threads from 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 f over items with up to options.threads workers, 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 requires threads > 1).
try_par_map_with_local
Parallel map with local state from init for each item.