Beispiel #1
0
    def throughputs(self, handler):
        """
        Listen for throughput events with information for interfaces and bridges.

        :param handler: handler for every event
        :return: nothing
        """
        request = core_pb2.ThroughputsRequest()
        stream = self.stub.Throughputs(request)
        start_streamer(stream, handler)
Beispiel #2
0
    def throughputs(self, session_id, handler):
        """
        Listen for throughput events with information for interfaces and bridges.

        :param int session_id: session id
        :param handler: handler for every event
        :return: stream processing events, can be used to cancel stream
        :raises grpc.RpcError: when session doesn't exist
        """
        request = core_pb2.ThroughputsRequest(session_id=session_id)
        stream = self.stub.Throughputs(request)
        start_streamer(stream, handler)
        return stream
Beispiel #3
0
    def throughputs(
            self, session_id: int,
            handler: Callable[[wrappers.ThroughputsEvent],
                              None]) -> grpc.Future:
        """
        Listen for throughput events with information for interfaces and bridges.

        :param session_id: session id
        :param handler: handler for every event
        :return: stream processing events, can be used to cancel stream
        :raises grpc.RpcError: when session doesn't exist
        """
        request = core_pb2.ThroughputsRequest(session_id=session_id)
        stream = self.stub.Throughputs(request)
        thread = threading.Thread(target=throughput_listener,
                                  args=(stream, handler),
                                  daemon=True)
        thread.start()
        return stream