pub struct UploadState {
pub pending_payment: Option<PaymentAttempt>,
/* private fields */
}Expand description
Prepared plans and confirmed proofs keyed by content address. Checkpoints contain no file bytes or wallet secrets.
Fields§
§pending_payment: Option<PaymentAttempt>Submission journal; an unresolved attempt must be reconciled before another payment.
Implementations§
Source§impl UploadState
impl UploadState
Sourcepub fn from_proofs(proofs: HashMap<XorName, Vec<u8>>) -> Self
pub fn from_proofs(proofs: HashMap<XorName, Vec<u8>>) -> Self
Import the same per-content proofs used by native disk receipts.
Sourcepub fn retained_plan(
&self,
address: &XorName,
size: u64,
now: SystemTime,
) -> Option<ChunkPaymentPlan>
pub fn retained_plan( &self, address: &XorName, size: u64, now: SystemTime, ) -> Option<ChunkPaymentPlan>
Reuse a previously prepared plan after a wallet callback was interrupted. Paid records are re-discovered so current storage targets replace stale ones.
Sourcepub fn prepare(&mut self, plan: ChunkPaymentPlan)
pub fn prepare(&mut self, plan: ChunkPaymentPlan)
Retain a verified plan before invoking an external wallet.
Sourcepub fn is_paid(&self, address: &XorName, now: SystemTime) -> bool
pub fn is_paid(&self, address: &XorName, now: SystemTime) -> bool
Whether a confirmed, safely fresh proof already covers this record.
Sourcepub fn confirm(
&mut self,
addresses: &[XorName],
transactions: &HashMap<QuoteHash, TxHash>,
now: SystemTime,
) -> Result<()>
pub fn confirm( &mut self, addresses: &[XorName], transactions: &HashMap<QuoteHash, TxHash>, now: SystemTime, ) -> Result<()>
Bind a confirmed payment to all pending plans, before loading or storing bytes. Missing transactions fail atomically, preserving the prepared plans for recovery.
Sourcepub fn reuse_prepared(
&self,
prepared: &PreparedChunk,
now: SystemTime,
) -> Option<PaidChunk>
pub fn reuse_prepared( &self, prepared: &PreparedChunk, now: SystemTime, ) -> Option<PaidChunk>
Attach an existing proof to refreshed native or browser PUT targets.
Sourcepub fn checkpoint(&self) -> Result<Vec<u8>>
pub fn checkpoint(&self) -> Result<Vec<u8>>
Serialize a local recovery checkpoint. Treat it like a native payment receipt.
Trait Implementations§
Source§impl Clone for UploadState
impl Clone for UploadState
Source§impl Debug for UploadState
impl Debug for UploadState
Source§impl Default for UploadState
impl Default for UploadState
Source§impl<'de> Deserialize<'de> for UploadState
impl<'de> Deserialize<'de> for UploadState
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 UploadState
impl RefUnwindSafe for UploadState
impl Send for UploadState
impl Sync for UploadState
impl Unpin for UploadState
impl UnsafeUnpin for UploadState
impl UnwindSafe for UploadState
Blanket Implementations§
impl<T> AdapterBounds for Twhere
T: Sync,
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
impl<'de, T> BorrowedRpcObject<'de> for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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