forked from TrueCloudLab/frostfs-testcases
[#184]: verbs joined to keywords
Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
parent
d696a8ee68
commit
e086d0d62b
8 changed files with 211 additions and 224 deletions
|
@ -92,6 +92,30 @@ def decode_storage_group(data: dict):
|
|||
|
||||
return data
|
||||
|
||||
def decode_tombstone(data: dict):
|
||||
'''
|
||||
This function reencodes Tombstone header.
|
||||
'''
|
||||
try:
|
||||
data = decode_simple_header(data)
|
||||
data['header']['sessionToken'] = decode_session_token(
|
||||
data['header']['sessionToken'])
|
||||
except Exception as exc:
|
||||
raise ValueError(f"failed to decode JSON output: {exc}") from exc
|
||||
return data
|
||||
|
||||
|
||||
def decode_session_token(data: dict):
|
||||
'''
|
||||
This function reencodes a fragment of header which contains
|
||||
information about session token.
|
||||
'''
|
||||
data['body']['object']['address']['containerID'] = json_reencode(
|
||||
data['body']['object']['address']['containerID']['value'])
|
||||
data['body']['object']['address']['objectID'] = json_reencode(
|
||||
data['body']['object']['address']['objectID']['value'])
|
||||
return data
|
||||
|
||||
def json_reencode(data: str):
|
||||
'''
|
||||
According to JSON protocol, binary data (Object/Container/Storage Group IDs, etc)
|
||||
|
@ -103,6 +127,10 @@ def json_reencode(data: str):
|
|||
|
||||
|
||||
def encode_for_json(data: str):
|
||||
'''
|
||||
This function encodes binary data for sending them as protobuf
|
||||
structures.
|
||||
'''
|
||||
return base64.b64encode(base58.b58decode(data)).decode('utf-8')
|
||||
|
||||
def decode_common_fields(data: dict):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue