server/modules/selva/module/hierarchy_reply.c
static int send_hierarchy_field_NodeCb(struct SelvaModify_HierarchyNode *node, void *arg) {
    Selva_NodeId nodeId;
    struct send_hierarchy_field_data *args = (struct send_hierarchy_field_data *)arg;
    int match = 0;

    SelvaHierarchy_GetNodeId(nodeId, node);

    /*
     * Some traversal modes must skip the first entry.
     */
    if (unlikely(args->skip)) {
        args->skip = 0;
        return 0;
    }

    for (size_t i = 0; i < args->nr_types; i++) {
        match |= memcmp(args->types[i], nodeId, SELVA_NODE_TYPE_SIZE) == 0;
    }
    if (!match && args->nr_types > 0) {
        /*
         * This node type is not accepted.
         */
        return 0;
    }

    RedisModule_ReplyWithStringBuffer(args->ctx, nodeId, Selva_NodeIdLen(nodeId));
    args->len++;

    return 0;
}
/*
 * Used for ancestors, children, descendants, parents
 */
Used for ancestors, children, descendants, parents
Used for ancestors children descendants parents
static int send_hierarchy_field_NodeCb(struct SelvaModify_HierarchyNode *node, void *arg) {
    Selva_NodeId nodeId;
    struct send_hierarchy_field_data *args = (struct send_hierarchy_field_data *)arg;
    int match = 0;
    SelvaHierarchy_GetNodeId(nodeId, node);
    if (unlikely(args->skip)) {
        args->skip = 0;
        return 0;
    }
    for (size_t i = 0; i < args->nr_types; i++) {
        match |= memcmp(args->types[i], nodeId, SELVA_NODE_TYPE_SIZE) == 0;
    }
    if (!match && args->nr_types > 0) {
        return 0;
    }
    RedisModule_ReplyWithStringBuffer(args->ctx, nodeId, Selva_NodeIdLen(nodeId));
    args->len++;
    return 0;
}
static int send_hierarchy_field_NodeCb ( struct SelvaModify_HierarchyNode * node , void * arg ) { Selva_NodeId nodeId ; struct send_hierarchy_field_data * args = ( struct send_hierarchy_field_data * ) arg ; int match = 0 ; SelvaHierarchy_GetNodeId ( nodeId , node ) ; if ( unlikely ( args -> skip ) ) { args -> skip = 0 ; return 0 ; } for ( size_t i = 0 ; i < args -> nr_types ; i ++ ) { match |= memcmp ( args -> types [ i ] , nodeId , SELVA_NODE_TYPE_SIZE ) == 0 ; } if ( ! match && args -> nr_types > 0 ) { return 0 ; } RedisModule_ReplyWithStringBuffer ( args -> ctx , nodeId , Selva_NodeIdLen ( nodeId ) ) ; args -> len ++ ; return 0 ; }
Used for ancestors, children, descendants, parents
Used for ancestors children descendants parents
/*
     * Some traversal modes must skip the first entry.
     */ /*
         * This node type is not accepted.
         */