Skip to main content

Importer

Struct Importer 

Source
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: DepthMemo

Per-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>

Source

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).

Source

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.

Trait Implementations§

Source§

impl<S: GitSource, K: ObjectSink> Debug for Importer<'_, S, K>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, S, K> !RefUnwindSafe for Importer<'a, S, K>

§

impl<'a, S, K> !Send for Importer<'a, S, K>

§

impl<'a, S, K> !Sync for Importer<'a, S, K>

§

impl<'a, S, K> !UnwindSafe for Importer<'a, S, K>

§

impl<'a, S, K> Freeze for Importer<'a, S, K>

§

impl<'a, S, K> Unpin for Importer<'a, S, K>

§

impl<'a, S, K> UnsafeUnpin for Importer<'a, S, K>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.