-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathprotocol.rs
59 lines (49 loc) · 1.08 KB
/
protocol.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use bitflags::bitflags;
pub mod mc;
pub mod redis;
pub trait IntoReply<R> {
fn into_reply(self) -> R;
}
impl<T> IntoReply<T> for T {
fn into_reply(self) -> T {
self
}
}
bitflags! {
pub struct CmdFlags: u8 {
const DONE = 0b00_000_001;
// redis cluster only
const ASK = 0b00_000_010;
const MOVED = 0b00_000_100;
// mc only
const NOREPLY = 0b00_001_000;
const QUIET = 0b00_010_000;
// retry
// const RETRY = 0b00100000;
const ERROR = 0b10_000_000;
}
}
#[derive(Clone, Debug, Copy, PartialEq, Eq)]
pub enum CmdType {
Read,
Write,
Ctrl,
NotSupport,
// for redis only
MSet, // Write
MGet, // Read
Exists, // Read
Eval, // Write
Del, // Write
Auth, // Auth
Info, // Read
ReadAll, // ReadAll
CountAll, // CountAll
Command, // Command
Client, // Client
Module, // Module
Scan, // Scan
Memory, // Memory
// Keys, // Read
// DbSize, // Read
}