Skip to content

VersionedDecoder

Registry mapping a serialization version to the decoder for that version's on-disk shape.

Each registered decoder fully decodes its own version's shape straight to the final, current-codebase Python value -- there is no chaining between versions here (contrast IMPORT_LOCATION_CHANGES_BY_VERSION, which does chain, since a class's import location can move again in a later version; a given version's on-disk shape never does). Encode never needs this: it always writes the current SERIALIZATION_VERSION's shape, never an old one.

VersionedDecoder

VersionedDecoder(name: str)

alias

alias(version: int, same_as: int) -> None

Register version to reuse the decoder already registered for same_as.


register

register(version: int)

Decorator registering fn as the decoder for version.