Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bigtable): Remove deprecated Bytes from BigEndianBytesEncoding #2309

Merged
merged 7 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading