mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-20 00:46:30 +08:00
protocols/file_db: remove unneeded hooks feature
This commit is contained in:
parent
97accd2540
commit
3923dd83c2
@ -1,5 +1,3 @@
|
|||||||
from time import time
|
|
||||||
|
|
||||||
from artiq.protocols import pyon
|
from artiq.protocols import pyon
|
||||||
from artiq.protocols.sync_struct import Notifier
|
from artiq.protocols.sync_struct import Notifier
|
||||||
|
|
||||||
@ -8,7 +6,6 @@ class FlatFileDB:
|
|||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.data = Notifier(pyon.load_file(self.filename))
|
self.data = Notifier(pyon.load_file(self.filename))
|
||||||
self.hooks = []
|
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
pyon.store_file(self.filename, self.data.read)
|
pyon.store_file(self.filename, self.data.read)
|
||||||
@ -19,13 +16,7 @@ class FlatFileDB:
|
|||||||
def set(self, key, value):
|
def set(self, key, value):
|
||||||
self.data[key] = value
|
self.data[key] = value
|
||||||
self.save()
|
self.save()
|
||||||
timestamp = time()
|
|
||||||
for hook in self.hooks:
|
|
||||||
hook.set(timestamp, key, value)
|
|
||||||
|
|
||||||
def delete(self, key):
|
def delete(self, key):
|
||||||
del self.data[key]
|
del self.data[key]
|
||||||
self.save()
|
self.save()
|
||||||
timestamp = time()
|
|
||||||
for hook in self.hooks:
|
|
||||||
hook.delete(timestamp, key)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user