Introducing the Microsoft Sync Framework: Next Generation Synchronization Framework (Cont.)
Components of the Microsoft Sync Framework
The synchronization framework team designed the Microsoft Sync Framework as a componentized and layered architecture to allow developers to pick and choose only what they require to enable their scenarios and ensure that assets built on the framework could participate in the content flow ecosystem we’re working to grow.
Microsoft designed the Microsoft Sync Framework as a componentized and layered architecture to allow developers to pick and choose only what they require to enable their scenarios and ensure that assets built on the framework could participate in the content flow ecosystem we’re working to grow.
The Microsoft Sync Framework’s designers divided these components into the following logical layers, which are available to both managed and native code developers. (Note: Device builds for ARM, SH, x86, MIPS as well as Apple Mac support are in development and will be provided in a future CTP on MSDN).
- Core Sync Runtime. Infrastructure that includes the algorithms to utilize the metadata as well as components to drive roaming, sharing, offline, and sync on behalf of applications.
- Sync Provider Framework. Components designed to make it easier to expose data to the platform. This is effectively the plug-in model to the Microsoft Sync Framework by which developers can either configure existing Sync Providers or write their own.
- Domain-specific components. Infrastructure to facilitate the rapid development of end-to-end solutions involving specific stores such as SQL Server, SQL Server Compact, FAT, NTFS, etc.
Core Sync Runtime
The core runtime contains the metadata services used by all of the Microsoft Sync Framework clients. Some of the features include:
- Multi-master metadata representation and management, including conflict detection, custom and preset conflict resolution handling, change enumeration assistance, etc.
- Conflict preservation management and representation of conflict resolution.
- Support for change units (tracking changes at a property level) and consistency units (dealing with logical groupings of objects).
- Handling of filtering changes and filter sync (both for items and for parts of items).
- Recovery from a multitude of failure scenarios, such as tombstone cleanup, interruptions, network failures, etc.
- Synchronization session management, such as cancellation, progress reporting, etc.
The Microsoft Sync Framework provides an out-of-the-box Synchronization Agent that can synchronize endpoints when requested. The endpoints are abstracted using the notion of a Sync Provider, which is responsible for exposing the capabilities of a given endpoint, store or protocol. Applications use Sync Providers for the stores they need to synchronize and developers use the Microsoft Sync Framework to create custom Sync Providers for virtually any type of data.
Core to the framework is support for Simple Sharing Extensions (SSE). The Microsoft Sync Framework natively supports endpoints that wish to interoperate using SSE extensions for RSS and ATOM feeds. Furthermore, the framework provides services for feed generation and consumption, including the requisite conflict detection and preservation. While the Microsoft Sync Framework offers RSS/ATOM support out-of-the-box, developers can extend this support to other formats as well. High level producer/consumer APIs help easily turn any “Microsoft Sync Framework” provider into an SSE-enabled endpoint!
Sync Provider Framework
The Microsoft Sync Framework supports several ways of writing Sync Providers. Each is intended to make the experience as easy and efficient as possible. In addition to full-featured (that is, “full participant”) providers that are capable of true peer-to-peer sync, the framework provides support for allowing legacy and existing devices and applications to participate in the content flow ecosystem. Specifically, the Microsoft Sync Framework Sync Providers support the following scenarios:
- Partial Participants. Providers that simply store but do not understand most of the sync metadata (e.g. a USB keychain, legacy phone, media device). Despite being very easy to develop even on endpoints that do not host the Microsoft Sync Framework engine, these providers can participate in all multi-master content flow scenarios.
- Simple Participants. Endpoints that lack the ability to detect changes and that lack the ability to store metadata. The Microsoft Sync Framework has services to allow data from these participants to flow within the ecosystem on behalf of a fully featured participant/provider.
- Anchor-Based Providers. Support for providers that rely on a simple tick-count based enumeration mechanism for their change detection mechanism (e.g. timestamps, tick counts, etc.).
Storage Specific Components
In addition to the Microsoft Sync Framework-enabled Sync Providers in development across Microsoft, the Microsoft Sync Framework includes several components to simplify the development of offline, sync, sharing, and roaming scenarios using specific stores and protocols. These components include:
- Relational Data Providers. Synchronization Services for ADO.NET 2.0, the next version of Sync Services discussed in Steve Lasker’s article, (“Caching with SQL Server Compact and Sync Services for ADO.NET” in this issue of CoDe Focus) will ship with SQL Server 2008. Sync Services 2.0 is built on the Microsoft Sync Framework aligning these two evolving sync platforms. It continues to dramatically simplify the caching of a remote or local database for scenarios such as line of business and branch office/point-of-sale scenarios, while providing peer-to-peer and other advanced sync capabilities. These providers take full advantage of the new change-tracking features in SQL Server 2008 and SQL Server Compact.
- SQL Server Compact Metadata Store. A ready-to-use component for storing sync metadata such as versions, anchors, and change detection information. This component greatly simplifies the development of custom providers that do not have a natural place to store metadata.
- File and Folder Sync Provider. A ready-to-configure provider capable of representing any Win32-compatible file system (e.g. FAT, NTFS, removable device). This provider handles challenges such as change detection on FAT volumes (including move and rename heuristics), name-name collision resolution, update-delete conflicts (including hierarchical update-delete), and the ability to preview a synchronization action.
- ADO.NET Data Services Offline Provider. ADO.NET Data Services providers are currently being explored through prototypes that allow synchronizing data using REST-style interfaces for taking data services offline.
- Plus many more providers currently in development across Microsoft!
Sync-Enabled Content Flow Scenarios
By removing the requirement that endpoints need intimate knowledge of one another in order to share or roam data, the Microsoft Sync Framework creates a sync-enabled occasionally connected ecosystem capable of providing:
- Offline support for rich Internet applications. Ability to take a Web service or an Internet application offline with all changes synced back to any other endpoint without conflicts.
- Calendar, Contact, Task List sync. Support for field-level sync such as “first name,” “last name” in an item-enabled rich PIM sync scenario.
- Rich media sync. Ability to efficiently sync a full media library, or smaller subset, to the cloud or to devices either directly from another endpoint or through intermediaries. Ability to sync properties such as ratings and play count without transferring the entire media file.
- Easy caching. The ability to easily cache a subset of the information from a remote or local store to support offline scenarios.
- Sharing. Ability to have endpoints, such as devices, share data between any number of devices, clients, and services with edits possible at any node. This makes tethered or over-the-air sharing or roaming of media, PIM, files, and settings a breeze.
While this is an introductory, high-level overview of the Microsoft Sync Framework CTP1, you’ll find plenty of material including “How-to” documents, full-featured samples, articles, and white papers as we unveil the framework on MSDN and at conferences in North America and Europe.
Please visit http://msdn.microsoft.com/sync to get a copy of the Microsoft Sync Framework CTP1 SDK! I’m personally looking forward to reading your comments and feedback as we extend the framework and deliver on the content flow vision and strategy. I encourage developers to evaluate the SDK and request the features and improvements that will help you become more productive and the platform easier to use. We can be reached at email@example.com and look forward to your feedback!
Data Platform Team
“I think we’re moving to the point that the cloud is becoming the next great platform for people to build applications on.”
Sam currently leads the Data Programmability team at Microsoft, in the SQL Server division; Sam is responsible for building out the data platform development strategy and engineering, shipping XML and Data platform technology in the .NET Framework and throughout the SQL Server product line. Sam is also responsible for core XML and Data access components in the Windows platform, Internet Explorer, and Office.
Sam has been in the software industry for more than 18 years. Prior to joining Microsoft, Sam was Vice President Engineering for LinkExchange, an early provider of Internet marketing services acquired by Microsoft in 1998 and Vice President Engineering for Cygnus Solutions, a provider of compiler and development tools to the open source community, since acquired by Red Hat Software. In the early nineties, he was a Principal Software Engineer at Cognex Corporation, a leading manufacturer of machine vision systems for factory automation and robotics. Sam started his software engineering career as Vice President Engineering for Zortech, which shipped the first native code compiler for C++. Sam is a graduate of MIT's VI-3 EECS program, a former offensive lineman for the Engineers, and now lives in Seattle, WA.