On Sat, Mar 17, 2012 at 1:08 AM, Chris Jones <
cjo...@mozilla.com> wrote:
> ----- Original Message -----
>> From: "Thinker Li" <
think...@gmail.com>
>> To:
mozilla-d...@lists.mozilla.org
>> Sent: Thursday, March 15, 2012 10:50:23 PM
>> Subject: Re: "Device storage" --- storing devices?
>>
>> On Mar 15, 9:32 am, Chris Jones <
cjo...@mozilla.com> wrote:
>> >
>> > Evolving this to storage of arbitrary files, in some sort of "file
>> > system" we might call it, sounds like scope creep from what was
>> > originally discussed.
>> >
>>
>> There is diverse reasons for saving files locally and sharing with
>> other applications. For example, people save PDF/epub files attached
>> to an email locally. Is there any reason that *Storage serves only
>> media files?
>
>> However I don't think that we should leave out storing things like
>> KeyNote presentations, Word documents or todo-lists, just because we
>> can't think of good name for the API. So whatever name we come up
>> with, I think the API should allow storing those types of files.
>>
>
> My concern is the difference between what's being proposed here and a generic FileSystem API. I think the differences are
> - for storing a new file, requested name isn't guaranteed to be honored
Indeed. For storing files on a B2G device, I'm not sure I see a need
for non-automatically-generated filenames. For storing on an external
USB key, filenames seems more useful.
> - there's no concept of a directory, hence no hierarchy
That's not entirely true. You can still enumerate a directory using
the enumerate function.
It's also missing functions to deal with "directory objects". I.e. you
can't get a list of *just* the directories in a given subdirectory,
and there is no object which represents a directory. Nor can you do a
non-deep directory traversal.
But I'm not sure that there are terribly strong use cases for
organizing user data with such a directory focus.
> - files of certain MIME types are handled specially (or, MIME types are the directory)
How so? That's not currently enforced by the API, simply encouraged by
it. But if you look at how user-data is handled by modern OSs they are
moving in the same direction by creating folders for common file
types.
And the intent is that it won't be focused on MIME types as they map
pretty poorly to what we humans think of as types, i.e. there are 9
different MIME types for Word documents, with new ones added as they
revise the format. And there is no MIME type for "fonts" or
"documents" and only sort-of a MIME type for "images".
> The last point seems to motivate the other two, so maybe TypedStorage is appropriate? Or MIMEStorage?
I'd be ok with TypedStorage. Though I think it misses the main feature
of the API which is that it's storage area which is shared by all
applications. I.e. it's not application-specific like IndexedDB and
localStorage is.
/ Jonas