Synchronize your WinFS data with Microsoft Rave

As some of you may have discovered there is a set of applications on the WinFS CD. Some of these are officially “unsupported”, but are included because they demonstrate some of the capabilities of the WinFS platform.

I’m going to describe Microsoft Rave, which is one such application. A little background – I work on WinFS Synchronization, and last year was tasked with building an application that the WinFS team could use to “self host” the sync features. Self-hosting is what product development teams do by internally deploying our code so that we have a day-to-day feel for the product. The idea is to have the product team go through the experiences a customer is likely to encounter, and so help ship a better product.

Microsoft Rave is designed to make it easy to synchronize your data using WinFS. You can synchronize between multiple computers running WinFS, and also between different users, while granting access to only those you want to synchronize your data with. WinFS has the ability to synchronize any of your data (Contacts, Email, Documents, Photos etc) regardless of which application created it. Rave allows you to select your data using Windows Explorer, and set it up for synchronization. You can then invite your friends and colleagues who have also installed WinFS to synchronize your data. Thus, you can share out your photos, contacts, and documents easily and have changes to them automatically replicated to others.

The documentation for Microsoft Rave is included on the CD, so I won’t talk a lot about how to actually use Rave. Instead, I’ll focus on what the experience was like developing Rave on top of WinFS. First, we recognized the importance of providing a secure sharing experience between the various users. Next, we wanted to make sure that replication occurs automatically when changes to the data occur on any of the computers. In addition, there was the need to grant various levels of access to the data. The key, though, is that once synchronization is set up, no further management should be necessary, and that the data should always be kept up to date on all computers.

WinFS Synchronization handles all the platform level details of peer to peer change enumeration and application, conflict detection, automatic conflict resolution and conflict logging. These are described in the WinFS SDK. This represents a huge investment by Microsoft that makes it easy for an application to distribute its data. Rave was built on top of the platform level synchronization services. Rave implements a full mesh network topology to connect every user to every other user of a synchronized folder using WinFS Synchronization. The list of users and computers (shares, really) that synchronize with each other is itself synchronized through the “community.” So, if I invite Shishir to synchronize with a WinFS folder, the membership list is updated to include Shishir. This membership list is replicated to all the existing users that synchronize with that folder. (For those interested in the details, there is a hidden WinFS Item – a Replica – that stores all the sync metadata. This item is stored underneath your synchronized folder. Rave stores the membership list and other configuration data under this Replica.)

Briefly, the replicated data is secured as follows. The first time synchronization is enabled for a folder, Rave creates a new WinFS share (similar to a Windows share) for that folder. It also creates three security groups, one for each of the roles Rave supports (Reader, Writer, and Manager – these are described in the Rave application documentation.) If the membership list changes (either locally or because a change to the list was synchronized in), Rave detects the change (using WinFS Watcher notifications) and updates the memberships to the security groups for the appropriate folder. If you have installed Rave, you can use the WinFS Stores tool to view the shares and their security permissions. You can also use the Computer Management tool to view the membership of each security group, and verify that Rave sets it up correctly. Finally, Rave also sets up item level security to grant access to just these security groups. As with Windows shares, WinFS access checks are done both at the share level and at the data level. Rave handles all these details automatically.

In addition, Rave waits for data changes to occur using the WinFS Watcher notification API. This API make it extremely simple to detect when changes to data occur. I expect this (along with the WinFS Synchronization services) to enable a new breed of easy to build workflow type applications that can react to changes that are made on other computers and then synchronized locally. As an example, consider a factory in which each unit periodically records its status into a local WinFS and then synchronizes this data into a management computer that can react to various situations and possibly even synchronize configuration changes back down to the individual units. Such applications can of course be written without WinFS and do in fact exist today. However, WinFS with its rich type system, notifications and synchronization services, makes this type of application a whole lot easier to build.

There were several things that could have been added to Rave that didn’t make it onto the beta. Enabling synchronizing between WinFS and external data, such as the file system, by using the WinFS File System synchronization adapter, was one such. Another area was a rich conflict policy and resolution user interface. WinFS offers very detailed control over what happens when a conflict occurs. Rave currently uses a last-writer-wins policy in the case of concurrent updates (and a merge policy in case of concurrent creates, which is a topic I won’t go into.)

When I consider what it would take to develop a peer-to-peer application like Rave in the absence of a powerful storage platform like WinFS, I think “several years” rather than the several months that it actually took. Hopefully this post helped describe why – no other general purpose store or file system provides the synchronization support, data change notifications, and security that WinFS does. Implementing a peer-to-peer data synchronization application like Rave in absence of these services would have been a daunting undertaking indeed.

If you’ve started using Rave and have ideas for what you’d like to see, we’d really like to hear from you! Post your comments and we’ll be sure to read them.

Author: Vivek Jhaveri