Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type ClientMonitors = Map HttpRequest StatusMonitor
- data Client api = Client {
- subscriber :: !(Subscriber api)
- monitors :: !(TVar ClientMonitors)
- readRequest :: !(IO (Maybe Request))
- writeResponse :: !(Response -> IO ())
- pongCommandRef :: !(IORef (IO ()))
- closeCommandRef :: !(TVar (IO ()))
- data StatusMonitor = StatusMonitor {
- request :: !HttpRequest
- monitor :: !(TVar (RefCounted ResourceStatus))
- oldStatus :: !(Maybe ResourceStatus)
- data Snapshot = Snapshot {}
- snapshotOld :: Snapshot -> Maybe ResourceStatus
- monitorPath :: StatusMonitor -> Path
- toSnapshot :: StatusMonitor -> STM Snapshot
- snapshotRequest :: Snapshot -> HttpRequest
- fromWebSocket :: Subscriber api -> IORef (IO ()) -> Connection -> STM (Client api)
- run :: (MonadLogger m, MonadBaseControl IO m, MonadIO m, Backend backend) => backend -> Client api -> m ()
- addRequest :: HttpRequest -> Client api -> STM ()
- removeRequest :: Client api -> HttpRequest -> STM ()
- unsubscribeMonitor :: Subscriber api -> StatusMonitor -> STM ()
- handleRequests :: Backend backend => backend -> Client api -> IO ()
- handleSubscribe :: Client api -> HttpRequest -> IO ()
- handleUnsubscribe :: Client api -> HttpRequest -> IO ()
- runMonitor :: Backend backend => backend -> Client api -> IO ()
- handleUpdates :: Backend backend => backend -> Client api -> (HttpRequest, ResourceStatus) -> IO ()
- handleModified :: Backend backend => backend -> Client api -> HttpRequest -> IO ()
- getServerResponse :: Backend backend => backend -> HttpRequest -> (Response -> IO ()) -> IO ()
- monitorChanges :: Client api -> STM [(HttpRequest, ResourceStatus)]
- getChanges :: [Snapshot] -> [(HttpRequest, ResourceStatus)]
- monitorChanged :: Snapshot -> Bool
- toChangeReport :: Snapshot -> (HttpRequest, ResourceStatus)
- updateMonitors :: [Snapshot] -> [StatusMonitor]
- updateOldStatus :: Snapshot -> StatusMonitor
- monitorsFromList :: [StatusMonitor] -> ClientMonitors
Documentation
type ClientMonitors = Map HttpRequest StatusMonitor Source #
Client | |
|
data StatusMonitor Source #
StatusMonitor | |
|
monitorPath :: StatusMonitor -> Path Source #
toSnapshot :: StatusMonitor -> STM Snapshot Source #
fromWebSocket :: Subscriber api -> IORef (IO ()) -> Connection -> STM (Client api) Source #
run :: (MonadLogger m, MonadBaseControl IO m, MonadIO m, Backend backend) => backend -> Client api -> m () Source #
addRequest :: HttpRequest -> Client api -> STM () Source #
removeRequest :: Client api -> HttpRequest -> STM () Source #
Remove a Request, also unsubscribes from subscriber and deletes our monitor if it was the last Request for the given path.
unsubscribeMonitor :: Subscriber api -> StatusMonitor -> STM () Source #
Does not remove the monitor - use removeRequest if you want this!
handleSubscribe :: Client api -> HttpRequest -> IO () Source #
handleUnsubscribe :: Client api -> HttpRequest -> IO () Source #
handleUpdates :: Backend backend => backend -> Client api -> (HttpRequest, ResourceStatus) -> IO () Source #
handleModified :: Backend backend => backend -> Client api -> HttpRequest -> IO () Source #
getServerResponse :: Backend backend => backend -> HttpRequest -> (Response -> IO ()) -> IO () Source #
monitorChanges :: Client api -> STM [(HttpRequest, ResourceStatus)] Source #
getChanges :: [Snapshot] -> [(HttpRequest, ResourceStatus)] Source #
monitorChanged :: Snapshot -> Bool Source #
toChangeReport :: Snapshot -> (HttpRequest, ResourceStatus) Source #
updateMonitors :: [Snapshot] -> [StatusMonitor] Source #