Struct Quota

Source
struct Quota {
    leases: FnvHashMap<Rc<str>, Lease>,
    dim_count: FnvHashMap<Rc<str>, u64>,
    expiry_timeouts: BTreeSet<(NonZeroU64, Rc<str>)>,
}

Fields§

§leases: FnvHashMap<Rc<str>, Lease>§dim_count: FnvHashMap<Rc<str>, u64>§expiry_timeouts: BTreeSet<(NonZeroU64, Rc<str>)>

Implementations§

Source§

impl Quota

Source

fn rdb_load(rdb: &mut RdbLoadIo, version: i32) -> RedisResult<Self>

Source

fn rdb_save(&mut self, rdb: &mut RdbSaveIo)

Source

fn aof_rewrite( &mut self, aof: &mut AofRewriteIo, key: RedisString, ) -> RedisResult<()>

Source

fn mem_usage(&self) -> usize

Source§

impl Quota

Source

fn gc(&mut self, now_ts: NonZeroU64)

Source

fn expires_at(&self) -> Option<NonZeroU64>

Source

fn remove_lease(&mut self, id: &str) -> bool

Source

fn insert_lease(&mut self, lease: Lease)

Source

fn renew_lease( &mut self, id: &str, now: NonZeroU64, expires_at: Option<NonZeroU64>, ) -> bool

Trait Implementations§

Source§

impl AofRewrite<Tmp> for Quota

Source§

const FN: AofRewriteFn<Self> = {quota::Quota::aof_rewrite as for<'a, 'b> fn(&'a mut quota::Quota, &'b mut redis_module_ext::data_type::AofRewriteIo, redis_module::RedisString) -> std::result::Result<(), redis_module::RedisError>}

Source§

fn extern_fn() -> Option<unsafe extern "C" fn(*mut RedisModuleIO, *mut RedisModuleString, *mut c_void)>

Source§

impl Clone for Quota

Source§

fn clone(&self) -> Quota

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C> Decode<C> for Quota

Source§

fn decode<D: Decoder<Context = C>>(decoder: &mut D) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl DeepSizeOf for Quota

Source§

fn deep_size_of_children(&self, context: &mut Context) -> usize

Returns an estimation of the heap-managed storage of this object. This does not include the size of the object itself. Read more
Source§

fn deep_size_of(&self) -> usize

Returns an estimation of a total size of memory owned by the object, including heap-managed storage. Read more
Source§

impl Default for Quota

Source§

fn default() -> Quota

Returns the “default value” for a type. Read more
Source§

impl Encode for Quota

Source§

fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl MemUsage<Tmp> for Quota

Source§

const FN: MemUsageFn<Self> = {quota::Quota::mem_usage as for<'a> fn(&'a quota::Quota) -> usize}

Source§

fn extern_fn() -> Option<unsafe extern "C" fn(*const c_void) -> usize>

Source§

impl RdbLoad<Tmp> for Quota

Source§

const FN: RdbLoadFn<Self> = {quota::Quota::rdb_load as for<'a> fn(&'a mut redis_module_ext::data_type::RdbLoadIo, i32) -> std::result::Result<quota::Quota, redis_module::RedisError>}

Source§

fn extern_fn() -> Option<unsafe extern "C" fn(*mut RedisModuleIO, i32) -> *mut c_void>

Source§

impl RdbSave<Tmp> for Quota

Source§

const FN: RdbSaveFn<Self> = {quota::Quota::rdb_save as for<'a, 'b> fn(&'a mut quota::Quota, &'b mut redis_module_ext::data_type::RdbSaveIo)}

Source§

fn extern_fn() -> Option<unsafe extern "C" fn(*mut RedisModuleIO, *mut c_void)>

Source§

impl RedisDataType for Quota

Source§

const NAME: &'static str = "scufquota"

Source§

const VERSION: i32 = 0i32

Source§

fn module_methods(_: &Context) -> RedisModuleTypeMethods

Source§

#[doc(hidden)] fn register(ctx: &Context) -> Result<(), &'static str>

Source§

#[doc(hidden)] fn redis_ty(ptr: *mut RedisModuleType) -> Option<RedisType>

Auto Trait Implementations§

§

impl Freeze for Quota

§

impl RefUnwindSafe for Quota

§

impl !Send for Quota

§

impl !Sync for Quota

§

impl Unpin for Quota

§

impl UnwindSafe for Quota

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SizedTypeProperties for T

Source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
Source§

#[doc(hidden)] const LAYOUT: Layout = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)] const MAX_SLICE_LEN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
The largest safe length for a [Self]. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.