Skip to content

Instance Role

picopyn.instance_role

Replicaset role filter for the instances a pool opens user connections to.

InstanceRole = Literal['any', 'leader', 'replica'] module-attribute

Replicaset role of the instances a pool may open user connections to.

It is applied together with the other user-connection filters (for example forbidden_tiers): an instance must pass all of them.

The role is taken from the pool's latest view of the cluster (the replicaset's current_master_uuid), so it may lag behind an actual leader change -- until the next topology refresh, or for the pool's whole lifetime if topology tracking is disabled. An instance whose role cannot be determined matches only "any".

  • "any": all instances, regardless of role.
  • "leader": only current replicaset leaders.
  • "replica": only instances that are not the current leader of their replicaset.