noc.core.dcs.consuldcs

Module Contents

noc.core.dcs.consuldcs.ConsulRepearableCodes
noc.core.dcs.consuldcs.ConsulRepeatableErrors
noc.core.dcs.consuldcs.CONSUL_CONNECT_TIMEOUT
noc.core.dcs.consuldcs.CONSUL_REQUEST_TIMEOUT
noc.core.dcs.consuldcs.CONSUL_NEAR_RETRY_TIMEOUT
class noc.core.dcs.consuldcs.ConsulHTTPClient

Bases: consul.tornado.HTTPClient

Gentler version of tornado http client

_request(self, callback, url, method='GET', body=None)
get(self, callback, path, params=None)
put(self, callback, path, params=None, data='')
delete(self, callback, path, params=None)
post(self, callback, path, params=None, data='')
class noc.core.dcs.consuldcs.ConsulClient

Bases: consul.base.Consul

connect(self, host, port, scheme, verify=True, cert=None)
class noc.core.dcs.consuldcs.ConsulResolver

Bases: noc.core.dcs.base.ResolverBase

start(self)
class noc.core.dcs.consuldcs.ConsulDCS(url, ioloop=None)

Bases: noc.core.dcs.base.DCSBase

Consul-based DCS

URL format: consul://<address>[:<port>]/<kv root>?token=<token>&check_interval=<…>&check_timeout=<…>&release_after=<…>

DEFAULT_CONSUL_HOST
DEFAULT_CONSUL_PORT
DEFAULT_CONSUL_CHECK_INTERVAL
DEFAULT_CONSUL_CHECK_TIMEOUT
DEFAULT_CONSUL_RELEASE
DEFAULT_CONSUL_SESSION_TTL
DEFAULT_CONSUL_LOCK_DELAY
DEFAULT_CONSUL_RETRY_TIMEOUT
DEFAULT_CONSUL_KEEPALIVE_ATTEMPTS
EMPTY_HOLDER =
resolver_cls
parse_url(self, u)
create_session(self)

Create consul session :return:

destroy_session(self)
register(self, name, address, port, pool=None, lock=None, tags=None)
deregister(self)
keep_alive(self)
get_lock_path(self, lock)
acquire_lock(self, name)
acquire_slot(self, name, limit)

Acquire shard slot :param name: <service name>-<pool> :param limit: Configured limit :return: (slot number, number of instances)

resolve_near(self, name, hint=None, wait=True, timeout=None, full_result=False, critical=False)

Synchronous call to resolve nearby service Commonly used for external services like databases :param name: Service name :param wait: :param timeout: :param full_result: :param hint: :param critical: :return: address:port