當前位置: 首頁>>代碼示例>>Python>>正文


Python eventbus.EventBus類代碼示例

本文整理匯總了Python中synapse.eventbus.EventBus的典型用法代碼示例。如果您正苦於以下問題:Python EventBus類的具體用法?Python EventBus怎麽用?Python EventBus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了EventBus類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的synapse.eventbus.EventBus類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。