forked from M-Labs/artiq
1
0
Fork 0

applets.simple: add mutate_dataset feature

This commit is contained in:
Florian Agbuya 2023-06-05 20:19:12 +08:00 committed by Sébastien Bourdeauducq
parent 1f306a2859
commit bf46ce4a92
1 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,10 @@ class AppletControlIPC:
def set_dataset(self, key, value, persist=None):
self.ipc.set_dataset(key, value, persist)
def mutate_dataset(self, key, index, value):
mod = {"action": "setitem", "path": [key, 1], "key": index, "value": value}
self.ipc.update_dataset(mod)
def append_to_dataset(self, key, value):
mod = {"action": "append", "path": [key, 1], "x": value}
self.ipc.update_dataset(mod)
@ -41,6 +45,10 @@ class AppletControlRPC:
def set_dataset(self, key, value, persist=None):
self._background(self.dataset_ctl.set, key, value, persist)
def mutate_dataset(self, key, index, value):
mod = {"action": "setitem", "path": [key, 1], "key": index, "value": value}
self._background(self.dataset_ctl.update, mod)
def append_to_dataset(self, key, value):
mod = {"action": "append", "path": [key, 1], "x": value}
self._background(self.dataset_ctl.update, mod)