platform: pass lookup instance to nmp_cache_dirty_set_all() instead of object-type

We already have NMPLookup to express a set of objects that can be looked
up via the multi-index.

Change the behavior of nmp_cache_dirty_set_all(), not to accept an
object-type. Instead, make it generally useful and accept a lookup
instance that is used to filter the elements that should be set as
dirty.
This commit is contained in:
Thomas Haller 2019-02-20 13:52:59 +01:00
parent d431de70ac
commit 40e0ff9fbf
3 changed files with 12 additions and 7 deletions

View file

@ -5205,9 +5205,13 @@ do_request_all_no_delayed_actions (NMPlatform *platform, DelayedActionType actio
action_type &= DELAYED_ACTION_TYPE_REFRESH_ALL;
FOR_EACH_DELAYED_ACTION (iflags, action_type) {
NMPLookup lookup;
priv->pruning[delayed_action_refresh_all_to_idx (iflags)] = TRUE;
nmp_lookup_init_obj_type (&lookup,
delayed_action_refresh_to_object_type (iflags));
nmp_cache_dirty_set_all (nm_platform_get_cache (platform),
delayed_action_refresh_to_object_type (iflags));
&lookup);
}
FOR_EACH_DELAYED_ACTION (iflags, action_type) {

View file

@ -2920,15 +2920,15 @@ nmp_cache_update_link_master_connected (NMPCache *cache,
/*****************************************************************************/
void
nmp_cache_dirty_set_all (NMPCache *cache, NMPObjectType obj_type)
nmp_cache_dirty_set_all (NMPCache *cache,
const NMPLookup *lookup)
{
NMPObject obj_needle;
nm_assert (cache);
nm_assert (lookup);
nm_dedup_multi_index_dirty_set_head (cache->multi_idx,
_idx_type_get (cache, NMP_CACHE_ID_TYPE_OBJECT_TYPE),
_nmp_object_stackinit_from_type (&obj_needle, obj_type));
_idx_type_get (cache, lookup->cache_id_type),
&lookup->selector_obj);
}
/*****************************************************************************/

View file

@ -771,7 +771,8 @@ NMPCacheOpsType nmp_cache_update_link_master_connected (NMPCache *cache,
const NMPObject **out_obj_old,
const NMPObject **out_obj_new);
void nmp_cache_dirty_set_all (NMPCache *cache, NMPObjectType obj_type);
void nmp_cache_dirty_set_all (NMPCache *cache,
const NMPLookup *lookup);
NMPCache *nmp_cache_new (NMDedupMultiIndex *multi_idx, gboolean use_udev);
void nmp_cache_free (NMPCache *cache);