faust.serializers.registry
¶
Registry of supported codecs (serializers, compressors, etc.).
-
class
faust.serializers.registry.
Registry
(key_serializer: Union[faust.types.codecs.CodecT, str, NoneType] = None, value_serializer: Union[faust.types.codecs.CodecT, str, NoneType] = 'json') → None[source]¶ Serializing message keys/values.
Parameters: -
loads_key
(typ: Union[typing.Type[faust.types.models.ModelT], typing.Type[bytes], typing.Type[str], NoneType], key: Union[bytes, NoneType], *, serializer: Union[faust.types.codecs.CodecT, str, NoneType] = None) → Union[bytes, faust.types.core.ModelT, typing.Any, NoneType][source]¶ Deserialize message key.
Parameters: Return type:
-
loads_value
(typ: Union[typing.Type[faust.types.models.ModelT], typing.Type[bytes], typing.Type[str], NoneType], value: Union[bytes, NoneType], *, serializer: Union[faust.types.codecs.CodecT, str, NoneType] = None) → Any[source]¶ Deserialize value.
Parameters: Return type:
-
dumps_key
(typ: Union[typing.Type[faust.types.models.ModelT], typing.Type[bytes], typing.Type[str], NoneType], key: Union[bytes, faust.types.core.ModelT, typing.Any, NoneType], *, serializer: Union[faust.types.codecs.CodecT, str, NoneType] = None, skip: Tuple[Type, ...] = (<class 'bytes'>,)) → Union[bytes, NoneType][source]¶ Serialize key.
Parameters: - typ (
Union
[Type
[ModelT
],Type
[bytes
],Type
[str
],None
]) – Model hint (can also be str/bytes). When typ=str or bytes, raw serializer is assumed. - key (
Union
[bytes
,ModelT
,Any
,None
]) – The key value to serializer. - serializer (
Union
[CodecT
,str
,None
]) – Codec to use for this key, if it is not a model type. If not set the default will be used (key_serializer
).
Return type: - typ (
-
dumps_value
(typ: Union[typing.Type[faust.types.models.ModelT], typing.Type[bytes], typing.Type[str], NoneType], value: Union[bytes, faust.types.core.ModelT, typing.Any], *, serializer: Union[faust.types.codecs.CodecT, str, NoneType] = None, skip: Tuple[Type, ...] = (<class 'bytes'>,)) → Union[bytes, NoneType][source]¶ Serialize value.
Parameters: - typ (
Union
[Type
[ModelT
],Type
[bytes
],Type
[str
],None
]) – Model hint (can also be str/bytes). When typ=str or bytes, raw serializer is assumed. - key – The value to serializer.
- serializer (
Union
[CodecT
,str
,None
]) – Codec to use for this value, if it is not a model type. If not set the default will be used (value_serializer
).
Return type: - typ (
-