swh.journal.serializers module#

class swh.journal.serializers.MsgpackExtTypeCodes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

LONG_INT = 1#
LONG_NEG_INT = 2#
swh.journal.serializers.msgpack_ext_encode_types(obj)[source]#
swh.journal.serializers.msgpack_ext_hook(code, data)[source]#
swh.journal.serializers.decode_types_bw(obj)[source]#
swh.journal.serializers.stringify_key_item(k: str, v: str | bytes) str[source]#

Turn the item of a dict key into a string

swh.journal.serializers.pprint_key(key: Dict[str, str] | Dict[str, bytes] | bytes) str[source]#

Pretty-print a kafka key

swh.journal.serializers.key_to_kafka(key: Dict[str, str] | Dict[str, bytes] | bytes) bytes[source]#

Serialize a key, possibly a dict, in a predictable way

swh.journal.serializers.kafka_to_key(kafka_key: bytes) Dict[str, str] | Dict[str, bytes] | bytes[source]#

Deserialize a key

swh.journal.serializers.value_to_kafka(value: Any) bytes[source]#

Serialize some data for storage in kafka

swh.journal.serializers.kafka_to_value(kafka_value: bytes) Any[source]#

Deserialize some data stored in kafka

swh.journal.serializers.kafka_stream_to_value(file_like: BinaryIO) Unpacker[source]#

Return a deserializer for data stored in kafka