Skip to main content

FeeDocumentTtlVersion

Struct FeeDocumentTtlVersion 

Source
pub struct FeeDocumentTtlVersion {
    pub tiers: [DocumentTtlFeeTier; 5],
    pub credit_per_byte_per_period: u64,
    pub pricing_period_seconds: u32,
    pub cleanup_base_processing_cost: u64,
    pub cleanup_processing_cost_per_index_level: u64,
    pub cleanup_processing_cost_per_document_byte: u64,
}
Expand description

Fees of documents whose document type declares a ttl (protocol version 14).

Such a document is stored without storage flags, refunds nothing when it goes, and is deleted by the platform once its time to live has passed. Instead of the perpetual storage price it pays, when it is written, for the time it will actually occupy the state, plus the processing its deletion will cost:

  • Every byte the document writes (the document, its index entries and its entry in the expirations tree) costs the credit_per_byte of the first tier whose max_ttl_seconds covers the remaining lifetime; tiers are ordered by max_ttl_seconds. A lifetime longer than the last tier costs credit_per_byte_per_period for every pricing_period_seconds it spans, rounded up. The period is part of the schedule, not the node’s epoch length, so a network with short epochs (testnet, local networks) prices a lifetime like mainnet does.
  • That amount is storage, paid out over the epochs the document lives in (at most one era) rather than by the perpetual storage distribution: the block’s storage fees for each lifetime collect in the lifetime storage fee pools, which every epoch change spreads evenly over the epochs of their lifetime.
  • A document created with a ttl also prepays its deletion as processing: cleanup_base_processing_cost, plus cleanup_processing_cost_per_index_level for every index level of its document type (each index counts its properties, times the number of overlapping windows of a timeRange index), plus cleanup_processing_cost_per_document_byte for every byte of the stored document. A change that grows the document prepays the deletion of the bytes it adds.

Every earlier schedule carries the same group; it is unread there because the ttl keyword does not parse before protocol version 14.

Fields§

§tiers: [DocumentTtlFeeTier; 5]

Short lifetimes, priced per byte, ordered by max_ttl_seconds.

§credit_per_byte_per_period: u64

Credits per byte per pricing period spanned for lifetimes longer than the last tier.

§pricing_period_seconds: u32

The length, in seconds, of the period credit_per_byte_per_period prices.

§cleanup_base_processing_cost: u64

Prepaid processing of a document’s deletion, charged once when it is created.

§cleanup_processing_cost_per_index_level: u64

Prepaid processing per index level of the document type, charged once on creation.

§cleanup_processing_cost_per_document_byte: u64

Prepaid processing per byte of the stored document: charged on creation for the whole document, and on a change for the bytes it adds.

Trait Implementations§

Source§

impl<'__de, __Context> BorrowDecode<'__de, __Context> for FeeDocumentTtlVersion

Source§

fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl Clone for FeeDocumentTtlVersion

Source§

fn clone(&self) -> FeeDocumentTtlVersion

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FeeDocumentTtlVersion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<__Context> Decode<__Context> for FeeDocumentTtlVersion

Source§

fn decode<__D: Decoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl Default for FeeDocumentTtlVersion

Source§

fn default() -> FeeDocumentTtlVersion

Returns the “default value” for a type. Read more
Source§

impl Encode for FeeDocumentTtlVersion

Source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl Eq for FeeDocumentTtlVersion

Source§

impl PartialEq for FeeDocumentTtlVersion

Source§

fn eq(&self, other: &FeeDocumentTtlVersion) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FeeDocumentTtlVersion

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.

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, U> IntoPlatformVersioned<U> for T

Source§

fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U

Performs the conversion.
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.
§

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

§

type Error = <T as TryFrom<U>>::Error

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

fn try_from_versioned( value: U, _grove_version: &GroveVersion, ) -> Result<T, <T as TryFromVersioned<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.
Source§

impl<T, U> TryIntoPlatformVersioned<U> for T

Source§

type Error = <U as TryFromPlatformVersioned<T>>::Error

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

fn try_into_platform_versioned( self, platform_version: &PlatformVersion, ) -> Result<U, <U as TryFromPlatformVersioned<T>>::Error>

Performs the conversion.
§

impl<T, U> TryIntoVersioned<U> for T
where U: TryFromVersioned<T>,

§

type Error = <U as TryFromVersioned<T>>::Error

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

fn try_into_versioned( self, grove_version: &GroveVersion, ) -> Result<U, <U as TryFromVersioned<T>>::Error>

Performs the conversion.