-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshared.py
More file actions
74 lines (60 loc) · 1.45 KB
/
shared.py
File metadata and controls
74 lines (60 loc) · 1.45 KB
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
# constants.py
from enum import Enum
class message(Enum):
"""
Used To Unify the type of message being sent
"""
SERVER_INIT = 1
SERVER_KILL = 2
PREPARE = 3
PROMISE = 4
LEADER_FORWARD = 5
LEADER_ACK = 6
ACCEPT = 7
ACCEPTED = 8
DECIDE = 9
LLM_RESPONSE = 10
# Used to update context and op_num
UPDATE_CONTEXT = 11
NETWORK_SERVER_PORT = 9000
MAX_SERVER_NUM = 3
DELAY = 3
TIMEOUT_TIME = DELAY * 3
"""
JSON Format:
message_data
"dest_server": int
"sending_server": int
"message_type": int
"args":
if SERVER_INIT:
"server_num": int
if SERVER_KILL:
if PREPARE:
"ballot_number": dictionary
if PROMISE:
"ballot_number": dictionary
"accept_val": string or -1
"accept_num": dict or -1
if LEADER_FORWARD:
"user_message": string
if LEADER_ACK:
"user_message": string
if ACCEPT:
"ballot_number": dictionary
"accept_val": string
"accept_num": dict
if ACCEPTED:
"ballot_number": dictionary
"accept_val": string
if DECIDE:
"accept_val": string
if LLM_RESPONSE:
"context_id": int
"query_string": string
"response":d string
if UPDATE_CONTEXT:
"context": KeyValue
"op_num": int
"leader": int
"""