mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-09-19 04:37:33 +03:00
Move common Channel type from Data.Stream to Data
This commit is contained in:
parent
9251eae2d0
commit
3f489cf3fa
19
src/Streamly/Internal/Data/Channel.hs
Normal file
19
src/Streamly/Internal/Data/Channel.hs
Normal file
@ -0,0 +1,19 @@
|
||||
-- |
|
||||
-- Module : Streamly.Internal.Data.Channel
|
||||
-- Copyright : (c) 2017 Composewell Technologies
|
||||
-- License : BSD-3-Clause
|
||||
-- Maintainer : streamly@composewell.com
|
||||
-- Stability : experimental
|
||||
-- Portability : GHC
|
||||
|
||||
module Streamly.Internal.Data.Channel
|
||||
(
|
||||
module Streamly.Internal.Data.Channel.Dispatcher
|
||||
, module Streamly.Internal.Data.Channel.Types
|
||||
, module Streamly.Internal.Data.Channel.Worker
|
||||
)
|
||||
where
|
||||
|
||||
import Streamly.Internal.Data.Channel.Dispatcher
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Worker
|
@ -1,5 +1,5 @@
|
||||
-- |
|
||||
-- Module : Streamly.Internal.Data.Stream.Channel.Dispatcher
|
||||
-- Module : Streamly.Internal.Data.Channel.Dispatcher
|
||||
-- Copyright : (c) 2017 Composewell Technologies
|
||||
-- License : BSD-3-Clause
|
||||
-- Maintainer : streamly@composewell.com
|
||||
@ -7,7 +7,7 @@
|
||||
-- Portability : GHC
|
||||
--
|
||||
--
|
||||
module Streamly.Internal.Data.Stream.Channel.Dispatcher
|
||||
module Streamly.Internal.Data.Channel.Dispatcher
|
||||
(
|
||||
-- * Latency collection
|
||||
minThreadDelay
|
||||
@ -40,7 +40,7 @@ import Streamly.Internal.Data.Time.Units
|
||||
|
||||
import qualified Data.Set as S
|
||||
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Worker latency data processing
|
@ -1,5 +1,5 @@
|
||||
-- |
|
||||
-- Module : Streamly.Internal.Data.Stream.Channel.Types
|
||||
-- Module : Streamly.Internal.Data.Channel.Types
|
||||
-- Copyright : (c) 2017 Composewell Technologies
|
||||
-- License : BSD-3-Clause
|
||||
-- Maintainer : streamly@composewell.com
|
||||
@ -31,7 +31,7 @@
|
||||
-- consumer is not pulling fast enough. The number of workers may even get
|
||||
-- reduced depending on the consuming pace.
|
||||
--
|
||||
module Streamly.Internal.Data.Stream.Channel.Types
|
||||
module Streamly.Internal.Data.Channel.Types
|
||||
(
|
||||
-- * Types
|
||||
Count (..)
|
@ -1,5 +1,5 @@
|
||||
-- |
|
||||
-- Module : Streamly.Internal.Data.Stream.Concurrent.Channel.Worker
|
||||
-- Module : Streamly.Internal.Data.Channel.Worker
|
||||
-- Copyright : (c) 2017 Composewell Technologies
|
||||
-- License : BSD-3-Clause
|
||||
-- Maintainer : streamly@composewell.com
|
||||
@ -8,7 +8,7 @@
|
||||
--
|
||||
-- Collecting results from child workers in a streamed fashion
|
||||
|
||||
module Streamly.Internal.Data.Stream.Channel.Worker
|
||||
module Streamly.Internal.Data.Channel.Worker
|
||||
(
|
||||
Work (..)
|
||||
, estimateWorkers
|
||||
@ -34,7 +34,7 @@ import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime)
|
||||
import Streamly.Internal.Data.Time.Units
|
||||
(AbsTime, NanoSecond64(..), diffAbsTime64, fromRelTime64)
|
||||
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Yield control
|
@ -26,11 +26,11 @@ import Control.Monad.IO.Class (MonadIO(liftIO))
|
||||
import Data.IORef (writeIORef)
|
||||
import Streamly.Internal.Control.Concurrent (MonadAsync)
|
||||
import Streamly.Internal.Data.Fold (Fold(..), Step (..))
|
||||
import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
|
||||
import Streamly.Internal.Data.Channel.Worker (sendWithDoorBell)
|
||||
import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime)
|
||||
|
||||
import Streamly.Internal.Data.Fold.Concurrent.Channel.Type
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Evaluating a Fold
|
||||
|
@ -30,13 +30,13 @@ import Streamly.Internal.Control.Concurrent
|
||||
(MonadAsync, MonadRunInIO, askRunInIO)
|
||||
import Streamly.Internal.Control.ForkLifted (doForkWith)
|
||||
import Streamly.Internal.Data.Fold (Fold(..))
|
||||
import Streamly.Internal.Data.Stream.Channel.Dispatcher (dumpSVarStats)
|
||||
import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
|
||||
import Streamly.Internal.Data.Channel.Dispatcher (dumpSVarStats)
|
||||
import Streamly.Internal.Data.Channel.Worker (sendWithDoorBell)
|
||||
|
||||
import qualified Streamly.Internal.Data.Fold as Fold
|
||||
import qualified Streamly.Internal.Data.Stream as D
|
||||
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
|
||||
data Channel m a b = Channel
|
||||
{
|
||||
|
@ -104,9 +104,9 @@ import Control.Monad (void, when)
|
||||
import Control.Monad.IO.Class (MonadIO(liftIO))
|
||||
import Streamly.Internal.Control.Concurrent (MonadAsync, askRunInIO)
|
||||
import Streamly.Internal.Control.ForkLifted (forkManaged)
|
||||
import Streamly.Internal.Data.Stream.Channel.Dispatcher (modifyThread)
|
||||
import Streamly.Internal.Data.Stream.Channel.Types (ChildEvent(..))
|
||||
import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
|
||||
import Streamly.Internal.Data.Channel.Dispatcher (modifyThread)
|
||||
import Streamly.Internal.Data.Channel.Types (ChildEvent(..))
|
||||
import Streamly.Internal.Data.Channel.Worker (sendWithDoorBell)
|
||||
import Streamly.Internal.Data.Stream (Stream, Step(..))
|
||||
import Streamly.Internal.Data.SVar.Type (adaptState)
|
||||
|
||||
|
@ -62,7 +62,7 @@ import qualified Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave
|
||||
import qualified Streamly.Internal.Data.StreamK as K
|
||||
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
|
||||
-- | Create a new concurrent stream evaluation channel. The monad
|
||||
-- state used to run the stream actions is captured from the call site of
|
||||
|
@ -32,7 +32,7 @@ import Streamly.Internal.Control.Concurrent
|
||||
(MonadRunInIO, RunInIO(..), askRunInIO, restoreM)
|
||||
import Streamly.Internal.Data.Atomics
|
||||
(atomicModifyIORefCAS, atomicModifyIORefCAS_)
|
||||
import Streamly.Internal.Data.Stream.Channel.Dispatcher (modifyThread)
|
||||
import Streamly.Internal.Data.Channel.Dispatcher (modifyThread)
|
||||
|
||||
import qualified Data.Heap as H
|
||||
import qualified Data.Set as Set
|
||||
@ -41,8 +41,8 @@ import qualified Streamly.Internal.Data.StreamK as K
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Stream.Channel.Worker
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Worker
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Concurrent streams with first-come-first serve results
|
||||
|
@ -25,8 +25,8 @@ import Streamly.Internal.Control.Concurrent (MonadRunInIO)
|
||||
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
|
||||
import Streamly.Internal.Data.Stream.Channel.Dispatcher
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Dispatcher
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Reading from the workers' output queue/buffer
|
||||
|
@ -34,9 +34,9 @@ import Streamly.Internal.Data.Time.Units
|
||||
(MicroSecond64(..), diffAbsTime64, fromRelTime64, toRelTime64)
|
||||
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
|
||||
import Streamly.Internal.Data.Stream.Channel.Dispatcher
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Stream.Channel.Worker
|
||||
import Streamly.Internal.Data.Channel.Dispatcher
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Worker
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Dispatching workers
|
||||
|
@ -21,14 +21,14 @@ import Data.Concurrent.Queue.MichaelScott (LinkedQueue, newQ, nullQ, tryPopR, pu
|
||||
import Data.IORef (newIORef, readIORef)
|
||||
import Streamly.Internal.Control.Concurrent
|
||||
(MonadRunInIO, MonadAsync, RunInIO(..), askRunInIO, restoreM)
|
||||
import Streamly.Internal.Data.Stream.Channel.Dispatcher (delThread)
|
||||
import Streamly.Internal.Data.Channel.Dispatcher (delThread)
|
||||
|
||||
import qualified Data.Set as Set
|
||||
import qualified Streamly.Internal.Data.StreamK as K
|
||||
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Creating a channel
|
||||
|
@ -44,7 +44,7 @@ import qualified Streamly.Internal.Data.StreamK as K
|
||||
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher
|
||||
import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
|
||||
import Streamly.Internal.Data.Stream.Channel.Types hiding (inspect)
|
||||
import Streamly.Internal.Data.Channel.Types hiding (inspect)
|
||||
|
||||
import Prelude hiding (map, concat, concatMap)
|
||||
|
||||
|
@ -25,12 +25,12 @@ import Data.List (intersperse)
|
||||
import Data.Set (Set)
|
||||
import Streamly.Internal.Control.Concurrent (RunInIO)
|
||||
import Streamly.Internal.Data.Atomics (atomicModifyIORefCAS_)
|
||||
import Streamly.Internal.Data.Stream.Channel.Dispatcher (dumpSVarStats)
|
||||
import Streamly.Internal.Data.Stream.Channel.Worker
|
||||
import Streamly.Internal.Data.Channel.Dispatcher (dumpSVarStats)
|
||||
import Streamly.Internal.Data.Channel.Worker
|
||||
(sendYield, sendStop, sendWithDoorBell)
|
||||
import Streamly.Internal.Data.StreamK (StreamK)
|
||||
|
||||
import Streamly.Internal.Data.Stream.Channel.Types
|
||||
import Streamly.Internal.Data.Channel.Types
|
||||
|
||||
-- IMPORTANT NOTE: we cannot update the SVar after generating it as we have
|
||||
-- references to the original SVar stored in several functions which will keep
|
||||
|
@ -363,6 +363,7 @@ library
|
||||
-- graphmod | dot -Tps > deps.ps
|
||||
Streamly.Internal.Data.IsMap.HashMap
|
||||
, Streamly.Internal.Data.Cont
|
||||
, Streamly.Internal.Data.Channel
|
||||
, Streamly.Internal.Data.Stream.MkType
|
||||
|
||||
-- streamly-concurrent
|
||||
@ -370,9 +371,6 @@ library
|
||||
, Streamly.Internal.Control.ForkLifted
|
||||
, Streamly.Internal.Data.Atomics
|
||||
, Streamly.Internal.Data.IOFinalizer.Lifted
|
||||
, Streamly.Internal.Data.Stream.Channel.Types
|
||||
, Streamly.Internal.Data.Stream.Channel.Dispatcher
|
||||
, Streamly.Internal.Data.Stream.Channel.Worker
|
||||
|
||||
, Streamly.Internal.Data.Unfold.Prelude
|
||||
, Streamly.Internal.Data.Fold.Prelude
|
||||
@ -451,7 +449,11 @@ library
|
||||
exposed-modules: Streamly.Internal.FileSystem.Event
|
||||
|
||||
other-modules:
|
||||
Streamly.Data.Stream.Exception
|
||||
Streamly.Internal.Data.Channel.Types
|
||||
, Streamly.Internal.Data.Channel.Dispatcher
|
||||
, Streamly.Internal.Data.Channel.Worker
|
||||
|
||||
, Streamly.Data.Stream.Exception
|
||||
, Streamly.Data.Stream.Concurrent
|
||||
, Streamly.Data.Stream.Time
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user