swh.journal.serializers module

swh.journal.serializers.object_key(object_type: str, object_: Union[swh.model.model.Content, swh.model.model.Directory, swh.model.model.Revision, swh.model.model.Release, swh.model.model.Snapshot]) → bytes[source]
swh.journal.serializers.object_key(object_type: str, object_: Union[swh.model.model.Origin, swh.model.model.SkippedContent]) → Dict[str, bytes]
swh.journal.serializers.object_key(object_type: str, object_: Union[swh.model.model.MetadataAuthority, swh.model.model.MetadataFetcher, swh.model.model.OriginVisit, swh.model.model.OriginVisitStatus, swh.model.model.RawExtrinsicMetadata]) → Dict[str, str]
swh.journal.serializers.stringify_key_item(k: str, v: Union[str, bytes]) → str[source]

Turn the item of a dict key into a string

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

Pretty-print a kafka key

swh.journal.serializers.key_to_kafka(key: Union[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) → Union[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.ensure_tuples(value: Any) → Any[source]