AntidoteDB / antidote-java-client

A java client for antidote db.
Apache License 2.0
2 stars 4 forks source link

Client API refactoring #1

Open peterzeller opened 7 years ago

peterzeller commented 7 years ago

Addressing some suggestions given by Paolo and some other things:

Backwards-compatible changes:

Mostly compatible:

Breaking changes:

mweberUKL commented 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.

peterzeller commented 7 years ago

(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:

Some benefits would be:

peterzeller commented 7 years ago

The updated interface is now available as version 0.1.0. I still don't consider this a stable API, so feedback is welcome ;)

peterzeller commented 7 years ago

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.