platform: add nm_platform_refresh_all() API
Add a function that allows to re-request all objects of a certain type. Usually, the cache is supposed to keep itself in a consistent state and this function is not useful. It is however useful during testing and debugging to explicitly reload an object type. If you ever think to need this function in non-testing code, then something else is probably wrong with the cache implementation.
This commit is contained in:
@@ -4829,6 +4829,12 @@ link_refresh (NMPlatform *platform, int ifindex)
|
||||
return !!nm_platform_link_get_obj (platform, ifindex, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
refresh_all (NMPlatform *platform, NMPObjectType obj_type)
|
||||
{
|
||||
do_request_one_type (platform, obj_type);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
link_set_netns (NMPlatform *platform,
|
||||
int ifindex,
|
||||
@@ -7196,6 +7202,7 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
|
||||
platform_class->link_add = link_add;
|
||||
platform_class->link_delete = link_delete;
|
||||
|
||||
platform_class->refresh_all = refresh_all;
|
||||
platform_class->link_refresh = link_refresh;
|
||||
|
||||
platform_class->link_set_netns = link_set_netns;
|
||||
|
Reference in New Issue
Block a user