aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/remote_worker
diff options
context:
space:
mode:
authorGravatar buchgr <buchgr@google.com>2017-07-12 10:29:27 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-07-12 10:52:22 +0200
commit226510b85b9c0b1465aa860bc6cdd792b01b3412 (patch)
tree7d512eb26f18dfa918c20ccf931be8c654107134 /src/tools/remote_worker
parent7a1e3a534efccc86dd86ba9d253f0a6801df7158 (diff)
remote: Rewrite Chunker
- Remove the Chunker.Builder and use the Chunker constructors instead. - Fix a correctness bug, where the chunker would ignore the return value of InputStream.read(byte[]). - Have Chunk.getData() return a ByteString as opposed to a byte[]. All callsides need ByteString objects and this change makes the subsequent change possible. - Have the Chunker use a preallocated byte[] in order to avoid allocating a new one on every call to next(). RELNOTES: None. PiperOrigin-RevId: 161637158
Diffstat (limited to 'src/tools/remote_worker')
-rw-r--r--src/tools/remote_worker/src/main/java/com/google/devtools/build/remote/ByteStreamServer.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/tools/remote_worker/src/main/java/com/google/devtools/build/remote/ByteStreamServer.java b/src/tools/remote_worker/src/main/java/com/google/devtools/build/remote/ByteStreamServer.java
index 2c6a1fb343..acc6685bf2 100644
--- a/src/tools/remote_worker/src/main/java/com/google/devtools/build/remote/ByteStreamServer.java
+++ b/src/tools/remote_worker/src/main/java/com/google/devtools/build/remote/ByteStreamServer.java
@@ -29,7 +29,6 @@ import com.google.devtools.build.lib.remote.SimpleBlobStoreActionCache;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.remoteexecution.v1test.Digest;
-import com.google.protobuf.ByteString;
import com.google.rpc.Code;
import com.google.rpc.Status;
import io.grpc.protobuf.StatusProto;
@@ -80,10 +79,10 @@ final class ByteStreamServer extends ByteStreamImplBase {
try {
// This still relies on the blob size to be small enough to fit in memory.
// TODO(olaola): refactor to fix this if the need arises.
- Chunker c = new Chunker.Builder().addInput(cache.downloadBlob(digest)).build();
+ Chunker c = new Chunker(cache.downloadBlob(digest));
while (c.hasNext()) {
responseObserver.onNext(
- ReadResponse.newBuilder().setData(ByteString.copyFrom(c.next().getData())).build());
+ ReadResponse.newBuilder().setData(c.next().getData()).build());
}
responseObserver.onCompleted();
} catch (CacheNotFoundException e) {