from allmydata.util import idlib
+from allmydata.util.dictutil import DictOfSets
MODE_CHECK = "MODE_CHECK" # query all peers
MODE_ANYTHING = "MODE_ANYTHING" # one recoverable version
-
-
-class DictOfSets(dict):
- def add(self, key, value):
- if key in self:
- self[key].add(value)
- else:
- self[key] = set([value])
-
- def discard(self, key, value):
- if not key in self:
- return
- self[key].discard(value)
- if not self[key]:
- del self[key]
-
class ResponseCache:
"""I cache share data, to reduce the number of round trips used during
mutable file operations. All of the data in my cache is for a single
--- /dev/null
+
+class DictOfSets(dict):
+ def add(self, key, value):
+ if key in self:
+ self[key].add(value)
+ else:
+ self[key] = set([value])
+
+ def discard(self, key, value):
+ if not key in self:
+ return
+ self[key].discard(value)
+ if not self[key]:
+ del self[key]
+