An Opinion blog

My Links

Story Categories

Archives

Post Categories

Image Galleries

Login


Remember

Disclaimer

This site is operated by Mike Deem. The opinions expressed here are mine. They are not necessarily my employer's or anybody else's.

WinFS = Windows Foo System

I need to clear up a misconception about WinFS: it isn't a system for storing metadata associated with files.

WinFS is an item store. Items have a type which defines the properties that make up that item. Item types are arranged in a type hierarchy, rooted with a base Item type. For example, here is the WinFS schema for a Foo item type:

<Schema Name="FooSchema" xmlns="http://schemas.microsoft.com/winfs/2002/11/18/schema">

  <Using Namespace="System.Storage"/>
  <Using Namespace="System.Storage.WinFSTypes"/>

  <ItemType Name="Foo" BaseType="System.Storage.Item">
    <Property Name="Bar" Type="System.Storage.WinSFTypes.Int32"/>
  </ItemType>

</Schema>

If I run this schema through our API generator and install the schema in WinFS (neither of which are possible with the PDC release, sorry), I can write the following code to create a Foo item in the store:

ItemContext ic = ItemContext.Open();
Foo foo = new Foo();
foo.Bar = 42;
Folder folder = Folder.GetRootFolder( ic );
folder.OutFolderMemberRelationships.AddMember( foo );

ic.Update();

I can find a Foo item using this code:

ItemContext ic = ItemContext.Open();
Foo foo = Foo.FindOne( ic, "Bar = 42" );

At no time was a file created in order to store my Foo item. The best conceptual analogy (and more or less the technical truth) is that a row was inserted into a database.

Now, it so happens that we are using this item store to store meta-data associated with a file. We do this as follows:

1) A file system redirector is part of WinFS. That is the thing that handles UNC paths like \\localhost\DefaultStore (if you are on a Longhorn box, you should be able to click on this link to open your WinFS store).

2) When a file is created through this redirector, WinFS creates an item that represents that file. This item and the file are tightly bound. When the file is deleted, the item is deleted.

3) WinFS looks up a registered file property handler using the file's extension. The handler knows what type of item to create and how to move meta-data between the file content and the item (in the PDC release, this happens only in one direction: from the file to the item. This will work in both directions before WinFS is finished).

In WinFS lingo, such an item is called a file backed item. It is distinct from the Foo item I created in the example above which we call a native item. Many of the types in the WinFS schemas we intend to ship with Windows are likely to be used for file backed items most of the time. For example, Document, Track, and Image. Other types will rarely be used for file backed items. Person, Organization, and Group come to mind.

Note: I decided to change the schema and code examples in this post to a version that is a little newer then that that shipped with the PDC release. We are making changes for good reason... like the new stuff makes more sense and is easier to explain.

posted on Saturday, November 15, 2003 11:30 PM

Feedback
Post a Comment

Remember Me?