pub struct PackedUpload { /* private fields */ }Expand description
A packed upload allows multiple objects to be uploaded together in a single upload. This can be more efficient than uploading each object separately if the size of the object is less than the minimum slab size.
The caller must call finalize to complete the upload.
Implementations§
Source§impl PackedUpload
impl PackedUpload
Sourcepub fn remaining(&self) -> u64
pub fn remaining(&self) -> u64
Returns the number of bytes remaining until reaching the optimal packed size. Adding objects larger than this will start a new slab. To minimize padding, prioritize objects that fit within the remaining size.
Sourcepub fn length(&self) -> u64
pub fn length(&self) -> u64
Returns the cumulative length of all objects currently in the upload.
Sourcepub async fn finalize(self) -> Result<Vec<Object>, UploadError>
pub async fn finalize(self) -> Result<Vec<Object>, UploadError>
Finalizes the upload and returns the resulting objects. This will wait for all readers to finish and all slabs to be uploaded before returning. The resulting objects will contain the metadata needed to download the objects.
The caller must pin the resulting objects to the indexer when ready.
Sourcepub async fn add<R: AsyncRead + Unpin>(&mut self, r: R) -> Result<u64>
pub async fn add<R: AsyncRead + Unpin>(&mut self, r: R) -> Result<u64>
Adds a new object to the upload. The data will be read until EOF and packed into the upload. The resulting object will contain the metadata needed to download the object. The caller must call finalize to get the resulting objects after all objects have been added.
Auto Trait Implementations§
impl Forget for PackedUpload
impl Freeze for PackedUpload
impl Move for PackedUpload
impl RefUnwindSafe for PackedUpload
impl Send for PackedUpload
impl Sync for PackedUpload
impl Unpin for PackedUpload
impl UnsafeUnpin for PackedUpload
impl UnwindSafe for PackedUpload
Blanket Implementations§
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
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 more