pub trait ReservableTree: Tree {
    // Required methods
    fn reserve(
        key: impl Into<Self::NodeId>,
        new_key: impl Into<Self::NodeId>,
        amount: Self::Balance
    ) -> Result<(), Self::Error>;
    fn system_reserve(
        key: impl Into<Self::NodeId>,
        amount: Self::Balance
    ) -> Result<(), Self::Error>;
    fn system_unreserve(
        key: impl Into<Self::NodeId>
    ) -> Result<Self::Balance, Self::Error>;
    fn get_system_reserve(
        key: impl Into<Self::NodeId>
    ) -> Result<Self::Balance, Self::Error>;
}

Required Methods§

source

fn reserve( key: impl Into<Self::NodeId>, new_key: impl Into<Self::NodeId>, amount: Self::Balance ) -> Result<(), Self::Error>

Reserve some value from underlying balance.

Used in gas reservation feature.

source

fn system_reserve( key: impl Into<Self::NodeId>, amount: Self::Balance ) -> Result<(), Self::Error>

Reserve some value from underlying balance.

Used in gas reservation for system signal.

source

fn system_unreserve( key: impl Into<Self::NodeId> ) -> Result<Self::Balance, Self::Error>

Unreserve some value from underlying balance.

Used in gas reservation for system signal.

source

fn get_system_reserve( key: impl Into<Self::NodeId> ) -> Result<Self::Balance, Self::Error>

Get system reserve value associated with given id.

Returns errors in cases of absence associated with given key node, or if such functionality is forbidden for specific node type: for example, for GasNode::ReservedLocal.

Implementors§

source§

impl<TotalValue, Balance, InternalError, Error, ExternalId, NodeId, StorageMap> ReservableTree for TreeImpl<TotalValue, InternalError, Error, ExternalId, NodeId, StorageMap>where Balance: BalanceTrait, TotalValue: ValueStorage<Value = Balance>, InternalError: Error, Error: From<InternalError>, ExternalId: Clone, NodeId: Copy, StorageMap: MapStorage<Key = NodeId, Value = GasNode<ExternalId, NodeId, Balance>>,