# patroni.tags module

Tags handling.

class patroni.tags.Tags

  Bases: `ABC`

  An abstract class that encapsulates all the `tags` logic.

  Child classes that want to use provided facilities must implement `tags` abstract property.

  _abc_impl = <_abc._abc_data object>
  static _filter_tags(tags: Dict[str, Any]) → Dict[str, Any]

    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 `tags` section that is not one of `clonefrom`, `nofailover`, `noloadbalance` or `nosync`.

    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 `nofailover` tag is always returned if `failover_priority` tag is defined. In this case, we need both values to see if they are contradictory and the `nofailover` value 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.

  property clonefrom: bool

    `True` if `clonefrom` tag is `True`, else `False`.

  property failover_priority: int

    Common logic for obtaining the value of `failover_priority` from `tags` if defined.

    If `nofailover` is defined as `True`, this will return `0`. Otherwise, it will return the value of `failover_priority`, defaulting to `1` if it’s not defined or invalid.

  property nofailover: bool

    Common logic for obtaining the value of `nofailover` from `tags` if defined.

    If `nofailover` is not defined, this methods returns `True` if `failover_priority` is non-positive, `False` otherwise.

  property noloadbalance: bool

    `True` if `noloadbalance` is `True`, else `False`.

  property nosync: bool

    `True` if `nosync` is `True`, else `False`.

  property replicatefrom: str | None

    Value of `replicatefrom` tag, if any.

  abstract property tags: Dict[str, Any]

    Configured tags.

    Must be implemented in a child class.