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;
}
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();
}
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());
}
}
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());
}
}
Aggregations