Пример #1
0
 def __init__(self, lw, expected_type, store, resync_period):
     self.should_resync = None
     # TODO: self.watch_list_page_size = 0
     # TODO: name
     self._store = store
     self._lister_watcher = lw
     self._period = 1
     self._resync_period = resync_period
     self._clock = clock.RealClock()
     self._last_sync_resource_version = ""
     self._set_expected_type(expected_type)
Пример #2
0
 def __init__(
     self,
     *,
     indexer,
     lister_watcher,
     object_type,
     default_event_handler_resync_period,
 ):
     real_clock = clock.RealClock()
     self._processor = _SharedProcessor(real_clock)
     self._indexer = indexer
     self._lister_watcher = lister_watcher
     self._object_type = object_type
     self._resync_check_period = default_event_handler_resync_period
     self._default_event_handler_resync_period = default_event_handler_resync_period
     self._clock = real_clock
     self._started = False
     self._stopped = False
     self._controller = None
     self._started_lock = asyncio.Lock()
     self._block_deltas = asyncio.Lock()
Пример #3
0
 def __init__(self, lec):
     if lec.lease_duration <= lec.renew_deadline:
         raise Exception(
             "lease_duration must be greater than renew_deadline")
     if lec.renew_deadline <= JITTER_FACTOR * lec.retry_period:
         raise Exception(
             "renew_deadline must be greater than retry_period * JITTER_FACTOR"
         )
     if lec.lease_duration <= 0:
         raise Exception("lease_duration must be greater than zero")
     if lec.renew_deadline <= 0:
         raise Exception("renew_deadline must be greater than zero")
     if lec.retry_period <= 0:
         raise Exception("retry_period must be greater than zero")
     if not lec.callbacks.on_started_leading:
         raise Exception("on_started_leading callback must not be None")
     if not lec.callbacks.on_stopped_leading:
         raise Exception("on_stopped_leading callback must not be None")
     if not lec.lock:
         raise Exception("lock must not be None")
     self._config = lec
     self._clock = clock.RealClock()
Пример #4
0
 def __init__(self, rate_limiter, c=None):
     if not c:
         c = clock.RealClock()
     super().__init__(c)
     self._rate_limiter = rate_limiter
Пример #5
0
def new():
    return _DelayingType(clock.RealClock())
Пример #6
0
def new():
    return Type(clock.RealClock())
Пример #7
0
 def __init__(self, config):
     self._config = config
     self._reflector = None
     self._reflector_mutex = asyncio.Lock()
     self._clock = clock.RealClock()