composablesys / collabs

Collabs library monorepo

Home Page:https://collabs.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interfaces RFC: Number

mweidner037 opened this issue · comments

Interface

https://github.com/composablesys/compoventuals/blob/master/client/src/crdt/number/interfaces.ts

Planned implementations

  • AddOnlyNumber: a counter, i.e., only add operations are supported (setting the value to x translates to adding (x - this.value)). It is resettable, using our novel construction.
  • DefaultNumber: The add/mult semidirect product. In the future, this could also include min/max operations, via a multiple semidirect product.

Questions

  • Should Number have any operations besides just setting the value (inherited from Register)? Currently, I put add and mult, since those are supported by the two constructions (with AddOnlyNumber implementing multiplications as their equivalent addition, i.e., mults don't affect concurrent additions - the opposite of Number). We could add other operations like min/max; or we could remove add/mult, and just leave it like Register, with subclasses adding add/mult/etc. if supported.
  • Should the semidirect product get the prized name DefaultNumber, or should AddOnlyNumber, or should neither (no DefaultNumber)?
  • Should we also export a non-resettable add-only number, using the traditional op-based counter, i.e., it's the same as a sequential counter? This slightly optimizes over AddOnlyNumber, but is only useful when you don't want resets and you only add integers.

Plan: remove the interface. Instead, DefaultNumber becomes the CNumber.
AddOnlyNumber will become Counter, which is its own thing, with just inc() operations. (Possibly also versions with dec(), reset()). If there are multiple implementations of Counters, they could have their own interface.

Done by #138