dvfs api and toolkits

Sean Middleditch elanthis at awesomeplay.com
Mon Apr 4 01:37:14 EEST 2005


Here's my current high-level plan for the API of D-VFS.

As stated before, the asynchronous API is the most important.  All
operations absolutely must support asynchronous operation in GUI
programs.  Otherwise the apps will block and things like mouse/keyboard
events and repaint events won't be processed and the app will appear to
have locked up or otherwise operate improperly.

However, asynchronous APIs are a pain in the arse to use.  Synchronous
APIs are much more friendly to developers.

It is entirely possible to build a synchronous wrapper around an
asynchronous API, but not the other way around.  The method to do so is
basically along the lines of: begin operation, set callback in toolkit
event loop, run toolkit loop, check if operation is complete, repeat
loop if not complete.  The most important bit here is the toolkit part -
doing a synchronous API is dependent on the toolkit (or, more
accurately, the event loop) of the application.

D-VFS itself is toolkit agnostic.  Therefor, it is not possible for
D-VFS to provide a solid and sane synchronous API.  We can provide the
raw asynchronous API, however, and API for hooking up the library to a
toolkit.

The plan, then, is similar to the one taken by D-BUS.  D-VFS will not
provide the API directly to applications, but instead will provide an
API intended to be wrapped by specific toolkits, which then will usually
be wrapped into various languages.

I don't believe that this is at all going to be a problem.  The vast,
vast majority of applications use a toolkit, mostly either GTK/GNOME or
Qt/KDE.  There are a couple high-profile apps that don't, like OOo or
Mozilla - they will simply have to use the raw D-VFS API, likely provide
their own internal wrapper API like they already do for other system
services.  The number of new applications appearing on the scene that
don't use one of the major toolkits is countable on your fingers, so
there shouldn't be any sort of resistance to using toolkit-oriented
wrapper APIs.

For applications that have no event loop, like most console
applications, it would also be possible to provide a helper library with
a simplified API.

I think with that plan in mind it should be a lot easier to formulate
the D-VFS API, and we'll have a better target developer base to work
with (toolkit authors).
-- 
Sean Middleditch <elanthis at awesomeplay.com>




More information about the xdg mailing list