patroni.dcs.etcd3 module
- exception _patroni.dcs.etcd3.AuthFailed(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
InvalidArgument
+- error_ = 'etcdserver: authentication failed, invalid user ID or password'_
- exception _patroni.dcs.etcd3.AuthNotEnabled(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
FailedPrecondition
+- error_ = 'etcdserver: authentication is not enabled'_
- exception _patroni.dcs.etcd3.AuthOldRevision(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
InvalidArgument
+- error_ = 'etcdserver: revision of auth store is old'_
- exception _patroni.dcs.etcd3.DeadlineExceeded(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3ClientError
+ - class _patroni.dcs.etcd3.Etcd3(_config: Dict[ str, Any], mpp: AbstractMPP) View on GitHub
-
Bases:
AbstractEtcd
+- __init\\__(config: Dict[ str, Any], mpp: AbstractMPP) → None View on GitHub
-
Prepare DCS paths, MPP object, initial values for state information and processing dependencies. +
- Variables
-
config –
dict
, reference to config section of selected DCS. i.e.:zookeeper
for zookeeper,etcd
for etcd, etc… +
- abc_impl = <_abc._abc_data object>_
-
+
- property \\__client: PatroniEtcd3Client_
-
return correct type of etcd client +
- cluster_from_nodes(_nodes: Dict[ str, Any]) → Cluster View on GitHub
-
+
- delete_leader(*args: Any, _**kwargs: Any) → Any View on GitHub
-
Remove leader key from DCS. + This method should remove leader key if current instance is the leader. +
- Parameters
-
leader –
Leader
object with information about the leader. - Returns
-
True
if successfully committed to DCS. +
- do_attempt_to_acquire_leader(_retry: Retry) → bool View on GitHub
-
+
- do_refresh_lease(_force: bool = False, retry: Retry | None = None) → bool View on GitHub
-
+
- load_cluster(_path: str, loader: Callable[[ str], Cluster | Dict[ int, Cluster]]) → Cluster | Dict[ int, Cluster] View on GitHub
-
Main abstract method that implements the loading of
Cluster
instance. + NoteInternally this method should call the _loader_ method that will build `+Cluster+` object which represents current state and topology of the cluster in DCS. This method supposed to be called only by the `+get_cluster()+` method. + Parameters::: Raise::: `+DCSError+` in case of communication problems with DCS. If the current node was running as a primary and exception raised, instance would be demoted. +
- mpp_cluster_loader(_path: str) → Dict[ int, Cluster] View on GitHub
-
Load and build all PostgreSQL clusters from a single MPP cluster. +
- Parameters
-
path – the path in DCS where to load Cluster(s) from.
- Returns
-
all MPP groups as
dict
, with group IDs as keys andCluster
objects as values. +
- postgresql_cluster_loader(_path: str) → Cluster View on GitHub
-
Load and build the
Cluster
object from DCS, which represents a single PostgreSQL cluster. +- Parameters
-
path – the path in DCS where to load
Cluster
from. - Returns
-
Cluster
instance. +
- update_leader(**kwargs: Any) View on GitHub
-
Update
leader
key (or session) ttl. + NoteYou have to use CAS (Compare And Swap) operation in order to update leader key, for example for etcd `+prevValue+` parameter must be used.
If update fails due to DCS not being accessible or because it is not able to process requests (hopefully temporary), the `+DCSError+` exception should be raised. + Parameters::: *leader* – a reference to a current `+leader+` object. Returns::: `+True+` if `+leader+` key (or session) has been updated successfully. +
- write_failsafe(*args: Any, _**kwargs: Any) → Any View on GitHub
-
Write current cluster topology to DCS that will be used by failsafe mechanism (if enabled). +
- Parameters
-
value – failsafe topology serialized in JSON format.
- Returns
-
True
if successfully committed to DCS. +
- write_leader_optime(*args: Any, _**kwargs: Any) → Any View on GitHub
-
Write current WAL LSN into
/optime/leader
key in DCS. +- Parameters
-
last_lsn – absolute WAL LSN in bytes.
- Returns
-
True
if successfully committed to DCS. +
- write_status(*args: Any, _**kwargs: Any) → Any View on GitHub
-
Write current WAL LSN and
confirmed_flush_lsn
of permanent slots into the/status
key in DCS. +- Parameters
-
value – status serialized in JSON format.
- Returns
-
True
if successfully committed to DCS. +
- attempt_to_acquire_leader(**kwargs: Any) View on GitHub
-
Attempt to acquire leader lock. + Note
This method should create `+/leader+` key with the value `+_name+`.
The key must be created atomically. In case the key already exists it should not be overwritten and `+False+` must be returned.
If key creation fails due to DCS not being accessible or because it is not able to process requests (hopefully temporary), the `+DCSError+` exception should be raised. + Returns::: `+True+` if key has been created successfully. +
- cancel_initialization(*args: Any, **kwargs: Any) → Any View on GitHub
-
Removes the
initialize
key for a cluster. +- Returns
-
True
if successfully committed to DCS. +
- property _cluster_prefix: str_
-
Construct the cluster prefix for the cluster. +
- Returns
-
path in the DCS under which we store information about this Patroni cluster. +
- create_lease() → None View on GitHub
-
+
- delete_cluster(*args: Any, **kwargs: Any) → Any View on GitHub
-
Delete cluster from DCS. +
- Returns
-
True
if successfully committed to DCS. +
- delete_sync_state(*args: Any, **kwargs: Any) → Any View on GitHub
-
Delete the synchronous state from DCS. +
- Parameters
-
version – for conditional deletion of the key/object.
- Returns
-
True
if delete successful. +
- initialize(*args: Any, **kwargs: Any) → Any View on GitHub
-
Race for cluster initialization. + This method should atomically create
initialize
key and returnTrue
, otherwise it should returnFalse
. +- Parameters
- Returns
-
True
if key has been created successfully. +
- static _member(_node: Dict[ str, str]) → Member View on GitHub
-
+
- refresh_lease() → bool View on GitHub
-
+
- set_config_value(*args: Any, **kwargs: Any) → Any View on GitHub
-
Create or update
/config
key in DCS. +- Parameters
- Returns
-
True
if successfully committed to DCS. +
- set_failover_value(*args: Any, **kwargs: Any) → Any View on GitHub
-
Create or update
/failover
key. +- Parameters
- Returns
-
True
if successfully committed to DCS. +
- set_history_value(*args: Any, **kwargs: Any) → Any View on GitHub
-
Set value for
history
in DCS. +- Parameters
-
value – new value of
history
key/object. - Returns
-
True
if successfully committed to DCS. +
- set_socket_options(sock: socket, socket_options: Collection[ Tuple[ int, int, int]] | None) → None View on GitHub
-
+
- set_sync_state_value(*args: Any, **kwargs: Any) → Any View on GitHub
-
Set synchronous state in DCS. +
- Parameters
- Returns
-
version of the new object or
False
in case of error. +
- set_ttl(ttl: int) → bool | None View on GitHub
-
Set the new ttl value for DCS keys. +
- take_leader(*args: Any, **kwargs: Any) → Any View on GitHub
-
Establish a new leader in DCS. + Note
This method should create leader key with value of `+_name+` and `+ttl+` of `+ttl+`.
Since it could be called only on initial cluster bootstrap it could create this key regardless, overwriting the key if necessary. + Returns::: `+True+` if successfully committed to DCS. +
- touch_member(*args: Any, **kwargs: Any) → Any View on GitHub
-
Update member key in DCS. + Note
This method should create or update key with the name with `+/members/+` + `+_name+` and the value of _data_ in a given DCS. + Parameters::: *data* – information about an instance (including connection strings). Returns::: `+True+` if successfully committed to DCS. +
- watch(leader_version: str | None, timeout: float) → bool View on GitHub
-
Sleep if the current node is a leader, otherwise, watch for changes of leader key with a given timeout. +
- Parameters
- Returns
-
if
True
this will reschedule the next run of the HA cycle.
- class _patroni.dcs.etcd3.Etcd3Client(_config: Dict[ str, Any], dns_resolver: DnsCachingResolver, cache_ttl: int = 300) View on GitHub
-
Bases:
AbstractEtcdClientWithFailover
+- ERROR_CLS View on GitHub
-
alias of
Etcd3Error
+ - __init\\__(config: Dict[ str, Any], dns_resolver: DnsCachingResolver, cache_ttl: int = 300) → None View on GitHub
-
+
- abc_impl = <_abc._abc_data object>_
-
+
- ensure_version_prefix(_base_uri: str, **kwargs: Any) → None View on GitHub
-
+
- _get_headers() → Dict[ str, str] View on GitHub
-
+
- get_members(_base_uri: str, **kwargs: Any) → List[ str] View on GitHub
-
returns: list of clientURLs +
- handle_server_response(_response: HTTPResponse) → Dict[ str, Any] View on GitHub
-
Handles the server response +
- prepare_get_members(_etcd_nodes: int) → Dict[ str, Any] View on GitHub
-
returns: request parameters +
- prepare_request(_kwargs: Dict[ str, Any], params: Dict[ str, Any] | None = None, method: str | None = None) → Callable[[…], HTTPResponse] View on GitHub
-
returns: request_executor +
- authenticate(*, retry: Retry | None = None) → bool View on GitHub
-
+
- call_rpc(method: str, fields: Dict[ str, Any], retry: Retry | None = None) → Dict[ str, Any] View on GitHub
-
+
- deleteprefix(key: str, *, retry: Retry | None = None) → Dict[ str, Any] View on GitHub
-
+
- deleterange(*args: Any, **kwargs: Any) → Any View on GitHub
-
+
- handle_auth_errors(func: Callable[[…], Any], *args: Any, retry: Retry | None = None, **kwargs: Any) → Any View on GitHub
-
+
- lease_grant(*args: Any, **kwargs: Any) → Any View on GitHub
-
+
- lease_keepalive(ID: str, *, retry: Retry | None = None) → str | None View on GitHub
-
+
- prefix(key: str, serializable: bool = True, *, retry: Retry | None = None) → Dict[ str, Any] View on GitHub
-
+
- put(*args: Any, **kwargs: Any) → Any View on GitHub
-
+
- range(*args: Any, **kwargs: Any) → Any View on GitHub
-
+
- txn(*args: Any, **kwargs: Any) → Any View on GitHub
-
+
- watchprefix(key: str, start_revision: str | None = None, filters: List[ Dict[ str, Any]] | None = None, read_timeout: float | None = None) → HTTPResponse View on GitHub
-
+
- watchrange(key: str, range_end: bytes | str | None = None, start_revision: str | None = None, filters: List[ Dict[ str, Any]] | None = None, read_timeout: float | None = None) → HTTPResponse View on GitHub
-
returns: response object
- exception _patroni.dcs.etcd3.Etcd3ClientError(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3Exception
+- __init\\__(code: int | None = None, error: str | None = None, status: int | None = None) → None View on GitHub
-
+
- as_dict() → Dict[ str, Any] View on GitHub
-
+
- _classmethod _get_subclasses() → Iterator[ Type[Etcd3ClientError]] View on GitHub
- exception _patroni.dcs.etcd3.Etcd3Error(_value: Any) View on GitHub
-
Bases:
DCSError
- exception _patroni.dcs.etcd3.Etcd3Exception(_message=None, payload=None) View on GitHub
-
Bases:
EtcdException
- exception _patroni.dcs.etcd3.FailedPrecondition(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3ClientError
+- code_ = 9_
- class _patroni.dcs.etcd3.GRPCCode(_value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None) View on GitHub
-
Bases:
IntEnum
+- Aborted_ = 10_
-
+
- AlreadyExists_ = 6_
-
+
- Canceled_ = 1_
-
+
- DataLoss_ = 15_
-
+
- DeadlineExceeded_ = 4_
-
+
- FailedPrecondition_ = 9_
-
+
- Internal_ = 13_
-
+
- InvalidArgument_ = 3_
-
+
- NotFound_ = 5_
-
+
- OK_ = 0_
-
+
- OutOfRange_ = 11_
-
+
- PermissionDenied_ = 7_
-
+
- ResourceExhausted_ = 8_
-
+
- Unauthenticated_ = 16_
-
+
- Unavailable_ = 14_
-
+
- Unimplemented_ = 12_
-
+
- Unknown_ = 2_
- exception _patroni.dcs.etcd3.InvalidArgument(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3ClientError
+- code_ = 3_
- exception _patroni.dcs.etcd3.InvalidAuthToken(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3ClientError
+ - class _patroni.dcs.etcd3.KVCache(_dcs: Etcd3, client: PatroniEtcd3Client) View on GitHub
-
Bases:
Thread
+- __init\\__(dcs: Etcd3, client: PatroniEtcd3Client) → None View on GitHub
-
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.
args is a list or tuple of arguments for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to \{}.
If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init\\__()) before doing anything else to the thread. + - _build_cache() → None View on GitHub
-
+
- do_watch(_revision: str) → None View on GitHub
-
+
- static \\__finish_response(_response: HTTPResponse) → None View on GitHub
-
+
- process_event(_event: Dict[ str, Any]) → None View on GitHub
-
+
- process_message(_message: Dict[ str, Any]) → None View on GitHub
-
+
- copy() → List[ Dict[ str, Any]] View on GitHub
-
+
- delete(name: str, mod_revision: str) → Tuple[ bool, Dict[ str, Any] | None] View on GitHub
-
+
- get(name: str) → Dict[ str, Any] | None View on GitHub
-
+
- is_ready() → bool View on GitHub
-
Must be called only when holding the lock on condition +
- kill_stream() → None View on GitHub
-
+
- run() → None View on GitHub
-
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively. + - set(value: Dict[ str, Any], overwrite: bool = False) → Tuple[ bool, Dict[ str, Any] | None] View on GitHub
- exception _patroni.dcs.etcd3.LeaseNotFound(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
NotFound
+- error_ = 'etcdserver: requested lease not found'_
- exception _patroni.dcs.etcd3.NotFound(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3ClientError
+- code_ = 5_
- class _patroni.dcs.etcd3.PatroniEtcd3Client(*args: Any, _**kwargs: Any) View on GitHub
-
Bases:
Etcd3Client
+- __init\\__(*args: Any, **kwargs: Any) → None View on GitHub
-
+
- abc_impl = <_abc._abc_data object>_
-
+
- _restart_watcher() → None View on GitHub
-
+
- wait_cache(_timeout: float) → None View on GitHub
-
+
- call_rpc(method: str, fields: Dict[ str, Any], retry: Retry | None = None) → Dict[ str, Any] View on GitHub
-
+
- configure(etcd3: Etcd3) → None View on GitHub
-
+
- get_cluster(path: str) → List[ Dict[ str, Any]] View on GitHub
-
+
- set_base_uri(value: str) → None View on GitHub
-
+
- start_watcher() → None View on GitHub
-
+
- txn(compare: Dict[ str, Any], success: Dict[ str, Any], failure: Dict[ str, Any] | None = None, *, retry: Retry | None = None) → Dict[ str, Any] View on GitHub
- exception _patroni.dcs.etcd3.PermissionDenied(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3ClientError
+ - exception _patroni.dcs.etcd3.Unavailable(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3ClientError
+- code_ = 14_
- exception _patroni.dcs.etcd3.Unknown(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
Etcd3ClientError
+- code_ = 2_
- exception _patroni.dcs.etcd3.UnsupportedEtcdVersion(_value: Any) View on GitHub
-
Bases:
PatroniException
- exception _patroni.dcs.etcd3.UserEmpty(_code: int | None = None, error: str | None = None, status: int | None = None) View on GitHub
-
Bases:
InvalidArgument
+- error_ = 'etcdserver: user name is empty'_
- patroni.dcs.etcd3.handle_auth_errors(_func: Callable[[…], Any]) → Any View on GitHub
- patroni.dcs.etcd3.raise_for_data(_data: bytes | str | Dict[ str, Dict[ str, Any] | Any], status_code: int | None = None) → Etcd3ClientError View on GitHub
- patroni.dcs.etcd3.base64_decode(v: str) → str View on GitHub
- patroni.dcs.etcd3.base64_encode(v: str | bytes) → str View on GitHub
- patroni.dcs.etcd3.build_range_request(key: str, range_end: bytes | str | None = None) → Dict[ str, Any] View on GitHub
- patroni.dcs.etcd3.prefix_range_end(v: str) → bytes View on GitHub
- patroni.dcs.etcd3.to_bytes(v: str | bytes) → bytes View on GitHub
© Copyright 2015 Compose, Zalando SE. Revision 9d231aee
.
Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: latest
+ Builds