看看现有的操作转换框架的所有示例,它们似乎都围绕纯文本文档的更改转换进行解决。 OT 框架如何用于更复杂的对象?
我想开发一个实时便签样式的应用程序,人们可以在其中共同创建便签,更改其位置和文本值。我假设位置值不会被转换是正确的吗? (我的意思是,他们怎么会,你不能合并它们,对吧?)。但是,我想使用 OT 框架来解决与 posit-its 值的冲突,对吗?
Looking at all the examples of Operational Transformation Frameworks out there, they all seem to resolve around the transformation of changes to plain text documents. How would an OT framework be used for more complex objects?
I'm wanting to dev a real-time sticky notes style app, where people can co-create sticky notes, change their positon and text value. Would I be right in assuming that the position values wouldn't be transformed? (I mean, how would they, you can't merge them right?). However, I would want to use an OT framework to resolve conflicts with the posit-its value, correct?
发布评论
评论(3)
我没有看到使用操作转换来处理复杂对象有任何问题,您需要的是定义您的 OT 系统支持哪些操作以及如何解决它们的并发性
例如,如果您收到两个粘滞便笺“坐标移动操作”来自相同“客户端状态”的两个不同用户,您需要使两个状态收敛,可能会取消第二个操作。
当两个用户生成两个更新来删除完全重叠(或可能部分重叠)的文本范围时,这与文本的行为完全相同,处理的第二个更新必须针对前一个更新进行转换,并且生成的操作将仅有效删除一部分原始的(或者通过“无操作”完全取消)
您可以查看 这个关于 Google Wave 运营转型如何工作的很好的解释,并从这一点猜测它应该如何工作您自己的实现
I do not see any problem to use Operational Transformation to work with Complex Objects, what you need is to define what operations your OT system support and how concurrency is solved for them
For instance, if you receive two Sticky notes "coordinates move operation" from two different users from same 'client state', you need to make both states to converge, probably cancelling out second operation.
This is exactly the same behaviour with text when two users generate two updates to delete a text range that overlaps completely, (or maybe partially), the second update processed must be transformed against the previous and the resultant operation will only effectively delete a portion of the original one, (or completely cancelled with a 'no-op')
You can take a look on this nice explanation about how Google Wave Operational Transformation works and guess from this point how it should work your own implementation
如果您想走这条路,请参阅以下论文,了解将 OT 与树结合使用的方法:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.100.74
但是,在您的特定情况下,我会使用单独的纯文本 OT 文档每个粘滞便笺并使用现有的库(例如:etherPad)来完成繁重的工作。然后可以在最后提交者获胜的基础上广播注释的位置。
See the following paper for an approach to using OT with trees if you want to go down that route:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.100.74
However, in your particular case, I would use a separate plain text OT document for each stickynote and use an existing library, eg: etherPad, to do the heavy lifting. The positions of the notes could then be broadcast on a last-committer-wins basis.
操作转换是一种通用技术,它适用于任何数据类型。关键是您需要定义转换函数。此外,还有一些原子属性无法自动合并,例如(位置和背景颜色),这些属性大部分是“最后更新获胜”,或者用户在发生冲突时手动解决它们。
有一些不错的库和框架可以为复杂数据提供 OT:
Operation Transformation is a general technique, it works for any data type. The point is you need to define your transformation functions. Also, there are some atomic attributes that you cannot merge automatically like (position and background color) those will be mostly "last-update wins" or the user solves them manually when there is a conflict.
there are some nice libs and frameworks that provide OT for complex data already out there: