split notifications (notify_changed_objects) in three signals: new_objects, changed_objects, removed_objects

This commit is contained in:
elmato 2017-02-10 08:25:39 +00:00
parent 823beb7fe5
commit 02b2672a39
2 changed files with 16 additions and 8 deletions

View file

@ -549,17 +549,19 @@ void database::notify_changed_objects()
if( _undo_db.enabled() )
{
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());
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;
removed.reserve( head_undo.removed.size() );
for( const auto& item : head_undo.removed )
{
changed_ids.push_back( item.first );
removed.emplace_back( item.second.get() );
}
vector<const object*> removed; removed.reserve( head_undo.removed.size() );
for( const auto& item : head_undo.removed ) removed.emplace_back( item.second.get() );
new_objects(new_ids);
changed_objects(changed_ids);
removed_objects(removed);
}
} FC_CAPTURE_AND_RETHROW() }

View file

@ -189,6 +189,12 @@ namespace graphene { namespace chain {
*/
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
* should not yield and should execute quickly.