mochi / statebox

Erlang state "monad" with merge/conflict-resolution capabilities. Useful for Riak.
Other
253 stars 20 forks source link

Can you please clarify the repeatability requirement? #3

Closed yrashk closed 11 years ago

yrashk commented 11 years ago

Hi,

I am adapting statebox for some specific use case, and I was wondering if I understand the repeatability requirement correctly.

From what I understand, this has to do more with the use of riak-like systems where you will have more than one replica of such an operation on different vnodes, and therefore, when you merge, you'll end up with duplicate data.. and hence, the repeatability requirement — so that replicas of the same operation don't effectively get applied twice.

Or is there any other reason for this requirement?

Lets say if I had some operation id "marker" embedded into operations that would allow me to figure out duplicates, and my own custom merge function which keeps trrack of applied operations and does not allow duplicates to be applied — would that lift the repeatability requirement?

etrepum commented 11 years ago

If f(f(x)) != f(x) then the implementation of statebox won't work for you. Read the code if you'd like further clarification.

yrashk commented 11 years ago

I know it won't work for me as is. I wasn't asking about that. I was asking about motivation. Anyway, will figure stuff out myself, then.