From 934d642b410d75dae1966c993fc61c371959876e Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Fri, 11 Jan 2013 20:01:09 +0100 Subject: datastore --- datastore/store/processor.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 datastore/store/processor.py (limited to 'datastore/store/processor.py') diff --git a/datastore/store/processor.py b/datastore/store/processor.py new file mode 100644 index 0000000..9d39d9a --- /dev/null +++ b/datastore/store/processor.py @@ -0,0 +1,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) + -- cgit v1.2.1