 | hashed-storage-0.4.13: Hashed file storage support code. | Contents | Index |
|
|
|
|
|
Description |
This module implements an object storage. This is a directory on disk
containing a content-addressed storage. This is useful for storing all kinds
of things, particularly filesystem trees, or darcs pristine caches and patch
objects. However, this is an abstract, flat storage: no tree semantics are
provided. You just need to provide a reference-collecting functionality,
computing a list of references for any given object. The system provides
transparent garbage collection and packing.
|
|
Synopsis |
|
|
|
Documentation |
|
data Format |
On-disk format for object storage: we implement a completely loose format
(one file per object), a compact format stored in a single append-only file
and an immutable "pack" format.
| Constructors | | Instances | |
|
|
data Block |
Object storage block. When used as a hatchery, the loose or compact format
are preferable, while for mature space, the pack format is more useful.
|
|
|
data OS |
Object storage. Contains a single "hatchery" and possibly a number of
mature space blocks, usually in form of packs. It also keeps a list of root
pointers and has a way to extract pointers from objects (externally
supplied). These last two things are used to implement a simple GC.
|
|
|
Basic operations.
|
|
hatch :: OS -> [ByteString] -> IO OS |
Add new objects to the object storage (i.e. put them into hatchery). It is
safe to call this even on objects that are already present in the storage:
such objects will be skipped.
|
|
compact :: OS -> IO OS |
Move things from hatchery into a (new) pack.
|
|
repack :: OS -> IO OS |
Reduce number of packs in the object storage. This may both recombine
packs to eliminate dead objects and join some packs to form bigger packs.
|
|
lookup :: OS -> Hash -> IO (Maybe FileSegment) |
|
Creating and loading.
|
|
create :: FilePath -> Format -> IO OS |
Create an empty object storage in given directory, with a hatchery of
given format. The directory is created if needed, but is assumed to be
empty.
|
|
load :: FilePath -> IO OS |
|
Low-level.
|
|
format :: Block -> Format |
|
blockLookup :: Block -> Hash -> IO (Maybe FileSegment) |
|
live :: OS -> [Block] -> IO (Map Hash FileSegment) |
Build a map of live objects (i.e. those reachable from the given roots) in
a given list of Blocks.
|
|
hatchery :: OS -> Block |
|
mature :: OS -> [Block] |
|
roots :: OS -> [Hash] |
|
references :: OS -> FileSegment -> IO [Hash] |
|
rootdir :: OS -> FilePath |
|
Produced by Haddock version 2.6.1 |