Beispiel #1
0
import logging
import threading
import time

from radosgw_agent import client
from radosgw_agent import exceptions as exc
from radosgw_agent.util import get_dev_logger

log = logging.getLogger(__name__)
dev_log = get_dev_logger(__name__)


class LockBroken(Exception):
    pass


class LockRenewFailed(LockBroken):
    pass


class LockExpired(LockBroken):
    pass


class Lock(threading.Thread):
    """A lock on a shard log that automatically refreshes itself.

    It may be used to lock different shards throughout its lifetime.
    To lock a new shard, call aquire() with the shard_num desired.

    To release the lock, call release_and_clear(). This will raise an
Beispiel #2
0
import logging
import threading
import time

from radosgw_agent import client
from radosgw_agent import exceptions as exc
from radosgw_agent.util import get_dev_logger

log = logging.getLogger(__name__)
dev_log = get_dev_logger(__name__)


class LockBroken(Exception):
    pass


class LockRenewFailed(LockBroken):
    pass


class LockExpired(LockBroken):
    pass


class Lock(threading.Thread):
    """A lock on a shard log that automatically refreshes itself.

    It may be used to lock different shards throughout its lifetime.
    To lock a new shard, call aquire() with the shard_num desired.

    To release the lock, call release_and_clear(). This will raise an