Skip to main content

AtomicCtx

Struct AtomicCtx 

Source
pub struct AtomicCtx<'a> { /* private fields */ }
Expand description

Handle passed to the atomic closure body. Methods mirror the equivalent Store ops but operate on the already-held write lock, so reads inside the block see the closure’s own writes.

Implementations§

Source§

impl AtomicCtx<'_>

Source

pub fn set(&mut self, key: &[u8], value: &[u8]) -> bool

SET key value. Returns true (SET always succeeds without NX/XX veto).

Source

pub fn get(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>

GET key.

Source

pub fn incr(&mut self, key: &[u8]) -> Result<i64>

INCR key — by 1.

Source

pub fn incr_by(&mut self, key: &[u8], delta: i64) -> Result<i64>

INCRBY key delta.

Source

pub fn hset(&mut self, key: &[u8], pairs: &[(&[u8], &[u8])]) -> Result<usize>

HSET key field value.

Source

pub fn hget(&mut self, key: &[u8], field: &[u8]) -> Result<Option<Vec<u8>>>

HGET key field.

Source

pub fn hincrby(&mut self, key: &[u8], field: &[u8], delta: i64) -> Result<i64>

HINCRBY key field delta.

Source

pub fn zadd(&mut self, key: &[u8], pairs: &[(f64, &[u8])]) -> Result<usize>

ZADD key score member.

Source

pub fn zincrby(&mut self, key: &[u8], delta: f64, member: &[u8]) -> Result<f64>

ZINCRBY key delta member.

Source

pub fn zscore(&mut self, key: &[u8], member: &[u8]) -> Result<Option<f64>>

ZSCORE key member.

Source

pub fn del(&mut self, keys: &[&[u8]]) -> usize

DEL key [key ...] — every key must hash to this shard.

Source

pub fn exists(&mut self, keys: &[&[u8]]) -> usize

EXISTS key [key ...] — count of the given keys that exist.

Source

pub fn hdel(&mut self, key: &[u8], fields: &[&[u8]]) -> Result<usize>

HDEL key field [field ...].

Source

pub fn hgetall(&mut self, key: &[u8]) -> Result<Vec<(Vec<u8>, Vec<u8>)>>

HGETALL key(field, value) pairs; reads see the closure’s own prior writes.

Source

pub fn hmget( &mut self, key: &[u8], fields: &[&[u8]], ) -> Result<Vec<Option<Vec<u8>>>>

HMGET key field [field ...]None per absent field.

Source

pub fn hexists(&mut self, key: &[u8], field: &[u8]) -> Result<bool>

HEXISTS key field.

Source

pub fn sadd(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>

SADD key member [member ...].

Source

pub fn srem(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>

SREM key member [member ...].

Source

pub fn lpush(&mut self, key: &[u8], values: &[&[u8]]) -> Result<usize>

LPUSH key value [value ...] — returns the new list length.

Source

pub fn rpush(&mut self, key: &[u8], values: &[&[u8]]) -> Result<usize>

RPUSH key value [value ...] — returns the new list length.

Source

pub fn zrem(&mut self, key: &[u8], members: &[&[u8]]) -> Result<usize>

ZREM key member [member ...].

Source

pub fn zcard(&mut self, key: &[u8]) -> Result<usize>

ZCARD key — member count; 0 when absent.

Source

pub fn zadd_flags( &mut self, key: &[u8], pairs: &[(f64, &[u8])], flags: ZaddFlags, ) -> Result<ZaddReport>

Flags-aware ZADD (v2.1). AOF logs the applied pairs as plain ZADD — the effect, never the condition (deterministic replay).

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for AtomicCtx<'a>

§

impl<'a> Freeze for AtomicCtx<'a>

§

impl<'a> RefUnwindSafe for AtomicCtx<'a>

§

impl<'a> Send for AtomicCtx<'a>

§

impl<'a> Sync for AtomicCtx<'a>

§

impl<'a> Unpin for AtomicCtx<'a>

§

impl<'a> UnsafeUnpin for AtomicCtx<'a>

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> 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, 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.