Safe HaskellNone




Implementation of configuration reader with watching support.



type ConfigReader = IO (Result ConfigData) Source #

A type for functions that can return the configuration when executed.

Configuration handling

Helper functions

Configuration loading

Watcher threads

We have three threads/functions that can mutate the server state:

  1. the long-interval watcher (onWatcherTimer)
  2. the polling watcher (onPollTimer)
  3. the inotify event handler (onInotify)

All of these will mutate the server state under modifyMVar or modifyMVar_, so that server transitions are more or less atomic. The inotify handler remains active during polling mode, but checks for polling mode and doesn't do anything in this case (this check is needed even if we would unregister the event handler due to how events are serialised).

initConfigReader :: (Result ConfigData -> IO ()) -> IO () Source #