Skip to main content

PackGenerator

Struct PackGenerator 

Source
pub struct PackGenerator<'a, R>{ /* private fields */ }
Expand description

Pack generation service for Git protocol operations

This handles the core Git pack generation logic internally within git-internal, using the RepositoryAccess trait only for data access. Pack trailers, object IDs and decoding are bound to the repository’s object_hash_kind() (SHA-1, SHA-256, or the BLAKE3 extension); nothing is inferred from ID widths.

Implementations§

Source§

impl<'a, R> PackGenerator<'a, R>

Source

pub fn new(repo_access: &'a R) -> Self

Create a generator bound to repo_access.object_hash_kind() as observed right now.

Source

pub fn new_with_hash_kind(repo_access: &'a R, hash_kind: HashKind) -> Self

Create a generator bound to an explicit, already validated hash_kind (what SmartProtocol passes after its consistency check).

Source

pub fn hash_kind(&self) -> HashKind

The object format this generator is bound to.

Source

pub async fn generate_full_pack( &self, want: Vec<String>, ) -> Result<ReceiverStream<Result<Vec<u8>, ProtocolError>>, ProtocolError>

Generate a full pack containing all requested objects.

Object collection (and its kind checks) happens before this returns; the pack bytes are produced on a background task and delivered as Ok chunks, and any failure of that task is delivered as a final Err item (fail-closed, never a silent EOF).

Source

pub async fn generate_incremental_pack( &self, want: Vec<String>, have: Vec<String>, ) -> Result<ReceiverStream<Result<Vec<u8>, ProtocolError>>, ProtocolError>

Generate an incremental pack containing only objects not in ‘have’ (see PackGenerator::generate_full_pack for the stream’s error contract).

Source

pub async fn unpack_stream( &self, pack_data: Bytes, ) -> Result<(Vec<Commit>, Vec<Tree>, Vec<Blob>), ProtocolError>

Unpack incoming pack stream and extract objects.

The pack is decoded against the generator’s bound object format: object IDs, ref-delta bases and the trailer checksum are computed and verified with that kind, so a pack of another format (for example a BLAKE3 pack pushed to a SHA-256 repository) fails closed.

Auto Trait Implementations§

§

impl<'a, R> Freeze for PackGenerator<'a, R>
where &'a R: Freeze,

§

impl<'a, R> RefUnwindSafe for PackGenerator<'a, R>

§

impl<'a, R> Send for PackGenerator<'a, R>
where &'a R: Send,

§

impl<'a, R> Sync for PackGenerator<'a, R>
where &'a R: Sync,

§

impl<'a, R> Unpin for PackGenerator<'a, R>
where &'a R: Unpin,

§

impl<'a, R> UnsafeUnpin for PackGenerator<'a, R>

§

impl<'a, R> UnwindSafe for PackGenerator<'a, R>

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> ValueSize for T

Source§

fn value_size(&self) -> usize

The size of this value in bytes, excluding allocated data. Read more
Source§

fn value_size_sum_iter<'item>(iterator: impl Iterator<Item = &'item T>) -> usize
where T: 'item,

The total sum of the sizes of all values in the given iterator, in bytes. This is default-implemented by computing ValueSize::value_size on every element and summing them. For Sized types, a more potentially efficient implementation using Iterator::count is provided. If you are implementing this trait manually, it is unlikely to be more efficient to provide a manual implementation here. Read more
Source§

fn value_size_sum_exact_size_iter<'item>( iterator: impl ExactSizeIterator<Item = &'item T>, ) -> usize
where T: 'item,

The total sum of the sizes of all values in the given exact-size-iterator, in bytes. This is default-implemented by using ValueSize::value_size_sum_iter. For Sized types, a usually more efficient implementation using ExactSizeIterator::len is provided. If you are implementing this trait manually, it is unlikely to be more efficient to provide a manual implementation here. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more