on master help sign in
Move common Channel type from Data.Stream to Data
commit3f489cf3fa02face2c8ceb07a26a773e0572dcbe authorHarendra Kumar <harendra@composewell.com> dateMon 27 Nov 2023, 01:47 (3 years ago) parent9251eae
15 files changed+56−35
src/Streamly/Internal/Data/Channel.hs+19 src/Streamly/Internal/Data/Stream/Channel/Dispatcher.hs → src/Streamly/Internal/Data/Channel/Dispatcher.hs+3−3 src/Streamly/Internal/Data/Stream/Channel/Types.hs → src/Streamly/Internal/Data/Channel/Types.hs+2−2 src/Streamly/Internal/Data/Stream/Channel/Worker.hs → src/Streamly/Internal/Data/Channel/Worker.hs+3−3 src/Streamly/Internal/Data/Fold/Concurrent/Channel.hs+2−2 src/Streamly/Internal/Data/Fold/Concurrent/Channel/Type.hs+3−3 src/Streamly/Internal/Data/Stream/Concurrent.hs+3−3 src/Streamly/Internal/Data/Stream/Concurrent/Channel.hs+1−1 src/Streamly/Internal/Data/Stream/Concurrent/Channel/Append.hs+3−3 src/Streamly/Internal/Data/Stream/Concurrent/Channel/Consumer.hs+2−2 src/Streamly/Internal/Data/Stream/Concurrent/Channel/Dispatcher.hs+3−3 src/Streamly/Internal/Data/Stream/Concurrent/Channel/Interleave.hs+2−2 src/Streamly/Internal/Data/Stream/Concurrent/Channel/Operations.hs+1−1 src/Streamly/Internal/Data/Stream/Concurrent/Channel/Type.hs+3−3 streamly.cabal+6−4
src/Streamly/Internal/Data/Channel.hsnew file+19
@@ -0,0 +1,19 @@
1+-- |
2+-- Module : Streamly.Internal.Data.Channel
3+-- Copyright : (c) 2017 Composewell Technologies
4+-- License : BSD-3-Clause
5+-- Maintainer : streamly@composewell.com
6+-- Stability : experimental
7+-- Portability : GHC
8+
9+module Streamly.Internal.Data.Channel
10+ (
11+ module Streamly.Internal.Data.Channel.Dispatcher
12+ , module Streamly.Internal.Data.Channel.Types
13+ , module Streamly.Internal.Data.Channel.Worker
14+ )
15+where
16+
17+import Streamly.Internal.Data.Channel.Dispatcher
18+import Streamly.Internal.Data.Channel.Types
19+import Streamly.Internal.Data.Channel.Worker
src/Streamly/Internal/Data/Stream/Channel/Dispatcher.hs → src/Streamly/Internal/Data/Channel/Dispatcher.hsrenamed+3−3
@@ -1,5 +1,5 @@
11-- |
2−-- Module : Streamly.Internal.Data.Stream.Channel.Dispatcher
2+-- Module : Streamly.Internal.Data.Channel.Dispatcher
33-- Copyright : (c) 2017 Composewell Technologies
44-- License : BSD-3-Clause
55-- Maintainer : streamly@composewell.com
@@ -7,7 +7,7 @@
77-- Portability : GHC
88--
99--
10−module Streamly.Internal.Data.Stream.Channel.Dispatcher
10+module Streamly.Internal.Data.Channel.Dispatcher
1111 (
1212 -- * Latency collection
1313 minThreadDelay
@@ -40,7 +40,7 @@ import Streamly.Internal.Data.Time.Units
4040
4141import qualified Data.Set as S
4242
43−import Streamly.Internal.Data.Stream.Channel.Types
43+import Streamly.Internal.Data.Channel.Types
4444
4545-------------------------------------------------------------------------------
4646-- Worker latency data processing
src/Streamly/Internal/Data/Stream/Channel/Types.hs → src/Streamly/Internal/Data/Channel/Types.hsrenamed+2−2
@@ -1,5 +1,5 @@
11-- |
2−-- Module : Streamly.Internal.Data.Stream.Channel.Types
2+-- Module : Streamly.Internal.Data.Channel.Types
33-- Copyright : (c) 2017 Composewell Technologies
44-- License : BSD-3-Clause
55-- Maintainer : streamly@composewell.com
@@ -31,7 +31,7 @@
3131-- consumer is not pulling fast enough. The number of workers may even get
3232-- reduced depending on the consuming pace.
3333--
34−module Streamly.Internal.Data.Stream.Channel.Types
34+module Streamly.Internal.Data.Channel.Types
3535 (
3636 -- * Types
3737 Count (..)
src/Streamly/Internal/Data/Stream/Channel/Worker.hs → src/Streamly/Internal/Data/Channel/Worker.hsrenamed+3−3
@@ -1,5 +1,5 @@
11-- |
2−-- Module : Streamly.Internal.Data.Stream.Concurrent.Channel.Worker
2+-- Module : Streamly.Internal.Data.Channel.Worker
33-- Copyright : (c) 2017 Composewell Technologies
44-- License : BSD-3-Clause
55-- Maintainer : streamly@composewell.com
@@ -8,7 +8,7 @@
88--
99-- Collecting results from child workers in a streamed fashion
1010
11−module Streamly.Internal.Data.Stream.Channel.Worker
11+module Streamly.Internal.Data.Channel.Worker
1212 (
1313 Work (..)
1414 , estimateWorkers
@@ -34,7 +34,7 @@ import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime)
3434import Streamly.Internal.Data.Time.Units
3535 (AbsTime, NanoSecond64(..), diffAbsTime64, fromRelTime64)
3636
37−import Streamly.Internal.Data.Stream.Channel.Types
37+import Streamly.Internal.Data.Channel.Types
3838
3939-------------------------------------------------------------------------------
4040-- Yield control
src/Streamly/Internal/Data/Fold/Concurrent/Channel.hs+2−2
@@ -26,11 +26,11 @@ import Control.Monad.IO.Class (MonadIO(liftIO))
2626import Data.IORef (writeIORef)
2727import Streamly.Internal.Control.Concurrent (MonadAsync)
2828import Streamly.Internal.Data.Fold (Fold(..), Step (..))
29−import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
29+import Streamly.Internal.Data.Channel.Worker (sendWithDoorBell)
3030import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime)
3131
3232import Streamly.Internal.Data.Fold.Concurrent.Channel.Type
33−import Streamly.Internal.Data.Stream.Channel.Types
33+import Streamly.Internal.Data.Channel.Types
3434
3535-------------------------------------------------------------------------------
3636-- Evaluating a Fold
src/Streamly/Internal/Data/Fold/Concurrent/Channel/Type.hs+3−3
@@ -30,13 +30,13 @@ import Streamly.Internal.Control.Concurrent
3030 (MonadAsync, MonadRunInIO, askRunInIO)
3131import Streamly.Internal.Control.ForkLifted (doForkWith)
3232import Streamly.Internal.Data.Fold (Fold(..))
33−import Streamly.Internal.Data.Stream.Channel.Dispatcher (dumpSVarStats)
34−import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
33+import Streamly.Internal.Data.Channel.Dispatcher (dumpSVarStats)
34+import Streamly.Internal.Data.Channel.Worker (sendWithDoorBell)
3535
3636import qualified Streamly.Internal.Data.Fold as Fold
3737import qualified Streamly.Internal.Data.Stream as D
3838
39−import Streamly.Internal.Data.Stream.Channel.Types
39+import Streamly.Internal.Data.Channel.Types
4040
4141data Channel m a b = Channel
4242 {
src/Streamly/Internal/Data/Stream/Concurrent.hs+3−3
@@ -104,9 +104,9 @@ import Control.Monad (void, when)
104104import Control.Monad.IO.Class (MonadIO(liftIO))
105105import Streamly.Internal.Control.Concurrent (MonadAsync, askRunInIO)
106106import Streamly.Internal.Control.ForkLifted (forkManaged)
107−import Streamly.Internal.Data.Stream.Channel.Dispatcher (modifyThread)
108−import Streamly.Internal.Data.Stream.Channel.Types (ChildEvent(..))
109−import Streamly.Internal.Data.Stream.Channel.Worker (sendWithDoorBell)
107+import Streamly.Internal.Data.Channel.Dispatcher (modifyThread)
108+import Streamly.Internal.Data.Channel.Types (ChildEvent(..))
109+import Streamly.Internal.Data.Channel.Worker (sendWithDoorBell)
110110import Streamly.Internal.Data.Stream (Stream, Step(..))
111111import Streamly.Internal.Data.SVar.Type (adaptState)
112112
src/Streamly/Internal/Data/Stream/Concurrent/Channel.hs+1−1
@@ -62,7 +62,7 @@ import qualified Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave
6262import qualified Streamly.Internal.Data.StreamK as K
6363
6464import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
65−import Streamly.Internal.Data.Stream.Channel.Types
65+import Streamly.Internal.Data.Channel.Types
6666
6767-- | Create a new concurrent stream evaluation channel. The monad
6868-- state used to run the stream actions is captured from the call site of
src/Streamly/Internal/Data/Stream/Concurrent/Channel/Append.hs+3−3
@@ -32,7 +32,7 @@ import Streamly.Internal.Control.Concurrent
3232 (MonadRunInIO, RunInIO(..), askRunInIO, restoreM)
3333import Streamly.Internal.Data.Atomics
3434 (atomicModifyIORefCAS, atomicModifyIORefCAS_)
35−import Streamly.Internal.Data.Stream.Channel.Dispatcher (modifyThread)
35+import Streamly.Internal.Data.Channel.Dispatcher (modifyThread)
3636
3737import qualified Data.Heap as H
3838import qualified Data.Set as Set
@@ -41,8 +41,8 @@ import qualified Streamly.Internal.Data.StreamK as K
4141import Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer
4242import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher
4343import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
44−import Streamly.Internal.Data.Stream.Channel.Types
45−import Streamly.Internal.Data.Stream.Channel.Worker
44+import Streamly.Internal.Data.Channel.Types
45+import Streamly.Internal.Data.Channel.Worker
4646
4747------------------------------------------------------------------------------
4848-- Concurrent streams with first-come-first serve results
src/Streamly/Internal/Data/Stream/Concurrent/Channel/Consumer.hs+2−2
@@ -25,8 +25,8 @@ import Streamly.Internal.Control.Concurrent (MonadRunInIO)
2525
2626import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher
2727import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
28−import Streamly.Internal.Data.Stream.Channel.Dispatcher
29−import Streamly.Internal.Data.Stream.Channel.Types
28+import Streamly.Internal.Data.Channel.Dispatcher
29+import Streamly.Internal.Data.Channel.Types
3030
3131-------------------------------------------------------------------------------
3232-- Reading from the workers' output queue/buffer
src/Streamly/Internal/Data/Stream/Concurrent/Channel/Dispatcher.hs+3−3
@@ -34,9 +34,9 @@ import Streamly.Internal.Data.Time.Units
3434 (MicroSecond64(..), diffAbsTime64, fromRelTime64, toRelTime64)
3535
3636import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
37−import Streamly.Internal.Data.Stream.Channel.Dispatcher
38−import Streamly.Internal.Data.Stream.Channel.Types
39−import Streamly.Internal.Data.Stream.Channel.Worker
37+import Streamly.Internal.Data.Channel.Dispatcher
38+import Streamly.Internal.Data.Channel.Types
39+import Streamly.Internal.Data.Channel.Worker
4040
4141-------------------------------------------------------------------------------
4242-- Dispatching workers
src/Streamly/Internal/Data/Stream/Concurrent/Channel/Interleave.hs+2−2
@@ -21,14 +21,14 @@ import Data.Concurrent.Queue.MichaelScott (LinkedQueue, newQ, nullQ, tryPopR, pu
2121import Data.IORef (newIORef, readIORef)
2222import Streamly.Internal.Control.Concurrent
2323 (MonadRunInIO, MonadAsync, RunInIO(..), askRunInIO, restoreM)
24−import Streamly.Internal.Data.Stream.Channel.Dispatcher (delThread)
24+import Streamly.Internal.Data.Channel.Dispatcher (delThread)
2525
2626import qualified Data.Set as Set
2727import qualified Streamly.Internal.Data.StreamK as K
2828
2929import Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer
3030import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
31−import Streamly.Internal.Data.Stream.Channel.Types
31+import Streamly.Internal.Data.Channel.Types
3232
3333------------------------------------------------------------------------------
3434-- Creating a channel
src/Streamly/Internal/Data/Stream/Concurrent/Channel/Operations.hs+1−1
@@ -44,7 +44,7 @@ import qualified Streamly.Internal.Data.StreamK as K
4444
4545import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher
4646import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
47−import Streamly.Internal.Data.Stream.Channel.Types hiding (inspect)
47+import Streamly.Internal.Data.Channel.Types hiding (inspect)
4848
4949import Prelude hiding (map, concat, concatMap)
5050
src/Streamly/Internal/Data/Stream/Concurrent/Channel/Type.hs+3−3
@@ -25,12 +25,12 @@ import Data.List (intersperse)
2525import Data.Set (Set)
2626import Streamly.Internal.Control.Concurrent (RunInIO)
2727import Streamly.Internal.Data.Atomics (atomicModifyIORefCAS_)
28−import Streamly.Internal.Data.Stream.Channel.Dispatcher (dumpSVarStats)
29−import Streamly.Internal.Data.Stream.Channel.Worker
28+import Streamly.Internal.Data.Channel.Dispatcher (dumpSVarStats)
29+import Streamly.Internal.Data.Channel.Worker
3030 (sendYield, sendStop, sendWithDoorBell)
3131import Streamly.Internal.Data.StreamK (StreamK)
3232
33−import Streamly.Internal.Data.Stream.Channel.Types
33+import Streamly.Internal.Data.Channel.Types
3434
3535-- IMPORTANT NOTE: we cannot update the SVar after generating it as we have
3636-- references to the original SVar stored in several functions which will keep
streamly.cabal+6−4
@@ -363,6 +363,7 @@ library
363363 -- graphmod | dot -Tps > deps.ps
364364 Streamly.Internal.Data.IsMap.HashMap
365365 , Streamly.Internal.Data.Cont
366+ , Streamly.Internal.Data.Channel
366367 , Streamly.Internal.Data.Stream.MkType
367368
368369 -- streamly-concurrent
@@ -370,9 +371,6 @@ library
370371 , Streamly.Internal.Control.ForkLifted
371372 , Streamly.Internal.Data.Atomics
372373 , Streamly.Internal.Data.IOFinalizer.Lifted
373− , Streamly.Internal.Data.Stream.Channel.Types
374− , Streamly.Internal.Data.Stream.Channel.Dispatcher
375− , Streamly.Internal.Data.Stream.Channel.Worker
376374
377375 , Streamly.Internal.Data.Unfold.Prelude
378376 , Streamly.Internal.Data.Fold.Prelude
@@ -451,7 +449,11 @@ library
451449 exposed-modules: Streamly.Internal.FileSystem.Event
452450
453451 other-modules:
454− Streamly.Data.Stream.Exception
452+ Streamly.Internal.Data.Channel.Types
453+ , Streamly.Internal.Data.Channel.Dispatcher
454+ , Streamly.Internal.Data.Channel.Worker
455+
456+ , Streamly.Data.Stream.Exception
455457 , Streamly.Data.Stream.Concurrent
456458 , Streamly.Data.Stream.Time
457459