コード例 #1
0
    def create(cls,
               envelope: Envelope = None,
               envelope_binary: bytes = None,
               **kwargs):
        assert not (
            envelope and envelope_binary
        ), "Either envelope or envelope_binary should be passed in (not both)"

        cmd = reactor_capnp.ReactorCommand.new_message()

        if envelope:
            assert isinstance(
                envelope,
                Envelope), "'envelope' kwarg must be an Envelope instance"
            cmd.envelope.data = envelope.serialize()
        if envelope_binary:
            assert isinstance(envelope_binary,
                              bytes), "'envelope_binary' must be bytes"
            cmd.envelope.data = envelope_binary

        cmd.init('kwargs', len(kwargs))
        for i, key in enumerate(kwargs):
            cmd.kwargs[i].key, cmd.kwargs[i].value = str(key), str(kwargs[key])

        return cls.from_data(cmd)
コード例 #2
0
ファイル: executor.py プロジェクト: cclauss/cilantro
    def _recv_reply_env(self, header: str, envelope: Envelope):
        self.log.debug("Recv REPLY envelope with header {} and envelope {}".format(header, envelope))

        reply_uuid = envelope.meta.uuid
        if reply_uuid in self.expected_replies:
            self.log.debug("Removing reply with uuid {} from expected replies".format(reply_uuid))
            self.expected_replies[reply_uuid].cancel()
            del(self.expected_replies[reply_uuid])

        self.call_on_mp(callback=StateInput.INPUT, header=header, envelope_binary=envelope.serialize())
コード例 #3
0
ファイル: executor.py プロジェクト: cclauss/cilantro
 def _recv_request_env(self, header: str, envelope: Envelope):
     self.log.debug("Recv REQUEST envelope with header {} and envelope {}".format(header, envelope))
     self.call_on_mp(callback=StateInput.REQUEST, header=header, envelope_binary=envelope.serialize())
コード例 #4
0
ファイル: executor.py プロジェクト: cclauss/cilantro
 def _recv_pub_env(self, header: str, envelope: Envelope):
     self.log.debug("Recv'd pub envelope with header {} and env {}".format(header, envelope))
     self.call_on_mp(callback=StateInput.INPUT, envelope_binary=envelope.serialize())