pub struct Importer<'a, S: GitSource, K: ObjectSink> {
pub source: &'a mut S,
pub sink: &'a mut K,
pub signer: ImportSigner<'a>,
pub map: &'a mut HashMap<Sha1Id, Hash>,
pub retain_raw: &'a mut RetainRawFn<'a>,
pub options: ImportOptions,
pub depth_memo: DepthMemo,
}Expand description
The import engine. map is the sha1→blake3 cache (load it from
the state dir; pairs accumulate across calls).
Long unmapped parent chains should go through
Importer::import_commits (parents-first order, recursion depth
1); Importer::import_ref recurses through unmapped parents.
Fields§
§source: &'a mut S§sink: &'a mut K§signer: ImportSigner<'a>§map: &'a mut HashMap<Sha1Id, Hash>§retain_raw: &'a mut RetainRawFn<'a>Retained-raw-bytes hook (commits + tags only); the CLI writes these sha1-addressed under the state dir (SPEC-GIT-IMPORT §5).
options: ImportOptions§depth_memo: DepthMemoPer-run scratch for the §3.3/§3.4 composition checks (tree heights / tag chain lengths measured on map-cache hits).
Implementations§
Source§impl<S: GitSource, K: ObjectSink> Importer<'_, S, K>
impl<S: GitSource, K: ObjectSink> Importer<'_, S, K>
Sourcepub fn import_ref(&mut self, tip: &Sha1Id) -> Result<ImportedRef, BridgeError>
pub fn import_ref(&mut self, tip: &Sha1Id) -> Result<ImportedRef, BridgeError>
Import the closure of one upstream ref tip (commit or tag
object id, parents-first commit order is derived internally
for the in-memory path; CLI callers pass rev_list order via
Self::import_commits for incremental efficiency).
Sourcepub fn import_commits(
&mut self,
order: &[Sha1Id],
tip: &Sha1Id,
new_pairs: &mut Vec<(Sha1Id, Hash)>,
normalized: &mut bool,
) -> Result<Hash, BridgeError>
pub fn import_commits( &mut self, order: &[Sha1Id], tip: &Sha1Id, new_pairs: &mut Vec<(Sha1Id, Hash)>, normalized: &mut bool, ) -> Result<Hash, BridgeError>
Import commits in caller-supplied parents-first order, then
return the map entry for tip. More efficient than
Self::import_ref for long histories (no deep recursion
through parent links).
new_pairs and normalized are CALLER-owned and keep every
pair discovered before an error: the sink writes happen
regardless, so on a per-ref refusal the caller must still
persist those pairs — a later ref sharing that history
memo-hits without re-emitting them, and dropping them here
would leave the durable map missing objects that recorded
refs reference.