Microcluster Token Distributor
| Channel | Revision | Published | Runs on |
|---|---|---|---|
| latest/edge | 11 | 27 Mar 2026 | |
| v1/stable | 9 | 17 Mar 2026 | |
| v1/candidate | 9 | 10 Mar 2026 | |
| v1/edge | 9 | 09 Dec 2025 |
juju deploy microcluster-token-distributor --channel edge
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
charms.microcluster_token_distributor.v0.token_distributor
-
- Last updated 27 Mar 2026
- Revision Library version 0.2
Microcluster token distributor library.
This is a library for the microcluster-token-distributor operator charm and charms that aim to integrate with it. It allows for distribution generation and usage of tokens using the token distributor units as a sort of mirror for key data that the units of the actual microcluster charm expose allowing communication without the usage of the peer relation.
Index
def mirror_id(hostname)
Return the mirror id for the specified hostname.
Returns
the mirror id for the specified hostname
def get_hostname()
Description
Return the hostname. None
def
corroborate(
items: list,
default
)
Return the most frequent value in a list.
Description
Iterate through the list finding the most frequent value, while ignoring default. However if no non-default values are found return default.
NOTE: In the event of two non default values with equal frequency we return the first one, this is not ideal however, it is also not a use case that should come up when using token distributor
class TokenDistributorProvides
Token Distributor Provider class.
Description
The provides side of the token distributor library. It exposes the hostnames found in the connected cluster and copies any data put up to be mirrored (typically tokens) in the leader units mirror for consumption by units in the connected cluster.
Methods
TokenDistributorProvides. __init__( self , charm , relation_name: str )
class ClusterBootstrappedEvent
Description
Event for when this unit bootstraps the cluster. None
class TokenGeneratedEvent
Description
Event for when a token is generated for a unit. None
class ClusterJoinedEvent
Event for when a the unit joins the cluster.
Description
bootstrapper: True if the unit bootstrapped the cluster
Methods
ClusterJoinedEvent. __init__( self , handle , bootstrapper: bool )
class ClusterPreBootstrapEvent
Description
Event for when this unit bootstraps the cluster. None
class ClusterPreJoinEvent
Description
Event for when this unit bootstraps the cluster. None
class TokenConsumerEvents
Description
Events class for on. None
class TokenConsumer
Token Consumer class.
Description
This uses the token distributor relation as a mirror to get information about the cluster such as hostnames that need tokens generated. It then generates neccicary tokens, which are then consumed by the respective units allowing easy cluster management.
Methods
TokenConsumer. add_to_mirror( self , relation , data )
Description
Add data into the units databag in a mirrorable form. None
TokenConsumer. find_value( self , relation , key: str , keep_empty )
Find corresponding value in mirror.
Description
Return false if value not found, if keep_empty is enabled 'empty' an empty value will be accepted.
TokenConsumer. any_data_exists( self , relation )
Description
Check if there is any non empty value on the remote side of the mirror. None
TokenConsumer. find_mirrors( self , relation )
Description
Find all remote mirror units. None
TokenConsumer. get_relevant_mirror_data( self , relation , keep_empty )
Return data in the mirror, where the key is of the form mirror-key.
Description
Return a dictionary of the relevant data in the mirror, with the mirror prefix stripped from the key. If keep_empty is true treat a value of empty as a valid value.
TokenConsumer. __init__( self , charm , relation_name: str , command_name: list )