pub struct UploadSession { /* private fields */ }Expand description
A provider upload recorded by the caller’s operation (§17.9, §11). The destination retains its original absent/revision condition across retries.
Record it before sending parts and after each call, including failed calls:
a publication conflict invalidates the native session even if abort fails.
Record it, too, after admitting a part that marks its plan
(crate::PartPermit::marked), before sending that part. After a crash,
call resume_upload to discover bytes accepted before a reply was lost. The
bytes of this value include an upload capability: keep them secret. Dropping
a session never aborts it; explicit abort abandons its pending bytes.
On copy profiles the recorded token names the temporary object as well as
identifying publication, and the session is recorded before the native
multipart upload exists: the first part initiates it. Abort deletes it even after native multipart completion; failed
copy or cleanup keeps the recording incomplete so it can be retried.
OneDrive creation returns its planned temporary UUID before any provider request.
After recording it, resume and record the returned native capability before
sending parts. The UUID stays through receipt, copying, verification
and deletion; native transfer completion alone is not publication.
Providers may retain closed session data until their expiry, without publishing it.
When recovery requires complete-byte comparison with a published object,
resumption resets the confirmed offset to zero. Feed the encrypted
bytes through upload_part again: they are compared to the published object,
without uploading them. Only a complete match confirms publication.
Implementations§
Source§impl UploadSession
impl UploadSession
Sourcepub fn needs_initiation(&self) -> bool
pub fn needs_initiation(&self) -> bool
Whether native initiation must follow recording this identity, before any part is sent. Resume it and save the returned session first (§20.6).
Sourcepub fn path(&self) -> &ObjectPath
pub fn path(&self) -> &ObjectPath
The destination encrypted-object path.
Sourcepub fn target(&self) -> &UploadTarget
pub fn target(&self) -> &UploadTarget
The original publication condition, retained by every resumed session.
Sourcepub fn confirmed_bytes(&self) -> u64
pub fn confirmed_bytes(&self) -> u64
Bytes confirmed by the provider; only these may advance the operation.
Sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
Total encrypted bytes promised when the session began.
Sourcepub fn part_size(&self) -> usize
pub fn part_size(&self) -> usize
Maximum part size. After resuming a partial part, send only the bytes remaining to the next part boundary (or the end of the object).
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether publication and provider upload cleanup have succeeded.
Sourcepub fn parts_independent(&self) -> bool
pub fn parts_independent(&self) -> bool
Whether this session’s parts are independent: the provider keeps each by its index, whatever order they arrive in and however often one is sent, so they may go together (§17.9, Appendix E.10). Only an S3 multipart upload’s are, once its first part has started it.
Sourcepub fn parts_to_send(&self) -> Vec<Range<u64>>
pub fn parts_to_send(&self) -> Vec<Range<u64>>
The bytes of each part still to send, in order: where parts are independent, every part the provider hasn’t confirmed; elsewhere only the next, which goes before any after it. After resuming a partial part, the next runs only to its part’s end.
Sourcepub fn confirm(&mut self, part: ConfirmedPart) -> Result<(), StorageError>
pub fn confirm(&mut self, part: ConfirmedPart) -> Result<(), StorageError>
Add a part the provider confirmed to an independent session. A part that isn’t one of the session’s, or one it holds already, is refused and changes nothing.
Sourcepub fn encode(&self) -> Result<SecretBytes, StorageError>
pub fn encode(&self) -> Result<SecretBytes, StorageError>
Encode the complete recorded state without printing upload credentials.
Sourcepub fn decode(bytes: &[u8]) -> Result<Self, StorageError>
pub fn decode(bytes: &[u8]) -> Result<Self, StorageError>
Read a recording only if its provider, destination, state and progress agree. Validation covers the location, state variant, nonempty identifiers, part counts and sizes, and confirmed byte offset; replacement requires a floor. The adapter also checks that it names the adapter’s location before any request.
Trait Implementations§
Source§impl Clone for UploadSession
impl Clone for UploadSession
Source§fn clone(&self) -> UploadSession
fn clone(&self) -> UploadSession
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for UploadSession
impl<'de> Deserialize<'de> for UploadSession
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for UploadSession
impl RefUnwindSafe for UploadSession
impl Send for UploadSession
impl Sync for UploadSession
impl Unpin for UploadSession
impl UnsafeUnpin for UploadSession
impl UnwindSafe for UploadSession
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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