OT type combinators

38 views
Skip to first unread message

Minghao Liu

unread,
Feb 7, 2018, 12:03:26 AM2/7/18
to ShareJS
Hello. 


I am having an idea about OT type combinators. They are like parser combinators but for OT types. 


I know JSON0 basically have similar functionality, but I want it a typed way. Then you can have different types for different usages, like OT type for stacks and lists.

Also in this way, each node will have a version, I am prototyping this in Scala. so it might look something like the code bellow.

Then you can implement Ot for various types. and the document type is combined. For example the Opeartion for a ListOt will be: {Insert, Delete, ChildChange}

So the operations on a type is also a "combined", like the OT type combinator themselves.


Is there a gitter or IRC for sharedb? I'd like to discuss some idea with you guys.



package shared.codata





trait Ot {

/**
* represent the data
*/
type Data


/**
* represent the changes of data
*/
type Operation

/**
* represent what conflict might happen if two concurrent `Change` is performed
*/
type Conflict

case class Rebased[T](t: T, conflicts: Set[Conflict]) {
def map[G](map: T => G) = Rebased(map(t), conflicts)
}

def transform(data: Data, c: Operation): Data

def rebase(winner: Operation, loser: Operation): Rebased[Operation]

}

Reply all
Reply to author
Forward
0 new messages