Search in sources :

Example 1 with CasIndexResults

use of build.buildfarm.common.CasIndexResults in project bazel-buildfarm by bazelbuild.

the class StubInstance method reindexCas.

@Override
public CasIndexResults reindexCas(@Nullable String hostName) {
    throwIfStopped();
    ReindexCasRequestResults proto = adminBlockingStub.get().reindexAllCas(ReindexAllCasRequest.newBuilder().build());
    if (hostName != null) {
        proto = adminBlockingStub.get().reindexCas(ReindexCasRequest.newBuilder().setHostId(hostName).build());
    }
    CasIndexResults results = new CasIndexResults();
    results.removedHosts = proto.getRemovedHosts();
    results.removedKeys = proto.getRemovedKeys();
    results.totalKeys = proto.getTotalKeys();
    return results;
}
Also used : CasIndexResults(build.buildfarm.common.CasIndexResults) ReindexCasRequestResults(build.buildfarm.v1test.ReindexCasRequestResults)

Example 2 with CasIndexResults

use of build.buildfarm.common.CasIndexResults in project bazel-buildfarm by bazelbuild.

the class IndexWorker method main.

public static void main(String[] args) throws Exception {
    String host = args[0];
    String instanceName = args[1];
    DigestUtil digestUtil = DigestUtil.forHash(args[2]);
    String reindexworker = args[3];
    ManagedChannel channel = createChannel(host);
    Instance instance = new StubInstance(instanceName, digestUtil, channel);
    CasIndexResults results = instance.reindexCas(reindexworker);
    System.out.println(results.toMessage());
    instance.stop();
}
Also used : StubInstance(build.buildfarm.instance.stub.StubInstance) Instance(build.buildfarm.instance.Instance) CasIndexResults(build.buildfarm.common.CasIndexResults) ManagedChannel(io.grpc.ManagedChannel) DigestUtil(build.buildfarm.common.DigestUtil) StubInstance(build.buildfarm.instance.stub.StubInstance)

Example 3 with CasIndexResults

use of build.buildfarm.common.CasIndexResults in project bazel-buildfarm by bazelbuild.

the class AdminService method reindexCas.

@Override
public void reindexCas(ReindexCasRequest request, StreamObserver<ReindexCasRequestResults> responseObserver) {
    try {
        CasIndexResults results = instance.reindexCas(request.getHostId());
        logger.log(INFO, "Indexer results: " + results.toMessage());
        responseObserver.onNext(ReindexCasRequestResults.newBuilder().setRemovedHosts(results.removedHosts).setRemovedKeys(results.removedKeys).setTotalKeys(results.totalKeys).build());
        responseObserver.onCompleted();
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Could not reindex CAS.", e);
        responseObserver.onError(io.grpc.Status.fromThrowable(e).asException());
    }
}
Also used : CasIndexResults(build.buildfarm.common.CasIndexResults)

Example 4 with CasIndexResults

use of build.buildfarm.common.CasIndexResults in project bazel-buildfarm by bazelbuild.

the class AdminService method reindexAllCas.

@Override
public void reindexAllCas(ReindexAllCasRequest request, StreamObserver<ReindexCasRequestResults> responseObserver) {
    try {
        String arg = null;
        CasIndexResults results = instance.reindexCas(arg);
        logger.log(INFO, "Indexer results: " + results.toMessage());
        responseObserver.onNext(ReindexCasRequestResults.newBuilder().setRemovedHosts(results.removedHosts).setRemovedKeys(results.removedKeys).setTotalKeys(results.totalKeys).build());
        responseObserver.onCompleted();
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Could not reindex CAS.", e);
        responseObserver.onError(io.grpc.Status.fromThrowable(e).asException());
    }
}
Also used : CasIndexResults(build.buildfarm.common.CasIndexResults)

Aggregations

CasIndexResults (build.buildfarm.common.CasIndexResults)4 DigestUtil (build.buildfarm.common.DigestUtil)1 Instance (build.buildfarm.instance.Instance)1 StubInstance (build.buildfarm.instance.stub.StubInstance)1 ReindexCasRequestResults (build.buildfarm.v1test.ReindexCasRequestResults)1 ManagedChannel (io.grpc.ManagedChannel)1