本文整理汇总了Python中synapse.eventbus.EventBus类的典型用法代码示例。如果您正苦于以下问题:Python EventBus类的具体用法?Python EventBus怎么用?Python EventBus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventBus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, items=()):
EventBus.__init__(self)
self.deq = collections.deque()
self.lock = threading.Lock()
self.event = threading.Event()
self.onfini( self._onQueFini )
开发者ID:imjonsnooow,项目名称:synapse,代码行数:7,代码来源:queue.py
示例2: __init__
def __init__(self, queen, **config):
# NOTE: queen must *always* be a telepath proxy
EventBus.__init__(self)
self.iden = guid()
self.slots = {}
self.slocs = {}
self.queen = queen
self.config = config
# FIXME maybe put our hostname etc in config?
self.queen.on('tele:sock:init', self._onTeleSockInit )
self.queen.on('hive:tell:%s' % self.iden, self._onHiveTell)
self.localurl = 'local://%s/syn.queen' % self.iden
# each worker has a local:// daemon
self.dmon = s_daemon.Daemon()
self.dmon.listen(self.localurl)
self.dmon.share('syn.queen',queen)
self.on('hive:slot:run', self._onHiveSlotRun)
self.on('hive:slot:fini', self._onHiveSlotFini)
self._initQueenProxy()
开发者ID:jhsmith,项目名称:synapse,代码行数:30,代码来源:hivemind.py
示例3: __init__
def __init__(self, core):
EventBus.__init__(self)
self.core = core
self.keys = c_cache.Cache()
self.keys.setOnMiss( self._getRsaKey )
self.pubs = c_cache.Cache()
self.pubs.setOnMiss( self._getPubKey )
self.certs = c_cache.Cache()
self.certs.setOnMiss( self._getTokenCert )
self.tokens = c_cache.Cache()
self.tokens.setOnMiss( self._getTokenTufo )
core.onfini( self.keys.fini )
core.onfini( self.pubs.fini )
core.onfini( self.certs.fini )
core.onfini( self.tokens.fini )
core.addTufoForm('syn:token', ptype='str', doc='synapse identity token (user/host)')
core.addTufoProp('syn:token', 'user', doc='humon readable user name for this token')
core.addTufoProp('syn:token', 'host', doc='humon readable host name for this token')
core.addTufoProp('syn:token', 'blob', doc='Base64 encoded token blob')
core.addTufoProp('syn:token', 'cert', doc='Base64 encoded certificate blob')
core.addTufoProp('syn:token', 'rsakey', doc='base64( der( rsa.private ) )')
开发者ID:k1derly-fe,项目名称:synapse,代码行数:30,代码来源:pki.py
示例4: __init__
def __init__(self):
EventBus.__init__(self)
self.threads = {}
self.on('thread:init', self._initThread)
self.on('thread:fini', self._finiThread)
self.onfini(self._finiThreadBoss)
开发者ID:piggum,项目名称:synapse,代码行数:7,代码来源:threads.py
示例5: __init__
def __init__(self, cura, sess):
EventBus.__init__(self)
self.sid = sess[0]
self.cura = cura
self.sess = sess
self.local = {} # runtime only props
开发者ID:imjonsnooow,项目名称:synapse,代码行数:8,代码来源:session.py
示例6: __init__
def __init__(self):
EventBus.__init__(self)
self.tagsbyname = {}
self.coresbyname = {}
self.coresbytag = collections.defaultdict(list)
self.onfini( self._onMetaFini )
开发者ID:piggum,项目名称:synapse,代码行数:8,代码来源:cortex.py
示例7: __init__
def __init__(self):
EventBus.__init__(self)
self.root = None
self.lock = threading.Lock()
self.wake = threading.Event()
self.thr = self._runSchedMain()
self.onfini( self._onSchedFini )
开发者ID:jhsmith,项目名称:synapse,代码行数:9,代码来源:sched.py
示例8: __init__
def __init__(self, relay):
EventBus.__init__(self)
self.relay = relay
self.boss = s_threads.ThreadBoss()
self.onfini(self.boss.fini)
# we get the sock first to fill in info
self.on('link:sock:init', self._onLinkSockInit)
开发者ID:piggum,项目名称:synapse,代码行数:9,代码来源:common.py
示例9: __init__
def __init__(self, maxsize=10000, onmiss=None):
EventBus.__init__(self)
self.cache = {}
self.onmiss = onmiss
self.maxsize = maxsize
self.cachelock = threading.Lock()
self.fifo = collections.deque()
开发者ID:williballenthin,项目名称:synapse,代码行数:9,代码来源:cache.py
示例10: __init__
def __init__(self, sock, **info):
EventBus.__init__(self)
self.sock = sock
self.unpk = msgpack.Unpacker(use_list=0,encoding='utf8')
self.ident = s_common.guid()
self.xforms = [] # list of SockXform instances
self.crypto = None
self.sockinfo = info
self.onfini(self._finiSocket)
开发者ID:drstrng,项目名称:synapse,代码行数:10,代码来源:socket.py
示例11: __init__
def __init__(self, core=None, maxtime=onehour):
EventBus.__init__(self)
self.core = core
self.cache = s_cache.Cache(maxtime=maxtime)
self.cache.setOnMiss( self._getSessByIden )
self.cache.on('cache:pop', self._onSessCachePop )
self.onfini( self.cache.fini )
开发者ID:williballenthin,项目名称:synapse,代码行数:10,代码来源:session.py
示例12: __init__
def __init__(self):
#cmd.Cmd.__init__(self)
EventBus.__init__(self)
self.cmdfuncs = {}
self.cmdprompt = 'cli> '
self.addCmdMeths(self)
self.addCmdFunc(cmd_quit, name='quit')
self.addCmdFunc(cmd_help, name='help')
开发者ID:jhsmith,项目名称:synapse,代码行数:10,代码来源:cli.py
示例13: __init__
def __init__(self, link):
EventBus.__init__(self)
self.link = link
self.relay = s_link.initLinkRelay(link)
self.client = self._init_client()
self._tele_with = {} # tid:client for with blocks
# objname is path minus leading "/"
self.objname = link[1].get('path')[1:]
开发者ID:drstrng,项目名称:synapse,代码行数:11,代码来源:telepath.py
示例14: __init__
def __init__(self, statefd=None):
self.authinfo = {}
self.authrules = collections.defaultdict(dict)
EventBus.__init__(self)
StateMachine.__init__(self, statefd=statefd)
if self.getAuthInfo('defauth') == None:
self.setAuthInfo('defauth', False)
self._loadAuthRules()
开发者ID:piggum,项目名称:synapse,代码行数:11,代码来源:daemon.py
示例15: __init__
def __init__(self, func, *args, **kwargs):
EventBus.__init__(self)
threading.Thread.__init__(self)
self.setDaemon(True)
self.iden = guid()
self.task = (func,args,kwargs)
self.cancels = []
self.onfini( self._onThrFini )
开发者ID:imjonsnooow,项目名称:synapse,代码行数:12,代码来源:threads.py
示例16: __init__
def __init__(self):
EventBus.__init__(self)
self.coreok = {}
self.cordefs = {}
self.tagsbyname = {}
self.coresbyname = {}
self.sched = s_sched.Sched()
self.coresbytag = collections.defaultdict(list)
self.onfini( self._onMetaFini )
开发者ID:k1derly-fe,项目名称:synapse,代码行数:12,代码来源:cortex.py
示例17: __init__
def __init__(self, fd, **opts):
EventBus.__init__(self)
fd.seek(0, os.SEEK_END)
self.fd = fd
self.size = fd.tell()
self.fdoff = self.size
self.fileno = fd.fileno()
self.lock = threading.Lock()
self.onfini( self._onAtomFini )
开发者ID:williballenthin,项目名称:synapse,代码行数:13,代码来源:atomfile.py
示例18: __init__
def __init__(self, sock, **info):
EventBus.__init__(self)
self.sock = sock
self.plex = None
self.unpk = msgpack.Unpacker(use_list=0,encoding='utf8')
self.iden = s_common.guid()
self.xforms = [] # list of SockXform instances
self.info = info
# used by Plex() tx
self.txbuf = None
self.txque = collections.deque()
self.onfini(self._finiSocket)
开发者ID:jhsmith,项目名称:synapse,代码行数:15,代码来源:socket.py
示例19: __init__
def __init__(self):
EventBus.__init__(self)
self.onfini( self._onBossFini )
self.pool = None
self.sched = s_sched.getGlobSched()
self.joblock = threading.Lock()
self._boss_jobs = {}
self.joblocal = {}
self.on('job:done', self._onJobDone ) # trigger job done
self.on('job:fini', self._onJobFini ) # job is finished
开发者ID:k1derly-fe,项目名称:synapse,代码行数:15,代码来源:async.py
示例20: __init__
def __init__(self, **settings):
EventBus.__init__(self)
s_daemon.DmonConf.__init__(self)
tornado.web.Application.__init__(self, **settings)
self.loop = tornado.ioloop.IOLoop.current()
self.serv = tornado.httpserver.HTTPServer(self)
self.boss = s_async.Boss()
# FIXME options
self.boss.runBossPool(8, maxsize=128)
self.iothr = self._runWappLoop()
self.onfini( self._onWappFini )
开发者ID:imjonsnooow,项目名称:synapse,代码行数:16,代码来源:webapp.py
注:本文中的synapse.eventbus.EventBus类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论