コード例 #1
0
ファイル: crust.py プロジェクト: exis-io/pyRiffle
    def join(self):
        # TODO: convert the "control plane" to use deferreds using Twisted style callbacks
        cb, eb = utils.newID(2)
        self.app.control[cb] = self.onJoin
        self.mantleDomain.Join(cb, eb)

        self.app.mainGreenlet = greenlet(self.app.handle)
        self.app.mainGreenlet.switch(self.mantleDomain)
コード例 #2
0
ファイル: crust.py プロジェクト: abdelali-m/Exis
    def __init__(self):
        self.cb, self.eb = utils.newID(2)
        self.green = None

        # Boy does it hurt me to put this here. canReturn needs to have access to the domain
        # for call returns
        self.mantleDomain = None

        # True if this deferred should inform the core of its types once set
        # Only true for calls
        self.canReturn = False
コード例 #3
0
    def __init__(self):
        self.cb, self.eb = utils.newID(2)
        self.green = None

        # Boy does it hurt me to put this here. canReturn needs to have access to the domain
        # for call returns
        self.mantleDomain = None

        # True if this deferred should inform the core of its types once set
        # Only true for calls
        self.canReturn = False
コード例 #4
0
ファイル: crust.py プロジェクト: abdelali-m/Exis
    def join(self, token=None):
        # Pass credentials down to the core before attempting to join the
        # fabric.
        if token is not None:
            self.mantleDomain.SetToken(token)

        # TODO: convert the "control plane" to use deferreds using Twisted style callbacks
        cb, eb = utils.newID(2)
        self.app.control[cb] = self.onJoin
        self.mantleDomain.Join(cb, eb)

        self.app.mainGreenlet = greenlet(self.app.handle)
        self.app.mainGreenlet.switch(self.mantleDomain)
コード例 #5
0
    def join(self, token=None):
        # Pass credentials down to the core before attempting to join the
        # fabric.
        if token is not None:
            self.mantleDomain.SetToken(token)

        # TODO: convert the "control plane" to use deferreds using Twisted style callbacks
        cb, eb = utils.newID(2)
        self.app.control[cb] = self.onJoin
        self.mantleDomain.Join(cb, eb)

        self.app.mainGreenlet = greenlet(self.app.handle)
        self.app.mainGreenlet.switch(self.mantleDomain)
コード例 #6
0
ファイル: crust.py プロジェクト: abdelali-m/Exis
    def _setHandler(self, endpoint, handler, coreFunction, doesReturn):
        '''
        Register or Subscribe. Invokes targetFunction for the given endpoint and handler.

        :param coreFunction: the intended core function, either Subscribe or Register
        :param doesReturn: True if this handler can return a value (is a registration)
        '''

        d, handlerId = Deferred(), utils.newID()
        self.app.deferreds[d.cb], self.app.deferreds[d.eb] = d, d
        self.app.handlers[handlerId] = handler, doesReturn

        coreFunction(endpoint, d.cb, d.eb, handlerId, cumin.reflect(handler))
        return d
コード例 #7
0
    def _setHandler(self, endpoint, handler, coreFunction, doesReturn):
        '''
        Register or Subscribe. Invokes targetFunction for the given endpoint and handler.

        :param coreFunction: the intended core function, either Subscribe or Register
        :param doesReturn: True if this handler can return a value (is a registration)
        '''

        d, handlerId = Deferred(), utils.newID()
        self.app.deferreds[d.cb], self.app.deferreds[d.eb] = d, d
        self.app.handlers[handlerId] = handler, doesReturn

        coreFunction(endpoint, d.cb, d.eb, handlerId, cumin.reflect(handler))
        return d