stablerange: introduce a sql backed version of the generic on disk cache
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 18 Dec 2017 02:11:34 +0100
changeset 3343 86a03229d32d
parent 3342 3194aec207ae
child 3344 4d054737a79c
stablerange: introduce a sql backed version of the generic on disk cache This is getting use close to actually using the new sorting and algorithm for real.
hgext3rd/evolve/stablerangecache.py
--- a/hgext3rd/evolve/stablerangecache.py	Mon Dec 18 01:11:01 2017 +0100
+++ b/hgext3rd/evolve/stablerangecache.py	Mon Dec 18 02:11:34 2017 +0100
@@ -238,6 +238,40 @@
         con.executemany(_updaterange, allranges)
         con.executemany(_updatesubranges, data)
 
+class stablerangesql(stablerangesqlbase, stablerangeondiskbase):
+    """base clase able to preserve data to disk as sql"""
+
+    __metaclass__ = abc.ABCMeta
+
+    # self._cachekey = (tiprev, tipnode)
+
+    @property
+    def _tiprev(self):
+        return self._cachekey[0]
+
+    @_tiprev.setter
+    def _tiprev(self, value):
+        self._cachekey = (value, self._cachekey[1])
+
+    @property
+    def _tipnode(self):
+        return self._cachekey[1]
+
+    @_tipnode.setter
+    def _tipnode(self, value):
+        self._cachekey = (self._cachekey[0], value)
+
+    def clear(self, reset=False):
+        super(stablerangesql, self).clear(reset=reset)
+        del self._con
+        self._subrangescache.clear()
+
+    def load(self, repo):
+        self._con
+
+    def save(self, repo):
+        self._save(repo)
+
 class sqlstablerange(stablerangesqlbase, stablerange.stablerange):
 
     _schemaversion = 1