Skip to main content

weavatrix_git/
acceleration.rs

1use crate::{CommitMetadata, Object, ObjectId, PathBloom, Repository, Result};
2
3impl Repository {
4    #[must_use]
5    pub fn multi_pack_index_count(&self) -> usize {
6        self.store.multi_pack_index_count()
7    }
8
9    #[must_use]
10    pub fn commit_graph_layer_count(&self) -> usize {
11        self.graph
12            .as_ref()
13            .map_or(0, crate::commit_graph::CommitGraph::layer_count)
14    }
15
16    pub fn commit_maybe_changed_path(
17        &self,
18        id: ObjectId,
19        path: impl AsRef<[u8]>,
20    ) -> Result<Option<PathBloom>> {
21        self.graph
22            .as_ref()
23            .map_or(Ok(None), |graph| graph.changed_path(id, path.as_ref()))
24    }
25
26    pub fn bitmap_reachable(&self, commit: ObjectId) -> Result<Option<Vec<ObjectId>>> {
27        self.store
28            .bitmap_reachable(commit, self.limits.max_bitmap_objects)
29    }
30
31    pub fn objects_parallel(&self, ids: &[ObjectId]) -> Vec<Result<Object>> {
32        crate::parallel::map_slice(ids, |id| self.object(id))
33    }
34
35    pub fn commit_metadata_parallel(&self, ids: &[ObjectId]) -> Vec<Result<CommitMetadata>> {
36        crate::parallel::map_slice(ids, |id| self.commit_metadata(id))
37    }
38}