Skip to content

Commit

Permalink
tools/offline_log_viewer: added decode_adl_or_serde to dispatch decod…
Browse files Browse the repository at this point in the history
…ing functions
  • Loading branch information
andijcr authored and jcsp committed Dec 15, 2022
1 parent b492385 commit 37b76a1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/offline_log_viewer/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def decode_feature_update_action(r):
cmd['type_name'] = 'unknown'
return cmd


def decode_cluster_bootstrap_command(record):
def decode_user_and_credential(r):
user_cred = {}
Expand Down Expand Up @@ -201,6 +200,18 @@ def decode_user_and_credential(r):

return cmd

def decode_adl_or_serde(record, adl_fn, serde_fn):
rdr = Reader(BufferedReader(BytesIO(record.value)))
k_rdr = Reader(BytesIO(record.key))
either_adl_or_serde = rdr.peek_int8()
assert either_adl_or_serde >= -1, "unsupported serialization format"
if either_adl_or_serde == -1:
# serde encoding flag, consume it and proceed
rdr.skip(1)
return serde_fn(k_rdr, rdr)
else:
return adl_fn(k_rdr, rdr)


def decode_record(batch, record, bin_dump: bool):
ret = {}
Expand Down

0 comments on commit 37b76a1

Please sign in to comment.