server/modules/selva/module/subscriptions.c
void Selva_Subscriptions_DeferAliasChangeEvents(
        RedisModuleCtx *ctx,
        struct SelvaModify_Hierarchy *hierarchy,
        RedisModuleString *alias_name) {
    SVECTOR_AUTOFREE(wipe_subs);
    Selva_NodeId orig_node_id;
    struct SelvaModify_HierarchyMetadata *orig_metadata;
    int err;

    SVector_Init(&wipe_subs, 0, SelvaSubscription_svector_compare);

    err = SelvaResolve_NodeId(ctx, hierarchy, (RedisModuleString *[]){ alias_name }, 1, orig_node_id);
    if (err < 0) {
        return;
    }

    orig_metadata = SelvaHierarchy_GetNodeMetadata(hierarchy, orig_node_id);
    if (!orig_metadata) {
        fprintf(stderr, "%s:%d: Failed to get metadata for node: \"%.*s\"\n",
                __FILE__, __LINE__,
                (int)SELVA_NODE_ID_SIZE, orig_node_id);
        return;
    }

    /*
     * Alias markers are never detached so no need to handle those.
     */

    /* Defer events for markers on the src node. */
    defer_alias_change_events(
            ctx,
            hierarchy,
            &orig_metadata->sub_markers,
            orig_node_id,
            &wipe_subs);

    struct SVectorIterator it;
    struct Selva_Subscription *sub;

    /* Wipe all markers of the subscriptions that were hit. */
    SVector_ForeachBegin(&it, &wipe_subs);
    while ((sub = SVector_Foreach(&it))) {
        remove_sub_markers(ctx, hierarchy, sub);
    }
}
/**
 * Defer alias events and wipeout markers of the subscriptions hit.
 */
Defer alias events and wipeout markers of the subscriptions hit.
Defer alias events and wipeout markers of the subscriptions hit .
void Selva_Subscriptions_DeferAliasChangeEvents(
        RedisModuleCtx *ctx,
        struct SelvaModify_Hierarchy *hierarchy,
        RedisModuleString *alias_name) {
    SVECTOR_AUTOFREE(wipe_subs);
    Selva_NodeId orig_node_id;
    struct SelvaModify_HierarchyMetadata *orig_metadata;
    int err;
    SVector_Init(&wipe_subs, 0, SelvaSubscription_svector_compare);
    err = SelvaResolve_NodeId(ctx, hierarchy, (RedisModuleString *[]){ alias_name }, 1, orig_node_id);
    if (err < 0) {
        return;
    }
    orig_metadata = SelvaHierarchy_GetNodeMetadata(hierarchy, orig_node_id);
    if (!orig_metadata) {
        fprintf(stderr, "%s:%d: Failed to get metadata for node: \"%.*s\"\n",
                __FILE__, __LINE__,
                (int)SELVA_NODE_ID_SIZE, orig_node_id);
        return;
    }
    defer_alias_change_events(
            ctx,
            hierarchy,
            &orig_metadata->sub_markers,
            orig_node_id,
            &wipe_subs);
    struct SVectorIterator it;
    struct Selva_Subscription *sub;
    SVector_ForeachBegin(&it, &wipe_subs);
    while ((sub = SVector_Foreach(&it))) {
        remove_sub_markers(ctx, hierarchy, sub);
    }
}
void Selva_Subscriptions_DeferAliasChangeEvents ( RedisModuleCtx * ctx , struct SelvaModify_Hierarchy * hierarchy , RedisModuleString * alias_name ) { SVECTOR_AUTOFREE ( wipe_subs ) ; Selva_NodeId orig_node_id ; struct SelvaModify_HierarchyMetadata * orig_metadata ; int err ; SVector_Init ( & wipe_subs , 0 , SelvaSubscription_svector_compare ) ; err = SelvaResolve_NodeId ( ctx , hierarchy , ( RedisModuleString * [ ] ) { alias_name } , 1 , orig_node_id ) ; if ( err < 0 ) { return ; } orig_metadata = SelvaHierarchy_GetNodeMetadata ( hierarchy , orig_node_id ) ; if ( ! orig_metadata ) { fprintf ( stderr , " \" \" \n " , __FILE__ , __LINE__ , ( int ) SELVA_NODE_ID_SIZE , orig_node_id ) ; return ; } defer_alias_change_events ( ctx , hierarchy , & orig_metadata -> sub_markers , orig_node_id , & wipe_subs ) ; struct SVectorIterator it ; struct Selva_Subscription * sub ; SVector_ForeachBegin ( & it , & wipe_subs ) ; while ( ( sub = SVector_Foreach ( & it ) ) ) { remove_sub_markers ( ctx , hierarchy , sub ) ; } }
Defer alias events and wipeout markers of the subscriptions hit.
Defer alias events and wipeout markers of the subscriptions hit .
/*
     * Alias markers are never detached so no need to handle those.
     */ /* Defer events for markers on the src node. */ /* Wipe all markers of the subscriptions that were hit. */