pub trait FeeTracker {
type Id;
// Required methods
fn get_fee_factor(id: Self::Id) -> FixedU128;
fn increase_fee_factor(
id: Self::Id,
message_size_factor: FixedU128,
) -> FixedU128;
fn decrease_fee_factor(id: Self::Id) -> FixedU128;
}
Expand description
Trait for tracking message delivery fees on a transport protocol.
Required Associated Types§
Required Methods§
sourcefn get_fee_factor(id: Self::Id) -> FixedU128
fn get_fee_factor(id: Self::Id) -> FixedU128
Returns the evolving exponential fee factor which will be used to calculate the delivery fees.
sourcefn increase_fee_factor(
id: Self::Id,
message_size_factor: FixedU128,
) -> FixedU128
fn increase_fee_factor( id: Self::Id, message_size_factor: FixedU128, ) -> FixedU128
Increases the delivery fee factor by a factor based on message size and records the result.
Returns the new delivery fee factor after the increase.
sourcefn decrease_fee_factor(id: Self::Id) -> FixedU128
fn decrease_fee_factor(id: Self::Id) -> FixedU128
Decreases the delivery fee factor by a constant factor and records the result.
Does not reduce the fee factor below the initial value, which is currently set as 1.
Returns the new delivery fee factor after the decrease.
Object Safety§
This trait is not object safe.