pub struct PackGenerator<'a, R>where
R: RepositoryAccess,{ /* 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>where
R: RepositoryAccess,
impl<'a, R> PackGenerator<'a, R>where
R: RepositoryAccess,
Sourcepub fn new(repo_access: &'a R) -> Self
pub fn new(repo_access: &'a R) -> Self
Create a generator bound to repo_access.object_hash_kind() as observed right now.
Sourcepub fn new_with_hash_kind(repo_access: &'a R, hash_kind: HashKind) -> Self
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).
Sourcepub async fn generate_full_pack(
&self,
want: Vec<String>,
) -> Result<ReceiverStream<Result<Vec<u8>, ProtocolError>>, ProtocolError>
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).
Sourcepub async fn generate_incremental_pack(
&self,
want: Vec<String>,
have: Vec<String>,
) -> Result<ReceiverStream<Result<Vec<u8>, ProtocolError>>, ProtocolError>
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).
Sourcepub async fn unpack_stream(
&self,
pack_data: Bytes,
) -> Result<(Vec<Commit>, Vec<Tree>, Vec<Blob>), ProtocolError>
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>
impl<'a, R> RefUnwindSafe for PackGenerator<'a, R>where
&'a R: RefUnwindSafe,
impl<'a, R> Send for PackGenerator<'a, R>
impl<'a, R> Sync for PackGenerator<'a, R>
impl<'a, R> Unpin for PackGenerator<'a, R>
impl<'a, R> UnsafeUnpin for PackGenerator<'a, R>where
&'a R: UnsafeUnpin,
impl<'a, R> UnwindSafe for PackGenerator<'a, R>where
&'a R: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.