diff sat_frontends/bridge/pb.py @ 3163:d10b2368684e

bridge: added methods to let frontends store/retrieve/delete private data
author Goffi <goffi@goffi.org>
date Mon, 10 Feb 2020 22:01:53 +0100
parents 559a625a236b
children 439e2f88c3a9
line wrap: on
line diff
--- a/sat_frontends/bridge/pb.py	Sun Feb 09 23:56:42 2020 +0100
+++ b/sat_frontends/bridge/pb.py	Mon Feb 10 22:01:53 2020 +0100
@@ -487,6 +487,30 @@
             errback = self._generic_errback
         d.addErrback(errback)
 
+    def privateDataDelete(self, namespace, key, arg_2, callback=None, errback=None):
+        d = self.root.callRemote("privateDataDelete", namespace, key, arg_2)
+        if callback is not None:
+            d.addCallback(lambda __: callback())
+        if errback is None:
+            errback = self._generic_errback
+        d.addErrback(errback)
+
+    def privateDataGet(self, namespace, key, profile_key, callback=None, errback=None):
+        d = self.root.callRemote("privateDataGet", namespace, key, profile_key)
+        if callback is not None:
+            d.addCallback(callback)
+        if errback is None:
+            errback = self._generic_errback
+        d.addErrback(errback)
+
+    def privateDataSet(self, namespace, key, data, profile_key, callback=None, errback=None):
+        d = self.root.callRemote("privateDataSet", namespace, key, data, profile_key)
+        if callback is not None:
+            d.addCallback(lambda __: callback())
+        if errback is None:
+            errback = self._generic_errback
+        d.addErrback(errback)
+
     def profileCreate(self, profile, password='', component='', callback=None, errback=None):
         d = self.root.callRemote("profileCreate", profile, password, component)
         if callback is not None:
@@ -859,6 +883,21 @@
         d.addErrback(self._errback)
         return d.asFuture(asyncio.get_event_loop())
 
+    def privateDataDelete(self, namespace, key, arg_2):
+        d = self.root.callRemote("privateDataDelete", namespace, key, arg_2)
+        d.addErrback(self._errback)
+        return d.asFuture(asyncio.get_event_loop())
+
+    def privateDataGet(self, namespace, key, profile_key):
+        d = self.root.callRemote("privateDataGet", namespace, key, profile_key)
+        d.addErrback(self._errback)
+        return d.asFuture(asyncio.get_event_loop())
+
+    def privateDataSet(self, namespace, key, data, profile_key):
+        d = self.root.callRemote("privateDataSet", namespace, key, data, profile_key)
+        d.addErrback(self._errback)
+        return d.asFuture(asyncio.get_event_loop())
+
     def profileCreate(self, profile, password='', component=''):
         d = self.root.callRemote("profileCreate", profile, password, component)
         d.addErrback(self._errback)