34
WinFS – Future WinFS – Future Technologies Technologies Damir Dobric Damir Dobric DAENET DAENET http://developers.de/blogs/damir_dobric/default.aspx

WinFS – Future Technologies Damir Dobric DAENET

Embed Size (px)

Citation preview

Page 1: WinFS – Future Technologies Damir Dobric DAENET

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

Page 2: WinFS – Future Technologies Damir Dobric DAENET

SponzoriSponzori

Page 3: WinFS – Future Technologies Damir Dobric DAENET
Page 4: WinFS – Future Technologies Damir Dobric DAENET

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

Page 5: WinFS – Future Technologies Damir Dobric DAENET

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.

Page 6: WinFS – Future Technologies Damir Dobric DAENET

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

Page 7: WinFS – Future Technologies Damir Dobric DAENET

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

Page 8: WinFS – Future Technologies Damir Dobric DAENET

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

Page 9: WinFS – Future Technologies Damir Dobric DAENET

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

Page 10: WinFS – Future Technologies Damir Dobric DAENET

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

Page 11: WinFS – Future Technologies Damir Dobric DAENET

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>

...

Page 12: WinFS – Future Technologies Damir Dobric DAENET

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

Page 13: WinFS – Future Technologies Damir Dobric DAENET

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

Page 14: WinFS – Future Technologies Damir Dobric DAENET

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

Page 15: WinFS – Future Technologies Damir Dobric DAENET

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.

Page 16: WinFS – Future Technologies Damir Dobric DAENET

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(); } }

Page 17: WinFS – Future Technologies Damir Dobric DAENET

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

Page 18: WinFS – Future Technologies Damir Dobric DAENET

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))))";

Page 19: WinFS – Future Technologies Damir Dobric DAENET

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

Page 20: WinFS – Future Technologies Damir Dobric DAENET

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

Page 21: WinFS – Future Technologies Damir Dobric DAENET

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

Page 22: WinFS – Future Technologies Damir Dobric DAENET

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(); }

Page 23: WinFS – Future Technologies Damir Dobric DAENET

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); } }

Page 24: WinFS – Future Technologies Damir Dobric DAENET

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

Page 25: WinFS – Future Technologies Damir Dobric DAENET

• 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.

Page 26: WinFS – Future Technologies Damir Dobric DAENET

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);

Page 27: WinFS – Future Technologies Damir Dobric DAENET

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

Page 28: WinFS – Future Technologies Damir Dobric DAENET

WinFS ArchitectureWinFS Architecture

Page 29: WinFS – Future Technologies Damir Dobric DAENET

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

Page 30: WinFS – Future Technologies Damir Dobric DAENET

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

Page 31: WinFS – Future Technologies Damir Dobric DAENET

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

Page 32: WinFS – Future Technologies Damir Dobric DAENET

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);

}

}

Page 33: WinFS – Future Technologies Damir Dobric DAENET

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.

Page 34: WinFS – Future Technologies Damir Dobric DAENET

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:[email protected]:[email protected]