cql-io-1.1.0: Cassandra CQL client.

Safe HaskellNone
LanguageHaskell2010

Database.CQL.IO.Cluster.Policies

Synopsis

Documentation

data Policy Source #

A policy defines a load-balancing strategy and generally handles host visibility.

Constructors

Policy 

Fields

  • setup :: [Host] -> [Host] -> IO ()

    Initialise the policy with two sets of hosts. The first parameter are hosts known to be available, the second are other nodes. Note that a policy may be re-initialised at any point through this function.

  • onEvent :: HostEvent -> IO ()

    Event handler. Policies will be informed about cluster changes through this function.

  • select :: IO (Maybe Host)

    Host selection. The driver will ask for a host to use in a query through this function. A policy which has no available nodes may return Nothing.

  • current :: IO [Host]

    Return all currently alive hosts.

  • acceptable :: Host -> IO Bool

    During startup and node discovery, the driver will ask the policy if a dicovered host should be ignored.

  • hostCount :: IO Word

    During query processing, the driver will ask the policy for a rough estimate of alive hosts. The number is used to repeatedly invoke select (with the underlying assumption that the policy returns mostly different hosts).

  • display :: IO String

    Like having an effectful Show instance for this policy.

random :: IO Policy Source #

Return hosts in random order.

roundRobin :: IO Policy Source #

Iterate over hosts one by one.