Search in sources :

Example 1 with FindOperationsResults

use of build.buildfarm.operations.FindOperationsResults in project bazel-buildfarm by bazelbuild.

the class OperationsFinder method findOperations.

/**
 * @brief Finds operations based on search settings.
 * @details Operations can be found based on different search queries depending on the context a
 *     caller has or wants to filter on.
 * @param cluster An established redis cluster.
 * @param instance An instance is used to get additional information about the operation.
 * @param settings Settings on how to find and filter operations.
 * @return Results from searching for operations.
 * @note Suggested return identifier: results.
 */
public static FindOperationsResults findOperations(JedisCluster cluster, Instance instance, FindOperationsSettings settings) {
    FindOperationsResults results = new FindOperationsResults();
    results.operations = new HashMap<>();
    adjustFilter(settings);
    // JedisCluster only supports SCAN commands with MATCH patterns containing hash-tags.
    // This prevents us from using the cluster's SCAN to traverse all of the CAS.
    // That's why we choose to scan each of the jedisNode's individually.
    cluster.getClusterNodes().values().forEach(pool -> {
        try (Jedis node = pool.getResource()) {
            findOperationNode(cluster, node, instance, settings, results);
        }
    });
    return results;
}
Also used : Jedis(redis.clients.jedis.Jedis) FindOperationsResults(build.buildfarm.operations.FindOperationsResults)

Aggregations

FindOperationsResults (build.buildfarm.operations.FindOperationsResults)1 Jedis (redis.clients.jedis.Jedis)1