Skip to main content

UploadSession

Struct UploadSession 

Source
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

Source

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).

Source

pub fn device(&self) -> DeviceId

The device whose connection began this upload.

Source

pub fn path(&self) -> &ObjectPath

The destination encrypted-object path.

Source

pub fn target(&self) -> &UploadTarget

The original publication condition, retained by every resumed session.

Source

pub fn confirmed_bytes(&self) -> u64

Bytes confirmed by the provider; only these may advance the operation.

Source

pub fn total_bytes(&self) -> u64

Total encrypted bytes promised when the session began.

Source

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).

Source

pub fn is_complete(&self) -> bool

Whether publication and provider upload cleanup have succeeded.

Source

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.

Source

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.

Source

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.

Source

pub fn encode(&self) -> Result<SecretBytes, StorageError>

Encode the complete recorded state without printing upload credentials.

Source

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

Source§

fn clone(&self) -> UploadSession

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'de> Deserialize<'de> for UploadSession

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for UploadSession

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,