Microsoft Sync Framework Basics 2: Microsoft Sync Framework runtime architecture

When Microsoft Sync Framework architecture and run

Benpian will first introduce a variety of synchronous participants, type of participants determines whether we can store metadata, and is able to directly launch the synchronization process. And then we will discuss in detail the core components and system architecture Microsoft Sync Framework, in order to let everyone have a knowledge and understanding of the overall situation of the Sync Framework.

 

Sync Framework participants (Participants)

Before discussing the Sync Framework core components, we need to first understand the Sync Framework supports synchronization of different types of participants. Participants are provided in combination and their associated copies, represents one end of synchronization. To synchronized copy (that is, information warehouse) can be taken from the Web service, laptops, and even U disk to any object.

Microsoft Sync Framework supports three types of participants: complete, partial and simple. Type of participant is determined by its ability to store and process the synchronization metadata. At least, we can assume that, if requested, a copy of the information through the ability to return to the program. Finally, it is determined whether the copy:

  1. Store or stores the current data and the operation information on existing equipment, and
  2. Allows an application (we call synchronization provider) executed directly on the device

Parties involved to distinguish between types of synchronization for the ecosystem is very important, because it allows us to know whether the party is able to store information needed to provide the state of the program, and whether we are able to offer programs to run directly on the device. In the end, the stakeholder model will become the universal model. Therefore, a full participant can be configured to partially or simple participants.

Full participant

Full participant means that allow developers to create new applications and data storage devices directly on the device. Laptops and smart phones belong to the full participant, because you can implement new applications directly from such devices and, if necessary, you can also create a new data storage to save the information.

Part of the participants

It refers to a portion participant device capable of storing data on the device. But you can not start the executable directly from these devices. Part participants important characteristic is that it can store the metadata required for the synchronization, and thus able to synchronize with any full participant. An example of part of party U disk. These devices are similar to the hard disk, the ability to create, update or delete information. But usually they do not provide enable applications to run directly on the device interface.

Simple party

It refers only simple participant information providing device that includes the ability When a request. Such devices can not store or operate the new data, and does not support the creation of new applications. Participants simply rely on the integrity of its participants to store metadata (it can only be synchronized with a specific full participant).

RSS feeds and Web services provided by external organizations (such as Amazon or EBay) are all simple participants. These organizations may give you the ability to perform Web service and retrieve the results, but will not give you the ability to create your own application store your own data or execute on its Web server.

A combination of synchronous participants

The ultimate goal of Microsoft Sync Framework is that no matter what kind of participatory data source types, allow them to integrate. Thus, a simple and partial participants can synchronize information with a complete party involved. But you need to be able to store at least a complete party information and start the synchronization process.

 

Sync Framework core components

Sync Framework includes a run-time, a set of "synchronization provider (synchronization providers)" specific data store, and provides an API for writing a program. Provider is a software component for communication between data sources and other components of the synchronous system. If the Sync Framework has provided the provider for the data storage area we want to synchronize, it is strongly recommended that you use the provider. Provider is scalable, so you can customize them to suit your application. If you want to synchronize we do not provide data storage area provider or if you need other implementations, use a custom provider.

The following figure shows the relationship between all the components of the Sync Framework.

The components in the figures are as follows:

  • 数据库同步提供程序(在以前的版本中称为 Sync Services for ADO.NET)。这些提供程序包含在 Microsoft.Synchronization.dll、Microsoft.Synchronization.Data.dll、Microsoft.Synchronization.Data.Server.dll、Microsoft.Synchronization.Data.SqlServer.dll 和 Microsoft.Synchronization.Data.SqlServerCe.dll 中。它们可用于在以下类型的方案中同步数据库:
    • 协作方案。例如,在一个允许用户共享项目备注的应用程序中,项目团队成员通常需要一份可以处理的数据的本地副本。当他们进行变更时,可以与其他团队成员同步以交换变更,还可以与中央服务器同步变更。
    • 脱机方案。例如,一个销售人员需要在客户的办公室访问产品数据,还必须能上载订单。该销售人员可以在每天早上与中央服务器同步以确保具有最新的产品和价格信息,然后在晚上执行同步以上载当天的订单。
  • 文件同步提供程序(在以前的版本中称为 Sync Services for File Systems)。此提供程序包含在 FileSyncProvider21.dll 和 Microsoft.Synchronization.Files.dll 中。它可用于同步 NTFS、FAT 或 SMB 文件系统中的文件和文件夹。要同步的目录可为本地或远程目录,且不必同属一个文件系统。应用程序可以使用静态筛选器通过显式列出文件或使用通配符(如 *.txt)来排除或包括这些文件;或者应用程序可以设置筛选器来排除整个子文件夹。应用程序还可以注册以接收文件同步进度的通知。
  • Web Feed同步组件(在以前的版本中称为 Sync Services for FeedSync)。这些组件包含在 FeedSync21.dll 和 Microsoft.Synchronization.dll 中。可以通过两种方式使用这些组件:
    • Web Feed同步提供程序服务可用于编写将 FeedSync XML 文件表示为其副本的提供程序。
    • Web Feed生成方和使用方组件可用于将其他类型的副本(如文件系统)的数据与 RSS 或 Atom Feeds同步。
  • 自定义提供程序。这些组件包含在 Synchronization21.dll 和 Microsoft.Synchronization.dll 以及 SimpleProviders21.dll 和 Microsoft.Synchronization.SimpleProviders.dll 中。它们可用于为任何类型的数据存储区创建同步提供程序。例如,如果应用程序包括用于客户联系人跟踪的自定义存储系统,您可以使用简单提供程序或完全自定义提供程序将该数据集成到您的应用程序。
  • 元数据存储服务。此组件包含在 MetaStore21.dll 和Microsoft.Synchronization.MetadataStorage.dll 中。自定义提供程序可以使用该服务作为存储和处理同步元数据的一种便捷方式,特别对于无法存储元数据的副本很适用。元数据存储服务使用占用较小内存和磁盘空间的可靠轻型数据库,可以随提供程序重新分发。该 API 将元数据存储区与用于访问元数据存储区的接口和方法明确区分开,这样既可实现备用存储区,且对提供程序稍作变更即可使用备用存储区。
  • 核心 API 和运行时。这些组件包含在 Synchronization21.dll 和 Microsoft.Synchronization.dll 中。核心API和运行时由除脱机数据库提供程序之外的其他组件使用。

 

Sync Framework系统架构

Sync Framework 使用基于提供程序的体系结构。提供程序使其他同步组件不再涉及每个数据存储区的复杂情况和特定实现。这个体系结构配合使用专门的同步元数据,使得 Sync Framework 可以同步编写了提供程序的任何类型的数据存储区。Sync Framework 提供常见数据存储区(如数据库和 NTFS 文件系统)的提供程序,并允许您为其他类型的存储区编写提供程序。提供程序是 Sync Framework 的主要集成点。

下图显示了 Sync Framework 的高级体系结构。同步总是发生在图中所示的两个副本(或“节点”)之间,但是同步社区(或“拓扑”)可以为任何形状,如中心辐射型、对等等。除了一些例外情况外,每对参与者可以根据应用程序的要求在 2 层或 n 层体系结构上同步。每个 Sync Framework 组件的文档提供有关相应体系结构和安全注意事项的详细信息。

图中的元素分为三种类型:

  • 由开发人员编写的元素。
    • 应用程序根据应用程序的要求调用同步方法、响应事件和处理其他任务。
    • 数据存储区可以是文件系统、关系数据库、平面文件联系人存储区或需要同步的任何其他数据存储区。
    • 数据传输协议确定两个提供程序之间传输数据变更的方式。
  • 由 Sync Framework 提供的元素。
    • 根据使用的是本机代码还是托管代码,应用程序与同步会话或同步控制器通信,后者与每个同步提供程序通信。
    • 同步运行时驱动同步过程并将状态、冲突和错误信息告知客户端应用程序。
  • 由开发人员编写或由 Sync Framework 提供的元素,取决于具体实现方案。
    • 提供程序对于正在同步的数据类型而言是特定的。在某些情况下,应用程序需要必须由开发人员编写的自定义提供程序。Sync Framework 提供了很多简化这一过程的 API,还提供了一些组件帮助完成同步最困难的部分(如冲突检测)。
    • 元数据存储区包含元数据,Sync Framework 使用这些元数据确定每个提供程序应选择哪些变更并将它们应用到所服务的数据存储区。存储和使用元数据的方式取决于所使用的提供程序。例如,用于数据库的提供程序一般将元数据存储在数据存储区所在数据库的跟踪表中。对于自定义提供程序,您可以创建元数据存储区或使用随 Sync Framework 提供的服务。

在了解了Sync Framework的核心组件和系统架构之后,我会在下一篇中详细的讨论Sync Framework的另一个关键特征:Sync Metadata,即同步元数据。

转载于:https://www.cnblogs.com/lifepoem/archive/2012/03/08/2384758.html

Guess you like

Origin blog.csdn.net/weixin_33816946/article/details/93911908