Serialize

Serializing shemes are often application-specific, and thus libraries often avoid imposing one. At the same time, it would be ideal if a variety of serializers were available and trivially pluggable into the data storage pattern through a simple interface.

The pickle protocol has established the pickle.loads() and pickle.dumps() serialization interface, which other serializers (like json) have adopted. This significantly simplifies things, but specific calls to serializers need to be added whenever inserting of extracting data with data storage libraries.

To flexibly solve this issue, datastore defines a datastore.SerializerShimDatastore which can be layered on top of any other datastore. As data is put, the serializer shim serializes it and put``s it into the underlying ``child_datastore. Correspondingly, on the way out (through get or query) the data is retrieved from the child_datastore and deserialized.

SerializerShimDatastore

datastore.serialize.shim

Serializers

The serializers that datastore.SerializerShimDatastore accepts must respond to the protocol outlined in datastore.serialize.Serializer (the pickle protocol).

serialize.Serializer

serialize.NonSerializer

serialize.prettyjson

serialize.Stack

serialize.map_serializer

Generators

Examples

TODO