MCPcopy Index your code
hub / github.com/couchbase/couchbase-python-client / Cluster

Class Cluster

couchbase/cluster.py:57–744  ·  view source on GitHub ↗

Create a Couchbase Cluster instance. The cluster instance exposes the operations which are available to be performed against a cluster. .. note:: Although creating an instance of :class:`.Cluster` is allowed, it is recommended to use the Cluster's static :meth:`.Cluster.con

Source from the content-addressed store, hash-verified

55
56
57class Cluster:
58 """Create a Couchbase Cluster instance.
59
60 The cluster instance exposes the operations which are available to be performed against a cluster.
61
62 .. note::
63 Although creating an instance of :class:`.Cluster` is allowed, it is recommended to
64 use the Cluster's static :meth:`.Cluster.connect` method. See :meth:`.Cluster.connect` for connect
65 for examples.
66
67 Args:
68 connstr (str):
69 The connection string to use for connecting to the cluster.
70 This is a URI-like string allowing specifying multiple hosts.
71
72 The format of the connection string is the *scheme*
73 (``couchbase`` for normal connections, ``couchbases`` for
74 SSL enabled connections); a list of one or more *hostnames*
75 delimited by commas
76 options (:class:`~couchbase.options.ClusterOptions`): Global options to set for the cluster.
77 Some operations allow the global options to be overriden by passing in options to the
78 operation.
79 **kwargs (Dict[str, Any]): keyword arguments that can be used in place or to
80 overrride provided :class:`~couchbase.options.ClusterOptions`
81
82 Raises:
83 :class:`~couchbase.exceptions.InvalidArgumentException`: If no :class:`~couchbase.auth.Authenticator`
84 is provided. Also raised if an invalid `ClusterOption` is provided.
85 :class:`~couchbase.exceptions.AuthenticationException`: If provided :class:`~couchbase.auth.Authenticator`
86 has incorrect credentials.
87
88 """
89
90 def __init__(self,
91 connstr, # type: str
92 *options, # type: ClusterOptions
93 **kwargs, # type: Dict[str, Any]
94 ) -> None:
95 self._impl = ClusterImpl(connstr, *options, **kwargs)
96
97 @property
98 def transactions(self) -> Transactions:
99 """
100 :class:`~couchbase.transactions.Transactions`: A Transactions instance which can be used to
101 perform transactions on this cluster.
102 """
103 return self._impl.transactions
104
105 def close(self) -> None:
106 """Shuts down this cluster instance. Cleaning up all resources associated with it.
107
108 .. warning::
109 Use of this method is almost *always* unnecessary. Cluster resources should be cleaned
110 up once the cluster instance falls out of scope. However, in some applications tuning resources
111 is necessary and in those types of applications, this method might be beneficial.
112
113 """
114 self._impl.close_connection()

Callers 15

test_kv_op_chainMethod · 0.90
kv_operations.pyFile · 0.90
simple_txns.pyFile · 0.90
usermgmt.pyFile · 0.90
collectionmgmt.pyFile · 0.90
querymgmt.pyFile · 0.90

Calls

no outgoing calls