BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
tracks changes to the state and allows changes to be undone More...
#include <undo_database.hpp>
Classes | |
class | session |
Public Member Functions | |
undo_database (object_database &db) | |
void | disable () |
void | enable () |
bool | enabled () const |
session | start_undo_session (bool force_enable=false) |
void | on_create (const object &obj) |
void | on_modify (const object &obj) |
void | on_remove (const object &obj) |
void | pop_commit () |
std::size_t | size () const |
void | set_max_size (size_t new_max_size) |
size_t | max_size () const |
uint32_t | active_sessions () const |
const undo_state & | head () const |
tracks changes to the state and allows changes to be undone
Definition at line 47 of file undo_database.hpp.
|
inlineexplicit |
Definition at line 50 of file undo_database.hpp.
|
inline |
Definition at line 123 of file undo_database.hpp.
void graphene::db::undo_database::disable | ( | ) |
Definition at line 31 of file undo_database.cpp.
void graphene::db::undo_database::enable | ( | ) |
Definition at line 30 of file undo_database.cpp.
|
inline |
Definition at line 87 of file undo_database.hpp.
const undo_state & graphene::db::undo_database::head | ( | ) | const |
Definition at line 301 of file undo_database.cpp.
|
inline |
Definition at line 122 of file undo_database.hpp.
void graphene::db::undo_database::on_create | ( | const object & | obj | ) |
This should be called just after an object is created
Definition at line 60 of file undo_database.cpp.
void graphene::db::undo_database::on_modify | ( | const object & | obj | ) |
This should be called just before an object is modified
If it's a new object as of this undo state, its pre-modification value is not stored, because prior to this undo state, it did not exist. Any modifications in this undo state are irrelevant, as the object will simply be removed if we undo.
Definition at line 73 of file undo_database.cpp.
void graphene::db::undo_database::on_remove | ( | const object & | obj | ) |
This should be called just before an object is removed.
If it's a new object as of this undo state, its pre-removal value is not stored, because prior to this undo state, it did not exist. Now that it's been removed, it doesn't exist again, so nothing has happened. Instead, remove it from the list of newly created objects (which must be deleted if we undo), as we don't want to re-delete it if this state is undone.
Definition at line 86 of file undo_database.cpp.
void graphene::db::undo_database::pop_commit | ( | ) |
Removes the last committed session, note... this is dangerous if there are active sessions... thus active sessions should track
Definition at line 264 of file undo_database.cpp.
|
inline |
Definition at line 121 of file undo_database.hpp.
|
inline |
Definition at line 120 of file undo_database.hpp.
undo_database::session graphene::db::undo_database::start_undo_session | ( | bool | force_enable = false | ) |
Definition at line 46 of file undo_database.cpp.