From bf46ce4a923f16927e2e40bdc5980fd342157a47 Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Mon, 5 Jun 2023 20:19:12 +0800 Subject: [PATCH] applets.simple: add mutate_dataset feature --- artiq/applets/simple.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/artiq/applets/simple.py b/artiq/applets/simple.py index 80cab97f6..8adb064d2 100644 --- a/artiq/applets/simple.py +++ b/artiq/applets/simple.py @@ -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)