Ejemplo n.º 1
0
    def __init__(self, initial_behaviour, socket_interface, logger,
                 formula_factory, route_table):
        """
        :param func initial_behaviour: Function that define
                                       the initial_behaviour

        :param socket_interface: Communication interface of the actor
        :type socket_interface: powerapi.SocketInterface

        :param formula_factory: Factory for Formula creation.
        :type formula_factory: func((formula_id) -> powerapi.Formula)
        :param route_table: initialized route table
        :type route_table: powerapi.dispatcher.state.RouteTable
        """
        State.__init__(self, initial_behaviour, socket_interface, logger)

        #: (dict): Store the formula by id
        self.formula_dict = {}

        #: (utils.Tree): Tree store of the formula for faster
        #: DispatchRule
        self.formula_tree = Tree()

        #: (func): Factory for formula creation
        self.formula_factory = formula_factory

        self.route_table = route_table
Ejemplo n.º 2
0
    def __init__(self, actor, database, report_model):
        """
        :param BaseDB database: Database for saving data.
        """
        State.__init__(self, actor)

        #: (BaseDB): Database for saving data.
        self.database = database

        #: (Report): Type of the report that the pusher handle.
        self.report_model = report_model

        #: (Dict): Buffer data.
        self.buffer = []
Ejemplo n.º 3
0
    def __init__(self,
                 behaviour,
                 socket_interface,
                 logger,
                 database,
                 report_filter,
                 timeout_basic=0,
                 timeout_sleeping=100):
        """
        :param func behaviour: Function that define the initial_behaviour
        :param SocketInterface socket_interface: Communication interface of the
                                                 actor
        :param BaseDB database: Allow to interact with a Database
        :param Filter report_filter: Filter of the Puller
        :param bool stream_mode: Puller stream_mode database.
        """
        State.__init__(self, behaviour, socket_interface, logger)

        #: (BaseDB): Allow to interact with a Database
        self.database = database

        #: (it BaseDB): Allow to browse the database
        self.database_it = None

        #: (Filter): Filter of the puller
        self.report_filter = report_filter

        #: (bool): Puller stream_mode database.
        self.stream_mode = database.stream_mode

        #: (int): Timeout for "basic mode"
        self.timeout_basic = timeout_basic

        #: (int): Timeout for "sleeping mode" (allow to free the CPU)
        self.timeout_sleeping = timeout_sleeping

        #: (int): Counter for "sleeping mode"
        self.counter = 0
Ejemplo n.º 4
0
 def __init__(self, behaviour, socket_interface, logger, formula_id):
     State.__init__(self, behaviour, socket_interface, logger)
     self.formula_id = formula_id