darcs-2.12.5: a distributed, interactive, smart revision control system

Safe Haskell | Safe
Language | Haskell2010

Darcs.Util.Download.Request

Synopsis

- data UrlRequest = UrlRequest {
  - url :: String
  - file :: FilePath
  - cachable :: Cachable
  - priority :: Priority
  }
- data Cachable
  - = Cachable
  - | Uncachable
  - | MaxAge !CInt
- data UrlState = UrlState {
  - inProgress :: Map String InProgressStatus
  - waitToStart :: Q String
  - pipeLength :: Int
  - randomJunk :: String
  }
- data Q a = Q [a] [a]
- readQ :: Q a -> Maybe (a, Q a)
- insertQ :: a -> Q a -> Q a
- pushQ :: a -> Q a -> Q a
- addUsingPriority :: Priority -> a -> Q a -> Q a
- deleteQ :: Eq a => a -> Q a -> Q a
- elemQ :: Eq a => a -> Q a -> Bool
- emptyQ :: Q a
- nullQ :: Q a -> Bool
- data Priority
  - = High
  - | Low
- data ConnectionError
  - = CouldNotResolveHost
  - | CouldNotConnectToServer
  - | OperationTimeout

# Documentation

data UrlRequest #

A UrlRequest object contains a url to get, the file into which the contents at the given url should be written, the cachability of this request and the request's priority.

Constructors

UrlRequest |
Fields url :: String file :: FilePath cachable :: Cachable priority :: Priority

data Cachable #

Constructors

Cachable |
Uncachable |
MaxAge !CInt |

Instances

Eq Cachable # |
Methods (==) :: Cachable -> Cachable -> Bool # (/=) :: Cachable -> Cachable -> Bool #
Show Cachable # |
Methods showsPrec :: Int -> Cachable -> ShowS # show :: Cachable -> String # showList :: [Cachable] -> ShowS #

data UrlState #

A UrlState object contains a map of url -> InProgressStatus, a Q of urls waiting to be started, the current pipe length and the unique junk to create unique filenames.

Constructors

UrlState |
Fields inProgress :: Map String InProgressStatus waitToStart :: Q String pipeLength :: Int randomJunk :: String

data Q a #

Q represents a prioritised queue, with two-tier priority. The left list contains higher priority items than the right list.

Constructors

Q [a] [a] |

readQ :: Q a -> Maybe (a, Q a) #

`readQ` will try and take an element from the Q, preferring elements from the high priority list.

insertQ :: a -> Q a -> Q a #

`insertQ` inserts a low priority item into a Q.

pushQ :: a -> Q a -> Q a #

`pushQ` inserts a high priority item into a Q.

addUsingPriority :: Priority -> a -> Q a -> Q a #

Return a function for adding an element based on the priority.

deleteQ :: Eq a => a -> Q a -> Q a #

`deleteQ` removes any instances of a given element from the Q.

elemQ :: Eq a => a -> Q a -> Bool #

`deleteQ` checks for membership in a Q.

emptyQ :: Q a #

`emptyQ` is an empty Q.

nullQ :: Q a -> Bool #

`nullQ` checks if the Q contains no items.

data Priority #

Constructors

High |
Low |

Instances

Eq Priority # |
Methods (==) :: Priority -> Priority -> Bool # (/=) :: Priority -> Priority -> Bool #

data ConnectionError #

Data type to represent a connection error. The following are the codes from libcurl which map to each of the constructors: * 6 -> CouldNotResolveHost : The remote host was not resolved. * 7 -> CouldNotConnectToServer : Failed to connect() to host or proxy. * 28 -> OperationTimeout: the specified time-out period was reached.

Constructors

CouldNotResolveHost |
CouldNotConnectToServer |
OperationTimeout |

Instances

Eq ConnectionError # |
Methods (==) :: ConnectionError -> ConnectionError -> Bool # (/=) :: ConnectionError -> ConnectionError -> Bool #
Read ConnectionError # |
Methods readsPrec :: Int -> ReadS ConnectionError # readList :: ReadS [ConnectionError] # readPrec :: ReadPrec ConnectionError # readListPrec :: ReadPrec [ConnectionError] #
Show ConnectionError # |
Methods showsPrec :: Int -> ConnectionError -> ShowS # show :: ConnectionError -> String # showList :: [ConnectionError] -> ShowS #