# Path: tooz/_retry.py
# def retry(stop_max_delay=None, **kwargs):
# 
# Path: tooz/partitioner.py
# class Partitioner(object):
#     DEFAULT_PARTITION_NUMBER = hashring.HashRing.DEFAULT_PARTITION_NUMBER
#     def __init__(self, coordinator, group_id,
#                  partitions=DEFAULT_PARTITION_NUMBER):
#     def _on_member_join(self, event):
#     def _on_member_leave(self, event):
#     def _hash_object(obj):
#     def members_for_object(self, obj, ignore_members=None, replicas=1):
#     def belongs_to_member(self, obj, member_id,
#                           ignore_members=None, replicas=1):
#     def belongs_to_self(self, obj, ignore_members=None, replicas=1):
#     def stop(self):
# 
# Path: tooz/utils.py
# class Base64LockEncoder(object):
# class ProxyExecutor(object):
# class SerializationError(tooz.ToozError):
#     def __init__(self, keyspace_url, prefix=''):
#     def check_and_encode(self, name):
#     def encode(self, name):
#     def __init__(self, driver_name, default_executor_factory):
#     def build(cls, driver_name, options):
#     def start(self):
#     def stop(self):
#     def submit(self, cb, *args, **kwargs):
# def safe_abs_path(rooted_at, *pieces):
# def convert_blocking(blocking):
# def collapse(config, exclude=None, item_selector=operator.itemgetter(-1)):
# def to_binary(text, encoding='ascii'):
# def dumps(data, excp_cls=SerializationError):
# def loads(blob, excp_cls=SerializationError):
# def millis_to_datetime(milliseconds):
# def raise_with_cause(exc_cls, message, *args, **kwargs):
#     KIND_TO_FACTORY = {
#         'threaded': (lambda:
#                      futurist.ThreadPoolExecutor(max_workers=1)),
#         'synchronous': lambda: futurist.SynchronousExecutor(),
#     }
#     DEFAULT_KIND = 'threaded'


import abc
import collections
import enum
import logging
import threading
import urllib
import tenacity
import tooz
from concurrent import futures
from oslo_utils import encodeutils
from oslo_utils import netutils
from oslo_utils import timeutils
from stevedore import driver
from tooz import _retry
from tooz import partitioner
from tooz import utils
        :returns: None
        :rtype: CoordAsyncResult
        """
        raise tooz.NotImplemented

    @_retry.retry()
    def join_group_create(self, group_id, capabilities=b""):
        """Join a group and create it if necessary.

        If the group cannot be joined because it does not exist, it is created
        before being joined.

        This function will keep retrying until it can create the group and join
        it. Since nothing is transactional, it may have to retry several times
        if another member is creating/deleting the group at the same time.

        :param group_id: Identifier of the group to join and create
        :param capabilities: the capabilities of the joined member
        """
        req = self.join_group(group_id, capabilities)
        try:
            req.get()
        except GroupNotCreated:
            req = self.create_group(group_id)
            try:
                req.get()
            except GroupAlreadyExist:
                # The group might have been created in the meantime, ignore
                pass
            # Now retry to join the group

# Path: tooz/_retry.py
# def retry(stop_max_delay=None, **kwargs):
# 
# Path: tooz/partitioner.py
# class Partitioner(object):
#     DEFAULT_PARTITION_NUMBER = hashring.HashRing.DEFAULT_PARTITION_NUMBER
#     def __init__(self, coordinator, group_id,
#                  partitions=DEFAULT_PARTITION_NUMBER):
#     def _on_member_join(self, event):
#     def _on_member_leave(self, event):
#     def _hash_object(obj):
#     def members_for_object(self, obj, ignore_members=None, replicas=1):
#     def belongs_to_member(self, obj, member_id,
#                           ignore_members=None, replicas=1):
#     def belongs_to_self(self, obj, ignore_members=None, replicas=1):
#     def stop(self):
# 
# Path: tooz/utils.py
# class Base64LockEncoder(object):
# class ProxyExecutor(object):
# class SerializationError(tooz.ToozError):
#     def __init__(self, keyspace_url, prefix=''):
#     def check_and_encode(self, name):
#     def encode(self, name):
#     def __init__(self, driver_name, default_executor_factory):
#     def build(cls, driver_name, options):
#     def start(self):
#     def stop(self):
#     def submit(self, cb, *args, **kwargs):
# def safe_abs_path(rooted_at, *pieces):
# def convert_blocking(blocking):
# def collapse(config, exclude=None, item_selector=operator.itemgetter(-1)):
# def to_binary(text, encoding='ascii'):
# def dumps(data, excp_cls=SerializationError):
# def loads(blob, excp_cls=SerializationError):
# def millis_to_datetime(milliseconds):
# def raise_with_cause(exc_cls, message, *args, **kwargs):
#     KIND_TO_FACTORY = {
#         'threaded': (lambda:
#                      futurist.ThreadPoolExecutor(max_workers=1)),
#         'synchronous': lambda: futurist.SynchronousExecutor(),
#     }
#     DEFAULT_KIND = 'threaded'


# Path: tooz/coordination.py
import abc
import collections
import enum
import logging
import threading
import urllib
import tenacity
import tooz
from concurrent import futures
from oslo_utils import encodeutils
from oslo_utils import netutils
from oslo_utils import timeutils
from stevedore import driver
from tooz import _retry
from tooz import partitioner
from tooz import utils

        :returns: None
        :rtype: CoordAsyncResult
        """
        raise tooz.NotImplemented

    @_retry.retry()
    def join_group_create(self, group_id, capabilities=b""):
        """Join a group and create it if necessary.

        If the group cannot be joined because it does not exist, it is created
        before being joined.

        This function will keep retrying until it can create the group and join
        it. Since nothing is transactional, it may have to retry several times
        if another member is creating/deleting the group at the same time.

        :param group_id: Identifier of the group to join and create
        :param capabilities: the capabilities of the joined member
        """
        req = self.join_group(group_id, capabilities)
        try:
            req.get()
        except GroupNotCreated:
            req = self.create_group(group_id)
            try:
                req.get()
            except GroupAlreadyExist:
                # The group might have been created in the meantime, ignore
                pass
            # Now retry to join the group

            raise _retry.TryAgain