Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add versioning support to savable objects #6

Open
muhrin opened this issue Apr 1, 2020 · 0 comments
Open

Add versioning support to savable objects #6

muhrin opened this issue Apr 1, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@muhrin
Copy link
Owner

muhrin commented Apr 1, 2020

It would be good to have some support for versions of objects as users may change their classes or change the way that they store the state in the database.

The proposition is as follows:

  1. Add a VERSION class attribute to SavableObject and TypeHelper that is expected to be an integer >= 0
  2. Encourage users to add a special _version key to their saved state dictionary (if it's not a dict they will have to 'promote' it to one and store the current value within)

Now, when a user gets a state dict in load_instance_state they can interrogate the _version value and have logic that handles the various versions. If they absoloutely cannot handle the version they've been given they can raise a new UnsupportedVersion exception and provide an explanation to the user. This should be discouraged as it's effectively the end of the road for getting the data to be read.

@muhrin muhrin added the enhancement New feature or request label Apr 1, 2020
@muhrin muhrin self-assigned this Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant