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

[core] Add snapshot mechanism for sad::db::Database #14

Closed
mamontov-cpp opened this issue Jul 9, 2015 · 2 comments
Closed

[core] Add snapshot mechanism for sad::db::Database #14

mamontov-cpp opened this issue Jul 9, 2015 · 2 comments
Milestone

Comments

@mamontov-cpp
Copy link
Owner

Let's consider the case, when game consists of multiple screens. If we consider one screen stored in database, we might modify screen, using database objects. But if we switch back from other screen, the screen
will remain modified. That could be solved, is user will reset database from simple snapshot.
However several conditions should be preserved:

  1. Existing objects must not be erased from database, only have their properties reset to a properties from snapshot (so the other components of a game may not re-query game objects from database).
  2. New objects must be erased from database.
  3. Removed objects must be recovered in database.
  4. m_max_id field must be set as we were loading stuff from database.
  5. Methods for loading must save snapshot, each time they were called.
  6. Methods like makeSnapshot, restoreFromSnapshot should be added.
@mamontov-cpp
Copy link
Owner Author

Snapshots can be stored as JSON values, since it's default format for storing polymorphic properties and supported in most of database objects.

@mamontov-cpp
Copy link
Owner Author

Implemented in master.

@mamontov-cpp mamontov-cpp added this to the 1.5.1 milestone Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant