use of build.buildfarm.server.ContentAddressableStorageService in project bazel-buildfarm by bazelbuild.
the class Worker method createServer.
private Server createServer(ServerBuilder<?> serverBuilder, ContentAddressableStorage storage, Instance instance, Pipeline pipeline, ShardWorkerContext context) {
serverBuilder.addService(healthStatusManager.getHealthService());
serverBuilder.addService(new ContentAddressableStorageService(instance, /* deadlineAfter=*/
1, DAYS));
serverBuilder.addService(new ByteStreamService(instance, /* writeDeadlineAfter=*/
1, DAYS));
serverBuilder.addService(new ShutDownWorkerGracefully(this, config));
// storage replication.
if (hasExecutionCapability) {
PipelineStage completeStage = new PutOperationStage((operation) -> context.deactivate(operation.getName()));
PipelineStage errorStage = completeStage;
/* new ErrorStage(); */
PipelineStage reportResultStage = new ReportResultStage(context, completeStage, errorStage);
PipelineStage executeActionStage = new ExecuteActionStage(context, reportResultStage, errorStage);
PipelineStage inputFetchStage = new InputFetchStage(context, executeActionStage, new PutOperationStage(context::requeue));
PipelineStage matchStage = new MatchStage(context, inputFetchStage, errorStage);
pipeline.add(matchStage, 4);
pipeline.add(inputFetchStage, 3);
pipeline.add(executeActionStage, 2);
pipeline.add(reportResultStage, 1);
serverBuilder.addService(new WorkerProfileService(storage, inputFetchStage, executeActionStage, context, completeStage, backplane));
} else {
PipelineStage casReplicationStage = new CasReplicationStage();
pipeline.add(casReplicationStage, 1);
}
return serverBuilder.build();
}
Aggregations