summaryrefslogtreecommitdiff
path: root/docs/api/client.rst
blob: 51335e6d03b666272f012b4fddd4b27002bdd1a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
.. _client_module:

:mod:`kazoo.client`
----------------------------

.. automodule:: kazoo.client

Public API
++++++++++

    .. autoclass:: KazooClient()
        :members:
        :member-order: bysource

        .. automethod:: __init__

        .. attribute:: handler

            The :class:`~kazoo.interfaces.IHandler` strategy used by this
            client. Gives access to appropriate synchronization objects.

        .. method:: retry(func, *args, **kwargs)

            Runs the given function with the provided arguments, retrying if it
            fails because the ZooKeeper connection is lost,
            see :ref:`retrying_commands`.

        .. attribute:: state

            A :class:`~kazoo.protocol.states.KazooState` attribute indicating
            the current higher-level connection state.

            .. note::

                Up to version 2.6.1, requests could only be submitted
                in the CONNECTED state.  Requests submitted while
                SUSPENDED would immediately raise a
                :exc:`~kazoo.exceptions.SessionExpiredError`.  This
                was problematic, as sessions are usually recovered on
                reconnect.

                Kazoo now simply queues requests submitted in the
                SUSPENDED state, expecting a recovery.  This matches
                the behavior of the Java and C clients.

                Requests submitted in a LOST state still fail
                immediately with the corresponding exception.

                See:

                  * https://github.com/python-zk/kazoo/issues/374 and
                  * https://github.com/python-zk/kazoo/pull/570

    .. autoclass:: TransactionRequest
        :members:
        :member-order: bysource