pub struct UploadPackStream<'a> { /* private fields */ }Expand description
The pack one upload-pack response streams: the client’s wants and haves, the shallow boundaries on either side, and an optional partial-clone filter.
Build it with UploadPackStream::new and the with_* setters, then
UploadPackStream::write it. The pack is streamed with pack reuse when bitmaps allow,
otherwise with pack-objects; filtered (partial clone) packs stream too.
Implementations§
Source§impl<'a> UploadPackStream<'a>
impl<'a> UploadPackStream<'a>
Sourcepub fn new(wants: &'a [ObjectId], options: PackBuildOptions) -> Self
pub fn new(wants: &'a [ObjectId], options: PackBuildOptions) -> Self
A pack of everything reachable from wants, built with options.
Sourcepub fn with_haves(self, haves: &'a [ObjectId]) -> Self
pub fn with_haves(self, haves: &'a [ObjectId]) -> Self
Leave out objects reachable from haves, which the client already has.
Sourcepub fn with_source_shallow(self, grafts: &'a HashSet<ObjectId>) -> Self
pub fn with_source_shallow(self, grafts: &'a HashSet<ObjectId>) -> Self
Shallow boundaries of the serving repository: the walk stops at their parents.
Sourcepub fn with_have_shallow(self, grafts: &'a HashSet<ObjectId>) -> Self
pub fn with_have_shallow(self, grafts: &'a HashSet<ObjectId>) -> Self
Shallow boundaries of the client: history behind them counts as missing on its side.
Sourcepub fn with_filter(self, filter: &'a ObjectFilter) -> Self
pub fn with_filter(self, filter: &'a ObjectFilter) -> Self
Apply a partial-clone object filter (blob:none, blob:limit=<n>, …).
Sourcepub fn write(
&self,
repo: &Repository,
progress: &mut dyn ProgressSink,
out: &mut dyn Write,
) -> Result<PackStats>
pub fn write( &self, repo: &Repository, progress: &mut dyn ProgressSink, out: &mut dyn Write, ) -> Result<PackStats>
Write the pack for repo to out, reporting progress through progress.
The whole build runs in the odb’s pack read context, so planning and the pack-write workers share one set of pack caches.
§Errors
Missing wants, corrupt objects, or I/O failures while writing to out.
Sourcepub fn build(&self, odb: &Odb) -> Result<Vec<u8>>
pub fn build(&self, odb: &Odb) -> Result<Vec<u8>>
Build the same pack in memory from odb instead of streaming it.
Objects are selected the way the streamed pack selects them (a filter keeps the wants and the objects their tags point at), but without bitmap pack reuse.
§Errors
Missing wants, corrupt objects, or pack encoding failures.