Trait snarkvm_ledger_store::FeeStorage
source · pub trait FeeStorage<N: Network>: Clone + Send + Sync {
type FeeMap: for<'a> Map<'a, N::TransactionID, (N::TransitionID, N::StateRoot, Option<Proof<N>>)>;
type ReverseFeeMap: for<'a> Map<'a, N::TransitionID, N::TransactionID>;
type TransitionStorage: TransitionStorage<N>;
Show 16 methods
// Required methods
fn open(
transition_store: TransitionStore<N, Self::TransitionStorage>
) -> Result<Self>;
fn fee_map(&self) -> &Self::FeeMap;
fn reverse_fee_map(&self) -> &Self::ReverseFeeMap;
fn transition_store(&self) -> &TransitionStore<N, Self::TransitionStorage>;
// Provided methods
fn dev(&self) -> Option<u16> { ... }
fn start_atomic(&self) { ... }
fn is_atomic_in_progress(&self) -> bool { ... }
fn atomic_checkpoint(&self) { ... }
fn clear_latest_checkpoint(&self) { ... }
fn atomic_rewind(&self) { ... }
fn abort_atomic(&self) { ... }
fn finish_atomic(&self) -> Result<()> { ... }
fn insert(
&self,
transaction_id: N::TransactionID,
fee: &Fee<N>
) -> Result<()> { ... }
fn remove(&self, transaction_id: &N::TransactionID) -> Result<()> { ... }
fn find_transaction_id_from_transition_id(
&self,
transition_id: &N::TransitionID
) -> Result<Option<N::TransactionID>> { ... }
fn get_fee(
&self,
transaction_id: &N::TransactionID
) -> Result<Option<Fee<N>>> { ... }
}
Expand description
A trait for fee storage.
Required Associated Types§
sourcetype FeeMap: for<'a> Map<'a, N::TransactionID, (N::TransitionID, N::StateRoot, Option<Proof<N>>)>
type FeeMap: for<'a> Map<'a, N::TransactionID, (N::TransitionID, N::StateRoot, Option<Proof<N>>)>
The mapping of transaction ID
to (fee transition ID, global state root, proof)
.
sourcetype ReverseFeeMap: for<'a> Map<'a, N::TransitionID, N::TransactionID>
type ReverseFeeMap: for<'a> Map<'a, N::TransitionID, N::TransactionID>
The mapping of fee transition ID
to transaction ID
.
sourcetype TransitionStorage: TransitionStorage<N>
type TransitionStorage: TransitionStorage<N>
The transition storage.
Required Methods§
sourcefn open(
transition_store: TransitionStore<N, Self::TransitionStorage>
) -> Result<Self>
fn open( transition_store: TransitionStore<N, Self::TransitionStorage> ) -> Result<Self>
Initializes the fee storage.
sourcefn reverse_fee_map(&self) -> &Self::ReverseFeeMap
fn reverse_fee_map(&self) -> &Self::ReverseFeeMap
Returns the reverse fee map.
sourcefn transition_store(&self) -> &TransitionStore<N, Self::TransitionStorage>
fn transition_store(&self) -> &TransitionStore<N, Self::TransitionStorage>
Returns the transition storage.
Provided Methods§
sourcefn start_atomic(&self)
fn start_atomic(&self)
Starts an atomic batch write operation.
sourcefn is_atomic_in_progress(&self) -> bool
fn is_atomic_in_progress(&self) -> bool
Checks if an atomic batch is in progress.
sourcefn atomic_checkpoint(&self)
fn atomic_checkpoint(&self)
Checkpoints the atomic batch.
sourcefn clear_latest_checkpoint(&self)
fn clear_latest_checkpoint(&self)
Clears the latest atomic batch checkpoint.
sourcefn atomic_rewind(&self)
fn atomic_rewind(&self)
Rewinds the atomic batch to the previous checkpoint.
sourcefn abort_atomic(&self)
fn abort_atomic(&self)
Aborts an atomic batch write operation.
sourcefn finish_atomic(&self) -> Result<()>
fn finish_atomic(&self) -> Result<()>
Finishes an atomic batch write operation.
sourcefn insert(&self, transaction_id: N::TransactionID, fee: &Fee<N>) -> Result<()>
fn insert(&self, transaction_id: N::TransactionID, fee: &Fee<N>) -> Result<()>
Stores the given (transaction ID, fee)
pair into storage.
sourcefn remove(&self, transaction_id: &N::TransactionID) -> Result<()>
fn remove(&self, transaction_id: &N::TransactionID) -> Result<()>
Removes the fee for the given transaction ID
.
sourcefn find_transaction_id_from_transition_id(
&self,
transition_id: &N::TransitionID
) -> Result<Option<N::TransactionID>>
fn find_transaction_id_from_transition_id( &self, transition_id: &N::TransitionID ) -> Result<Option<N::TransactionID>>
Returns the transaction ID that contains the given transition ID
.
Object Safety§
This trait is not object safe.