server/modules/selva/module/subscriptions.c
void SelvaSubscriptions_DeferMissingAccessorEvents(struct SelvaModify_Hierarchy *hierarchy, const char *id_str, size_t id_len) {
    struct SelvaSubscriptions_DeferredEvents *def = &hierarchy->subs.deferred_events;
    struct Selva_Subscription *sub;
    SelvaObject_Iterator *it;
    struct SelvaObject *obj;
    int err;

    if (SelvaObject_ExistsStr(hierarchy->subs.missing, id_str, id_len)) {
        return;
    }

    /* Get the <id> object containing a number of subscription pointers for this id. */
    err = SelvaObject_GetObjectStr(hierarchy->subs.missing, id_str, id_len, &obj);
    if (err) {
        fprintf(stderr, "%s:%d: Failed to get missing accessor marker: %s",
                __FILE__, __LINE__,
                getSelvaErrorStr(err));
        return;
    }

    /* Defer event for each subscription. */
    it = SelvaObject_ForeachBegin(obj);
    while ((sub = SelvaObject_ForeachValue(obj, &it, NULL, SELVA_OBJECT_POINTER))) {
        /*
         * These are a bit special because we have no marker structs but the
         * markers are pointers to the subscription in a SelvaObject.
         * The event type is an update.
         */
        SVector_InsertFast(&def->updates, sub);
    }

    /* Finally delete the ID as all events were deferred. */
    SelvaObject_DelKeyStr(obj, id_str, id_len);
}
/**
 * Defer events for missing accessor signaling creation of nodes and aliases.
 * @param id nodeId or alias.
 */
Defer events for missing accessor signaling creation of nodes and aliases.
@param id nodeId or alias.
Defer events for missing accessor signaling creation of nodes and aliases . @param id nodeId or alias .
void SelvaSubscriptions_DeferMissingAccessorEvents(struct SelvaModify_Hierarchy *hierarchy, const char *id_str, size_t id_len) {
    struct SelvaSubscriptions_DeferredEvents *def = &hierarchy->subs.deferred_events;
    struct Selva_Subscription *sub;
    SelvaObject_Iterator *it;
    struct SelvaObject *obj;
    int err;
    if (SelvaObject_ExistsStr(hierarchy->subs.missing, id_str, id_len)) {
        return;
    }
    err = SelvaObject_GetObjectStr(hierarchy->subs.missing, id_str, id_len, &obj);
    if (err) {
        fprintf(stderr, "%s:%d: Failed to get missing accessor marker: %s",
                __FILE__, __LINE__,
                getSelvaErrorStr(err));
        return;
    }
    it = SelvaObject_ForeachBegin(obj);
    while ((sub = SelvaObject_ForeachValue(obj, &it, NULL, SELVA_OBJECT_POINTER))) {
        SVector_InsertFast(&def->updates, sub);
    }
    SelvaObject_DelKeyStr(obj, id_str, id_len);
}
void SelvaSubscriptions_DeferMissingAccessorEvents ( struct SelvaModify_Hierarchy * hierarchy , const char * id_str , size_t id_len ) { struct SelvaSubscriptions_DeferredEvents * def = & hierarchy -> subs . deferred_events ; struct Selva_Subscription * sub ; SelvaObject_Iterator * it ; struct SelvaObject * obj ; int err ; if ( SelvaObject_ExistsStr ( hierarchy -> subs . missing , id_str , id_len ) ) { return ; } err = SelvaObject_GetObjectStr ( hierarchy -> subs . missing , id_str , id_len , & obj ) ; if ( err ) { fprintf ( stderr , " " , __FILE__ , __LINE__ , getSelvaErrorStr ( err ) ) ; return ; } it = SelvaObject_ForeachBegin ( obj ) ; while ( ( sub = SelvaObject_ForeachValue ( obj , & it , NULL , SELVA_OBJECT_POINTER ) ) ) { SVector_InsertFast ( & def -> updates , sub ) ; } SelvaObject_DelKeyStr ( obj , id_str , id_len ) ; }
Defer events for missing accessor signaling creation of nodes and aliases.
Defer events for missing accessor signaling creation of nodes and aliases .
/* Get the <id> object containing a number of subscription pointers for this id. */ /* Defer event for each subscription. */ /*
         * These are a bit special because we have no marker structs but the
         * markers are pointers to the subscription in a SelvaObject.
         * The event type is an update.
         */ /* Finally delete the ID as all events were deferred. */