Skip to content

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

@mamontov-cpp

Description

@mamontov-cpp

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions