pub struct AccountData<Balance, BlockNumber> {
pub balance: AccountData<Balance>,
pub rate: Rate<BlockNumber>,
}Expand description
Custom account data structure with rate limiting.
Fields§
§balance: AccountData<Balance>Balance data from the pallet_balances module.
rate: Rate<BlockNumber>Rate limiter data.
Trait Implementations§
Source§impl<Balance: Clone, BlockNumber: Clone> Clone for AccountData<Balance, BlockNumber>
impl<Balance: Clone, BlockNumber: Clone> Clone for AccountData<Balance, BlockNumber>
Source§fn clone(&self) -> AccountData<Balance, BlockNumber>
fn clone(&self) -> AccountData<Balance, BlockNumber>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Balance, BlockNumber> Debug for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> Debug for AccountData<Balance, BlockNumber>
Source§impl<Balance, BlockNumber> Decode for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> Decode for AccountData<Balance, BlockNumber>
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
impl<Balance, BlockNumber> DecodeWithMemTracking for AccountData<Balance, BlockNumber>
Source§impl<Balance: Default, BlockNumber: Default> Default for AccountData<Balance, BlockNumber>
impl<Balance: Default, BlockNumber: Default> Default for AccountData<Balance, BlockNumber>
Source§fn default() -> AccountData<Balance, BlockNumber>
fn default() -> AccountData<Balance, BlockNumber>
Source§impl<Balance, BlockNumber> Encode for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> Encode for AccountData<Balance, BlockNumber>
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
impl<Balance, BlockNumber> EncodeLike for AccountData<Balance, BlockNumber>
impl<Balance: Eq, BlockNumber: Eq> Eq for AccountData<Balance, BlockNumber>
Source§impl<Balance, BlockNumber> MaxEncodedLen for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> MaxEncodedLen for AccountData<Balance, BlockNumber>
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Source§impl<Balance: PartialEq, BlockNumber: PartialEq> PartialEq for AccountData<Balance, BlockNumber>
impl<Balance: PartialEq, BlockNumber: PartialEq> PartialEq for AccountData<Balance, BlockNumber>
Source§impl<T> RateLimiter<T> for AccountData<T::Balance, BlockNumberFor<T>>
A rate limiter implementation for managing transaction limits
and data size constraints based on a specified block number period.
impl<T> RateLimiter<T> for AccountData<T::Balance, BlockNumberFor<T>>
A rate limiter implementation for managing transaction limits and data size constraints based on a specified block number period.
This implementation limits the number of transactions and the total size of transactions that can be processed within a given period. The rate limiter checks whether the rate limit has been exceeded, and updates the rate statistics accordingly.
Source§fn is_allowed(&self, b: BlockNumberFor<T>, len: u32) -> bool
fn is_allowed(&self, b: BlockNumberFor<T>, len: u32) -> bool
Source§fn update_rate(&mut self, b: BlockNumberFor<T>, len: u32)
fn update_rate(&mut self, b: BlockNumberFor<T>, len: u32)
Updates the rate limiter’s internal statistics, such as the number of transactions and the total data size for the current period, based on the current block number and transaction size.
§Arguments
b- The current block number.len- The size of the transaction in bytes.
This method will reset the transaction count and size if the current block number exceeds the specified period. Otherwise, it will update the transaction count and size based on the new transaction.
impl<Balance: PartialEq, BlockNumber: PartialEq> StructuralPartialEq for AccountData<Balance, BlockNumber>
Source§impl<Balance, BlockNumber> TypeInfo for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> TypeInfo for AccountData<Balance, BlockNumber>
Auto Trait Implementations§
impl<Balance, BlockNumber> Freeze for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> RefUnwindSafe for AccountData<Balance, BlockNumber>where
Balance: RefUnwindSafe,
BlockNumber: RefUnwindSafe,
impl<Balance, BlockNumber> Send for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> Sync for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> Unpin for AccountData<Balance, BlockNumber>
impl<Balance, BlockNumber> UnsafeUnpin for AccountData<Balance, BlockNumber>where
Balance: UnsafeUnpin,
BlockNumber: UnsafeUnpin,
impl<Balance, BlockNumber> UnwindSafe for AccountData<Balance, BlockNumber>where
Balance: UnwindSafe,
BlockNumber: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S> Codec for S
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> EncodeLike<&&T> for Twhere
T: Encode,
impl<T> EncodeLike<&T> for Twhere
T: Encode,
impl<T> EncodeLike<&mut T> for Twhere
T: Encode,
impl<T> EncodeLike<Arc<T>> for Twhere
T: Encode,
impl<T> EncodeLike<Box<T>> for Twhere
T: Encode,
impl<T> EncodeLike<Cow<'_, T>> for T
impl<T> EncodeLike<Rc<T>> for Twhere
T: Encode,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<S> FullCodec for Swhere
S: Decode + FullEncode,
impl<S> FullEncode for Swhere
S: Encode + EncodeLike,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
impl<T> JsonSchemaMaybe for T
impl<T> MaybeDebug for Twhere
T: Debug,
impl<T> MaybeRefUnwindSafe for Twhere
T: RefUnwindSafe,
impl<T> Member for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read moreimpl<T> StaticTypeInfo for Twhere
T: TypeInfo + 'static,
Source§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.