Open peterzeller opened 7 years ago
Regarding the database update and query DSL (also referred to as "immutable interface" in the context of Antidote), a way to group together multiple key-updates into a single map update would be helpful. At the moment there is no way to issue a map-update that updates more than one key in the map.
(also referred to as "immutable interface" in the context of Antidote)
It is not called "immutable interface" anywhere.
Regarding the database update and query DSL, a way to group together multiple key-updates into a single map update would be helpful. At the moment there is no way to issue a map-update that updates more than one key in the map.
I think changing this would require to change the API to be more similar to the API of the JavaScript client. That could look something like this:
tx.execute(
map(bucket, "my_map").update(
counter("c").increment(),
register("r").set("hello")
)
);
or similarly (using a Builder):
map(bucket, "my_map")
.update(counter("c").increment())
.update(register("r").set("hello"))
.removeKey(set("s"))
.execute(tx)
Compared to the current API:
MapRef<String> my_map = bucket.map_rr("my_map");
my_map.counter("c").increment(tx);
my_map.register("r").set(tx, "hello");
Drawbacks of this approach:
execute
it (this happened to some people using the JavaScript client, but in Java it might help to use the javax.annotation.CheckReturnValue
annotation)execute
call is requiredSome benefits would be:
CounterRef c = counter("c");
)ValueCoder
instances.The updated interface is now available as version 0.1.0
. I still don't consider this a stable API, so feedback is welcome ;)
Feedback from Nuno:
quick first comment: I found the names of the interfaces for crdts strange - IntegerKey
Maybe we should think about naming it AntidoteInteger
, AntidoteSet
, etc.
Addressing some suggestions given by Paolo and some other things:
Backwards-compatible changes:
ValueCoder
also have an overload which uses utf8-strings as default encoding.ValueCoder
s for Integers, Enums, Id-Types (classes wrapping a string).AntidoteException
.Mostly compatible:
CrdtMap
implementjava.util.Map
Breaking changes:
noTransaction
toautomaticTransaction
ObjectRef
andResponseDecoder
(this should get rid of some unnecessary methods onRegisterRef
,MapRef
and so on)