hashed-storage-0.4.12: Hashed file storage support code.



The plain format implementation resides in this module. The plain format does not use any hashing and basically just wraps a normal filesystem tree in the hashed-storage API.

NB. The read function on Blobs coming from a plain tree is susceptible to file content changes. Since we use mmap in read, this will break referential transparency and produce unexpected results. Please always make sure that all parallel access to the underlying filesystem tree never mutates files. Unlink + recreate is fine though (in other words, the writePlainTree and plainTreeIO implemented in this module are safe in this respect).



writePlainTree :: Tree IO -> FilePath -> IO ()Source

Write out full tree to a plain directory structure. If you instead want to make incremental updates, refer to Storage.Hashed.Monad.

plainTreeIO :: TreeIO a -> Tree IO -> FilePath -> IO (a, Tree IO)Source

Run a TreeIO action in a plain tree setting. Writes out changes to the plain tree every now and then (after the action is finished, the last tree state is always flushed to disk). XXX Modify the tree with filesystem reading and put it back into st (ie. replace the in-memory Blobs with normal ones, so the memory can be GCd).