Portability | portable |
---|---|
Stability | experimental |
Maintainer | pxqr.sta@gmail.com |
Safe Haskell | None |
Progress
used to track amount downloaded/left/upload bytes
either on per client or per torrent basis. This value is used to
notify the tracker and usually shown to the user. To aggregate
total progress you can use the Monoid instance.
- data Progress = Progress {}
- left :: Lens' Progress Word64
- uploaded :: Lens' Progress Word64
- downloaded :: Lens' Progress Word64
- startProgress :: Integer -> Progress
- downloadedProgress :: Int -> Progress -> Progress
- enqueuedProgress :: Integer -> Progress -> Progress
- uploadedProgress :: Int -> Progress -> Progress
- dequeuedProgress :: Integer -> Progress -> Progress
- canDownload :: Ratio Int -> Progress -> Bool
- canUpload :: Ratio Int -> Progress -> Bool
Progress
Progress data is considered as dynamic within one client
session. This data also should be shared across client application
sessions (e.g. files), otherwise use startProgress
to get initial
Progress
value.
Lens
Construction
startProgress :: Integer -> ProgressSource
Initial progress is used when there are no session before.
Please note that tracker might penalize client some way if the do
not accumulate progress. If possible and save Progress
between
client sessions to avoid that.
downloadedProgress :: Int -> Progress -> ProgressSource
Used when the client download some data from any peer.
enqueuedProgress :: Integer -> Progress -> ProgressSource
Used when leecher join client session.
uploadedProgress :: Int -> Progress -> ProgressSource
Used when the client upload some data to any peer.
dequeuedProgress :: Integer -> Progress -> ProgressSource
Used when leecher leave client session. (e.g. user deletes not completed torrent)