libaster/
protocol.rs

1use bitflags::bitflags;
2
3pub mod mc;
4pub mod redis;
5
6pub trait IntoReply<R> {
7    fn into_reply(self) -> R;
8}
9
10impl<T> IntoReply<T> for T {
11    fn into_reply(self) -> T {
12        self
13    }
14}
15
16bitflags! {
17    pub struct CmdFlags: u8 {
18        const DONE     = 0b00000001;
19        // redis cluster only
20        const ASK      = 0b00000010;
21        const MOVED    = 0b00000100;
22        // mc only
23        const NOREPLY  = 0b00001000;
24        const QUIET    = 0b00010000;
25
26        // retry
27        const RETRY    = 0b00100000;
28
29        const ERROR    = 0b10000000;
30    }
31}
32
33#[derive(Clone, Debug, Copy, PartialEq, Eq)]
34pub enum CmdType {
35    Read,
36    Write,
37    Ctrl,
38    NotSupport,
39
40    // for redis only
41    MSet,   // Write
42    MGet,   // Read
43    Exists, // Read
44    Eval,   // Write
45    Del,    // Write
46}