Skip to content

Commit ae99293

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 6339 b: refs/heads/tswast-patch-1 c: 5f01eb9 h: refs/heads/master i: 6337: a1fafcd 6335: a353f43
1 parent c9b19b4 commit ae99293

7 files changed

Lines changed: 75 additions & 228 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: 55957705eaeca59fb637c5805fb3062afc7b79f2
60+
refs/heads/tswast-patch-1: 5f01eb90a4ea5c07ace82f84af0094db69c4b991
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ static Filter fromPb(DatastoreV1.Filter filterPb) {
113113
}
114114
}
115115

116+
/*
117+
* A class representing a filter composed of a combination of other filters.
118+
*/
116119
public static final class CompositeFilter extends Filter {
117120

118121
private static final long serialVersionUID = 3610352685739360009L;
@@ -194,6 +197,9 @@ protected DatastoreV1.Filter toPb() {
194197
}
195198
}
196199

200+
/*
201+
* A class representing a filter based on a single property or ancestor.
202+
*/
197203
public static final class PropertyFilter extends Filter {
198204

199205
private static final long serialVersionUID = -4514695915258598597L;
@@ -514,6 +520,9 @@ static OrderBy fromPb(DatastoreV1.PropertyOrder propertyOrderPb) {
514520
}
515521
}
516522

523+
/*
524+
* A class representing a projection based on a property.
525+
*/
517526
public static final class Projection implements Serializable {
518527

519528
private static final long serialVersionUID = 3083707957256279470L;
@@ -665,12 +674,18 @@ public B clearOrderBy() {
665674
return self();
666675
}
667676

677+
/*
678+
* Clears all previously-specified OrderBy objects and orders by the given input instead.
679+
*/
668680
public B orderBy(OrderBy orderBy, OrderBy... others) {
669681
clearOrderBy();
670682
addOrderBy(orderBy, others);
671683
return self();
672684
}
673685

686+
/*
687+
* Adds one or more OrderBy objects to the existing list of OrderBy objects.
688+
*/
674689
public B addOrderBy(OrderBy orderBy, OrderBy... others) {
675690
this.orderBy.add(orderBy);
676691
Collections.addAll(this.orderBy, others);
@@ -682,12 +697,19 @@ B clearProjection() {
682697
return self();
683698
}
684699

700+
/*
701+
* Clears all previously-specified Projections and sets the list of Projections to the given
702+
* input instead.
703+
*/
685704
B projection(Projection projection, Projection... others) {
686705
clearProjection();
687706
addProjection(projection, others);
688707
return self();
689708
}
690709

710+
/*
711+
* Adds one or more Projections to the existing list of Projections.
712+
*/
691713
B addProjection(Projection projection, Projection... others) {
692714
this.projection.add(projection);
693715
Collections.addAll(this.projection, others);
@@ -699,12 +721,19 @@ B clearGroupBy() {
699721
return self();
700722
}
701723

724+
/*
725+
* Clears all existing properties to group by and instead groups by the given the list of
726+
* properties.
727+
*/
702728
B groupBy(String property, String... others) {
703729
clearGroupBy();
704730
addGroupBy(property, others);
705731
return self();
706732
}
707733

734+
/*
735+
* Adds one or more properties to the existing list of "group by" properties.
736+
*/
708737
B addGroupBy(String property, String... others) {
709738
this.groupBy.add(property);
710739
Collections.addAll(this.groupBy, others);
@@ -754,6 +783,9 @@ static final class Builder<V> extends BaseBuilder<V, Builder<V>> {
754783
}
755784
}
756785

786+
/*
787+
* A StructuredQuery builder for queries that return Entity results.
788+
*/
757789
public static final class EntityQueryBuilder extends BaseBuilder<Entity, EntityQueryBuilder> {
758790

759791
EntityQueryBuilder() {
@@ -766,6 +798,9 @@ public StructuredQuery<Entity> build() {
766798
}
767799
}
768800

801+
/*
802+
* A StructuredQuery builder for queries that return Key results.
803+
*/
769804
public static final class KeyQueryBuilder extends BaseBuilder<Key, KeyQueryBuilder> {
770805

771806
KeyQueryBuilder() {
@@ -787,6 +822,9 @@ public StructuredQuery<Key> build() {
787822
}
788823
}
789824

825+
/*
826+
* A StructuredQuery builder for projection queries.
827+
*/
790828
public static final class ProjectionEntityQueryBuilder
791829
extends BaseBuilder<ProjectionEntity, ProjectionEntityQueryBuilder> {
792830

branches/tswast-patch-1/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.google.common.collect.Lists;
2525
import com.google.gcloud.spi.StorageRpc;
2626
import com.google.gcloud.storage.Storage.BlobTargetOption;
27-
import com.google.gcloud.storage.Storage.BlobWriteOption;
2827
import com.google.gcloud.storage.Storage.CopyRequest;
2928
import com.google.gcloud.storage.Storage.SignUrlOption;
3029

@@ -270,14 +269,12 @@ public BlobReadChannel reader(BlobSourceOption... options) {
270269
}
271270

272271
/**
273-
* Returns a {@code BlobWriteChannel} object for writing to this blob. By default any md5 and
274-
* crc32c values in the current blob are ignored unless requested via the
275-
* {@code BlobWriteOption.md5Match} and {@code BlobWriteOption.crc32cMatch} options.
272+
* Returns a {@code BlobWriteChannel} object for writing to this blob.
276273
*
277274
* @param options target blob options
278275
* @throws StorageException upon failure
279276
*/
280-
public BlobWriteChannel writer(BlobWriteOption... options) {
277+
public BlobWriteChannel writer(BlobTargetOption... options) {
281278
return storage.writer(info, options);
282279
}
283280

branches/tswast-patch-1/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java

Lines changed: 5 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121

2222
import com.google.common.collect.ImmutableList;
2323
import com.google.common.collect.Iterables;
24-
import com.google.common.collect.Lists;
2524
import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
2625
import com.google.gcloud.Service;
2726
import com.google.gcloud.spi.StorageRpc;
28-
import com.google.gcloud.spi.StorageRpc.Tuple;
2927

3028
import java.io.InputStream;
3129
import java.io.Serializable;
@@ -35,7 +33,6 @@
3533
import java.util.LinkedHashSet;
3634
import java.util.LinkedList;
3735
import java.util.List;
38-
import java.util.Objects;
3936
import java.util.Set;
4037
import java.util.concurrent.TimeUnit;
4138

@@ -148,105 +145,6 @@ public static BlobTargetOption metagenerationMatch() {
148145
public static BlobTargetOption metagenerationNotMatch() {
149146
return new BlobTargetOption(StorageRpc.Option.IF_METAGENERATION_NOT_MATCH);
150147
}
151-
152-
static Tuple<BlobInfo, BlobTargetOption[]> convert(BlobInfo info, BlobWriteOption... options) {
153-
BlobInfo.Builder infoBuilder = info.toBuilder().crc32c(null).md5(null);
154-
List<BlobTargetOption> targetOptions = Lists.newArrayListWithCapacity(options.length);
155-
for (BlobWriteOption option : options) {
156-
switch (option.option) {
157-
case IF_CRC32C_MATCH:
158-
infoBuilder.crc32c(info.crc32c());
159-
break;
160-
case IF_MD5_MATCH:
161-
infoBuilder.md5(info.md5());
162-
break;
163-
default:
164-
targetOptions.add(option.toTargetOption());
165-
break;
166-
}
167-
}
168-
return Tuple.of(infoBuilder.build(),
169-
targetOptions.toArray(new BlobTargetOption[targetOptions.size()]));
170-
}
171-
}
172-
173-
class BlobWriteOption implements Serializable {
174-
175-
private static final long serialVersionUID = -3880421670966224580L;
176-
177-
private final Option option;
178-
private final Object value;
179-
180-
enum Option {
181-
PREDEFINED_ACL, IF_GENERATION_MATCH, IF_GENERATION_NOT_MATCH, IF_METAGENERATION_MATCH,
182-
IF_METAGENERATION_NOT_MATCH, IF_MD5_MATCH, IF_CRC32C_MATCH;
183-
184-
StorageRpc.Option toRpcOption() {
185-
return StorageRpc.Option.valueOf(this.name());
186-
}
187-
}
188-
189-
BlobTargetOption toTargetOption() {
190-
return new BlobTargetOption(this.option.toRpcOption(), this.value);
191-
}
192-
193-
private BlobWriteOption(Option option, Object value) {
194-
this.option = option;
195-
this.value = value;
196-
}
197-
198-
private BlobWriteOption(Option option) {
199-
this(option, null);
200-
}
201-
202-
@Override
203-
public int hashCode() {
204-
return Objects.hash(option, value);
205-
}
206-
207-
@Override
208-
public boolean equals(Object obj) {
209-
if (obj == null) {
210-
return false;
211-
}
212-
if (!(obj instanceof BlobWriteOption)) {
213-
return false;
214-
}
215-
final BlobWriteOption other = (BlobWriteOption) obj;
216-
return this.option == other.option && Objects.equals(this.value, other.value);
217-
}
218-
219-
public static BlobWriteOption predefinedAcl(PredefinedAcl acl) {
220-
return new BlobWriteOption(Option.PREDEFINED_ACL, acl.entry());
221-
}
222-
223-
public static BlobWriteOption doesNotExist() {
224-
return new BlobWriteOption(Option.IF_GENERATION_MATCH, 0L);
225-
}
226-
227-
public static BlobWriteOption generationMatch() {
228-
return new BlobWriteOption(Option.IF_GENERATION_MATCH);
229-
}
230-
231-
public static BlobWriteOption generationNotMatch() {
232-
return new BlobWriteOption(Option.IF_GENERATION_NOT_MATCH);
233-
}
234-
235-
public static BlobWriteOption metagenerationMatch() {
236-
return new BlobWriteOption(Option.IF_METAGENERATION_MATCH);
237-
}
238-
239-
public static BlobWriteOption metagenerationNotMatch() {
240-
return new BlobWriteOption(Option.IF_METAGENERATION_NOT_MATCH);
241-
}
242-
243-
public static BlobWriteOption md5Match() {
244-
return new BlobWriteOption(Option.IF_MD5_MATCH, true);
245-
}
246-
247-
public static BlobWriteOption crc32cMatch() {
248-
return new BlobWriteOption(Option.IF_CRC32C_MATCH, true);
249-
}
250148
}
251149

252150
class BlobSourceOption extends Option {
@@ -612,25 +510,21 @@ public static Builder builder() {
612510

613511
/**
614512
* Create a new blob. Direct upload is used to upload {@code content}. For large content,
615-
* {@link #writer} is recommended as it uses resumable upload. MD5 and CRC32C hashes of
616-
* {@code content} are computed and used for validating transferred data.
513+
* {@link #writer} is recommended as it uses resumable upload.
617514
*
618515
* @return a complete blob information.
619516
* @throws StorageException upon failure
620-
* @see <a href="https://cloud.google.com/storage/docs/hashes-etags">Hashes and ETags</a>
621517
*/
622518
BlobInfo create(BlobInfo blobInfo, byte[] content, BlobTargetOption... options);
623519

624520
/**
625521
* Create a new blob. Direct upload is used to upload {@code content}. For large content,
626-
* {@link #writer} is recommended as it uses resumable upload. By default any md5 and crc32c
627-
* values in the given {@code blobInfo} are ignored unless requested via the
628-
* {@code BlobWriteOption.md5Match} and {@code BlobWriteOption.crc32cMatch} options.
522+
* {@link #writer} is recommended as it uses resumable upload.
629523
*
630524
* @return a complete blob information.
631525
* @throws StorageException upon failure
632526
*/
633-
BlobInfo create(BlobInfo blobInfo, InputStream content, BlobWriteOption... options);
527+
BlobInfo create(BlobInfo blobInfo, InputStream content, BlobTargetOption... options);
634528

635529
/**
636530
* Return the requested bucket or {@code null} if not found.
@@ -785,13 +679,11 @@ public static Builder builder() {
785679
BlobReadChannel reader(BlobId blob, BlobSourceOption... options);
786680

787681
/**
788-
* Create a blob and return a channel for writing its content. By default any md5 and crc32c
789-
* values in the given {@code blobInfo} are ignored unless requested via the
790-
* {@code BlobWriteOption.md5Match} and {@code BlobWriteOption.crc32cMatch} options.
682+
* Create a blob and return a channel for writing its content.
791683
*
792684
* @throws StorageException upon failure
793685
*/
794-
BlobWriteChannel writer(BlobInfo blobInfo, BlobWriteOption... options);
686+
BlobWriteChannel writer(BlobInfo blobInfo, BlobTargetOption... options);
795687

796688
/**
797689
* Generates a signed URL for a blob.

0 commit comments

Comments
 (0)