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

上一篇文章介绍了在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> 里面。
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值