Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Cache
- mkCache :: [CacheLoc] -> Cache
- mkDirCache :: FilePath -> Cache
- mkRepoCache :: FilePath -> Cache
- cacheEntries :: Cache -> [CacheLoc]
- data CacheType
- data CacheLoc = Cache {}
- data WritableOrNot
- data HashedDir
- hashedDir :: HashedDir -> FilePath
- bucketFolder :: FilePath -> FilePath
- filterRemoteCaches :: Cache -> IO Cache
- cleanCaches :: Cache -> HashedDir -> IO ()
- cleanCachesWithHint :: Cache -> HashedDir -> [String] -> IO ()
- fetchFileUsingCache :: ValidHash h => Cache -> h -> IO (FilePath, ByteString)
- speculateFileUsingCache :: ValidHash h => Cache -> h -> IO ()
- speculateFilesUsingCache :: ValidHash h => Cache -> [h] -> IO ()
- writeFileUsingCache :: ValidHash h => Cache -> ByteString -> IO h
- peekInCache :: ValidHash h => Cache -> h -> IO Bool
- parseCacheLoc :: String -> Maybe CacheLoc
- showCacheLoc :: CacheLoc -> String
- writable :: CacheLoc -> Bool
- isThisRepo :: CacheLoc -> Bool
- hashedFilePath :: CacheLoc -> HashedDir -> FilePath -> FilePath
- allHashedDirs :: [HashedDir]
- reportBadSources :: IO ()
- closestWritableDirectory :: Cache -> Maybe String
- dropNonRepos :: Cache -> Cache
Documentation
Cache is an abstract type for hiding the underlying cache locations
mkDirCache :: FilePath -> Cache Source #
mkRepoCache :: FilePath -> Cache Source #
cacheEntries :: Cache -> [CacheLoc] Source #
Cache | |
|
data WritableOrNot Source #
Instances
Show WritableOrNot Source # | |
Defined in Darcs.Util.Cache showsPrec :: Int -> WritableOrNot -> ShowS # show :: WritableOrNot -> String # showList :: [WritableOrNot] -> ShowS # | |
Eq WritableOrNot Source # | |
Defined in Darcs.Util.Cache (==) :: WritableOrNot -> WritableOrNot -> Bool # (/=) :: WritableOrNot -> WritableOrNot -> Bool # |
Semantically, this is the type of hashed objects. Git has a type tag inside the hashed file itself, whereas in Darcs the type is determined by the subdirectory.
bucketFolder :: FilePath -> FilePath Source #
filterRemoteCaches :: Cache -> IO Cache Source #
Filter caches for remote repos. This affects only entries that are locally valid paths (i.e. not network URLs): they are removed if non-existent, or demoted to NotWritable if they are not actually writable in the file system.
fetchFileUsingCache :: ValidHash h => Cache -> h -> IO (FilePath, ByteString) Source #
fetchFileUsingCache cache dir hash
receives a list of caches cache
, the
directory for which that file belongs dir
and the hash
of the file to
fetch. It tries to fetch the file from one of the sources, trying them in
order one by one. If the file cannot be fetched from any of the sources,
this operation fails. Otherwise we return the path where we found the file
and its content.
speculateFileUsingCache :: ValidHash h => Cache -> h -> IO () Source #
Add pipelined downloads to the (low-priority) queue, for the rest it is a noop.
speculateFilesUsingCache :: ValidHash h => Cache -> [h] -> IO () Source #
Do speculateFilesUsingCache
for files not already in a writable cache
position.
writeFileUsingCache :: ValidHash h => Cache -> ByteString -> IO h Source #
Write file content, except if it is already in the cache, in which case merely create a hard link to that file. The returned value is the size and hash of the content.
peekInCache :: ValidHash h => Cache -> h -> IO Bool Source #
Return whether the CacheLoc
contains a file with the given hash in a
writable position.
showCacheLoc :: CacheLoc -> String Source #
isThisRepo :: CacheLoc -> Bool Source #
allHashedDirs :: [HashedDir] Source #
reportBadSources :: IO () Source #
Prints an error message with a list of bad caches.
dropNonRepos :: Cache -> Cache Source #
This keeps only Repo
NotWritable
entries.