-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathprotocol.js
102 lines (97 loc) · 3.81 KB
/
protocol.js
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
exports.errors = {};
exports.errors[0x0000] = 'No error';
exports.errors[0x0001] = 'Key not found';
exports.errors[0x0002] = 'Key exists';
exports.errors[0x0003] = 'Value too large';
exports.errors[0x0004] = 'Invalid arguments';
exports.errors[0x0005] = 'Item not stored';
exports.errors[0x0006] = 'Incr/Decr on non-numeric value';
exports.errors[0x0007] = 'The vbucket belongs to another server';
exports.errors[0x0008] = 'Authentication error';
exports.errors[0x0009] = 'Authentication continue';
exports.errors[0x0081] = 'Unknown command';
exports.errors[0x0082] = 'Out of memory';
exports.errors[0x0083] = 'Not supported';
exports.errors[0x0084] = 'Internal error';
exports.errors[0x0085] = 'Busy';
exports.errors[0x0086] = 'Temporary failure';
var magic = {};
magic.BINARY_REQ = 0x80;
magic.BINARY_RES = 0x81;
exports.magic = magic;
var status = {};
status.SUCCESS = 0x00; // No error
status.KEY_ENOENT = 0x01; // Key not found
status.KEY_EEXISTS = 0x02; // Key exists
status.E2BIG = 0x03; // Value too large
status.EINVAL = 0x04; // Invalid arguments
status.NOT_STORED = 0x05; // Item not stored
status.DELTA_BADVAL = 0x06; // Incr/Decr on non-numeric value
status.AUTH_ERROR = 0x20; // Auth error
status.AUTH_CONTINUE = 0x21; // auth continue
status.UNKNOWN_COMMAND = 0x81; // Unknown command
status.ENOMEM = 0x82; // Out of memory
exports.status = status;
var opcode = {};
opcode.GET = 0x00;
opcode.SET = 0x01;
opcode.ADD = 0x02;
opcode.REPLACE = 0x03;
opcode.DELETE = 0x04;
opcode.INCREMENT = 0x05;
opcode.DECREMENT = 0x06;
opcode.QUIT = 0x07;
opcode.FLUSH = 0x08;
opcode.GETQ = 0x09;
opcode.NO_OP = 0x0a;
opcode.VERSION = 0x0b;
opcode.GETK = 0x0c;
opcode.GETKQ = 0x0d;
opcode.APPEND = 0x0e;
opcode.PREPEND = 0x0f;
opcode.STAT = 0x10;
opcode.SETQ = 0x11;
opcode.ADDQ = 0x12;
opcode.REPLACEQ = 0x13;
opcode.DELETEQ = 0x14;
opcode.INCREMENTQ = 0x15;
opcode.DECREMENTQ = 0x16;
opcode.QUITQ = 0x17;
opcode.FLUSHQ = 0x18;
opcode.APPENDQ = 0x19;
opcode.PREPENDQ = 0x1a;
opcode.VERBOSITY = 0x1b;
opcode.TOUCH = 0x1c;
opcode.GAT = 0x1d;
opcode.GATQ = 0x1e;
opcode.SASL_LIST_MECHS = 0x20;
opcode.SASL_AUTH = 0x21;
opcode.SASL_STEP = 0x22;
opcode.RGET = 0x30;
opcode.RSET = 0x31;
opcode.RSETQ = 0x32;
opcode.RAPPEND = 0x33;
opcode.RAPPENDQ = 0x34;
opcode.RPREPEND = 0x35;
opcode.RPREPENDQ = 0x36;
opcode.RDELETE = 0x37;
opcode.RDELETEQ = 0x38;
opcode.RINCR = 0x39;
opcode.RINCRQ = 0x3a;
opcode.RDECR = 0x3b;
opcode.RDECRQ = 0x3c;
opcode.SET_VBUCKET = 0x3d;
opcode.GET_VBUCKET = 0x3e;
opcode.DEL_VBUCKET = 0x3f;
opcode.TAP_CONNECT = 0x40;
opcode.TAP_MUTATION = 0x41;
opcode.TAP_DELETE = 0x42;
opcode.TAP_FlUSH = 0x43;
opcode.TAP_OPAQUE = 0x44;
opcode.TAP_VBUCKET_SET = 0x45;
opcode.TAP_CHECKPOINT_START = 0x46;
opcode.TAP_CHECKPOINT_END = 0x47;
exports.opcode = opcode;
var dataType = {};
dataType.BINARY_RAW_BYTES = 0x00;
exports.dataType = dataType;