| darcs-2.4.4: a distributed, interactive, smart revision control system | Source code | Contents | Index

Darcs.Repository.Cache

Synopsis

cacheHash :: ByteString -> String
okayHash :: String -> Bool
takeHash :: ByteString -> Maybe (String, ByteString)
newtype Cache = Ca [CacheLoc]

data CacheType

= Repo
| Directory

data CacheLoc = Cache !CacheType !WritableOrNot !String

data WritableOrNot

= Writable
| NotWritable

data HashedDir

= HashedPristineDir
| HashedPatchesDir
| HashedInventoriesDir

hashedDir :: HashedDir -> String
unionCaches :: Cache -> Cache -> Cache
cleanCaches :: Cache -> HashedDir -> IO ()
cleanCachesWithHint :: Cache -> HashedDir -> [String] -> IO ()
fetchFileUsingCache :: Cache -> HashedDir -> String -> IO (String, ByteString)
speculateFileUsingCache :: Cache -> HashedDir -> String -> IO ()
writeFileUsingCache :: Cache -> Compression -> HashedDir -> ByteString -> IO String
peekInCache :: Cache -> HashedDir -> String -> IO Bool
repo2cache :: String -> Cache
writable :: CacheLoc -> Bool
isthisrepo :: CacheLoc -> Bool
hashedFilePath :: CacheLoc -> HashedDir -> String -> String
allHashedDirs :: [HashedDir]

Documentation

cacheHash :: ByteString -> String | Source

`cacheHash` computes the cache hash (i.e. filename) of a packed string.

okayHash :: String -> Bool | Source

takeHash :: ByteString -> Maybe (String, ByteString) | Source

newtype Cache | Source

Constructors

Ca [CacheLoc] |

Instances

Show Cache

data CacheType | Source

Constructors

Repo |
Directory |

Instances

Eq CacheType
Show CacheType

data CacheLoc | Source

Constructors

Cache !CacheType !WritableOrNot !String |

Instances

Eq CacheLoc
Show CacheLoc

data WritableOrNot | Source

Constructors

Writable |
NotWritable |

Instances

Show WritableOrNot

data HashedDir | Source

Constructors

HashedPristineDir |
HashedPatchesDir |
HashedInventoriesDir |

hashedDir :: HashedDir -> String | Source

unionCaches :: Cache -> Cache -> Cache | Source

cleanCaches :: Cache -> HashedDir -> IO () | Source

cleanCachesWithHint :: Cache -> HashedDir -> [String] -> IO () | Source

fetchFileUsingCache :: Cache -> HashedDir -> String -> IO (String, ByteString) | Source

speculateFileUsingCache :: Cache -> HashedDir -> String -> IO () | Source

`speculateFileUsingCache cache subdirectory name` takes note that the file `name` is likely to be useful soon: pipelined downloads will add it to the (low-priority) queue, for the rest it is a noop.

writeFileUsingCache :: Cache -> Compression -> HashedDir -> ByteString -> IO String | Source

`writeFileUsingCache cache compression subdir contents` write the string `contents` to the directory subdir, except if it is already in the cache, in which case it is a noop. Warning (?) this means that in case of a hash collision, writing using writeFileUsingCache is a noop. The returned value is the filename that was given to the string.

peekInCache :: Cache -> HashedDir -> String -> IO Bool | Source

`peekInCache cache subdir hash` tells whether `cache` and contains an object with hash `hash` in a writable position. Florent: why do we want it to be in a writable position?

repo2cache :: String -> Cache | Source

writable :: CacheLoc -> Bool | Source

isthisrepo :: CacheLoc -> Bool | Source

hashedFilePath :: CacheLoc -> HashedDir -> String -> String | Source

`hashedFilePath cachelocation subdir hash` returns the physical filename of hash `hash` in the `subdir` section of `cachelocation`.

allHashedDirs :: [HashedDir] | Source

Produced by Haddock version 2.4.2