summaryrefslogtreecommitdiff
path: root/ick2/persistent.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-07-14 16:44:51 +0300
committerLars Wirzenius <liw@liw.fi>2019-08-03 21:06:50 +0300
commit80539a84aaa17aca1da9c56794e41a114e222041 (patch)
tree7549224e4df90c797e1d80abfc486bea111bf23c /ick2/persistent.py
parent4dd2e14cd15ad2840cfc3636251802f8eb0bc9ba (diff)
downloadick2-80539a84aaa17aca1da9c56794e41a114e222041.tar.gz
Add: update_resource
Diffstat (limited to 'ick2/persistent.py')
-rw-r--r--ick2/persistent.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ick2/persistent.py b/ick2/persistent.py
index d865207..d323db7 100644
--- a/ick2/persistent.py
+++ b/ick2/persistent.py
@@ -45,6 +45,9 @@ class PersistentStateInterface: # pragma: no cover
def write_resource(self, token, kind, rid, resource):
raise NotImplementedError()
+ def update_resource(self, token, kind, rid, resource):
+ raise NotImplementedError()
+
def remove_resource(self, token, kind, rid):
raise NotImplementedError()
@@ -72,6 +75,9 @@ class MemoryPersistentState(PersistentStateInterface):
self._res[kind] = {}
self._res[kind][rid] = resource
+ def update_resource(self, token, kind, rid, resource):
+ self.write_resource(token, kind, rid, resource)
+
def remove_resource(self, token, kind, rid):
if kind not in self._res or rid not in self._res[kind]:
raise ick2.NotFound(kind=kind, rid=rid)
@@ -101,6 +107,9 @@ class MuckPersistentState(PersistentStateInterface):
self._res[kind] = {}
self._res[kind][rid] = resource
+ def update_resource(self, token, kind, rid, resource):
+ self.write_resource(token, kind, rid, resource)
+
def remove_resource(self, token, kind, rid):
if kind not in self._res or rid not in self._res[kind]:
raise ick2.NotFound(kind=kind, rid=rid)