darcs-2.12.5: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Util.Tree.Plain

Contents

- Obtaining Trees.
- Writing trees.

Description

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` implemented in this module is safe in this respect).

Synopsis

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

# Obtaining Trees.

Please note that Trees obtained this way will contain Stub items. These need to be executed (they are IO actions) in order to be accessed. Use `expand` to do this. However, many operations are perfectly fine to be used on a stubbed Tree (and it is often more efficient to do everything that can be done before expanding a Tree).

readPlainTree :: FilePath -> IO (Tree IO) #

# Writing trees.

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

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