hashed-storage-0.3.8: Hashed file storage support code.Source codeContentsIndex
Storage.Hashed.Packed
Synopsis
data Format
= Loose
| Compact
| Pack
loosePath :: OS -> Hash -> FilePath
looseLookup :: OS -> Hash -> IO (Maybe FileSegment)
data Block = Block {
blockLookup :: Hash -> IO (Maybe FileSegment)
size :: Int
format :: Format
}
data OS = OS {
hatchery :: Block
mature :: [Block]
roots :: [Hash]
references :: FileSegment -> IO [Hash]
rootdir :: FilePath
}
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
data Format Source
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
Loose
Compact
Pack
show/hide Instances
loosePath :: OS -> Hash -> FilePathSource
looseLookup :: OS -> Hash -> IO (Maybe FileSegment)Source
data Block Source
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.
Constructors
Block
blockLookup :: Hash -> IO (Maybe FileSegment)
size :: Int
format :: Format
data OS Source
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.
Constructors
OS
hatchery :: Block
mature :: [Block]
roots :: [Hash]
references :: FileSegment -> IO [Hash]
rootdir :: FilePath
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.
compact :: OS -> IO OSSource
Reduce hatchery size by moving things into packs.
blocksLookup :: [Block] -> Hash -> IO (Maybe (Hash, FileSegment))Source
lookup :: OS -> Hash -> IO (Maybe FileSegment)Source
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.
readOS :: FilePath -> IO OSSource
createPack :: OS -> [(Hash, FileSegment)] -> IO BlockSource
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!
storePackedDarcsPristine :: Tree -> OS -> IO (OS, Hash)Source
darcsPristineRefs :: FileSegment -> IO [Hash]Source
Produced by Haddock version 2.4.2