Mirror of DataTableStore's version/capture surface.
| 13 | |
| 14 | |
| 15 | class Store: |
| 16 | """Mirror of DataTableStore's version/capture surface.""" |
| 17 | |
| 18 | def __init__(self, n_slots): |
| 19 | self.version = [0] * n_slots |
| 20 | self.write_clock = 0 |
| 21 | self._capture = None |
| 22 | |
| 23 | def write(self, slot): |
| 24 | self.write_clock += 1 |
| 25 | self.version[slot] = self.write_clock |
| 26 | |
| 27 | def set_capture_target(self, read_set): |
| 28 | self._capture = read_set |
| 29 | |
| 30 | def read(self, slot): |
| 31 | if self._capture is not None and slot not in self._capture: |
| 32 | self._capture.append(slot) |
| 33 | return self.version[slot] # value stand-in |
| 34 | |
| 35 | def changed_since(self, slots, since_clock): |
| 36 | return any(self.version[s] > since_clock for s in slots) |
| 37 | |
| 38 | |
| 39 | class Dataset: |
no outgoing calls