OT type combinators

瀏覽次數:38 次
跳到第一則未讀訊息

Minghao Liu

未讀,
2018年2月7日 凌晨12:03:262018/2/7
收件者: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]

}

回覆所有人
回覆作者
轉寄
0 則新訊息