Search in sources :

Example 1 with StubWriteOutputStream

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

the class GrpcCAS method newWrite.

@SuppressWarnings("Guava")
public static Write newWrite(Channel channel, String instanceName, Digest digest, UUID uuid, RequestMetadata requestMetadata) {
    HashCode hash = HashCode.fromString(digest.getHash());
    String resourceName = ByteStreamUploader.uploadResourceName(instanceName, uuid, hash, digest.getSizeBytes());
    Supplier<ByteStreamBlockingStub> bsBlockingStub = Suppliers.memoize(() -> ByteStreamGrpc.newBlockingStub(channel).withInterceptors(attachMetadataInterceptor(requestMetadata)));
    Supplier<ByteStreamStub> bsStub = Suppliers.memoize(() -> ByteStreamGrpc.newStub(channel).withInterceptors(attachMetadataInterceptor(requestMetadata)));
    return new StubWriteOutputStream(bsBlockingStub, bsStub, resourceName, Functions.identity(), digest.getSizeBytes(), /* autoflush=*/
    false);
}
Also used : HashCode(com.google.common.hash.HashCode) ByteStreamStub(com.google.bytestream.ByteStreamGrpc.ByteStreamStub) ByteStreamBlockingStub(com.google.bytestream.ByteStreamGrpc.ByteStreamBlockingStub) StubWriteOutputStream(build.buildfarm.common.grpc.StubWriteOutputStream) ByteString(com.google.protobuf.ByteString)

Aggregations

StubWriteOutputStream (build.buildfarm.common.grpc.StubWriteOutputStream)1 ByteStreamBlockingStub (com.google.bytestream.ByteStreamGrpc.ByteStreamBlockingStub)1 ByteStreamStub (com.google.bytestream.ByteStreamGrpc.ByteStreamStub)1 HashCode (com.google.common.hash.HashCode)1 ByteString (com.google.protobuf.ByteString)1