-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Read and write appropriately from both master and replicated postgresql instances.
--
-- Please see the README on GitHub at
-- https://github.com/iand675/multipool#readme
@package multipool-persistent-postgresql
@version 0.1.0.1
module Data.MultiPool.Persist.Postgresql
initMultiPool :: (MonadLogger m, MonadUnliftIO m) => ConnectionString -> Int -> [(InstanceName SqlReadBackend, ConnectionString, Int)] -> m (MultiPool SqlBackend)
initMultiPool' :: (MonadLogger m, MonadUnliftIO m) => (MultiPool SqlBackend -> IO (Maybe (InstanceName SqlReadBackend))) -> ConnectionString -> Int -> [(InstanceName SqlReadBackend, ConnectionString, Int)] -> m (MultiPool SqlBackend)
-- | Performs a read on the first replica found that sufficiently
-- up-to-date with the given LSN. This function can be combined with
-- gatherLSNs and some sort of caching mechanism to provide a
-- simple way to scale out reads. An great article on this concept can be
-- found here
--
-- If no replica is up-to-date with the given LSN, the master instance
-- will be used to run the query.
runReadCurrent :: MonadUnliftIO m => MultiPool SqlBackend -> HashMap (InstanceName SqlReadBackend) LSN -> LSN -> ReaderT SqlReadBackend m a -> m a
getLastLSN :: MonadIO m => ReaderT SqlReadBackend m LSN
gatherLSNs :: MonadUnliftIO m => MultiPool SqlBackend -> m (HashMap (InstanceName SqlReadBackend) LSN)