Skip to content

Commit

Permalink
Merge pull request #562 from mziccard/rename-apply
Browse files Browse the repository at this point in the history
Rename Storage.apply to Storage.submit
  • Loading branch information
ajkannan committed Jan 21, 2016
2 parents 483b4d8 + 3026e77 commit 9fba603
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public List<Blob> get(String blobName1, String blobName2, String... blobNames) {
batch.get(info.name(), name);
}
List<Blob> blobs = new ArrayList<>(blobNames.length);
BatchResponse response = storage.apply(batch.build());
BatchResponse response = storage.submit(batch.build());
for (BatchResponse.Result<BlobInfo> result : response.gets()) {
BlobInfo blobInfo = result.get();
blobs.add(blobInfo != null ? new Blob(storage, blobInfo) : null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* @return the batch response
* @throws StorageException upon failure
*/
BatchResponse apply(BatchRequest batchRequest);
BatchResponse submit(BatchRequest batchRequest);

/**
* Return a channel for reading the blob's content. The blob's latest generation is read. If the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public byte[] call() {
}

@Override
public BatchResponse apply(BatchRequest batchRequest) {
public BatchResponse submit(BatchRequest batchRequest) {
List<Tuple<StorageObject, Map<StorageRpc.Option, ?>>> toDelete =
Lists.newArrayListWithCapacity(batchRequest.toDelete().size());
for (Map.Entry<BlobId, Iterable<BlobSourceOption>> entry : batchRequest.toDelete().entrySet()) {
Expand Down Expand Up @@ -592,7 +592,7 @@ public List<BlobInfo> get(BlobId... blobIds) {
for (BlobId blob : blobIds) {
requestBuilder.get(blob);
}
BatchResponse response = apply(requestBuilder.build());
BatchResponse response = submit(requestBuilder.build());
return Collections.unmodifiableList(transformResultList(response.gets(), null));
}

Expand All @@ -602,7 +602,7 @@ public List<BlobInfo> update(BlobInfo... blobInfos) {
for (BlobInfo blobInfo : blobInfos) {
requestBuilder.update(blobInfo);
}
BatchResponse response = apply(requestBuilder.build());
BatchResponse response = submit(requestBuilder.build());
return Collections.unmodifiableList(transformResultList(response.updates(), null));
}

Expand All @@ -612,7 +612,7 @@ public List<Boolean> delete(BlobId... blobIds) {
for (BlobId blob : blobIds) {
requestBuilder.delete(blob);
}
BatchResponse response = apply(requestBuilder.build());
BatchResponse response = submit(requestBuilder.build());
return Collections.unmodifiableList(transformResultList(response.deletes(), Boolean.FALSE));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void testGetAll() throws Exception {
}
BatchResponse response = new BatchResponse(Collections.<Result<Boolean>>emptyList(),
Collections.<Result<BlobInfo>>emptyList(), batchResultList);
expect(storage.apply(capture(capturedBatchRequest))).andReturn(response);
expect(storage.submit(capture(capturedBatchRequest))).andReturn(response);
replay(storage);
List<Blob> blobs = bucket.get("n1", "n2", "n3");
Set<BlobId> blobInfoSet = capturedBatchRequest.getValue().toGet().keySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ public void testBatchRequest() {
.update(updatedBlob1)
.update(updatedBlob2)
.build();
BatchResponse updateResponse = storage.apply(updateRequest);
BatchResponse updateResponse = storage.submit(updateRequest);
assertEquals(2, updateResponse.updates().size());
assertEquals(0, updateResponse.deletes().size());
assertEquals(0, updateResponse.gets().size());
Expand All @@ -602,7 +602,7 @@ public void testBatchRequest() {
.get(BUCKET, sourceBlobName1)
.get(BUCKET, sourceBlobName2)
.build();
BatchResponse getResponse = storage.apply(getRequest);
BatchResponse getResponse = storage.submit(getRequest);
assertEquals(2, getResponse.gets().size());
assertEquals(0, getResponse.deletes().size());
assertEquals(0, getResponse.updates().size());
Expand All @@ -616,7 +616,7 @@ public void testBatchRequest() {
.delete(BUCKET, sourceBlobName1)
.delete(BUCKET, sourceBlobName2)
.build();
BatchResponse deleteResponse = storage.apply(deleteRequest);
BatchResponse deleteResponse = storage.submit(deleteRequest);
assertEquals(2, deleteResponse.deletes().size());
assertEquals(0, deleteResponse.gets().size());
assertEquals(0, deleteResponse.updates().size());
Expand Down Expand Up @@ -646,7 +646,7 @@ public void testBatchRequestManyDeletes() {
.get(BUCKET, sourceBlobName1)
.update(updatedBlob2)
.build();
BatchResponse response = storage.apply(updateRequest);
BatchResponse response = storage.submit(updateRequest);
assertEquals(2 * MAX_BATCH_DELETES, response.deletes().size());
assertEquals(1, response.updates().size());
assertEquals(1, response.gets().size());
Expand Down Expand Up @@ -685,7 +685,7 @@ public void testBatchRequestFail() {
.get(BUCKET, blobName, Storage.BlobGetOption.generationMatch(-1L))
.get(BlobId.of(BUCKET, blobName, -1L))
.build();
BatchResponse batchResponse = storage.apply(batchRequest);
BatchResponse batchResponse = storage.submit(batchRequest);
assertEquals(1, batchResponse.updates().size());
assertEquals(2, batchResponse.deletes().size());
assertEquals(2, batchResponse.gets().size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ public Tuple<StorageObject, StorageException> apply(StorageObject f) {
EasyMock.expect(storageRpcMock.batch(EasyMock.capture(capturedBatchRequest))).andReturn(res);
EasyMock.replay(storageRpcMock);
storage = options.service();
BatchResponse batchResponse = storage.apply(req);
BatchResponse batchResponse = storage.submit(req);

// Verify captured StorageRpc.BatchRequest
List<Tuple<StorageObject, Map<StorageRpc.Option, ?>>> capturedToDelete =
Expand Down

0 comments on commit 9fba603

Please sign in to comment.