pub enum AofRecord {
Show 31 variants
Set {
key: String,
value: Bytes,
expire_ms: i64,
},
Del {
key: String,
},
Expire {
key: String,
seconds: u64,
},
LPush {
key: String,
values: Vec<Bytes>,
},
RPush {
key: String,
values: Vec<Bytes>,
},
LPop {
key: String,
},
RPop {
key: String,
},
LSet {
key: String,
index: i64,
value: Bytes,
},
LTrim {
key: String,
start: i64,
stop: i64,
},
LInsert {
key: String,
before: bool,
pivot: Bytes,
value: Bytes,
},
LRem {
key: String,
count: i64,
value: Bytes,
},
ZAdd {
key: String,
members: Vec<(f64, String)>,
},
ZRem {
key: String,
members: Vec<String>,
},
Persist {
key: String,
},
Pexpire {
key: String,
milliseconds: u64,
},
Pexpireat {
key: String,
timestamp_ms: u64,
},
Incr {
key: String,
},
Decr {
key: String,
},
HSet {
key: String,
fields: Vec<(String, Bytes)>,
},
HDel {
key: String,
fields: Vec<String>,
},
HIncrBy {
key: String,
field: String,
delta: i64,
},
SAdd {
key: String,
members: Vec<String>,
},
SRem {
key: String,
members: Vec<String>,
},
IncrBy {
key: String,
delta: i64,
},
DecrBy {
key: String,
delta: i64,
},
Append {
key: String,
value: Bytes,
},
SetRange {
key: String,
offset: usize,
value: Bytes,
},
SetBit {
key: String,
offset: u64,
value: u8,
},
BitOp {
op: u8,
dest: String,
keys: Vec<String>,
},
Rename {
key: String,
newkey: String,
},
Copy {
source: String,
destination: String,
replace: bool,
},
}Expand description
A single mutation record stored in the AOF.
Variants§
Set
SET key value [expire_ms]. expire_ms is -1 for no expiration.
Del
DEL key.
Expire
EXPIRE key seconds.
LPush
LPUSH key value [value …].
RPush
RPUSH key value [value …].
LPop
LPOP key.
RPop
RPOP key.
LSet
LSET key index element.
LTrim
LTRIM key start stop.
LInsert
LINSERT key BEFORE|AFTER pivot element.
LRem
LREM key count element.
ZAdd
ZADD key score member [score member …].
ZRem
ZREM key member [member …].
Persist
PERSIST key — remove expiration.
Pexpire
PEXPIRE key milliseconds.
Pexpireat
PEXPIREAT key timestamp-ms — set expiry at an absolute Unix timestamp (ms).
Used to persist EXPIREAT and PEXPIREAT commands so that after recovery the expiry deadline is the same absolute point in time rather than being re-anchored to the moment of replay.
Incr
INCR key.
Decr
DECR key.
HSet
HSET key field value [field value …].
HDel
HDEL key field [field …].
HIncrBy
HINCRBY key field delta.
SAdd
SADD key member [member …].
SRem
SREM key member [member …].
IncrBy
INCRBY key delta.
DecrBy
DECRBY key delta.
Append
APPEND key value.
SetRange
SETRANGE key offset value.
SetBit
SETBIT key offset value. Replays the bit mutation verbatim.
BitOp
BITOP op destkey key [key …]. Replays the bitwise operation.
op is stored as a raw byte: 0=AND, 1=OR, 2=XOR, 3=NOT.
Rename
RENAME key newkey.
Copy
COPY source destination [REPLACE].
Implementations§
Source§impl AofRecord
impl AofRecord
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>, FormatError>
pub fn to_bytes(&self) -> Result<Vec<u8>, FormatError>
Serializes this record into a byte vector (tag + payload, no CRC).
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, FormatError>
pub fn from_bytes(data: &[u8]) -> Result<Self, FormatError>
Deserializes a record from its binary payload (tag byte + fields, no CRC).
The format is the same as to_bytes(). CRC validation is the caller’s
responsibility (done by the AOF recovery reader before this is called).