hashed-storage-0.3: Hashed file storage support code.Source codeContentsIndex
Storage.Hashed.Index
Synopsis
hashToString :: Hash -> String
data Item = Item {
iPath :: ByteString
iName :: ByteString
iHash :: ByteString
iSize :: Ptr Int64
iAux :: Ptr Int64
}
itemSize :: Item -> Int
itemSizeI :: Num a => Item -> a
itemIsDir :: Item -> Bool
createItem :: ItemType -> AnchoredPath -> ForeignPtr () -> Int -> IO Item
peekItem :: ForeignPtr () -> Int -> Maybe Int -> IO Item
update :: Item -> Maybe EpochTime -> Hash -> IO ()
iHash' :: Item -> IO Hash
mmapIndex :: forall a. Int -> IO (ForeignPtr a, Int)
readIndex' :: IO (Tree, IORef (Map AnchoredPath Item))
readIndex :: IO Tree
updateIndexFrom :: Tree -> IO Tree
Documentation
hashToString :: Hash -> StringSource
data Item Source
A recursive-ish index structure (as opposed to flat-ish structure, which is used by git... It turns out that it's hard to efficiently read a flat index with our internal data structures -- we need to turn the flat index into a recursive Tree object, which is rather expensive...). As a bonus, we can also efficiently implement subtree queries this way (cf. readIndex).
Constructors
Item
iPath :: ByteString
iName :: ByteString
iHash :: ByteString
iSize :: Ptr Int64
iAux :: Ptr Int64
show/hide Instances
itemSize :: Item -> IntSource
itemSizeI :: Num a => Item -> aSource
itemIsDir :: Item -> BoolSource
createItem :: ItemType -> AnchoredPath -> ForeignPtr () -> Int -> IO ItemSource
peekItem :: ForeignPtr () -> Int -> Maybe Int -> IO ItemSource
update :: Item -> Maybe EpochTime -> Hash -> IO ()Source
Update an existing item with new hash and optionally mtime (give Nothing when updating directory entries).
iHash' :: Item -> IO HashSource
mmapIndex :: forall a. Int -> IO (ForeignPtr a, Int)Source
readIndex' :: IO (Tree, IORef (Map AnchoredPath Item))Source
See readIndex. This version also gives a map from paths to items, so the extra per-item data can be used (hash and mtime) directly. The map is in a form of IORef, since the data is not available until the tree is unfolded.
readIndex :: IO TreeSource
Read an index and build up a Tree object from it, referring to current working directory. Any parts of the index that are out of date are updated in-place. The result is always an up-to-date index. Also, the Tree is stubby and only the pieces of the index that are unfolded will be actually updated! To implement a subtree query, you can use Tree.filter and then unfold the result. Otherwise just unfold the whole tree to avoid unexpected problems.
updateIndexFrom :: Tree -> IO TreeSource
Will add and remove files in index to make it match the Tree object given (it is an error for the Tree to contain a file or directory that does not exist in a plain form under FilePath).
Produced by Haddock version 2.4.2