blob: b10cd98555ee714065a08dbdfb93079dc75c34e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
class CmRDT:
pass
class Counter(CmRDT):
def __init__(self): # constructor function
self._count = 0
def value(self): # query function
return self._count
def increment(self): # update function
self._count += 1
for replica in self.replicas():
self.transmit("increment", replica)
|