zoovisitor-0.1.6.0: A haskell binding to Apache Zookeeper C library(mt) using Haskell Z project.
Safe HaskellNone
LanguageHaskell2010

ZooKeeper.Recipe

Synopsis

Documentation

election Source #

Arguments

:: ZHandle

The zookeeper handle obtained by a call to zookeeperResInit

-> CBytes

The path to start the election from. Ephemeral znodes will be put on it

-> CBytes

The GUID for this zookeeper session. To handle recoverable execptions correctly, it should be distinct from different sessions.

-> IO ()

The action to be executed when an leader is elected.

-> (DataCompletion -> IO ())

The action to be executed when a watcher is set. It can be used to remind the user that one step is finished.

-> IO () 

Run a leader election process. IMPORTANT: This function may run endlessly until it is selected as the leader.

lock Source #

Arguments

:: ZHandle

The zookeeper handle obtained by a call to zookeeperResInit

-> CBytes

The path to get the lock. Ephemeral znodes will be put on it

-> CBytes

The GUID for this zookeeper session. To handle recoverable execptions correctly, it should be distinct from different sessions

-> IO CBytes

The real path of the lock that acquired. It will be used when unlocking the same lock

To acquire a distributed lock.

unlock Source #

Arguments

:: ZHandle

The zookeeper handle obtained by a call to zookeeperResInit

-> CBytes

The real lock path acquired by lock. An exception will be thrown if it is bad (for example, does not exist)

-> IO () 

To release a distributed lock. Note that the real lock path should be the one acquired by lock, otherwise, a ZooException will be thrown.