-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
50a5a3b
commit 0e3927b
Showing
3 changed files
with
36 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from artiq.protocols.sync_struct import Notifier | ||
from artiq.protocols import pyon | ||
|
||
|
||
class DDB: | ||
def __init__(self, backing_file): | ||
self.backing_file = backing_file | ||
self.data = Notifier(pyon.load_file(self.backing_file)) | ||
|
||
def scan(self): | ||
new_data = pyon.load_file(self.backing_file) | ||
|
||
for k in list(self.data.read.keys()): | ||
if k not in new_data: | ||
del self.data[k] | ||
for k in new_data.keys(): | ||
if k not in self.data.read or self.data.read[k] != new_data[k]: | ||
self.data[k] = new_data[k] | ||
|
||
def get(self, key): | ||
return self.data.read[key] |