WWDC2004 Session 415
Transcript
Kind: captions Language: en ladies and gentlemen please welcome group manager dot Mac face engineering Scott writer hi everybody good to see you on this last session on Wednesday so I was actually kind of preparing for our session you have today and I realized that I am the only thing standing between you and dinner so I figured what i would do is in that interest is I would just strip all the white space for my commentary so what we're gonna do is we actually have the session actually probably double or triple rate so we can actually always face out there so you really really quickly then you can get it out and go and go and go and go and go okay No thank you very much we'll be here all night so as I said my name is Scott Ryder I manage the infrastructure group within Mac we're responsible for kind of all those back-end servers that make things go we don't let us near pixels which is probably a good thing since none of us can draw so agenda where we going to talk about today we're going to talk about very basically what is that max from a developer's perspective what does it offer you why should you consider integrating your application with it and what is it kind of fundamentally all about we're then going to talk about click hello there we go some new features in Tiger specifically if you've installed the tiger DVD that you got if you look on the dot mac preferences pane you'll notice as a new tab on the very end called samain and it's not very well explained what that is so I actually get to do a feature announcement and about what it is that that tab is all about and what it does for you and we're going to touch very briefly on the new synchronization services in tiger and what that does and what it means to dot Mac and what it means to your app then after that we're going to talk about how you can get all the exact same integration that you've seen in Mac OS 10 and our I applications over the past couple years in your app basically what we've done is we've listened to our developers and today we're announcing the new dot Mac kit the dot map kit is a high-level Coco wrapper around all the dot Mac services that you would need to kind of enable a next generation of features for your application the key is you can do all of this without network programming there's no asynchronous you don't have to deal with run Luke's there's no threading issues it's a very simple API for you to use and it just moves your application forward and gives you a whole new set of features again this is at no cost to you there's no charge for running the thousands of servers that we run there's no charge to you for using the kit it's just something that's available to you and again and I'll hit this several times dot Mac is open standards-based that hasn't changed we're not in venturing custom binary protocols we're not trying to push some new standard deviation that we've come up with these are entirely using the same webdav the same XML the same HTTP that we've been using for a long time what we're simply doing is lifting the bar of it so you don't have to do that work so what we hope you'll learn specifically is a brief overview of how to integrate the dot Mac domain with your application what it means to you and how to use the rendezvous api's the touches on tigers and synchronization services in dot max the new dot Mac kit specifically what it is when you should use it when you should not use it and some good call style and of course lots and lots of code samples ultimately what we want you to get is a little bit mac then we want you to kind of help bridge that worked out for the users between their local world and the online world that's what the kit really enables it lets you build features that go seamlessly to the server and back again they let two clients work together it just makes data flow seamlessly for our customers and yours so got Mac overview of developers what did max look like from a developer's perspective so first and foremost it gave you the ability to create a new category of features first and dot Mac offers a universal namespace this is you know we're at so i think somewhere around 500,000 paying accounts or over 500,000 paying accounts that all have names in one space when the new user comes to us we give them a name there's no collisions we don't recycle the namespace so once a customer gets a name it never goes away it's there's forever and there's a lot of things that your app can do with this if you think about you know a good example who does this today I chat those dot Mac names that you get are perfectly valid through ichat they're free you don't have to be a paying account you don't have to be in any particular state as long as you have the credential and you have the password you're good to go with ichat we're good with the dot Matt kit we're giving you the same ability to build I chat like services that use those IDs use those credentials we all with paid memberships though there's a whole bunch of services that we provide one of them is is always on store-and-forward the ability to kind of do if you think of what ical does with its published and subscribe for calendar data you can publish a calendar out there 12 a thousand people can then download and subscribe to that calendar all the updates flow through the server it you can do shared meta you imagine if you want to have a work flow going and you want to put up you know this is the state of the project you want to have X number of people look at that particular project state and of course ultimately just like you see in iPhoto we offer the simplest direct to web that's available for customers customers don't have to deal with server URLs they don't have to deal with credentials facing because it's all built into the OS with a kit you can leverage that directly in your application and truly provide one button publish ultimately this will help you stand out in your market this is something that you cannot do on any other platform that other OS doesn't offer this even in the cow form it's not something that they have done you've not integrated the credential plexus with the system in a totally open standard way so dot Mac from a developer's perspective this is actually something that's been part of the service way back when it started like five years ago as vie tools we fundamentally designed this to work with desktop applications as well as online applications if you look in your idisk you'll see something called the library folder it's just like the library folder and your local hard drive but it has a couple neat attributes one of them is its protected users can't accidentally go into the folder and mess up data they can't delete files they can't overwrite files so you can keep you know application state or some important files in this location and they can't be accidentally deleted by users and we'll talk a little bit more about the library folder later it's designed fundamentally for a single app multi machine use you can imagine your software is running in one or two or three or four of the users Max and you want to have a place for all those apps to court each other to keep data that they want to pass to each other that's what you can use the library folder and I just to do it's a great place to put that meta and then read it out in multiple places and put it back and can keep some really interesting coordination pieces there we do this with our own applications of the dot Mac layers another section of folders on the idisk are the Public Insight folders these are kind of your distribution points there a place that you can get public data out to users two ways one is if you want to do with the web browser you know with the homepage mac com services anything in that site folder can be out can be viewed from the web there's no credentialing there's no extra headaches required or if they want you can put things in the public folder and use I descamps to go into that URL and you can password-protect that and you can start adding some access control the key is you can mix and match whatever is the appropriate model for what your application wants to achieve from both of simplicity from a web access for me needs of use and from a security perspective you can put some data in one place some data in the other place it doesn't really matter we'll get a little bit more into this so what ultimately could you really do by integrating mac with your application well again as I mentioned earlier you can do publish and subscribe kind of like ical does imagine the ability you know one of my favorites auditors is the Hydra client the ability to do rendezvous based HTML or group editing of a text document now as if you put that document on the idis for store-and-forward now you don't need all the clients to be online at once everybody can publish it ready can edit the locking we provide mechanisms for viewing with all that concurrency and it's all pretty simple another thing you could do is you could do obviously an application data store wouldn't it be nice if the user installs your application and then something horrendous happens to their machine and they have to install it again and you didn't have to ask them all the same questions as they've already answered if you want to keep track of how many you know where your application get all that meta here's a place you can put it put the meta on that I disk the next time some calamitous thing happens and the user have to reinstall your app or wants to install it on another computer you have a place to get all that meta back again without having to re query them you can do some lightweight collaboration again we offer that single namespace so if you want to keep track of who's publishing something you want to to identify a user you want to do some meta flow or met a workflow kind of storage maybe you pass the information computer to computer but you keep this state of the workflow on the idisk where anybody can get at it so they can see and you have a nice unified namespace it usually comes at least with an ichat ID and probably even with an email address so if they're paying members and of course distribution you can do some really seamless client to server blending when you start bringing the dot Mac domain technology in together with the dot Mac technology for the offline access so of course identity as i mentioned that single namespace gives you a lot of things again think of what i shat does its i want to really stress it's not required for a fee to get an identity a user comes to our website it's also form that identity is theirs for eternity they say you know we hope that they choose to pay for the services that can go with it but it's not required and of course back up an archival lots of great places and I just to keep you know data that's important to users are met it is important to your app and ultimately there's a lot more you can do because as I said earlier and I will say again dot Mac is totally open standards-based so that means this is why I've been talking back to mac it doesn't have to be Mac to Mack it can be Mac to windows it can be windows to windows it can be windows to linux the key thing is by building open standards at the core we enable you to embrace and go forward on to other platforms without having to worry about things breaking we follow the same rfcs without modification so specifically what is this offer your app at no cost remember all this is free to use the developer to integrate we offer you access to over one half million paying customers these are some of apple's best customers or some of your best customers and what we find is that when they use services are integrated they tend to really stick with those applications it makes your applications sticky and it makes it a light for users to use because they really enjoy the experience they get when they go online and they go offline and their data survives and all the things that oh you can do that and it just happens we offer all the account management password reset password management security questions all those things is all managed for you we offer very very scalable sir services for example I guess Cologne handle seven terabytes of data down every single week we have a half a terabyte a day to come up every single week we have over a gigabit and a half of bandwidth that we use for the service and as we get more users we always add more capacity all these systems are supported and monitored twenty-four seven there's a bunch of very dedicated folks at Mac that have a job that I frankly could never force myself to do which is holding the pager of doom the thing goes off at nine o'clock in the night it goes off at one o'clock in the morning and if the service is down these guys will go into the office that they have to get it back up again very very dedicated folks and again all open standards-based so from an architecture this is what you would see through the look kind of look at dot Mac at the center of the whole thing sits idisk and we'll talk a bit more about this or on the sides we have to kind of key functions that you would need one is account management this is the credentialing the password resetting all that management pieces on the other side and connected through it we have kind of integration services these are the things that let external things like your applications and our own applications tie into those other services and extensible and controllable way again xmlrpc is the core of this so if you think it would I sink or I photo or iMovie or ical or own backup all these applications use these core services on top of them of course we also have our own web services or our own applications that run web objects that the clicker is once again decided it's done there we go that take that and emit that data through HTML so whether you're coming in kind of from the bottom directly to the metal if you will or if you're coming out the top with a nice pretty web interface it's all sitting atop the same infrastructure the application servers are using the same protocols in the same interfaces that you as a developer have access to I just gives the court all data lives on idisk we support web dev level 2 and as web dev specifications move forward through time we're always looking at adding more being at the center means that our own servers use the web dev protocol to access data so this is not something that you know we're telling you to do and we do something completely different we use the same protocols the same semantics and then a bit about standard formats the internet you know push this forward and I really want to drive it even further by keeping images in JPEG or keeping text in text by keeping things in a standard format that means it's really easy for it to flow from one service to another if you're an application and you deal with pictures for example so you're doing a webcam kind of app by uploading those pictures in JPEG that means they're automatically accessible to I cards or automatically accessible to home page you don't have to do any extra work so you know let's open standard formats that we all know and love they're just a really good thing when you start thinking about sharing things across services there's some special behaviors that I just gives you library is again as I said it can be read by all anybody any application can read the contents of library but it can only be written by a select few and we'll talk about that backup is reserved the backup folders for the use of our backup application if you have you want to do backups you can do them in library you can do them in other places in the idisk it depends on the kind of data you want to backup and some objects depending on where they are and we'll go a little bit deeper can be read without members credentials so be careful where you put things and we'll talk about that but it is key to stress there is absolutely no situation where users idisk the contents on that disk can be listed without credentials you may be able to get the object if you know it exists but you ask though we can't find out what objects exist without the owner's credential so the two roads to Rome as I said there are two ways into idisk one way is with web dev you zydus mass comm and you can go through these particular path member credentials required to do this read you can read anything in the folder structure and those special folders i mentioned backup library and software for example you cannot necessarily write things in to library you can the other ones you can't the other choice is you can come in via homepage mac com and homepage accesses those folders so the key thing is objects are files that you place in movies or pictures or music or sites can be read without credential they can't be written without it they can't be lifted without it but they can be read without it and the way you would do that is would simply say homepage mac com / member name put a dot at the beginning so like dot pictures dot music and you would be able to get into the contents of those particular folders why web tab well first and foremost web dev is nothing more than a set of extensions on HTTP if you want to move things around the internet you want to do that with HTTP it is the fastest most scalable protocol its most gateway to the most proxy is far and above the most supported it's just the easiest way to do things it offers very rich object management all the uploads downloads as even versioning extensions to web dev it's a very active community if you look at kind of the open source or i/o protocol today HTTP and webdav are the only two that are really still evolving actively and still changing over time web dev has for example I think four or five specs will even out for comments and two or three that just actually came back into being full standards and of course it's fully cross-platform support mac OS has had a webdav file system since 10-0 windows and linux to both have web dev file systems for quite some time now so it's very well supported and this is why we've been using it for three years something we know we do 60 million webdav transactions per week and that number is just going up and it's the only thing you can scale easily I should point out we do 60 million web dev transactions with 24 servers that's the beauty of web dev it's a very scalable protocol it's our second most popular service so a little bit an open standard they're absolutely central to our philosophy everything we do we want to do it with open standards the key is we look for standards that are meet all these criteria they're stable they're secure their broadly accepted and they really offer something different for the user when we find a standard that meets all of those that's when we start looking at adopting it and obviously we use things from both of those bodies today many flavors of HTTP and dad's obviously many male things and even xmlrpc and for tiger we're adding some new stuff with DNS and we'll talk about that so what is the dot Mac domain what is that little domain tab you see in those feeds well first and foremost it offers us something that our users when asking for for a long time brand-new and tiger we're going to give every member at least one zone so they will have a zone on the Internet is permanently it is theirs as long as they have a paying subscription they can publish things into it the note zone will be there member name so for example my name is Scott so I'm Scott members mass comm and when I want to find my computers I can publish those machines into there so I can have a work imac or i can have home g5 all built into the same zone regardless of what IP that they have and this is built entirely on dns and dns update this is not a custom hacked protocol that we come up with we've taken the existing industry standard protocol to make this work now that's that's kind of cool but let's bring rendezvous into the picture when you bring rendezvous into the picture what we're actually going to do is we're going to kind of make the world's e dot local we're going to kind of hide the internet nature of things and so when you do a service browse on one computer you will see all the other users computers rather than the local link or not so if you want to imagine this is kind of diagram with the internet middle what we do is we kind of make that sort of fade out you could click there we go fade out and your applications will sit on top of that so when you're running your app you'll come up on a powerbook the user could be sitting in a coffee shop it will see the home g5 is if they were plugged into the same network link and all the mat and spanning and all that in between them all handled automatically all handled invisibly so again as I said this is fully integrated with rendezvous so what do you get for free basically when you log into a machine remember there's that dot Mac member account right in the preferences panel all the other apps for that account will be seen together the key is what we're doing is we're changing that default meaning of public or the dog farts the meaning of the default browse that you saw in the sample code for rendezvous so if I bring that up originally it said past the empty string and it said for the empty string we're going to simply insert insert dot local in tiger with got Mac domain what we're going to do is we're going to insert local and that members own like Scott members max calm so this is the code sample that existed when rendezvous was first introduced no change exactly the same thing but by passing that empty string when this comes back you'll see that local printer sitting on the local Ethernet connection and you'll see the work g5 you'll be returned you and a look like it's one link this requires absolutely no effort you're done it just works but what if you want to go beyond the base behavior what if you want to actually do more for example you drive an application you want to do some of those collaboration stuff remember I mentioned those IDs get kind of interesting because those are the keys to find other user services you can use their taught Mac member name to compute the domain that their services would live in and then pass it into rendezvous so let's take that same code sample let's make a couple change to changes first thing we'll do is we'll have some object that gives me a name of someone else I'm supposed to browse so in this case we'll say I'm supposed to browse writer my last name so comes back members names of browsers writer so we simply compute a domain writer members mac.com and we pass that into rendezvous we will now see the services that writer writer has published into his life is a Mac domain so if you imagine you can go through the address book you can find buddies you can present any kind of you know person picker you why once you have their mac ID we have the only key you need and with two lines of code change you can browse and look for your application services running on that member subnet and you don't care where those computers are as far as all your connections and all your other hooks into the rendezvous API there exactly they always have been so a little bit on security publishing is restricted obviously I know you can't publish something into my domain and I can't publish something into your domain it's restricted to the local members own and if you basically if you call the rendezvous API all the right things are done for you automatically you don't have to do anything if the user has turned on the dot mac domain that service will be automatically published into their zone browsing is notice doesn't require authentication if I know your member name I can browse your services so this is life as it has always been willing to do absolutely critical that if your service is vending secure information or to vending personal information it's up to you to protect it put some kind of password off put some challenge-response whatever is appropriate for your app it's your responsibility as it always has been to protect the content master domain will help people find each other but it's up to you the developers for whatever is the right instance for your application to protect the data and as always if you really want to stand the local link just pass that local you don't have to do anything else and you know I encourage you very strongly go to test number 50 4 1030 Stewart Cheshire has all the great details and exactly how this works open standards DNS update and T cyghfer authentication so even the off that we're using to do the publish is still open standards-based so if you really wanted to you could do a DNS update packet from a linux machine and you could probably get it into work open standards very very important so think services all i want to say on this is i think is growing up i think is becoming an you know absolutely killer synchronization infrastructure for you to use in your applications dot mac is still the court so just like it was and i think one where your data went through I disc in the sync services and Tiger it goes through your idisk it lives in the library folder but there's been a couple changes the protocol is now pure web dev so we're even using the same piece to know web dev to move that synchronization data up and down what we do it obviously over SSL to protect the data the new syncservices is your Steve Cybertron say you can define your own data classes you have much greater flexibility and performance of how sinks are triggered because the web dev protocol is much thinner than we used to be and this is actually built with the dot Mac kit so we're actually using our own kit in the OS so again same protocols the same technologies the same frameworks that are available to us that we're using to build this stuff is available to you now I want to give you one quick slide on how to use the tiger seed that you got because as you said Tigers still cub he's still growing up and so there's some things as special steps you do in order to use Mac domain and in order to use of sync services and Tiger just for the seat this goes away when the product ship we've built a little side environment this is a you know environment where you know we run the kind of special next generation servers that we're developing but the key thing is this is an active development environment we were working on this too is this tiger move forward we're working on this environment at the same time so you know well there's a thing that one of the engineers and team came up with you'll laugh you'll cry you'll wonder where your data went data durability is not guaranteed in this environment things will come up and we'll go down so don't use accounts with data that you care about create a trial account and play with that to use this account there's one URL you can go to this is in your seed it's in the release notes it's even in the UI and it has all the instructions on how to get things set up and of course this has a limited life when tiger comes along this whole environment will just kind of think back into the sand from which it came and everything will be work fine in the production normal environment however I do want to mention one thing in that web page you will see a button that says reset this account what the reset this account does is if something horrendous happens and you'll somehow sync services and it's gets a little wedge sideways so the dns service gets a little wedge sideways go push the reset button what that does is it just blows away the store that's in that separate environment it won't touch the main mac it only resets the little side environment so it resets that special synchronization store that's really what it's going to reset for you so if you get really stuck to hit reset you can kind of start over but remember it does delete everything and the web page makes that I think very very clear so everything we've talked about up until this point is tiger now I want to talk about the dot Mac kit and remember the dot Matt kit runs on jaguar Panther and tiger I think I've now you said it one dot Mac is open standards-based but there's still a relatively complex amount of network programming that have to go on in order to use this you know run loops thread CF network CF xml web services framework there's a lot of pieces you have to do to weld us all together so why do all that if you don't have to what we've done with a dot matt kit is we built all that on the same infrastructure so we're using CF network we're using CF XML we're doing all kind of the heavy lifting under the covers for you on the on our own even all the way down to like automatic proxy configuration if the system is configured for proxies the kit will automatically configure itself or proxies literally it's intended to be one call and it Jeff works it's a simple fashion style Coco API we fully support and now I'm going to get on another horse I mean fully support asynchronous and synchronous operation any transaction that you can do synchronously you can do asynchronously there's no difference in API another key point this is an embedded framework this is not something that comes on the US this is something that you can deliver in your application package this has a couple advantages for you one is we move the kit forward in time you don't have to wait for a less reps you can deliver the kit with your application if you know that the kid this version of the kit is qualified for the version of the u.s. you want to ship you can deliver that kit yourself regardless of how the OS changes through time now of course it would really be you know be bad if that kit was well let's just say it's five megabytes don't worry about it so we worked very very hard the kit is 500k half a meg you know if anybody remembers floppies that would actually sit on one so it this is a very lightweight thing because we're leveraging the mac OS infrastructure a lot of the heavy lifting pieces are already on the system and as I said Jaguar better 10 to 6 and above and will support them all and it's free compania you don't have to pay for it and as I said again we use this today this is something that's in our app servers it's in the new sync services and tiger and this time go forward will continue to use it in other things the same code so when should you use this when is a good candidate for the kit well if you're doing you know I'll use text edit is an example here through your users are thinking about what they're doing the terms of file their opening file they're saving files it's a kind of a file centric experience you don't need to do anything there's no special behaviors required right they just want to let them save there's a lot of work we put in over the years to make I just look and feel just like a hard drive to the users even you know the new local idisk helps make that a brother performant experience for them so don't use the kit for these use the open save panels and you're just done there's no extra work this is is as it has been but what we've had over the years we've had many developers conduits and say look I'm not doing smiles here you know I'm doing an HTML publishing application or we're doing a workflow application or I want to write a really cool webcam I don't want to have users keep saving stuff and their ideas to be mounted on the desktop and things like that that's not what I need you know I'm doing relatively frequent and basically invisible background applications that's what the kid is for the kid is you know if you want to think of it the kid is for working with objects and the existing systems are working with file and a good example this is of course I photo you know when you click on the home page button where you click on the dot Mac slides button you're not really thinking of your saving files to the i just know technically you are uploading JPEGs to the idisk but from the users perspective it's invisible it's just kind of woven in this is what the kit is intended to do so exactly what is the kit well it's three classes the first one is VM member account vm member account is designed to kind of encapsulate everything about the Adamic members account it pulls the information from the system it gives you methods to validate it it gives you methods to check if it's expiring it gives you methods to even upgrade it or create a new one if you wish it's basically everything you need to manage member accounts he's kind of the key you always start with a DM member account and then you start doing other things like you get a session to a particular service so in the one point 0 of the kit the first session we have is I discussions in I just sessions manage everything that is specific about the web dev protocol all the state all the issues about dealing with prop finds and collections HTML parsing on parsing and locking and railings and redirection all done simple Coco API and of course transaction DN member account creates transactions the session creates transactions and as we add other types to the kit they will create transactions the transaction is kind of the encapsulator for all the work he does it the member account authorizes it so to speak the sessions test it up and the transaction actually does it this is the one point 0 of the kit so let's go a little deeper let's go a little deeper into DM member account what does he do as I said he encapsulates all the pieces about the user's account he gets the credentials from the LF you can provide them yourself if you want but in most cases you just want to automatically pull them from the US he provides access to key account state information you know when is this account going to expire what are the services that this account has are the credentials that I have any good are they valid so for example in the if you were to write kind of your own ichat you just want to use the credentials you would hand them into the member account and you've asked the member account are these credentials valid and it would need to tell you there invalid credentials meaning the name or the password is wrong we won't tell you which just one of the other is wrong or they are valid and then you can start asking ok we'll find is this account expired are there any services you can go deeper if you need those things and of course it has facilities for upgrading or generating new account and I should point out he handles all the international issues for you so if you're running the user is a Japanese user you simply call upgrade they'll go into the upgrade path with japanese text if they're an english user they'll go in the upgrade path with english text one call to you you don't have to worry about managing any of the other complexities we'll do it all and as I said sink or a sink for everything he does and he's the key he's how you get session so let's look at encode as i said vm member account represents your application to mac so the first thing we ask you do is get a unique ID the dub dub dr site has had a registration service for developers to register unique ID through their applications for many years why is this important well if you actually look at the dot mac servers we talked to something like 300 to 400 unique user agent type client things every day just on the idisk service alone it's very hard to provide a guaranteed quality of service because we don't know necessarily square are we talking to a linux machine are we talking to you know some users it's just banging up from the outside we want to make sure that we give your apps kind of the best experience we can and it only works if we know that it's your app that's calling in to us so by giving us this unique ID and we actually require you to do this it'll make it really easy for us to make sure that your apps going to get you know somewhat a little higher priority access if you will for key things when there's a contention so you need to get this ID and pass it in the constructors either whether you're getting an auto released instance or you're getting kind of your own managed instance and I just put those spaces those dashes in there this is where you get that four-letter creatorcode well the URL you need is in the docs for the kit it's in the sample code for the kid there's one optional parameter if you're going to be doing something on the idisk that's going to be represented to the user or do you expect to use it or kind of go browsing through and it'd be appropriate to see the name of your application you might want to set the human readable name and this can be any Unicode string you know we'd recommend for right now keep it Japanese or English but you can pass in whatever their appropriate human readable name for your app is this is particularly important when we are dealing with some future functionality coming in the library folder and we'll talk about that so get an account reference so we'll simply use the you know pull it automatically from the system and we'll use a kind of a fictitious creatorcode for this next step validate those credentials make sure that they're good for one call call back here and if it's not right and obviously credentials are probably invalid and you can tease it apart to figure out why they're not valid once you've got the credentials let's say we're going to use the idisk service make sure the service exists you can simply use the account so hey give me a list of all the services that this user has will give you back an array and you can look through the array we provide constant for all the things you'd expect like sync service or email service or idisk service or web hosting service and we provide constants for these so you can simply check so in this case hey he's got the idisk service we're ready to go or oh maybe this is an email only account or maybe this is an expired account once you've done this we can talk about getting a session and I should point out when you go through this hold on to that member account object because you remember you only have to do this one once it's done you're done you don't need to mess with it ever again so hold on to that number account object and then you can reuse it again and again to create sessions what is the session he's designed to kind of be a one-to-one relationship for this member i want this members idisk service or for this member i want this members ex-service the one the run relationship so once you create a service he's bound to the member from what you created him for multiple idisk for mobile members use multiple members create multiple DM member accounts and do the checks on them he offers a full feature set upload download delete make directory move coffee you name it it's in there and he initiates transactions each operation whether it's done by a member account or by nida session returns a transaction will get a little bit deeper on that the only difference is when the kid is synchronous the transaction is automatically complete and when it's asynchronous it may or may not be complete so as I said you needed DM member account to create so in this case will create a DM member account the default state is synchronous arm sorry is asynchronous so we're going to flip it over to sync very very important safety tip if you're expecting thing is to be synchronous remember to set it to synchronous otherwise you'll be calling into transactions as you get back and they may not have even started yet and if you're looking for data will be kind of weird if you ask for it and its transaction hasn't even started we'll just give you back nothing we don't have anything yet we won't give you back an error because it has an error it just hasn't started so make sure if you're expecting things to be synchronous every single instance the dot Mac kit always default to async put it to sink if you expect it to be sick so set the state to sink and that start firing transactions now dealing with errors remember the kit the session doesn't do err the transactions do the transactions are the guys that do all the work so if you want to see how far our transaction is progressing you want to see if it has an error remember you're always going to be asking the transaction for those things not the session one more important thing the key thing about I discussion something we worked very hard to do is you can flip the state between a sink and sink randomly it's entirely up to you so if you want to issue for transactions asynchronously and then two transactions synchronously and then for more transactions asynchronously just simply flip the state around the in-flight transactions will not be affected by those state changes so if you kick the thing over into sync and you have three a sinks running they'll just keep running and when your sink is done that those notifications will be queued for you and be ready to pick up when you're done with the synchronous operation so the kit is very very good about letting you change modes on the fly you're not bound one mode you won't screw up things that are in flight or not so DM transaction he does all the work he's the guy that moves the bits around uploads them and downloads them encapsulates all transaction details all the state all the errors all the results and he's created by both DM member account and by DM idisk session so again if you imagine those two services sitting on the side one is wrapped by DM Ida session one is wrap idea member account they both create DM transaction and he's responsible for all the protocol specifics whether it's xmlrpc over SSL or webdav V HTTP and you can set delegates on him and he will call you back so using a transaction some key things you can do is you can using to obviously determine progress you can ask the transaction what's the content length how much stuff do I have to move and you can ask him how many bikes as I move so far I should point out the kit fully thread safe so you can do these any time you want from a number of threads that you want you can just kind of bounce around it's entirely up to you [Applause] you want to see how the transaction is doing kind of an asynchronous polling model you can simply hate we know what's your state and we provide you a whole set of constants for onion oh not started error de boarded successful all those kinds of things and then to get the result simple call the result function and will give you the result back pretty straightforward so kind of a flow how to use the kit synchronously step one get that DM member account step to validate it step 3 create an idisk session from its will pull the session step 4 set it to think this is a synchronous example so remember start a sink you've got to set it to sink it'll stay there until you set it back then start pulling your transactions go get the work done and when the transaction is done you can go ahead and if it's not an error pull the data object out of it so very simple synchronous code sample and I'm going to go very quickly for these code because I'm running a little short on time and i want to show you that all the code that i'm showing your parents in the slide is included in the sample code that comes with the kit so you know don't worry about paying too much attention to it it's all there in the kit sample code so we're going to go ahead and get a DM member account right from the system we're going to validate the access to make sure this account the credentials are good is there stored in the system if it's not we're going to go ahead and deal with that in this case we'll set the mode to think because this is a synchronous example and then we'll get a session pull the sessions or go start doing some work once we've got that session we'll get a pass we're in this case we're just going to pull a picture you know from some name of image that's hold in the pictures folder created somewhere else and will fire a synchronous transaction to go off and get the data down get the data from this path the minute because it's a synchronous the minute this call completes we know the transaction is done it's either succeeded or it has failed and so what we do instead of having to deal with okay we'll check the HTTP code now check to see the payload is there if you're supposed to be a payload Oh we'll blame it this was supposed to have a payload a lot of complexity we provide you a very simple accessor its successful is successful depending what the transaction was trying to do is have all the smarts to figure out cable the right HTTP code for the right transactions the right XML responses it's all ads all dealt with for you so they call it successful is successful returns true then you know the thing works you know the result will be there what you expect so in this case you can go ahead great it was successful I'm going to copy that picture out and do it in this image in its data and then I will go ahead and create it in this image from that data and then do whatever it is I want to do and if not it wasn't successful now you can start teasing it apart whether a network error where the credential bad whatever and off you go so some notes maybe I've said this one the kit defaults to async if you need to use it synchronously set it to synchronously but you can flip it back and forth any time there's no penalty it just means it's the very next transaction you pull will follow the new model bit about the result function we worked very hard on this particularly for Jaguar when you call result if you're downloading a lot of data we will give you back a memory mapped instance of that data so this means if you have an application you're running on a very limited footprint machine downloading five you know 100 megabyte JPEGs would be a very bad thing you'd kill the system performance because you're pulling all those bits in what we actually do is whenever you're downloading an object we put it on a temporary file in the file system and then we return that object to you when you asked for it so that means you can download as many things as you want asynchronously and you won't cause the machines vm to go into swap nightmare and then as long as you access the objects carefully you will avail to manage memory very cleanly all done with an NS data there's no all done under covers for you no extra work a little bit about asking for results before the transactions are done if the kits running asynchronously if you ask the results before it's complete we're going to give you what we've got this could be a good thing if it's your own format and you can deserialize it a partial download yourself but generally it's probably a bad idea because you can get into some strange things well what do you mean I don't have this you can get to some interesting bugs where sometimes it works and sometimes it doesn't work simply based on how far the transaction is gone you should always check make sure that you've got the whole thing to simply check that you know content lengths and bikes downloaded so far to see if you've got everything you need but you can do it if you want and if you call you know call result call result call result will simply give you however many bites we've gotten up until that point you can do progressive downloads if you wish just be careful and again use vm member account to preflight recommend checking three things valets the credentials make sure the service you need exists and of course it's really convenient for the users to check to see if the account is expire heat it's kind of bad if they go through all the stuff and they're really using your app and it's just great and then they launched it the next day and they get this message saying oh by the way all the work you did yesterday you can't get to it cuz your account just expired so if the users account is expiring you know two or three or ten days it's probably a good thing to show them some UI saying hey we notice your accounts about to expire and then we give you message all the methods you would need to upgrade that account automatically you make one call if they say yes and we'll just do the work and it's against you can do this lazily the kit support they think you can just fire these things off to forget about them and they'll come back when they're done so let's talk about async how to use it it's almost exactly the same is sync create a DM member account perform those validations create a session now register a delegate for this for the idisk session pull come on clicker pull some transactions uh-huh here we go pull some transactions the transactions will send messages to their delegates a little bit about the delegates another area that we worked very hard on in the kit so you can set and just like you can change the mode from think async at any time you can change the delegate for a session at any time and it will affect the next transaction that you pull so if you want you can pull a transaction with a delegated object a change it pull another one object being pull another one object see pull another one object d so if you know you're doing a particular category like you're doing it download you want all those messages to go to one controller you can set that delegate then flip it around now you're doing an upload and all those messages can go to a different delicate the transaction will handle all that automatically something else that's very important the kit does all of its work off of the main UI thread so we have a state machine and a little threading model internal with some workers so that when you're using the kit where they're using at asynchronously or synchronously we won't do our work on your threat so we won't flow down your UI and we won't float on your application and all those great dual processor machines it just hums away on the other processor just flying so again no extra work by you and it will call back onto your thread so if you pull a transaction pull transaction on threads for we're going to call back on thread for you pull a transaction on your main thread we're gonna call back on your main thread so you don't have to manage any of that state either the kit will do all that for you and of course the transactions where you get the data objects so an asynchronous sample again setup is exactly the same as it was except this time we're not going to call that is synchronous so we're going to get imagine we got the DM member account the same as we did before but now we're going to set the delegate in the case it's optional but it's usually a good idea you can set the delegate up when we talk a little bit about retaining right now well i'll save that set the delegate create some paths that holds the information i want this case because it's saying name image we did before by our transaction and we go off and we get the image then the delegate will run along and they'll get message on the big state changes so if you know everything works you'll get message back you know transaction successful there was no error notice we give you the transaction back this means you don't even need to retain those transactions will do that for you so you can imagine if something in your code style works this way you could fire transaction in one particular you know object and then it could the whole thing can go away and then the delegate will object will get called back and they can get the payload out of the transaction so you don't have to do the extra work of holding the transactions and rendezvous Inge the response with the object that initiated it and keeping track of all that it's all done for you automatically under the hood you don't have to hold on to anything will give you back what you need to get back from an error obviously we'll give you the same thing back for errors and for cancelled we'll give you back the same thing if you take an asynchronous transaction and cancel it remember if you set a delegate on the synchronous mode it's not going to call back because it can't get synchronous each transaction can have a different delegate steps assess you set it on the session the very next transaction that you fire will message that delegate with polling you can use it to make a very responsive user interface you can imagine set up a timer every second or so just pull the pole the transaction hey how many by to be moved so far and when it's done you'll get a nice message and it makes it real easy from a code flow just to go ahead and great turn and pull him out of the ue because he's all done and go start dealing with the object that he was trying to move now hopefully that seems pretty straightforward and pretty simple but we want to make it even simpler so what I want to offer you here is the one line adoption how to use a dot map kit with changing one line of code we offer in a file manager replacement so there are many really cool apps out there today to kind of integrate with Mac and they did it on their own they figured okay the web dev file system I can mount the volume and I can do this and I can do that alone was that either days I've got done it's like look you know so what we're gonna let you do is if you're using in a file manager take the instance where you create the file manager and replace it with that what we do is DMI disc session will mirror or kind of has you know categories if you will it's exactly what it is of most of the most popular in a file manager methods if you change that one line in your code odds are most the file manager calls that you make will now just go through the kit but there's some details here this is a lightweight replacement we certainly don't implement every message that you haven't in a file manager we implement only the Select now the good news is they're the ones you post Michael you copy things up move things around delete things read open those are all there it is synchronous only it does not support the async operations as a kit we're not going to move this forward over time if you want to deal with files that's what the file manager and the whole web dev file systems for but we know there's a category of applications out there that is kind of integrated with Mac early and we want to help them move over to using the kit very quickly this is intended as a time to market tool you know if you have places in your code we're doing pub/sub using the file manager you can very quickly kind of get in there and use the kit and then over time go through and actually implement the kit and it's asynchronous modes and do all the kind of the fancy stuff so it's a time to market tool it's not an end point and as I prolonged stress this is it is as it is and it's not going to change over time so as we do more sessions and more cool services with the kit you're not going to see them change this particular option with that what I'd like to do is invite Ryan parks up who's a lead engineer and Ryan and I are going to a very quick demo for you of kind of some sample code that you get with the kit thanks good we have we have demo 16 so and I want to share a very brief little story here this this sample app implements kind of the basic things you would expect to be able to see you can look at account status pull from the system you can do web uploads back up it's kind of intended to be a cookbook app code that you can crib very simple and I wrote it so if it stinks I apologize in fact you know more than once I've had my team come into my office and run out of my office shrieking he's using the compiler again run run for the hills so managers shouldn't write code it scares engineers but very simply he's intended the kits designed to do the kind of basic things you would need if you wanted to provide say browsing the pictures folder you can click you can get a list of all the pictures that exist you can scroll down you can find some pic notice if I turn off the synchronous bit now you can see the progress is reflect their thing here if I click very quickly I can get them well there we go you can see I had two transactions and flight at once so this is using the asynchronous mode it's using examples of polling for a response of view we the whole app that you see here for doing you know web uploads for publishing if you want to put your publish an HTML page upload demo page and when you're all done with that you can click view it from launch Safari and you can see the demo page you know all the code to do all of this is maybe 31 spread out through a couple classes so it gets very very simple to use and what Ryan's going to do now is going to show you a little more complicated example so you really want to get any intimacy is exactly what the kid is doing you can use this thanks yes Scott jokes about his code writing ability but he's actually very good you've seen the sample we also have another sample app that ships with the kit it's called I just browser and as you see is the default mode is asynchronous just like the kit itself and we can actually toggle between asynchronous and synchronous if we navigate through the software folder in the directories all of the prop signs are happening asynchronously that the quota calculation is happening asynchronously and we can just flip back and forth and actually this is a good apps to look at if you're interested in learning more about using a session the same session and flipping between a sink and stinks because we're just using one I just session instance in this app and we just flip between the two modes basically you just double click to download in this app and if we do an upload here you can see the polling the UI progress but we get an error and even though it had written a little bit up to this I disc it deleted it properly at the end and that delete is an example of kind of a carefree async transaction that was fired right when we learned that the transaction failed we told the callers that it had failed but filed fired this delete immediately and we didn't have to retain that damn transaction we didn't have to do any special handling it just happened on its own basically once you fire diem trans action if you're not interested in the result you just want it to be a best efforts attempt to correct whatever problem there was you don't have to worry about it anymore so this is a good app to look at if you want to learn more about basically what's available to you if you open this side window you can see the I just property available for the various files and folders you see things like content length content types whether it's a collection or not and there's a extended attributes that path method which gives you all this data that's pretty useful also as you click around in this app and do various things upload things you can see what's happening in this log and basically get an idea of what the differences are between the async and the synchronous call models so I encourage you to take a look at the source here and appreciate it because it really flexes all the various modes you can use from polling to delegate call back to straight synchronous called okay thanks run thanks very much again with the samples for the kit we wanted to provide you either a cookbook if you just want to kind of crib the objects right out and start using the code immediately in your thing you could do that with a DM samples or if you really want to get into the intimacy's of exactly how the kit works and what you can and can't do you know and how easy it is we gave you the full browser app as well and again both the source for those is included with the kit so I talked about the library folder and the special behaviors that it exhibits I want to kind of double click a little bit on but I do want to emphasize this behavior comes with Tiger shipped this is not something you have today everything I've talked about with regards to the dot Mac kit you know the Jaguar support using it the browser apps all of that the kid is one out this is not a developer preview this is the freedom shipping instance we encourage you use this in your apps deploy this to your customers get it out there but these these are little extra functionality you're going to get when Tiger ship so specifically what we're going to let your application do is create a folder inside of library application support that it can use to hold its own data but you must use the name that you set with that convenience application in or if your application is called my grade app with spaces then it you must set you know my great app and you must create a folder called myspace great space app inside of there yes they have to match and again this is simply to help the user and organizing things and they want to see which of their software applications with the names they know them by our storing things on their ideas can using things on their I disk but as I said early remember the library folder and its contents are protected this means that you are responsible for this folder there's not a simple way for the user to go in and delete its contents so if you know you're putting things here keeps one we'd recommend keep them small and to make sure that you give the user a way to delete them or to clean them up if they don't want them to live there anymore only your app will be allowed to read and write so other apps can't stop on this folder the user can't accidentally stomp on the folder so you know again why would you do this in the first place this is a great place to keep that small amounts of state data you know multiple installs of your app running on multiple machines for the user and there you know using the dot maximum they all know about each other and you can do really cool peer-to-peer stuff but you want to keep a little extra state you can do that in the library application folder in one really cool example is you could write a webcam thing for example that uses a dot Mac domain and if it finds the two machines directly then it goes straight through and it does appear to peer connection high speed but if you know could always fall back and also do the direct web publishing stuff using the kit involve loading to idisk so good place to keep state stuff and of course as I said it's protected from accidental modification you can't fax the user can't accidentally screw it up so how do you get it remember the kits not part of the US this is an embedded framework it's a 500k framework that you need to deliver with your application it's part of your application rapper real simple go to developer apple com login with your developer ID that they give you and you in the downloads area starting today or for somebody very close to today you should see ad image that are called the dot mac kit and you should be able to download it there's some common life common sense licensing that you need to agree to when you use the kid this is again it's nothing you would expect of course I can encapsulate on the fly the lawyers of expanded until like ten pages but it's pretty simple stuff don't build bad karma don't build applications to do you know bad things this is not part of the license it's not with the kits intended for it's just you shouldn't do it remember data cannot be collected or used centrally again the kit does not give you any way to access the members password it's an important you know privacy thing to point out you know the DM member account and cap slates all there's really no reason for you to need it in a couple rare cases where you may need to capture those credentials you can pass them indirectly but the kit won't give you access to the password it will give you access to the member name because obviously with Mac domain there's a lot of reasons why having that name would be useful but don't send them to a central server keeps them in your application you can keep them in your preference file you can keep some local em system just don't send them back to some central marketing database it's a kind of a violation of just good karma from a privacy perspective don't create you know don't cause members to violate the Terms of Service you know don't upload a gigabyte and download a gigabyte and upload a gay buy and download a gigabyte in the background you know be be creative you know do things carefully uploading and downloading gigabytes is just not a good thing to do for the user even the users perspective use a creator code for each app that you write so if you're a company and you have two or three software products and you want to use the kit in all of them which is totally great just make sure you use a unique code for each one of those applications that waves that you know again we can make sure that we give them the best experience download the latest release from the website again as I said Jaguar and hire 10 to six Panther tiger it's our intent hopefully we're going to support current shipping minus one but when Tiger comes out is the shipping OS we hope to stay with panther and tiger and then whatever comes beyond tiger we want to try to keep both of those out there for you but again because this is an embedded framework if you have a version the kits at work for you go ahead and deliver it you can deliver it with your applications as long as it's functional not part of us and getting it includes all the sample projects and all the sample code we've been talking about up here and all the documentation for the kit as well as obviously the kit itself and it's available today or very close to today we still have to get the damage online but by tomorrow let's say at the latest it'll be up there so kind of to wrap up the formula is with mackerel if Tiger and dot Mac domain and the new sink services and all the dot Mac integration that's been available in the US for a long time there's a lot of really cool things that the u.s. does when you add that to your application using you know core data or core video and all the other excessive things there's some really really cool cool products out there now we're giving you the same tools and the same capabilities that we've had with an apple and I app and I sink and imovie and iphoto and all those places to actually have things that equal you know that then that ability to have of users local world their local high life bridge into their online life and back and forth and seamlessly you can you know you want to do a director web one button push we have all the tools here you need to do it synchronously or asynchronously you know the kinds of apps you can create here just it's staggering kind of thing we've had a lot of ideas kicking stuff around but ultimately you can build something you can't build on any other OS and you can do so very very simply using one kit so who to contact obviously wa is a great place within dub dub dr david conway who's our marketing guru here is under good place if you have very specific business things you want to do with a kit or you want to do a thought Mac David's a great place to go there's two other URLs email addresses i want to give you I do want to caveat these are both kind of you'll be black hole messages go in there red but we don't necessarily going to respond because of the volume of email that we expect one is not Matt Kindt feedback this is not for bugs so obviously you have radar and all that infrastructure for implementing issuing bug reports this is hey you know the API is great but we really like to see the API for this particular function go this way or you know I could really use this method on the DM transaction so for getting it so kind of direct API feature requests for the kit use Mac kit feedback for Don sorry got Mac kit that max calm and just like consumers in the dot Mac website there's a feedback section where consumers can ask for consumer features got mag then is for developers ask for developer features so if you notice the kit is not about you know taking existing stuff and wrapping ways interfacing to it the kits about giving you new things that you can do when you have servers in the skies that are always on always monitored and offer be alive support with unified account so if there's some really cool things you'd like to see from you know dot Mac from a developer's perspective or you know kind of under the covers it's not necessarily HTML or a browser go ahead and kick those into dot max Renn and we'll try to get them to the kit with that having been said I'd like to invite if I can click yeah like tax advice the dot Mac infrastructure team up here on stage and we can take your questions [Applause]