| Copyright | (c) 2017 Composewell Technologies |
|---|---|
| License | BSD-3-Clause |
| Maintainer | streamly@composewell.com |
| Stability | experimental |
| Portability | GHC |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Streamly.Internal.Data.Stream.Channel.Worker
Contents
Description
Collecting results from child workers in a streamed fashion
Synopsis
- data Work
- estimateWorkers :: Limit -> Count -> Count -> NanoSecond64 -> NanoSecond64 -> NanoSecond64 -> LatencyRange -> Work
- isBeyondMaxRate :: Limit -> IORef Int -> YieldRateInfo -> IO Bool
- workerRateControl :: Limit -> IORef Int -> YieldRateInfo -> WorkerInfo -> IO Bool
- sendWithDoorBell :: IORef ([ChildEvent a], Int) -> MVar () -> ChildEvent a -> IO Int
- sendYield :: Limit -> Limit -> IORef Int -> Maybe WorkerInfo -> Maybe YieldRateInfo -> IORef ([ChildEvent a], Int) -> MVar () -> ChildEvent a -> IO Bool
- sendStop :: IORef Int -> Maybe WorkerInfo -> Maybe YieldRateInfo -> IORef ([ChildEvent a], Int) -> MVar () -> IO ()
- handleChildException :: IORef ([ChildEvent a], Int) -> MVar () -> SomeException -> IO ()
Documentation
Constructors
| BlockWait NanoSecond64 | |
| PartialWorker Count | |
| ManyWorkers Int Count |
estimateWorkers :: Limit -> Count -> Count -> NanoSecond64 -> NanoSecond64 -> NanoSecond64 -> LatencyRange -> Work Source #
isBeyondMaxRate :: Limit -> IORef Int -> YieldRateInfo -> IO Bool Source #
workerRateControl :: Limit -> IORef Int -> YieldRateInfo -> WorkerInfo -> IO Bool Source #
CAUTION! this also updates the yield count and therefore should be called only when we are actually yielding an element.
Send Events
sendWithDoorBell :: IORef ([ChildEvent a], Int) -> MVar () -> ChildEvent a -> IO Int Source #
sendYield :: Limit -> Limit -> IORef Int -> Maybe WorkerInfo -> Maybe YieldRateInfo -> IORef ([ChildEvent a], Int) -> MVar () -> ChildEvent a -> IO Bool Source #
Returns whether the worker should continue (True) or stop (False).
sendStop :: IORef Int -> Maybe WorkerInfo -> Maybe YieldRateInfo -> IORef ([ChildEvent a], Int) -> MVar () -> IO () Source #
handleChildException :: IORef ([ChildEvent a], Int) -> MVar () -> SomeException -> IO () Source #