multipool-0.2.0.0: Generalized system for reading and writing to distributed systems that have primary/replica topologies.

Safe HaskellNone
LanguageHaskell2010

Data.MultiPool

Documentation

newtype InstanceName backend Source #

Constructors

InstanceName 
Instances
Eq (InstanceName backend) Source # 
Instance details

Defined in Data.MultiPool

Methods

(==) :: InstanceName backend -> InstanceName backend -> Bool #

(/=) :: InstanceName backend -> InstanceName backend -> Bool #

Ord (InstanceName backend) Source # 
Instance details

Defined in Data.MultiPool

Methods

compare :: InstanceName backend -> InstanceName backend -> Ordering #

(<) :: InstanceName backend -> InstanceName backend -> Bool #

(<=) :: InstanceName backend -> InstanceName backend -> Bool #

(>) :: InstanceName backend -> InstanceName backend -> Bool #

(>=) :: InstanceName backend -> InstanceName backend -> Bool #

max :: InstanceName backend -> InstanceName backend -> InstanceName backend #

min :: InstanceName backend -> InstanceName backend -> InstanceName backend #

Show (InstanceName backend) Source # 
Instance details

Defined in Data.MultiPool

Methods

showsPrec :: Int -> InstanceName backend -> ShowS #

show :: InstanceName backend -> String #

showList :: [InstanceName backend] -> ShowS #

Hashable (InstanceName backend) Source # 
Instance details

Defined in Data.MultiPool

Methods

hashWithSalt :: Int -> InstanceName backend -> Int #

hash :: InstanceName backend -> Int #

data InstanceDoesNotExist backend Source #

Instances
Eq (InstanceDoesNotExist backend) Source # 
Instance details

Defined in Data.MultiPool

Show (InstanceDoesNotExist backend) Source # 
Instance details

Defined in Data.MultiPool

(Show (InstanceDoesNotExist backend), Typeable backend) => Exception (InstanceDoesNotExist backend) Source # 
Instance details

Defined in Data.MultiPool

class Monad m => MultiPoolBackend m backend where Source #

Associated Types

type Primaries backend :: * Source #

type Replicas backend :: * Source #

type LocalPrimary backend :: * Source #

type LocalReplica backend :: * Source #

type PrimaryConnection backend :: * Source #

type ReplicaConnection backend :: * Source #

type PrimaryIdentifier backend :: * Source #

type ReplicaIdentifier backend :: * Source #

Methods

runWriteAny :: MultiPool backend -> ReaderT (PrimaryConnection backend) m a -> m a Source #

runWrite :: MultiPool backend -> PrimaryIdentifier backend -> ReaderT (PrimaryConnection backend) m a -> m a Source #

runReadPrimary :: MultiPool backend -> PrimaryIdentifier backend -> ReaderT (ReplicaConnection backend) m a -> m a Source #

runReadAnyPrimary :: MultiPool backend -> ReaderT (ReplicaConnection backend) m a -> m a Source #

runReadAny :: MultiPool backend -> ReaderT (ReplicaConnection backend) m a -> m a Source #

runRead :: MultiPool backend -> ReplicaIdentifier backend -> ReaderT (ReplicaConnection backend) m a -> m a Source #

takePrimary :: MultiPool backend -> PrimaryIdentifier backend -> m (PrimaryConnection backend, LocalPrimary backend) Source #

putPrimary :: MultiPool backend -> LocalPrimary backend -> PrimaryConnection backend -> m () Source #

takeReplica :: MultiPool backend -> ReplicaIdentifier backend -> m (ReplicaConnection backend, LocalReplica backend) Source #

putReplica :: MultiPool backend -> LocalReplica backend -> ReplicaConnection backend -> m () Source #

data MultiPool backend Source #

forReplicas :: (MultiPoolBackend m backend, Replicas backend ~ HashMap k v) => MultiPool backend -> (k -> v -> m a) -> m [a] Source #

roundRobin :: MonadIO m => [choice] -> m (a -> IO (Maybe choice)) Source #