Releases: SpineEventEngine/gcloud-java
1.9.1
This is a minor release of Spine's Google Cloud library in 1.x
family, which, however, brings a minor breaking change into API.
Custom column mappings via DsColumnMapping
In particular, it is now possible to override the default mappings provided by DsColumnMapping
. Previously, SPI users could only extend DsColumnMapping
's behavior by overriding this method:
protected void setupCustomMapping(
ImmutableMap.Builder<Class<?>, ColumnTypeMapping<?, ? extends Value<?>>> builder);
It was good enough if one wanted to append their mapping rules. But such an approach did not allow to re-define the existing (framework-default) mapping — since a builder of ImmutableMap
was passed, preventing from having duplicate keys.
This method is now made final
, effectively closing it as an extension point.
Now, the API for SPI users implies overriding another method:
@SPI
protected ImmutableMap<Class<?>, ColumnTypeMapping<?, ? extends Value<?>>> customMapping()
This one allows to return an immutable map of mappings, combining them into the final result, giving priority to those values which were provided by SPI users.
Please see the documentation for DsColumnMapping
for more details.
How to use it
Referring to the original issue, end-users may configure how Timestamp.getDefaultValue()
is stored for some column. In the example below, a Datastore-specific null
is written for such values to the corresponding property of respective Datastore Entity
:
/**
* A mapping similar to the default one,
* but telling to store {@link Timestamp}s as {@code null}s.
*/
public final class CustomMapping extends DsColumnMapping {
@Override
protected ImmutableMap<Class<?>, ColumnTypeMapping<?, ? extends Value<?>>> customMapping() {
return ImmutableMap.of(Timestamp.class, ofNullableTimestamp());
}
@SuppressWarnings("UnnecessaryLambda" /* For brevity */)
private static ColumnTypeMapping<Timestamp, Value<?>> ofNullableTimestamp() {
return timestamp -> {
if (timestamp.equals(Timestamp.getDefaultInstance())) {
return NullValue.of();
}
return TimestampValue.of(
ofTimeSecondsAndNanos(timestamp.getSeconds(), timestamp.getNanos())
);
};
}
}
See #186 for more detail on the change.
1.9.0
This is a part of Spine 1.9.0 release.
Here is a list of updates:
-
Support of the shard pick-up result distinguishing introduced in
core-java
(#181). See core-java#1505 for more detail. -
Updates of third-party dependencies:
- Cloud Datastore is now
2.14.2
, - Cloud Pub/Sub is used at
1.105.8
, - Cloud Trace version becomes
2.14.0
.
- Cloud Datastore is now
1.8.2
This is a part of Spine release in version 1.8.2
.
With this update, gcloud-java
modules now support the changes recently introduced in core-java
.
Also, the versions of Google Cloud client libraries were updated:
- Cloud Datastore version is set to 2.8.0;
- Cloud Pubsub V1 version is set to 1.101.1;
- Cloud Trace version is set to 2.2.0.
1.8.0
This is another public release of Spine libraries which streamline the development of apps running under GCP.
It supports all the features recently introduced in the corresponding core-java:1.8.0
release.
Migration
In order to support the API change introduced in core-java#1433, the datastore
library updates the storage schema. Instead of the ShardSessionRecord.node
field, ShardSessionRecord.worker
field is now used.
ShardSessionRecord
s are short-lived by their nature, so the simplest migration strategy would be to pause or stop the application instances, drop all remaining ShardSessionRecord
s and migrate the traffic to the updated version of the application.
Special attention should be paid to the Datastore indexes, which previously could be created in the applications built on top of Spine datastore
library. In case ShardSessionRecord.node
was included into any indexes, it might be a good idea to include ShardSessionRecord.worker
field instead.
1.7.0
A public release of GCP-related Spine libraries.
Infrastructure
The libraries now do not use implementation
for compile-only annotations like errorprone
annotations but use the newly introduced compileOnlyApi
configuration for such dependencies (see #158).
Dependency upgrades
- Cloud Datastore:
1.102.2
->1.105.3
- Cloud Pub/Sub protos:
1.89.0
->1.92.1
- Cloud Trace:
0.109.3-beta
->1.2.8
Compare v1.6.0 and v1.7.0.
1.6.0
A public release of Datastore-related Spine libraries.
Notable changes
1.5.0
This release brings the support of the latest features introduced in the framework.
Please see the release notes of core-java
for the details.
1.3.0
A public release of the Datastore-related Spine libraries.