Skip to content

Commit

Permalink
feat(bigtable): Remove deprecated Bytes from BigEndianBytesEncoding (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ron-gal authored Aug 13, 2024
1 parent acaa3ff commit 32f244f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.43.0')
implementation platform('com.google.cloud:libraries-bom:26.44.0')
implementation 'com.google.cloud:google-cloud-bigtable'
```
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-bigtable:2.41.0'
implementation 'com.google.cloud:google-cloud-bigtable:2.42.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.41.0"
libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.42.0"
```
<!-- {x-version-update-end} -->

Expand Down Expand Up @@ -542,7 +542,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigtable/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigtable.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigtable/2.41.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigtable/2.42.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
10 changes: 10 additions & 0 deletions google-cloud-bigtable/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,14 @@
<className>com/google/cloud/bigtable/admin/v2/models/Type$Raw</className>
<to>com/google/cloud/bigtable/admin/v2/models/Type</to>
</difference>
<difference>
<differenceType>7004</differenceType>
<className>com/google/cloud/bigtable/admin/v2/models/Type$Int64$Encoding$BigEndianBytes</className>
<method>*</method>
</difference>
<difference>
<differenceType>7002</differenceType>
<className>com/google/cloud/bigtable/admin/v2/models/Type$Int64$Encoding$BigEndianBytes</className>
<method>*</method>
</difference>
</differences>
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static Bytes bytes(Bytes.Encoding encoding) {
* Creates an Int64 type with a big-endian encoding. The bytes are then encoded in "raw" format.
*/
public static Int64 bigEndianInt64() {
return Int64.create(Int64.Encoding.BigEndianBytes.create(Type.rawBytes()));
return Int64.create(Int64.Encoding.BigEndianBytes.create());
}

/** Creates an Int64 type with the specified encoding. */
Expand Down Expand Up @@ -200,29 +200,25 @@ public abstract static class Encoding {
static Encoding fromProto(com.google.bigtable.admin.v2.Type.Int64.Encoding source) {
switch (source.getEncodingCase()) {
case BIG_ENDIAN_BYTES:
return BigEndianBytes.create(
Bytes.fromProto(source.getBigEndianBytes().getBytesType()));
return BigEndianBytes.create();
case ENCODING_NOT_SET:
return BigEndianBytes.create(Type.rawBytes());
return BigEndianBytes.create();
}
throw new UnsupportedOperationException();
}

@AutoValue
public abstract static class BigEndianBytes extends Encoding {

public static BigEndianBytes create(Bytes bytes) {
return new AutoValue_Type_Int64_Encoding_BigEndianBytes(bytes);
public static BigEndianBytes create() {
return new AutoValue_Type_Int64_Encoding_BigEndianBytes();
}

@Nonnull
public abstract Bytes getBytes();

@Override
public com.google.bigtable.admin.v2.Type.Int64.Encoding toProto() {
com.google.bigtable.admin.v2.Type.Int64.Encoding.Builder builder =
com.google.bigtable.admin.v2.Type.Int64.Encoding.newBuilder();
builder.getBigEndianBytesBuilder().setBytesType(getBytes().toProto().getBytesType());
builder.getBigEndianBytesBuilder();
return builder.build();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public static com.google.bigtable.admin.v2.Type int64Type() {
.setBigEndianBytes(
com.google.bigtable.admin.v2.Type.Int64.Encoding.BigEndianBytes
.newBuilder()
.setBytesType(bytesType())
.build())
.build()))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void bigEndianInt64() {

@Test
public void int64WithEncoding() {
Type type = Type.int64(Int64.Encoding.BigEndianBytes.create(Type.rawBytes()));
Type type = Type.int64(Int64.Encoding.BigEndianBytes.create());
assertThat(type.toProto()).isEqualTo(TypeProtos.int64Type());
}

Expand Down

0 comments on commit 32f244f

Please sign in to comment.