[haiku-gsoc] Re: Handling Device Unmounting

  • From: Ankur Sethi <get.me.ankur@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Thu, 9 Jul 2009 20:33:06 +0530

Axel wrote:
> The only thing that really does the trick is to use transactional
> writing, that's how databases do it, and that's how you should do it,
> too. If that's too much work for now, there is still the possibility to
> postpone that particular problem a bit.

I just read about transactional databases on Wikipedia. What I
understood is this (do correct me if I'm wrong):

The indexer indexes the documents and keeps them in memory instead of
writing to disk. After a certain interval of time, or after a certain
number of documents have been indexed, the indexer opens the index,
writes all the documents to it and closes it.

This should not be too difficult to achieve. CLucene already provides
a RAMDirectory class that allows you to keep your index in memory.
This can later be merged with the main index. Another option could be
creating a new index in a temporary directory, and merging it with the
main index after certain intervals. Merging two CLucene indexes to
create a larger index is trivial. The only problem that should come up
is the elimination of duplicates during merging.

I suppose Haiku will raise a warning if a user tries to unmount a
volume while a process is writing to it?

-- 
Salut,
General Maximus

Other related posts: