summaryrefslogtreecommitdiff
path: root/datastore/store/processor.py
blob: 9d39d9a7466294a66e9c2ffb30081cc1712fd55a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class IProcessor:
    def __init__(self): raise NotImplementedError()
    def process(self, name, timestamp, data, controller): pass

class CountingProcessor(IProcessor):
    def __init__(self, destination):
        self.destination = destination

    def process(self,name,timestamp,data,controller):
        current = controller.get(self.destination,None)
        if not current:
            current = 0
        current = int(current)

        controller.put(self.destination, timestamp, current + 1)