mim architecture overview

24
MIM Architecture Overview Tim Dowty 12/15/04

Upload: tim-dowty

Post on 18-Aug-2015

39 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: MIM Architecture Overview

MIM Architecture Overview

Tim Dowty12/15/04

Page 2: MIM Architecture Overview

MIM Goals

• Simplify music client programming Encapsulate jukebox functionality Provide consistent access across all items of

interest

• Provide platform for expandability Metadata formats Devices and device families

• Enhance product functionality and scalability Query-able/scalable database Improved portable plug-in API

Page 3: MIM Architecture Overview

What Is the MIM?

• Defines a classic n-tiered architecture Client(s) + business logic + persistent storage MIM comprises the non-client tiers

• Provides a device management system

• Provides a framework for client async operation and control

• MIM provides (almost) all jukebox client services No play services A few other services performed on the client side

(i.e. Cdi lookup, line-in recording)

Page 4: MIM Architecture Overview

Client

Business Logic

Storage(database/ media)

MIMLayer

Client

Business Logic

Storage(database/ media)

MIMLayer

MIM Service Tiers

MIM Sync Jobs

MIM Async Jobs

DB Manager

Device Manager

MIM URI Naming

MIM Basic Objects

Page 5: MIM Architecture Overview

MIM Tiered Services

• Asynchronous jobs Run from high/low priority thread pools

• Synchronous jobs Normal method calls on RPC threads

• Integrated device/metadata system Database (virtual) Devices/media (physical)

• Naming system for objects of interest MIM URIs

• System-wide object abstraction Basic objects

Track, playlist, device, media, etc.

Page 6: MIM Architecture Overview

MIM High-level Architecture

MIM

Data

base

Device Manager

InternetStreams

Local Disks CDs/DVDs Portables Future...

- Peer J ukeboxes- Telephones- UPnP devices- Cameras- Others...

- WM Streams- Shoutcast- Others...

- Fixed andremovabledisks

- Network andsubst drives

- Zip/ J az/etc.- USB/Firewire/etc.

- Fixed andremovabledrives

- USB/Firewire/etc.

- Legacyportables

- WMDM- Othercurrent andnewportables

MIM J obs

TOD

DB Manager

- MM Track OnDemandstreams

MIM creates, dispenses,and enqueus async jobs

on client requestCopyCreateDeleteQuery

Updateetc...

MIM also implementsand exposes a set of

synchronous jobs

Page 7: MIM Architecture Overview

The Device Problem

• Devices are intrinsically different in their capabilities

• But… We want to provide a consistent content/metadata

model to clients We want to provide “anywhere to anywhere” copy

capability where allowed

Page 8: MIM Architecture Overview

Portable Devices

• Highest degree of variation is here

• Intrinsic device capabilities Format, bitrate, DRM support

• OEM API support Level of abstraction Deployment/packaging Playlist support

• Can’t use windows URLs to specify content on all devices

Page 9: MIM Architecture Overview

Other Devices

•CD device Capabilities change

when different media inserted

Try to get metadata from an RBA CD …Go fish!

•Track-on-demand device Metadata lives on a

remote server Tracks/playlists exist

in library only when user logged on

When track is in play queue we need MD even when not logged on

Page 10: MIM Architecture Overview

Device System Components

Device Manager

Device Factory

Device Object Device Object

Entry point

Creates and manages lifetime of device factories

Provides device arbitration (more than one factory claims device)

Participates in MIM URI building/parsing

Manages a device family (CDs, portables, etc.)

Creates and manages lifetime of individual device objects

Monitors and events device arrivals/departures

Participates in MIM URI building/parsing

Device Device

Manages one device and its mounted media

Monitors and events media arrivals/departures

Participates in MIM URI building/parsing

Events adds/deletes/updates of managed items

Advertises the capabilities of the device

Implements needed abstractions

Media Media

Page 11: MIM Architecture Overview

Typical Device Manager Usage

• What are the currently known device families?

• Give me pointers on all of the CD/DVD devices

• Give me a pointer on the device object that holds the item with this URI

• Give me the current URL that corresponds to the item with this URI

• What kind of object is represented by this URI?

Page 12: MIM Architecture Overview

Database System

• Database manager is layered on top of OLEDB Database engine is MS Jet

• Implements a custom schema and query format targeted to our specific needs

• Produces events on add/delete/update of content

• Provides automated db backups and restores

• Enables automatic schema changes in the field

Page 13: MIM Architecture Overview

MIM URIs

• Defines a hierarchical namespace to contain all items “in the system”

• MIM URIs are handled by clients but always opaquely No parsing on the client side

• Knowledge of parsing format is encapsulated and distributed by URI segment Moniker-like scheme is extensible as new device and

item types are added to the system

Page 14: MIM Architecture Overview

MIM URI Examples

mi m: dat abase: t r ack: 2CAC2FA7- 18CF- 4A6C- 9344- 97724180F56A

mi m: devi ce: l ocal di sk: medi ai d: c402d8a1: t r acki d: \ Document s and Set t i ngs\t dowt y\ My Document s\ My Musi c\ Mount ai n\ Cl i mbi ng! \ Mount ai n - Si l verPaper . WMA

mi m: devi ce: st r eam: medi ai d: st r eam: t r acki d: ht t p: / / 205. 188. 234. 38: 8002

Device URIs

Database URI

Page 15: MIM Architecture Overview

MIM Serves Multiple Clients

MIM

MMJ B

Library GUI

Auto DJ

Tag Editor/SuperTagging

Playlist Window

Recorder Window

Burner Plus(until inc. in MMJ B)

MMJ B Tray AppEngineering Test

Apps

Printing

Portables Window

- MIM is a COM EXE server

- MIM runs in its ownprocess

- Clients communicate viastandard COM interfaces

Clients may subscribe to eventsof interest Content add/delete/update Device/media arrival and

departure

UPnP Server

Page 16: MIM Architecture Overview

Client/MIM Job Interaction

miMIMJobs::QueryMetadata()

moMIMJobQueryMetadataCoCreateInstance()

Return(miMIMJobQueryMetadata*)

miMIMJobQueryMetadata:SetParams()

Return()Return(miMIMJobCtrl*)

miMIMJobs::QueueForegroundJob(miMIMJobCtrl*)Job is enqueued in the MIM foreground thread pool. When a foreground thread becomes available, the job is executed on the pooled thread

_miMIMJobEvent::JobStart()miMIMJobCtrl::Execute()

Return(plRequestedChunkSize)

_miMIMJobEvent::JobProgress()

Return(plRequestedChunkSize)

_miMIMJobEvent::JobMessage()

Return(plMessageReturn)

_miMIMJobEvent::JobComplete()

Returnp()

On error only

May repeat: one progress per job atom

Client MIM

Page 17: MIM Architecture Overview

Client Async Job Details

• Client provides _miMIMJobEvent* for callbacks Direct callback -- not a connection point event

• Client receives miMIMJobCtrl* on job object Permits enqueueing of job to run on a thread from

MIM’s foreground or background thread pool Permits for cancel and pause/resume of running job

Page 18: MIM Architecture Overview

Client Async Job Details (cont.)

• Job payload(s) are returned in _miMIMJobEvent::JobProgress callback(s) Desired next payload chunk size can be specified in

callback return

• Rich job error information provided in _miMIMJobEvent::JobMessage callback(s) Localized error dialog spec – displayed by client

Caption Error message Button count, text and default selection

Page 19: MIM Architecture Overview

MIM Thread Pools

• MIM maintains two thread pools and associated job queues

• Clients can enqueue jobs to execute from either thread pool as appropriate Foreground

Threads run at normal OS priority Most client jobs run from this thread pool

Background Threads run at lower OS priority Thread execution is preempted by any foreground thread

execution • background jobs are paused until all foreground threads go idle

Page 20: MIM Architecture Overview

Basic Objects

• Set of interfaces and objects that represent entities and collections of entities in the system

• Entities Derive from miMetadata Comprise a collection of name/value pairs

Values comprise scalars, strings and IUnknown* Know how to marshal themselves by value

• Entity collections Derive from miMetadataIColl Comprise an ordered collection of miMetadata pointers Know how to marshal themselves by value

Page 21: MIM Architecture Overview

MIM Implementation

• MIM is a free threaded COM exe server (singleton)• Completely Unicode internally• STL used for collections and many strings• Heavy use of COM and ATL

Strongly typed interfaces used throughout _com_ptr_t<> used for proper reference counting #import used to create call wrappers and raise

exceptions on errors All interface types are oleautomation compatible

Can be auto wrapped for use with managed code Can be used with VB

Page 22: MIM Architecture Overview

MIM ExpandabilityAutomatic Plug-in Discovery• Devices (device objects)

Portable devices, etc.

• Device families (device factories) Peer databases, cameras, telephones, etc. Implies new item types included in MIM URI

namespace COM CATIDs used to detect factories on MIM

initialization

• File tag and playlist formats COM CATIDs used to detect components

Page 23: MIM Architecture Overview

MIM ExpandabilityOther Changes

• DB Schema changes Schema changes can be applied automatically in the

field Add/drop/modify tables Add/drop/modify columns Change data in tables

• New MIM Jobs Addition of job requires rebuild of some modules

Jobs are known a priori, not discovered New job requires a (backward-compatible) MIM

interface change

Page 24: MIM Architecture Overview