- data Format
- loosePath :: OS -> Hash -> FilePath
- looseLookup :: OS -> Hash -> IO (Maybe FileSegment)
- data Block = Block {}
- data OS = OS {}
- repack :: OS -> Set Hash -> IO OS
- hatch :: OS -> [ByteString] -> IO OS
- compact :: OS -> IO OS
- blocksLookup :: [Block] -> Hash -> IO (Maybe (Hash, FileSegment))
- lookup :: OS -> Hash -> IO (Maybe FileSegment)
- create :: FilePath -> Format -> IO OS
- readOS :: FilePath -> IO OS
- createPack :: OS -> [(Hash, FileSegment)] -> IO Block
- live :: OS -> [Block] -> IO (Map Hash FileSegment)
- readPackedDarcsPristine :: OS -> Hash -> IO Tree
- writePackedDarcsPristine :: Tree -> OS -> IO (OS, Hash)
- storePackedDarcsPristine :: Tree -> OS -> IO (OS, Hash)
- darcsPristineRefs :: FileSegment -> IO [Hash]
Documentation
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.
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.
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.
repack :: OS -> Set Hash -> IO OSSource
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. The set of hashes given is used as roots for GC marking.
hatch :: OS -> [ByteString] -> IO OSSource
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.
create :: FilePath -> Format -> IO OSSource
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.
live :: OS -> [Block] -> IO (Map Hash FileSegment)Source
Build a map of live objects (i.e. those reachable from the given roots) in a given list of Blocks.
readPackedDarcsPristine :: OS -> Hash -> IO TreeSource
Read a Tree in the darcs hashed format from an object storage. This is basically the same as readDarcsHashed from Storage.Hashed, but uses an object storage instead of traditional darcs filesystem layout. Requires the tree root hash as a starting point.
writePackedDarcsPristine :: Tree -> OS -> IO (OS, Hash)Source
Write a Tree into an object storage, using the darcs-style directory formatting (and therefore darcs-style hashes). Gives back the object storage and the root hash of the stored Tree. NB. The function expects that the Tree comes equipped with darcs-style hashes already!
darcsPristineRefs :: FileSegment -> IO [Hash]Source