static GError * __notify_services(struct meta1_backend_s *m1, struct sqlx_sqlite3_s *sq3, struct oio_url_s *url) { if (!m1->notifier) return NULL; struct meta1_service_url_s **services = NULL; GError *err = __get_container_all_services(sq3, url, NULL, &services); if (!err) { struct meta1_service_url_s **services2 = expand_urlv(services); GString *notif = oio_event__create ("account.services", url); g_string_append (notif, ",\"data\":["); if (services2) { for (struct meta1_service_url_s **svc = services2; *svc ; svc++) { if (svc != services2) // not at the beginning g_string_append(notif, ","); meta1_service_url_encode_json(notif, *svc); } } g_string_append(notif, "]}"); oio_events_queue__send (m1->notifier, g_string_free(notif, FALSE)); meta1_service_url_cleanv(services2); meta1_service_url_cleanv(services); } return err; }
GError * rawx_event_send (const char *event_type, GString *data_json) { EXTRA_ASSERT(q != NULL); GString *json = oio_event__create (event_type, NULL); g_string_append_printf(json, ",\"data\":%.*s}", (int) data_json->len, data_json->str); g_string_free (data_json, TRUE); oio_events_queue__send (q, g_string_free (json, FALSE)); return NULL; }
static void _notify_beans (struct meta2_backend_s *m2b, struct oio_url_s *url, GSList *beans, const char *name) { void forward (GSList *list_of_beans) { gchar tmp[256]; g_snprintf (tmp, sizeof(tmp), "%s.%s", META2_EVENTS_PREFIX, name); GString *gs = oio_event__create (tmp, url); g_string_append (gs, ",\"data\":["); meta2_json_dump_all_xbeans (gs, list_of_beans); g_string_append (gs, "]}"); oio_events_queue__send (m2b->notifier, g_string_free (gs, FALSE)); }