Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Core = Core {}
- data EnqueueResult
- data Command
- type ServerState = SubscriptionTree UUID Connection
- data Updated = Updated Path Value
- enqueueCommand :: Command -> Core -> IO ()
- tryEnqueueCommand :: Command -> Core -> IO EnqueueResult
- getCurrentValue :: Core -> Path -> IO (Maybe Value)
- withCoreMetrics :: MonadIO m => Core -> (IcepeakMetrics -> IO ()) -> m ()
- lookup :: Eq a => a -> [(a, b)] -> Maybe b
- newCore :: Config -> Logger -> Maybe IcepeakMetrics -> IO (Either String Core)
- postQuit :: Core -> IO ()
- runCommandLoop :: Core -> IO ()
- runSyncTimer :: Core -> IO ()
Documentation
data EnqueueResult Source #
Instances
Defines the kinds of commands that are handled by the event loop of the Core.
Sync | The |
Modify Modification (Maybe (MVar ())) | The |
Stop | The |
type ServerState = SubscriptionTree UUID Connection Source #
enqueueCommand :: Command -> Core -> IO () Source #
Enqueue a command. Blocks if the queue is full. This is used by the sync timer to make sure the sync commands are actually enqueued. In general, whenever it is critical that a command is executed eventually (when reaching the front of the queue), this function should be used.
tryEnqueueCommand :: Command -> Core -> IO EnqueueResult Source #
Try to enqueue a command. It succeeds if the queue is not full, otherwise, nothing is changed. This should be used for non-critical commands that can also be retried later.
withCoreMetrics :: MonadIO m => Core -> (IcepeakMetrics -> IO ()) -> m () Source #
lookup :: Eq a => a -> [(a, b)] -> Maybe b #
lookup
key assocs
looks up a key in an association list.
newCore :: Config -> Logger -> Maybe IcepeakMetrics -> IO (Either String Core) Source #
Try to initialize the core. This loads the database and sets up the internal data structures.