-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Task Framework for The Cloud Haskell Application Platform
--
-- The Task Framework intends to provide tools for task management, work
-- scheduling and distributed task coordination. These capabilities build
-- on the Async Framework as well as other tools and libraries. The
-- framework is currently a work in progress. The current release
-- includes a simple bounded blocking queue implementation only, as an
-- example of the kind of capability and API that we intend to produce.
@package distributed-process-task
@version 0.1.0
-- | A simple bounded (size) task queue, which accepts requests and blocks
-- the sender until they're completed. The size limit is applied to the
-- number of concurrent tasks that are allowed to execute - if the limit
-- is 3, then the first three tasks will be executed immediately, but
-- further tasks will then be queued (internally) until one or more tasks
-- completes and the number of active/running tasks falls within the
-- concurrency limit.
--
-- Note that the process calling executeTask will be blocked for
-- _at least_ the duration of the task itself, regardless of whether or
-- not the queue has reached its concurrency limit. This provides a
-- simple means to prevent work from being submitted faster than the
-- server can handle, at the expense of flexible scheduling.
module Control.Distributed.Process.Task.Queue.BlockingQueue
data BlockingQueue a
-- | Limit for the number of concurrent tasks.
type SizeLimit = Int
data BlockingQueueStats
BlockingQueueStats :: Int -> Int -> Int -> BlockingQueueStats
maxJobs :: BlockingQueueStats -> Int
activeJobs :: BlockingQueueStats -> Int
queuedJobs :: BlockingQueueStats -> Int
-- | Start a queue with an upper bound on the # of concurrent tasks.
start :: Serializable a => Process (InitResult (BlockingQueue a)) -> Process ()
-- | Define a pool of a given size.
pool :: Serializable a => SizeLimit -> Process (InitResult (BlockingQueue a))
-- | Enqueue a task in the pool and block until it is complete.
executeTask :: (Addressable s, Serializable a) => s -> Closure (Process a) -> Process (Either ExitReason a)
-- | Fetch statistics for a queue.
stats :: Addressable s => s -> Process (Maybe BlockingQueueStats)
instance Typeable GetStats
instance Typeable BlockingQueueStats
instance Typeable BlockingQueue
instance Generic GetStats
instance Generic BlockingQueueStats
instance Datatype D1GetStats
instance Constructor C1_0GetStats
instance Datatype D1BlockingQueueStats
instance Constructor C1_0BlockingQueueStats
instance Selector S1_0_0BlockingQueueStats
instance Selector S1_0_1BlockingQueueStats
instance Selector S1_0_2BlockingQueueStats
instance Binary BlockingQueueStats
instance Binary GetStats
-- | The Task Framework intends to provide tools for task
-- management, work scheduling and distributed task coordination. These
-- capabilities build on the Execution Framework as well as other
-- tools and libraries. The framework is currently a work in progress.
-- The current release includes a simple bounded blocking queue
-- implementation only, as an example of the kind of capability and API
-- that we intend to produce.
--
-- The Task Framework will be broken down by the task scheduling
-- and management algorithms it provides, e.g., at a low level providing
-- work queues, worker pools and the like, whilst at a high level
-- allowing the user to choose between work stealing, sharing,
-- distributed coordination, user defined sensor based bounds/limits and
-- so on.
module Control.Distributed.Process.Task