class UniresisProxy(ResoursesProxy): def __init__(self, endpoints, name): self.name = name self.uniresis = \ Service(name, endpoints) if endpoints else Service(name) @property def service_name(self): return self.name @gen.coroutine def uuid(self): ch = yield self.uniresis.uuid() uuid = yield ch.rx.get() raise gen.Return(uuid) @gen.coroutine def extra(self): ch = yield self.uniresis.extra() extra = yield ch.rx.get() raise gen.Return(extra)
class UniresisProxy(ResoursesProxy): def __init__(self, context, endpoints, name): self.config = context.config self.name = name self.uniresis = \ Service(name, endpoints) if endpoints else Service(name) @property def service_name(self): """Return name of backend service. Shoud return either 'locator' or 'uniresis'. """ return self.name @gen.coroutine def uuid(self): """Resquest uuid from uniresis service.""" ch = yield self.uniresis.uuid() uuid = yield ch.rx.get(timeout=self.config.api_timeout) raise gen.Return(uuid) @gen.coroutine def extra(self): """Resquest extra records from uniresis/locator service. Cluster name of main intrest in 'extra' json. """ ch = yield self.uniresis.extra() extra = yield ch.rx.get(timeout=self.config.api_timeout) raise gen.Return(extra)