def __init__(self): s_eventbus.EventBus.__init__(self) self.bytag = s_tags.ByTag() self.services = {} self.on('syn:svc:fini', self._onSynSvcFini)
def __init__(self, sbus, timeout=None): self.sbus = sbus self.timeout = timeout # FIXME set a reconnect handler for sbus self.sbus.on('syn:svc:init', self._onSynSvcInit) self.sbus.on('syn:svc:fini', self._onSynSvcFini) self.byiden = {} self.byname = {} self.bytag = s_tags.ByTag() self.tagprox = {} [self._addSvcTufo(svcfo) for svcfo in sbus.getSynSvcs()]
def test_aspect_bytag(self): bytag = s_tags.ByTag() bytag.put('foo0', ('foos.foo0', 'bar.baz')) bytag.put('foo1', ('foos.foo1', 'bar.faz')) vals = tuple(sorted(bytag.get('bar'))) self.eq(vals, ('foo0', 'foo1')) vals = tuple(sorted(bytag.get('foos'))) self.eq(vals, ('foo0', 'foo1')) vals = tuple(sorted(bytag.get('foos.foo0'))) self.eq(vals, ('foo0', )) vals = tuple(sorted(bytag.get('newp.foo0'))) self.eq(vals, ()) bytag.pop('foo0') vals = tuple(sorted(bytag.get('foos'))) self.eq(vals, ('foo1', ))
def __init__(self, sbus, timeout=None): s_eventbus.EventBus.__init__(self) self.byiden = {} self.byname = {} self.bytag = s_tags.ByTag() self.idenprox = {} self.nameprox = {} self.tagprox = {} self.sbus = sbus self.timeout = timeout self.onfini(self.sbus.fini) # FIXME set a reconnect handler for sbus self.sbus.on('syn:svc:init', self._onSynSvcInit) self.sbus.on('syn:svc:init', self.dist) self.sbus.on('syn:svc:fini', self._onSynSvcFini) self.sbus.on('syn:svc:fini', self.dist) [self._addSvcTufo(svcfo) for svcfo in sbus.getSynSvcs()]