feat: added opcodes for requests
This commit is contained in:
parent
e079dd8a5d
commit
4f2042fb52
@ -10,6 +10,7 @@ import os
|
||||
import pickle
|
||||
import re
|
||||
|
||||
|
||||
# patterns for command matchings
|
||||
# compiled for extra performance
|
||||
get_command_pattern: Pattern = re.compile(r"^get\s+[^\s]+$")
|
||||
@ -17,6 +18,13 @@ put_command_pattern: Pattern = re.compile(r"^put\s+[^\s]+$")
|
||||
summary_command_pattern: Pattern = re.compile(r"^summary\s+[^\s]+$")
|
||||
change_command_pattern: Pattern = re.compile(r"^change\s+[^\s]+\s+[^\s]+$")
|
||||
|
||||
# opcodes
|
||||
put_request_opcode = "000"
|
||||
get_request_opcode = "001"
|
||||
change_request_opcode = "010"
|
||||
summary_request_opcode = "011"
|
||||
help_requrest_opcode = "100"
|
||||
|
||||
# custome type to represent the hostname(server name) and the server port
|
||||
Address = Tuple[str, int]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user