[PATCH 06 of 14] cache: add a obsstoresourcebase class
Boris Feld
boris.feld at octobus.net
Sun Jul 9 13:55:18 EDT 2017
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1499458924 -7200
# Fri Jul 07 22:22:04 2017 +0200
# Node ID 5b49f653a4a50607127e37e7511c8a8e343cc8d9
# Parent 7c41d1484f53c53d516153d19a90c331c3f87c16
# EXP-Topic obs-cache
cache: add a obsstoresourcebase class
This class provides an abstract base for cache based on the obsstore. Having
this as a separared class is useful as it could be used for the obsindexes
cache that have been discussed in June this year.
diff -r 7c41d1484f53 -r 5b49f653a4a5 mercurial/cache.py
--- a/mercurial/cache.py Sat Jun 17 06:39:43 2017 +0200
+++ b/mercurial/cache.py Fri Jul 07 22:22:04 2017 +0200
@@ -164,3 +164,20 @@
def _fetchupdatedata(self, repo):
return self._fetchchangelogdata(self._cachekey, repo.changelog)
+
+class obsstoresourcebase(incrementalcachebase):
+ """an abstract class for cache that source data from the obsstore
+
+ For this purpose it use a cache key covering obsstore
+ content provided by the obsstore itself
+ """
+
+ __metaclass__ = abc.ABCMeta
+
+ # default key used for an empty cache
+ emptykey = (0, node.nullid)
+ _cachekeyspec = 'I20s'
+ _cachename = None # used for debug message
+
+ def _fetchupdatedata(self, repo):
+ return repo.obsstore.getmarkerssince(self._cachekey)
More information about the Mercurial-devel
mailing list