WinFS – Future Technologies Damir Dobric DAENET

Preview:

Citation preview

WinFS – Future WinFS – Future TechnologiesTechnologiesWinFS – Future WinFS – Future TechnologiesTechnologiesDamir DobricDamir DobricDAENETDAENEThttp://developers.de/blogs/damir_dobric/default.aspx

SponzoriSponzori

Sadržaj predavanjaSadržaj predavanja

WInFS history and WInFS history and MotivationMotivation

WinFS Data modelWinFS Data model

WinFS Type SystemWinFS Type System

Item LifetimeItem Lifetime

Item ExtensionsItem Extensions

Item RelationsItem Relations

Future of WinFSFuture of WinFS

Q&AQ&A

History of WinFSHistory of WinFS

Started in the early 1990s. Started in the early 1990s. Dubbed Dubbed Object File System (OFS)Object File System (OFS)it was supposed to be included as part of it was supposed to be included as part of CairoCairo. .

Later during the development of Later during the development of COMCOM, a storage , a storage systemsystem

Called Storage+, Called Storage+, Based on then-upcoming SQL Server 8.0, Based on then-upcoming SQL Server 8.0, Relational File SystemRelational File System, was conceived to be launched , was conceived to be launched with SQL Server 2000, but as SQL Server 2000 ended up with SQL Server 2000, but as SQL Server 2000 ended up being a minor upgrade to SQL Server 7.0, RFS being a minor upgrade to SQL Server 7.0, RFS

On On August 29August 29, , 20052005, Microsoft quietly made Beta , Microsoft quietly made Beta 1 1

Available to MSDN subscribers. Available to MSDN subscribers. It worked on It worked on Windows XPWindows XPIt was refreshed on It was refreshed on December 1December 1, , 20052005 to be compatible to be compatible with version 2.0 of the .NET Framework. with version 2.0 of the .NET Framework.

WinFS MotivationWinFS MotivationUnifyUnify

Structured – DBStructured – DBSemi-structured - XMLSemi-structured - XMLUnstructured – Flat fileUnstructured – Flat file

OrganizeOrganize Think beyond the rigid hierarchy of the traditional Think beyond the rigid hierarchy of the traditional

folder modelfolder model

Explore Explore Efficient exploration of information, powerful Efficient exploration of information, powerful

queriesqueries

Innovate.Innovate.New data platform for application developers New data platform for application developers

What is WinFS? What is WinFS?

Active Storage PlatformActive Storage Platform

Active storage platform for organizing, Active storage platform for organizing, searching, and sharing all kinds of information searching, and sharing all kinds of information

Rich data model on the top of a relational Rich data model on the top of a relational storage enginestorage engine

Flexible programming model – WinFS APIFlexible programming model – WinFS API

File SystemFile System

For file-based data (text documents, audio For file-based data (text documents, audio tracks, video clips ..)tracks, video clips ..)

Efficient indexing and streaming capabilitiesEfficient indexing and streaming capabilities

Some key points Some key points

Traditional DB -> Relational dataTraditional DB -> Relational data

Traditional Fileystems: ThreeTraditional Fileystems: Three

WinFS -> Directed Acyclic Graph WinFS -> Directed Acyclic Graph (DAG)(DAG)

WinFS -> HighLevel databaseWinFS -> HighLevel database

WinFS - Data ModelWinFS - Data ModelSchemasSchemas

TypesTypes

ItemsItems

AttributesAttributes

FragmentsFragments

ExtensionsExtensions

AssociationsAssociations

Item

Attr1 Attr2 Attr N

relationship

Item

Attr1 Attr2 Attr N

Item

Attr1 Attr2 Attr N

Organization of the dataOrganization of the dataBy types and attributesBy types and attributes

Predefined Types (Person, Contact, Predefined Types (Person, Contact, Document,..)Document,..)Custom Types (Type Definition Language)Custom Types (Type Definition Language)

By Relationship (Item Associations)By Relationship (Item Associations)Containment RelationshipsContainment RelationshipsLinksLinksSharing of common valuesSharing of common values

By grouping in categoriesBy grouping in categories

Type Definition LanguageType Definition Language

XML VocabularyXML Vocabulary

<?xml version="1.0"?>

<Schema Version="0.2.0" Alias="Contacts"Namespace ="System.Storage.Contacts“xmlns="http://schemas.microsoft.com/winfs/2003/09/schema" >

<Using Version="0.1" Alias="WinFS" Namespace="System.Storage" />

<Using Version="0.1" Alias="Core" Namespace="System.Storage.Core" />

<EntityType Name="Contact" BaseType="WinFS.Item" > <Property Name="EAddresses"

Type="Array(Core.EAddress)" Nullable="true" ChangeUnit="EAddressesCu"> </Property>

...

Types in WinFSTypes in WinFSScalar TypesScalar Types

Enumeration TypesEnumeration Types

Inline TypesInline TypesI.e. FullNameI.e. FullName

Entity TypesEntity TypesItemItem

LinkLink

ItemFragmentItemFragmentSet of other typesSet of other types

ExtensionsExtensions

Type System - ExamplesType System - ExamplesWinFS CLR type

String String

Binary Byte[]

Boolean Boolean

Byte Byte

Int16 Int16

Int32 Int32

Int64 Int64

Single Single

Double Double

Decimal Decimal

DateTime DateTime

Guid Guid

WinFS ItemWinFS Item

Item is the smallest unit of dataItem is the smallest unit of data

Imagine Item as a vector Imagine Item as a vector

Item is strongly typedItem is strongly typed

Item is a root in the hierarchyItem is a root in the hierarchy

Item is abstract class:Item is abstract class:public abstract class Item : Entitypublic abstract class Item : Entity

Currently defined itemsCurrently defined itemsClass Description

Audio.RadioStation Represents a radio station that may provide streams of radio.

RadioStreams Represents a radio stream that a radio station provides.

Schedule A collection of events, appointments, or meetings associated with a user.

ScheduleEntry An item that records the occurrence of something in the environment.

Contact Represents either an organization or a person

OpaqueItem Represents the opaque binary data.

Document An item that represents content that is authored

Folder A Folder item is a container of items..

GenericFile Represents a generic file item.

Document Represents audio documents, such as tracks and albums.

Message Represents any message in the system.

Rule An abstract base class for all "WinFS" rule objects.

Share Represents information about a "WinFS" share.

StoreInfo Represents information about a "WinFS" store.

Sync.Conflict Provides custom methods for the conflict object

NonSynchronizedItem All item types deriving from this type and all entities located below this item

Video.VideoClip Represents a video clip.

Life time of an ItemLife time of an Item public static void CreateItem() { using (WinFSData store = new WinFSData()) { Document doc1 = new Document(); doc1.DisplayName = "docX";

Document doc2 = new Document(); doc2.DisplayName = "docX";

Folder root = store.GetRootItem() as Folder; root.Children.Add(doc1); root.Children.Add(doc2);

store.SaveChanges(); } }

DEMO: Item LifetimeDEMO: Item LifetimeDEMO: Item LifetimeDEMO: Item Lifetime

Item ExtensionsItem Extensionspublic void AppendKeyword(string keyWord){ Folder folder = store.Items.FilterByType<Folder>().

Filter("DisplayName == 'ExtensionHandling'"). GetFirst();

Document doc = new Document(folder); doc.NamespaceName = "KeyWordTest.doc"; doc.DisplayName = "KeyWordTest"; doc.Title = "Daenet Keyword Test"; Keyword keyW = new Keyword(keyWord); ItemKeywords kwds = new ItemKeywords(); kwds.Keywords.Add(keyW);

doc.Extensions.Add(kwds);

store.SaveChanges(); }

string filterExpression =

"Exists(Extensions.FilterByType(@0).Filter(Exists(Keywords.Filter(Value==@1))))";

DEMO: Item ExtensionsDEMO: Item ExtensionsDEMO: Item ExtensionsDEMO: Item Extensions

Item Relations Item Relations LinksLinks

Relation between EntitiesRelation between Entities

Defined by Source and TargetDefined by Source and Target

Link Link isis physical construct in store physical construct in store

AssociationsAssociationsEntity based (Links)Entity based (Links)

None Entity basedNone Entity based

Association Association is notis not a physical a physical construct in storeconstruct in store

API generator creates Helper classAPI generator creates Helper class

LinksLinks

System.Object System.Object       System.Storage.StoreObjectSystem.Storage.StoreObject           System.Storage.EntitySystem.Storage.Entity       System.Storage.Link      System.Storage.Link                  System.Storage.Calendar.ScheduledEntryLinkSystem.Storage.Calendar.ScheduledEntryLink                   System.Storage.FolderToStoreInfoLinkSystem.Storage.FolderToStoreInfoLink                   System.Storage.Messages.AttachmentLinkSystem.Storage.Messages.AttachmentLink                   System.Storage.Video.ClipsSystem.Storage.Video.Clips

Item 1

Attr1 Attr2 Attr N

Link

Item 2

Attr1 Attr2 Attr N

Linking of itemsLinking of items public void CreateDocumentsAndRelations() { // Create documents and one message. Document document1 = new Document(folder); Message message = new Message(folder);

document1.DisplayName = "Document1"; document1.NamespaceName = "Document1"; message.DisplayName = "Message1"; message.NamespaceName = "Message1"; // Create the link. AttachmentLink link1 = new AttachmentLink(message, document1);

store.SaveChanges(); }

Searching for LinksSearching for Links

StorageSearcher<AttachmentLink> linkSearcher = store.Links .FilterByType<AttachmentLink>() .Filter("Exists(Target.NamespaceName like '@0')", "Document%)");

foreach (AttachmentLink l in linkSearcher) { if (l.Source != null && l.Target != null) { Console.WriteLine(l.Target.NamespaceName + " - " +

l.Source.NamespaceName); } }

DEMO: Linking of itemsDEMO: Linking of itemsDEMO: Linking of itemsDEMO: Linking of items

• API Generator

• Three entities: Link, Source and Target

• LinkRelation Helper Class

Entity Based AssociationsEntity Based AssociationsGetLinksGivenSource

Finds all links associated with a single source item. This method is not CLS-compliant.

GetLinksGivenSources Finds all links associated with a collection of sources. This method is not CLS-compliant.

GetLinksGivenTarget Finds all links associated with a single target. This method is not CLS-compliant.

GetLinksGivenTargets Finds all links associated with a collection of targets. This method is not CLS-compliant.

GetSourcesGivenLinks Finds all sources associated with a collection of links. This method is not CLS-compliant.

GetSourcesGivenTarget Finds all sources associated with a single target. This method is not CLS-compliant.

GetSourcesGivenTargets Finds all sources associated with a collection of targets. This method is not CLS-compliant.

GetTargetsGivenLinks Finds all targets associated with a collection of links. This method is not CLS-compliant.

GetTargetsGivenSource Finds all targets associated with a single source. This method is not CLS-compliant.

GetTargetsGivenSources Finds all targets associated with a collection of sources. This method is not CLS-compliant.

None Entity Based AssociationsNone Entity Based Associations

UserTask PrimaryTask = new UserTask();

PrimaryTask.DisplayName = "Birthday UserTask"; PrimaryTask.NamespaceName = "Birthday UserTask"; PrimaryTask.CorrelationId = new CorrelationId("PrimaryTaskId"); exampleFolder.Children.Add(PrimaryTask);

UserTask SubTask1 = new UserTask();

SubTask1.DisplayName = "Arrange Hall";

SubTask1.NamespaceName = "Arrange Hall";

SubTask1.TaskParentTask = new CorrelationId("PrimaryTaskId"); exampleFolder.Children.Add(SubTask1);

StorageSearcher<UserTask> ParentTaskSearcher = TaskParentTasks.GetParentTasksGivenTask(t);

WinFS ServicesWinFS ServicesRsFxSvc.Exe, RsFxDrv.SysRsFxSvc.Exe, RsFxDrv.Sys

C:\RsFxName\MachineName\DefaultStoreC:\RsFxName\MachineName\DefaultStoreCoordinate file servicesCoordinate file servicesE.g.: >pushdE.g.: >pushd

WinFS.exeWinFS.exeC:\System Volume Information\WinFS\C:\System Volume Information\WinFS\{15836D96-5B44-4DB9-AD69-{15836D96-5B44-4DB9-AD69-3C76B99C8571}3C76B99C8571}\\\Database.mdf\Database.mdf\Database.ldf\Database.ldf

WinFS Search serviceWinFS Search serviceWinFS File Promotion managerWinFS File Promotion managerWinFS SyncWinFS SyncWinFS Rule EngineWinFS Rule Engine

WinFS ArchitectureWinFS Architecture

WinFS vs. NTFS?WinFS vs. NTFS?

Relational Storage EngineRelational Storage EngineExpanded to stores streamsExpanded to stores streams

Called: File Backed ItemsCalled: File Backed Items

WinFS works with Item onlyWinFS works with Item only

Win32 API works with streams Win32 API works with streams onlyonly

MetadataServices keeps MetadataServices keeps consistency (stream <-> item)consistency (stream <-> item)

Promotion, DemotionPromotion, Demotion

NTFS File SparsingNTFS File SparsingHANDLE hFile = ::CreateFile("file.dat:alt", ... HANDLE hFile = ::CreateFile("file.dat:alt", ...

::DeleteFile("file.dat:alt"); ::DeleteFile("file.dat:alt");

>echo "alternative stream" > SparseMainStream.txt:AltStream.Txt

>notepad SparseMainStream.txt:AltStream.Txt

DEMO: DEMO: Copy a File Between NTFS and Copy a File Between NTFS and

WinFSWinFS DEMO: DEMO: Copy a File Between NTFS and Copy a File Between NTFS and

WinFSWinFS

WinFS PerformanceWinFS Performance

foreach (Person person in peopleSearcher)

{

// Avoid such queries !

foreach (ContactCard card in person.ContactCards)

{

Console.WriteLine(" " + card.Label);

}

}

StorageSearcher<StorageRecord> searcher =

wData.Items.FilterByType<Person>()

.Filter( "Container.ItemId = @0", exampleFolder.ItemId)

.Project("it as Person, ContactCards as ContactCards");

foreach (StorageRecord record in searcher)

{

Person person = (Person)record["Person"];

IList<ContactCard> contactCards =

(IList<ContactCard>)record["ContactCards"];

foreach (ContactCard card in contactCards)

{

Console.WriteLine(" " + card.Label);

}

}

Future of WinFSFuture of WinFSWinFS Beta 2 is planned for WinFS Beta 2 is planned for May 1May 1, , 20062006. .

It will include integration with It will include integration with Windows Desktop SearchWindows Desktop Search, ,

It will also include integration with It will also include integration with ADO.NETADO.NET API. API.

A third Beta is scheduled for A third Beta is scheduled for NovemberNovember 20062006. .

The final release is not likely to be available until The final release is not likely to be available until late 2007. It is not clear at this time whether the late 2007. It is not clear at this time whether the final release of WinFS will be included with final release of WinFS will be included with Windows Server "Longhorn"Windows Server "Longhorn" or not. or not.

www.daenet.dewww.daenet.de

www.daenet.bawww.daenet.baDamir Dobric Blog: http://developers.de/blogs/damir_dobric/default.aspxDAENET team blog: http://Developers.deJob at DAENET: http://homepage.daenet.de/portal/templates/jobmail.htm

Damir DobricDamir DobricDAENET GmbHDAENET GmbH

www.daenet.dewww.daenet.demailto:ddobric@daenet.demailto:ddobric@daenet.de