Refactor the counter with generics
highcloud100 opened this issue · 0 comments
highcloud100 commented
What would you like to be added:
Convert the raw types to generics in counter implementation.
https://github.com/yorkie-team/yorkie/blob/main/pkg/document/crdt/counter.go
https://github.com/yorkie-team/yorkie/blob/main/pkg/document/json/counter.go
Why is this needed:
Currently LongCnt, IntegerCnt types can be used as counter.
To support both types, there is many duplicated code in counter.
Moreover interface{} is used for supporting arbitrary type in crdt.Counter.
This interface{ } can spread and produce continuous bad results.
yorkie/pkg/document/crdt/counter.go
Lines 53 to 57 in eaefcdc