patroni.tags module¶
Tags handling.
Bases:
abc.ABCAn abstract class that encapsulates all the
tagslogic.Child classes that want to use provided facilities must implement
tagsabstract property.Note
Due to backward-compatibility reasons, old tags may have a less strict type conversion than new ones.
Get tags configured for this node, if any.
Handle both predefined Patroni tags and custom defined tags.
Note
A custom tag is any tag added to the configuration
tagssection that is not one ofclonefrom,nofailover,noloadbalance,``nosync`` ornostream.For most of the Patroni predefined tags, the returning object will only contain them if they are enabled as they all are boolean values that default to disabled. However
nofailovertag is always returned iffailover_prioritytag is defined. In this case, we need both values to see if they are contradictory and thenofailovervalue should be used.- Returns
a dictionary of tags set for this node. The key is the tag name, and the value is the corresponding tag value.
Trueifclonefromtag isTrue, elseFalse.
Common logic for obtaining the value of
failover_priorityfromtagsif defined.If
nofailoveris defined asTrue, this will return0. Otherwise, it will return the value offailover_priority, defaulting to1if it’s not defined or invalid.
Common logic for obtaining the value of
nofailoverfromtagsif defined.If
nofailoveris not defined, this methods returnsTrueiffailover_priorityis non-positive,Falseotherwise.
TrueifnoloadbalanceisTrue, elseFalse.
TrueifnostreamisTrue, elseFalse.
TrueifnosyncisTrue, elseFalse.
Value of
replicatefromtag, if any.
Configured tags.
Must be implemented in a child class.