distribuidos_tp1_protocols/
opcodes.rs

1pub type Opcode = u8;
2
3// Request opcode domain: [0, 128)
4
5pub const OP_TERMINATE: Opcode = 0;
6pub const OP_EVENT: Opcode = 1;
7pub const OP_QUERY: Opcode = 2;
8
9// Response opcode domain: [128, 256)
10
11// 2XX
12pub const OP_EVENT_RECEIVED: Opcode = 128;
13pub const OP_QUERY_RESPONSE: Opcode = 129;
14
15// 4XX
16pub const OP_INVALID_FORMAT: Opcode = 130;
17pub const OP_INVALID_RANGE: Opcode = 131;
18pub const OP_INVALID_AGGR_WINDOW: Opcode = 132;
19pub const OP_METRIC_NOT_FOUND: Opcode = 133;
20
21// 5XX
22pub const OP_SERVER_AT_CAPACITY: Opcode = 134;
23pub const OP_INTERNAL_SERVER_ERROR: Opcode = 135;
24
25// More
26
27// Query request
28pub const INCLUDES_RANGE: Opcode = 0;
29pub const DOES_NOT_INCLUDE_RANGE: Opcode = 1;
30pub const INCLUDES_AGGR_WINDOW: Opcode = 0;
31pub const DOES_NOT_INCLUDE_AGGR_WINDOW: Opcode = 1;
32
33// Query response
34pub const NONE: Opcode = 0;
35pub const SOME: Opcode = 1;
36pub const EOF: Opcode = 2;