Move common Channel type from Data.Stream to Data

This commit is contained in:
Harendra Kumar 2023-11-27 01:47:43 +05:30
parent 9251eae2d0
commit 3f489cf3fa
15 changed files with 56 additions and 35 deletions

View 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

View File

@ -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

View File

@ -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 (..)

View File

@ -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

View File

@ -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

View File

@ -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
{

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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