Completed
Pull Request — master (#156)
by
unknown
02:37
created

new_historized_event()   A

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.125
Metric Value
cc 1
dl 0
loc 7
ccs 1
cts 2
cp 0.5
crap 1.125
rs 9.4285
1 1
class HistoryStorageInterface(object):
2
3
    """
4
    Interface of a history backend.
5
    Must be implemented by backends
6
    """
7
8 1
    def new_historized_node(self, node, period, count=0):
9
        """
10
        Called when a new node is to be historized
11
        Returns None
12
        """
13
        raise NotImplementedError
14
15 1
    def save_node_value(self, node, datavalue):
16
        """
17
        Called when the value of a historized node has changed and should be saved in history
18
        Returns None
19
        """
20
        raise NotImplementedError
21
22 1
    def read_node_history(self, node, start, end, nb_values):
23
        """
24
        Called when a client make a history read request for a node
25
        if start or end is missing then nb_values is used to limit query
26
        nb_values is the max number of values to read. Ignored if 0
27
        Start time and end time are inclusive
28
        Returns a list of DataValues and a continuation point which
29
        is None if all nodes are read or the ServerTimeStamp of the last rejected DataValue
30
        """
31
        raise NotImplementedError
32
33 1
    def new_historized_event(self, event, period):
34
        """
35
        Called when historization of events is enabled on server side
36
        FIXME: we may need to store events per nodes in future...
37
        Returns None
38
        """
39
        raise NotImplementedError
40
41 1
    def save_event(self, event):
42
        """
43
        Called when a new event has been generated ans should be saved in history
44
        Returns None
45
        """
46
        raise NotImplementedError
47
48 1
    def read_event_history(self, start, end, evfilter):
49
        """
50
        Called when a client make a history read request for events
51
        Start time and end time are inclusive
52
        Returns a list of Events and a continuation point which
53
        is None if all events are read or the ServerTimeStamp of the last rejected event
54
        """
55
        raise NotImplementedError
56
57 1
    def stop(self):
58
        """
59
        Called when the server shuts down
60
        Can be used to close database connections etc.
61
        """
62
        raise NotImplementedError
63