split notifications (notify_changed_objects) in three signals: new_objects, changed_objects, removed_objects
This commit is contained in:
parent
823beb7fe5
commit
02b2672a39
2 changed files with 16 additions and 8 deletions
|
|
@ -549,17 +549,19 @@ void database::notify_changed_objects()
|
||||||
if( _undo_db.enabled() )
|
if( _undo_db.enabled() )
|
||||||
{
|
{
|
||||||
const auto& head_undo = _undo_db.head();
|
const auto& head_undo = _undo_db.head();
|
||||||
|
|
||||||
|
vector<object_id_type> new_ids; new_ids.reserve(head_undo.new_ids.size());
|
||||||
|
for( const auto& item : head_undo.new_ids ) new_ids.push_back(item);
|
||||||
|
|
||||||
vector<object_id_type> changed_ids; changed_ids.reserve(head_undo.old_values.size());
|
vector<object_id_type> changed_ids; changed_ids.reserve(head_undo.old_values.size());
|
||||||
for( const auto& item : head_undo.old_values ) changed_ids.push_back(item.first);
|
for( const auto& item : head_undo.old_values ) changed_ids.push_back(item.first);
|
||||||
for( const auto& item : head_undo.new_ids ) changed_ids.push_back(item);
|
|
||||||
vector<const object*> removed;
|
vector<const object*> removed; removed.reserve( head_undo.removed.size() );
|
||||||
removed.reserve( head_undo.removed.size() );
|
for( const auto& item : head_undo.removed ) removed.emplace_back( item.second.get() );
|
||||||
for( const auto& item : head_undo.removed )
|
|
||||||
{
|
new_objects(new_ids);
|
||||||
changed_ids.push_back( item.first );
|
|
||||||
removed.emplace_back( item.second.get() );
|
|
||||||
}
|
|
||||||
changed_objects(changed_ids);
|
changed_objects(changed_ids);
|
||||||
|
removed_objects(removed);
|
||||||
}
|
}
|
||||||
} FC_CAPTURE_AND_RETHROW() }
|
} FC_CAPTURE_AND_RETHROW() }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,12 @@ namespace graphene { namespace chain {
|
||||||
*/
|
*/
|
||||||
fc::signal<void(const signed_transaction&)> on_pending_transaction;
|
fc::signal<void(const signed_transaction&)> on_pending_transaction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitted After a block has been applied and committed. The callback
|
||||||
|
* should not yield and should execute quickly.
|
||||||
|
*/
|
||||||
|
fc::signal<void(const vector<object_id_type>&)> new_objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted After a block has been applied and committed. The callback
|
* Emitted After a block has been applied and committed. The callback
|
||||||
* should not yield and should execute quickly.
|
* should not yield and should execute quickly.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue