Ejemplo n.º 1
0
range* rangefunc_has(range_request* rr, range** r)
{
    range* ret = range_new(rr);
    apr_pool_t* pool = range_request_pool(rr);
    const char** tag_names = range_get_hostnames(pool, r[0]);
    const char** tag_values = range_get_hostnames(pool, r[1]);

    const char* tag_name = tag_names[0];
    const char* tag_value = tag_values[0];

    const char** all_clusters = _all_clusters(rr);
    const char** cluster = all_clusters;
    int warn_enabled = range_request_warn_enabled(rr);

    if (!cluster) return ret;

    range_request_disable_warns(rr);
    while (*cluster) {
        range* vals = _expand_cluster(rr, *cluster, tag_name);
        if (set_get(vals->nodes, tag_value) != NULL) {
            range_add(ret, *cluster);
        }
        cluster++;
    }
    if (warn_enabled) range_request_enable_warns(rr);

    return ret;
}
Ejemplo n.º 2
0
range* rangefunc_allclusters(range_request* rr, range** r)
{
    range* ret = range_new(rr);

    const char** all_clusters = _all_clusters(rr);
    const char** cluster = all_clusters;
    int warn_enabled = range_request_warn_enabled(rr);

    if (!cluster) return ret;

    range_request_disable_warns(rr);
    while (*cluster) {
        range_add(ret, *cluster);
        cluster++;
    }
    if (warn_enabled) range_request_enable_warns(rr);

    return ret;
}