您的位置:首页 > Web前端

[Web开发] 微软的RSS协议扩展 - FeedSync 介绍 (4)

2008-02-15 09:21 549 查看
上一篇文章介绍了在2台电脑上同时修改数据的feedsync 同步过程, 今天再讨论一下当在2台电脑上同时删除同一个数据的情况。
假设最初feed 里面数据是这样的
<item>
<sx:sync id="ep2.100" updates="1" deleted="false" noconflicts="false">
<sx:history sequence="1" when="2007-11-29T06:27:12Z" by="B"/>
</sx:sync>
<title>Return books to library</title>
<description>2 books in total</description>
</item>
接下来, 我先在电脑A 删除"Return books to library" 这项, 暂时不和Server 做同步。然后再到电脑B 上,因为电脑B也还没有做同步, 所以电脑B 上还有"Return books to library" 这项,我再对它进行删除操作。
这时电脑A 上的Feed
<item>
<sx:sync id="ep2.100" updates="2" deleted="true" noconflicts="false">
<sx:history sequence="2" when="2007-11-29T06:27:16Z" by="A"/>
<sx:history sequence="1" when="2007-11-29T06:27:12Z" by="B"/>
</sx:sync>
<title>Return books to library</title>
<description>2 books in total</description>
</item>
电脑B 上的Feed
<item>
<sx:sync id="ep2.100" updates="2" deleted="true" noconflicts="false">
<sx:history sequence="2" when="2007-11-29T06:27:18Z" by="B"/>
<sx:history sequence="1" when="2007-11-29T06:27:12Z" by="B"/>
</sx:sync>
<title>Return books to library</title>
<description>2 books in total</description>
</item>
这个时候,同步电脑A、B 和Server, Server上的feed 变成
<item>
<sx:sync id="ep2.100" updates="2" deleted="true" noconflicts="false">
<sx:history sequence="2" when="2007-11-29T06:27:18Z" by="B"/>
<sx:history sequence="1" when="2007-11-29T06:27:12Z" by="B"/>
<sx:conflicts>
<item>
<sx:sync id="ep2.100" updates="2" deleted="true" noconflicts="false">
<sx:history sequence="2" when="2007-11-29T06:27:16Z" by="A"/>
<sx:history sequence="1" when="2007-11-29T06:27:12Z" by="B"/>
</sx:sync>
<title>Return books to library</title>
<description>2 books in total</description>
</item>
</sx:conflicts>
</sx:sync>
<title>Return books to library</title>
<description>2 books in total</description>
</item>
我们可以看到, 改数据还被存在Feed 文件里面,并没有因为被删除而消失, 只是属性 deleted="true" 。虽然两个电脑的操作是一样的,但电脑A 的操作还是被保存在冲突列表<sx:conflicts> 里面。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息