darcs-2.18.4: a distributed, interactive, smart revision control system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Darcs.Util.Cache

Synopsis

Documentation

data Cache Source #

Cache is an abstract type for hiding the underlying cache locations

Instances

Instances details
Show Cache Source # 
Instance details

Defined in Darcs.Util.Cache

Methods

showsPrec :: Int -> Cache -> ShowS #

show :: Cache -> String #

showList :: [Cache] -> ShowS #

mkCache :: [CacheLoc] -> Cache Source #

Smart constructor for CacheLoc.

data CacheType Source #

Constructors

Repo 
Directory 

Instances

Instances details
Show CacheType Source # 
Instance details

Defined in Darcs.Util.Cache

Eq CacheType Source # 
Instance details

Defined in Darcs.Util.Cache

data CacheLoc Source #

Instances

Instances details
Eq CacheLoc Source #

Note: this non-structural instance ignores the cacheWritable field. This is so that when we nub a list of locations we retain only one (the first) variant.

Instance details

Defined in Darcs.Util.Cache

data WritableOrNot Source #

Constructors

Writable 
NotWritable 

Instances

Instances details
Show WritableOrNot Source # 
Instance details

Defined in Darcs.Util.Cache

Eq WritableOrNot Source # 
Instance details

Defined in Darcs.Util.Cache

data HashedDir Source #

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.

Instances

Instances details
Eq HashedDir Source # 
Instance details

Defined in Darcs.Util.ValidHash

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.

hashedFilePath :: CacheLoc -> HashedDir -> FilePath -> FilePath Source #

The full filepath of a simple file name inside a given CacheLoc under HashedDir.

reportBadSources :: IO () Source #

Prints an error message with a list of bad caches.

dropNonRepos :: Cache -> Cache Source #

This keeps only Repo NotWritable entries.