packages feed

extensible-effects-concurrent-2.0.0: examples/loadtest/Main.hs

-- | This example uses most parts of the
-- the library and allows to interactively
-- generate a lot of processes.
--
-- The goal is to be able to benchmark and/or
-- profile the library.
--
-- This library will use a log writer, and will
-- filter debug messages.
--
-- It starts a book store server, that has several
-- book store warehouses.
--
-- The book store and the warehouses remain constant
-- throughout the life time of the program.
--
-- There are also many book store customer
-- processes that are spawned, buy a random
-- amount of books, randomly selling some
-- back to the book store, and eventually dieing
-- after a random lifetime.
--
-- Throughout the life time the book store sends
-- each customer random advertising messages at random
-- intervalls.
--
-- Through a UI process a user can interactively
-- spawn and kill customers, books and warehouses.
-- The UI process will also observe all kinds of events
-- and print them.
-- The UI process dispatches the incoming commands to
-- the book store, the warehouses and the customers.
module Main where

-- The Warehouse:
-- Messages:
--  * StoreBook (async: Book -> ())
--  * RetreiveBook  (sync: Title -> Maybe Book)
--  * DestroyWarehouse (sync: [Book])
-- Events:
--  * WarehoseCapacityChanged

-- The Book Store
-- Messages:
--  * Observe WarehoseEvents
--  * Observe CustomerEvents
--  * ListAvailableBooks
--  * RegisterCustomer
--  * BuyBook
--  * SellBook

-- The Customer
-- Messages:
--   * DoSomething
--   * Die
-- Life Events:
--   * Died
-- BuyEvents:
--   * BoughtBook
--   * SoldBook

-- The World
-- Messages:
--   * CreateBookStore
--   * AddBooks
--   * SpawnCustomers
--   * KillCustomers
--