changeset 3343:86a03229d32d

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 18 Dec 2017 02:11:34 +0100
parents 3194aec207ae
children 4d054737a79c
files hgext3rd/evolve/stablerangecache.py
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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