A first thought system architecture (pulling mode) is one that the server doesn't keep client information and the client takes a more active part in retrieving updates from the server,

Note the previous model manager which is responsible for both the management of the entire model collection and the model provisioning for the rendering department is now split to two parts each taking one of the responsibilities respectively and communicating with each other locally or on the wire.

Server                   |                                     Client                                                                           
                                                                         o  IModelProvider                  
                                                                         |
ModelManager ---------- Local/Remote ---------> On-screen model provider ---> View/View Model department
[All models]  1. -> 'model changed' signal            [On-screen models]                  
                 <- check current o/s async                  
                 -> reply if its update                  
                 <- current collection                 
                 -> changes in collection               
              2. <- sight change                  
                 <- current collection                  
                 -> changes in collection                     
                (any new signal invalidates updated)               
 
          <-----------------------------------                Handlers                                                   
                                             references local o/s first                 
              1. <- send update                
              2. -> Acknowledge update

For recording, for each client request a recording object is instantiated and starts listening on user's further request and working as normal on the revision tree on the server as usual.

For playback, The recording is sent to the client who will also have a copy of the tree (which should only add up and not change or reduce) to play the recording on.

For undo and redo, it's also totally up to the server, and the client is subject to its latest update.

Obviously the communication between the client and server for updating the models is not complete yet and there are lots of cases that need to be dealt with. So this pattern has a high complexity in the client design which is error prone, inflexible to changes, and against the general app design guidelines.

Last night before I fell a sleep I came up with an idea of using sort of pushing mode, which should be so straightforward and had been so long missing from my mind. In detail, it's using a more sophisticated server and the principle of matching design and minimal data exchange.

Take a look at the architecture first,

Server                                              |                                  Client                                 
                                                                                               o  IModelProvider 
                                                                                               |
ModelManager  --> Per-session On-screen    --------Local/Remote ------->    On-screen provider ---> View/View Model
[All models]       [On-screen models]                  
                 Client view scope info             Handshakes, 
                                             <- client view changes
                                             -> update of on-screen list 
                                                and individual model data
                                                EXCLUDES unnecessary self
                                                initiated model changes

Handlers

references local o/s first
                                           <-----------------------------
                                                  model changes

This design greatly simplifies the data exchange and therefore makes it much more manageable by minimising the model data update to only changes to on-screen list and models. It's literally a split of on-screen model provider with each part sitting on either server or client with a minimum communication between. Consequently, the cost is the provider on the server needs to keep a session for each client which consists of a mirror of the clients on-screen list and the client's current view scope, which is totally reasonable and affordable.

The handlers check the local on-screen list as well (again it makes sense, as only those on-screen can be manipulated) and immediately report the changes to the server and leave the server to confirm and make the verfied model update. (Here mechanism for proper presentation/notification is needed if the update is rejected/invalidated)

Another question that remains is how to determine if a model is on screen if its representing shape and size is not certain before rendered.

One simple solution to it is completely get the server to decide the on-screen status using approximation in a C/S scenario, which is fine in most uses.

However if a finer approach is really needed, it can be

- canvas simulation on the server (which is subject to the system support on the server)

- use a distributed version of posterior checking mechanism, which is to flag all changed size undetermined model as VisualToMeasure initially and get client to update their dimension information. In a distributed scenario, the server may receive multiple client responses, however in this application, the measurements are supposed to be close to each other, the server just needs to average them out.

The design of a distributed variant of Plato framework to support collaborated editing的更多相关文章

  1. Posterior visual bounds retrieval for the Plato framework

    Plato is a MVVM compliant 2D on-canvas graphics framework I've been designing and implementing for d ...

  2. Domain Driven Design and Development In Practice--转载

    原文地址:http://www.infoq.com/articles/ddd-in-practice Background Domain Driven Design (DDD) is about ma ...

  3. HDFS分布式文件系统(The Hadoop Distributed File System)

    The Hadoop Distributed File System (HDFS) is designed to store very large data sets reliably, and to ...

  4. Distributed transactions in Spring, with and without XA

    While it's common to use the Java Transaction API and the XA protocol for distributed transactions i ...

  5. 创建Material Design风格的Android应用--应用主题

    本人全部文章首先公布于个人博客,欢迎关注,地址:http://blog.isming.me 昨天正式公布了android 5,同一时候android developer站点也更新了,添加了创建Mate ...

  6. Distributed MVCC based cross-row transaction

    The algorithm for supporting distributed MVCC based cross-row transactions on top of a distributed k ...

  7. Android Material Design 兼容库的使用

    Android Material Design 兼容库的使用 mecury 前言:近来学习了Android Material Design 兼容库,为了把这个弄懂,才有了这篇博客,这里先推荐两篇博客: ...

  8. Android应用Design Support Library完全使用实例

    阅读目录 2-1 综述 2-2 TextInputLayout控件 2-3 FloatingActionButton控件 2-4 Snackbar控件 2-5 TabLayout控件 2-6 Navi ...

  9. Android Design Support Library: 学习CoordinatorLayout

    简述 CoordinatorLayout字面意思是"协调器布局",它是Design Support Library中提供的一个超级帧布局,帮助我们实现Material Design ...

随机推荐

  1. 第一课 移动端&响应式

    一.调试工具介绍(Chrome Emulation) 1.Device(设备相关) 自定义尺寸.Network(网络模拟).UseAgent(浏览器信息).缩放 2.Media(媒体) 3.Netwo ...

  2. history 清空历史记录 或 history不记录历史命令

    # vi ~/.bash_history 清空里面的记录,并退出当前shell # exit(一定要退出当前shell) # history 1 vi ~/.bash_history 2 histor ...

  3. 数据结构和算法 – 7.散列和 Hashtable 类

    7.1.散列函数 散列是一种常见的存储数据的技术,按照这种方式可以非常迅速地插入和取回数据.散列所采用的数据结构被称为是散列表.尽管散列表提供了快速地插入.删除.以及取回数据的操作,但是诸如查找最大值 ...

  4. CSS3–1.css3 新增选择器

    1.后代级别选择器 2.同辈级别选择器 3.伪类选择器 4.属性选择器 5.UI伪类选择器 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 T ...

  5. EChart使用简单介绍

    Echart是百度研发团队开发的一款报表视图JS插件,功能十分强大,使用内容做简单记录:(EChart下载地址 http://echarts.baidu.com/download.html) 1.ti ...

  6. 使用html5 canvas绘制图片

    注意:本文属于<html5 Canvas绘制图形入门详解>系列文章中的一部分.如果你是html5初学者,仅仅阅读本文,可能无法较深入的理解canvas,甚至无法顺畅地通读本文.请点击上述链 ...

  7. javascript实用技巧,js小知识

    一.js整数的操作 使用|0和~~可以将浮点转成整型且效率方面要比同类的parseInt,Math.round 要快,在处理像素及动画位移等效果的时候会很有用.性能比较见此. var foo = (1 ...

  8. PostgreSQL的时间/日期函数使用

    PostgreSQL的常用时间函数使用整理如下: 一.获取系统时间函数 1.1 获取当前完整时间 select now(); david=# select now(); now ----------- ...

  9. 针对较大基数的排列组合算法Java实现类(n选m)

    package com.utils; import java.math.BigDecimal; import java.math.RoundingMode; public class PLZUUtil ...

  10. Solr入门之(3)常用概念说明(持续补充):

    由于solr底层使用lucene,所以很多概念与lucene相同,下面是几个常用的概念: * Document:一个要进行索引的单元,相当于数据库的一行纪录,任何想要被索引的数据,都必须转化为Docu ...