Skip to main content

UploadSession

Struct UploadSession 

Source
pub struct UploadSession<'p, B: BlobStore, N, H> { /* private fields */ }
Expand description

One UploadPack stream in progress. It borrows the pipeline: a binding that owns an Arc<Pipeline> keeps the Arc alive across the stream. Dropping it without Self::finish or Self::abort records the request as canceled and leaves nothing visible; an in-flight record stays resumable until it expires.

Implementations§

Source§

impl<'p, B: MultipartBlobStore, N: NamespaceStore, H: HookSet> UploadSession<'p, B, N, H>

Source

pub fn mode(&self) -> UploadMode

How this upload relates to its replay record.

Source

pub async fn push( &mut self, chunk_pack_id: Option<&[u8]>, offset: Option<u64>, data: Bytes, last: bool, ) -> Result<bool, ServerError>

Validate one chunk’s framing and write it to the blob sink (or, on a replay, only hash it); returns whether the last chunk has arrived. After an error the session is dead: every later call returns that error.

§Errors

The chunk’s UploadError; internal for a failed blob write.

Source

pub async fn finish(self) -> Result<(), ServerError>

End of stream: commit the blob (BLAKE3-verified by the sink), run pre_receive, then commit the replay record. A replayed upload stops once the stream verified.

§Errors

The stream’s UploadError (DigestMismatch when the bytes do not hash to the pack id); a hook’s error; the commit batch’s error.

Source

pub async fn abort(self)

Discard the upload: nothing becomes visible. An in-flight record stays resumable. Recorded as canceled.

Source

pub async fn abort_with(self, err: &ServerError)

Discard the upload because of err, e.g. a malformed message the binding decoded or a broken request stream: like Self::abort, but the request is recorded with err’s code, the one the client receives. A session that already failed keeps its first error.

Trait Implementations§

Source§

impl<B: BlobStore, N, H> Debug for UploadSession<'_, B, N, H>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'p, B, N, H> !RefUnwindSafe for UploadSession<'p, B, N, H>

§

impl<'p, B, N, H> !UnwindSafe for UploadSession<'p, B, N, H>

§

impl<'p, B, N, H> Freeze for UploadSession<'p, B, N, H>
where &'p Pipeline<B, N, H>: Freeze, Option<Target<<B as BlobStore>::Sink>>: Freeze,

§

impl<'p, B, N, H> Send for UploadSession<'p, B, N, H>
where &'p Pipeline<B, N, H>: Send, Option<Target<<B as BlobStore>::Sink>>: Send,

§

impl<'p, B, N, H> Sync for UploadSession<'p, B, N, H>
where &'p Pipeline<B, N, H>: Sync, Option<Target<<B as BlobStore>::Sink>>: Sync,

§

impl<'p, B, N, H> Unpin for UploadSession<'p, B, N, H>
where &'p Pipeline<B, N, H>: Unpin, Option<Target<<B as BlobStore>::Sink>>: Unpin,

§

impl<'p, B, N, H> UnsafeUnpin for UploadSession<'p, B, N, H>
where &'p Pipeline<B, N, H>: UnsafeUnpin, Option<Target<<B as BlobStore>::Sink>>: UnsafeUnpin,

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> 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> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSync for T
where T: Sync + ?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> 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