def __init__(self, buffer): self._buffer = buffer self._buffer_size = buffer.getbuffer().nbytes self._unpacker = msgpack.Unpacker(self._buffer, **UNPACK_ARGS) self._version = self._read_next() self._tables = {} # Keys and Values may have custom serialisers. # Store most as raw bytes, only decode a few which we know are msgpack. self._msgpacked_tables = {"ccf.member_certs", "ccf.governance.history"} self._read()
def __init__(self, buffer: io.BytesIO): self._buffer = buffer self._buffer_size = buffer.getbuffer().nbytes self._unpacker = msgpack.Unpacker(self._buffer, **UNPACK_ARGS) self._is_snapshot = self._read_next() self._version = self._read_next() self._max_conflict_version = self._read_next() self._tables = {} # Keys and Values may have custom serialisers. # Store most as raw bytes, only decode a few which we know are msgpack and are required for ledger verification. self._msgpacked_tables = { SIGNATURE_TX_TABLE_NAME, NODES_TABLE_NAME, } self._read()
def __init__(self, buffer: io.BytesIO): self._buffer = buffer self._buffer_size = buffer.getbuffer().nbytes self._unpacker = msgpack.Unpacker(self._buffer, **UNPACK_ARGS) self._is_snapshot = self._read_next() self._version = self._read_next() self._tables = {} # Keys and Values may have custom serialisers. # Store most as raw bytes, only decode a few which we know are msgpack. self._msgpacked_tables = { "public:ccf.gov.member_cert_ders", "public:ccf.gov.governance.history", "public:ccf.gov.signatures", "public:ccf.gov.nodes", } self._read()