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_byteof the first tier whosemax_ttl_secondscovers the remaining lifetime; tiers are ordered bymax_ttl_seconds. A lifetime longer than the last tier costscredit_per_byte_per_periodfor everypricing_period_secondsit 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
ttlalso prepays its deletion as processing:cleanup_base_processing_cost, pluscleanup_processing_cost_per_index_levelfor every index level of its document type (each index counts its properties, times the number of overlapping windows of atimeRangeindex), pluscleanup_processing_cost_per_document_bytefor 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: u64Credits per byte per pricing period spanned for lifetimes longer than the last tier.
pricing_period_seconds: u32The length, in seconds, of the period credit_per_byte_per_period prices.
cleanup_base_processing_cost: u64Prepaid processing of a document’s deletion, charged once when it is created.
cleanup_processing_cost_per_index_level: u64Prepaid processing per index level of the document type, charged once on creation.
cleanup_processing_cost_per_document_byte: u64Prepaid 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
impl<'__de, __Context> BorrowDecode<'__de, __Context> for FeeDocumentTtlVersion
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for FeeDocumentTtlVersion
impl Clone for FeeDocumentTtlVersion
Source§fn clone(&self) -> FeeDocumentTtlVersion
fn clone(&self) -> FeeDocumentTtlVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more