Stateful#
- class openstef_core.mixins.Stateful[source]#
Bases:
objectMixin for objects that can save and restore their internal state.
Provides versioned serialization with automatic state migration. Objects can be pickled, saved to disk, transmitted over networks, or stored in databases, then restored to their previous state. Version tracking ensures backward compatibility when object structure changes.
Subclasses can override _migrate_state to handle state migrations between versions. Increment _VERSION when making incompatible changes to object structure.
- __getstate__() VersionedState[source]#
Serialize object state with version metadata.
- Return type:
VersionedState- Returns:
Versioned state dictionary containing version number, class name, and the object’s internal state.