[haiku-development] Re: [GSoC proposal] IMAP FS - A few queries

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 14 Apr 2011 20:56:52 +0200

Am 14.04.2011 20:33, schrieb Anshul Singhle:

    But when an application posts a read request starting at a point
    in the file that isn't cached, the filesystem needs to go out and
    get the data to satisfy that request.  That might be at position 0
    in the file, if I just do a "cat" on the file and the filesystem
    hasn't yet downloaded the full header.'

I don't really know how to implement this. Conceptually speaking, and
application can ask for a node and i can give it the contents of that
node. How will I know if the application is asking for data that is not
stored in a node. Can we have empty nodes? and can we know if an empty
node is being accessed?

To me it starts to sounds as though you have misunderstood the concept of the IMAP FS. The IMAP FS will not work by mapping files in the BFS file system elsewhere. It is completely in control of the exposed file system contents. For example, it can publish an e-mail file and advertise a certain file size. This happens by way of implementing the file system hooks and just declaring objects to be there. They don't have to exist on the harddrive at all. Advertising a certain file size does not mean the e-mail is already downloaded in full. The download can be delayed to when an application actually reads the file. I hope you realize that displaying a file in Tracker does not require the full file contents to be available at that time. Still, Tracker would display the file size as though the contents are already there, while in fact IMAP FS has only downloaded the header as of yet. Only when IMAP FS receives the read request for data at a position that it has not downloaded yet, will the download be finally triggered.

    If it isn't feasible to support random access as described
    above, it still makes sense to support incremental download
    for sequential access.  You don't need to download a part until
    I have asked to read it.  If I read "off the end" of the cached
    data, but still inside the extent of the file as reported by
    RFC822.SIZE, then it's time to fetch more parts.  I don't have
    to know the MIME structure of the file to do this, and of course
    I don't have to communicate it to the filesystem as such, I just
    ask for N bytes of data at file offset T.

This seems doable.. How ever, if you can give me an example of some
existing implementation.. that would be great. One thing I'm not sure of
is whether you can set the size of a file. i.e. if you can tell the FS
that this file is x bits of data so allocate and index accordingly, even
if in reality i'm storing only y(<x) bits.

Like I've said above, your IMAP FS *is* the file system. It can say whatever it pleases. The caching of files will of course happen in another, persistent FS, but of course you can append more data to some existing file in the other file system.


> I'm guessing this can be done
using blocks i.e you keep an empty block as a part of the node. So when
you ask for the contents of a node, it looks at all the blocks and gets
an empty block, so it calls a function which gathers from the context
what data needs to be fetched and accordingly fetches and stores that data.

The block allocation used by another file system that happens to store your cached files is irrelevant to your task.

Best regards,
-Stephan

Other related posts: