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>
impl<'p, B: MultipartBlobStore, N: NamespaceStore, H: HookSet> UploadSession<'p, B, N, H>
Sourcepub fn mode(&self) -> UploadMode
pub fn mode(&self) -> UploadMode
How this upload relates to its replay record.
Sourcepub async fn push(
&mut self,
chunk_pack_id: Option<&[u8]>,
offset: Option<u64>,
data: Bytes,
last: bool,
) -> Result<bool, ServerError>
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.
Sourcepub async fn finish(self) -> Result<(), ServerError>
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.
Sourcepub async fn abort(self)
pub async fn abort(self)
Discard the upload: nothing becomes visible. An in-flight record
stays resumable. Recorded as canceled.
Sourcepub async fn abort_with(self, err: &ServerError)
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.