These are chat archives for RBMHTechnology/eventuate

6th
Oct 2017
Bartosz Sypytkowski
@Horusiath
Oct 06 2017 04:33
@krasserm is there any way of retrieving current CRDT from CRDTService - I've seen that custom CRDTService instances offer operations for their corresponding CRDTs i.e. ORSetService[A] has add and removeoperations. However they are not accessing underlying crdt directly, but via op(id: String, operation: Any): Future[B] - my case is that I'd like to get that crdt in order to construct an operation object before applying it.
the actual case is RGArray[A] - it evaluates into Vector[A] and it offers ability to put an element on the right side of a given position. However internally that position is not stored as index in vector, but as a complex object. If I want to insert an element into it, I need to use that complex object (which is highly unintuitive), because I cannot use index from evaluated vector to compute that index indirectly. Well I can do that in the CRDT itself, but not in it's corresponding CRDTService
Martin Krasser
@krasserm
Oct 06 2017 05:42

my case is that I'd like to get that crdt in order to construct an operation object before applying it

There is CRDTServiceOps.prepare exactly for that purpose. It is called with the operation prototype (passed as argument to op) and the current CRDT. prepare can return an updated operation object (see this example). This operation object is then persisted by Eventuate and applied (locally and remote) in the effect phase.

Is that what you need?

Bartosz Sypytkowski
@Horusiath
Oct 06 2017 19:44
I hope so, thanks :)