pub enum UploadSessionLifecycle {
Open {
expires_at_ms: u64,
staged_content: Option<ContentRef>,
},
Completed {
completed_at_ms: u64,
content_ref: ContentRef,
},
Aborted {
aborted_at_ms: u64,
},
}Expand description
Lifecycle of a durable upload session: one live state and two terminal ones, with no way back.
A session opens with a lease and either completes or is aborted. The
compare-and-swap that makes one of those two land is the serialization
point for the whole upload — provider state follows the durable
transition, never the other way around — so whichever transition wins is
simply what happened, and the loser reports a terminal error rather than
undoing anything. Nothing returns a session to open: a client that
wants another try begins another session, which mints its own content
identity.
Variants§
Open
The one state that may stage bytes and complete. Live until its lease passes, after which garbage collection aborts it.
Fields
expires_at_ms: u64Unix-millisecond instant after which the session is abandoned. The record carries it so no session transition depends on an object’s provider timestamp.
staged_content: Option<ContentRef>Content this session has already written and proven, or None
before any bytes have passed validation.
Only a service-proxied session stages: the other transports write past this server, so what they wrote is established at completion. Staged content lives here rather than beside the state because it is the one thing about an open session that changes, and because a terminal session has no use for it — a completed one names its content once, below.
Completed
Terminal: the content is durable and verified. This is the only state a receipt may be minted from, and the content reference it carries is what every re-mint and idempotent completion retry answers with.
Fields
completed_at_ms: u64Unix-millisecond stamp written by the completing compare-and-swap, and the only input to when the content may be reclaimed.
content_ref: ContentRefVerified immutable content this session settled on, and the one place a completed session’s reference exists.
Aborted
Terminal: the session will never select content. Its content identity was never published — a receipt exists only for a completed session — so the object it named belongs to nobody and is deleted.
Trait Implementations§
Source§impl Clone for UploadSessionLifecycle
impl Clone for UploadSessionLifecycle
Source§fn clone(&self) -> UploadSessionLifecycle
fn clone(&self) -> UploadSessionLifecycle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more