MCPcopy Create free account
hub / github.com/corosync/corosync / stats_map_notify_fn

Function stats_map_notify_fn

exec/stats.c:599–635  ·  view source on GitHub ↗

Callback from libqb when a key is added/removed */

Source from the content-addressed store, hash-verified

597
598/* Callback from libqb when a key is added/removed */
599static void stats_map_notify_fn(uint32_t event, char *key, void *old_value, void *value, void *user_data)
600{
601 struct cs_stats_tracker *tracker = user_data;
602 struct icmap_notify_value new_val;
603 struct icmap_notify_value old_val;
604 char new_value[64];
605
606 if (value == NULL && old_value == NULL) {
607 return ;
608 }
609
610 /* Ignore schedmiss trackers as the values are read from the circular buffer */
611 if (strncmp(key, SCHEDMISS_PREFIX, strlen(SCHEDMISS_PREFIX)) == 0 ) {
612 return ;
613 }
614
615 new_val.data = new_value;
616 if (stats_map_get(key,
617 &new_value,
618 &new_val.len,
619 &new_val.type) != CS_OK) {
620 log_printf(LOGSYS_LEVEL_WARNING, "get value of notified key %s failed", key);
621 return ;
622 }
623
624 /* We don't know what the old value was
625 but as this only tracks ADD & DELETE I'm not worried
626 about it */
627 memcpy(&old_val, &new_val, sizeof(new_val));
628
629 tracker->notify_fn(icmap_qbtt_to_tt(event),
630 key,
631 new_val,
632 old_val,
633 tracker->user_data);
634
635}
636
637cs_error_t stats_map_track_add(const char *key_name,
638 int32_t track_type,

Callers

nothing calls this directly

Calls 2

stats_map_getFunction · 0.85
icmap_qbtt_to_ttFunction · 0.85

Tested by

no test coverage detected