summaryrefslogtreecommitdiff
path: root/zuul
diff options
context:
space:
mode:
authorSimon Westphahl <simon.westphahl@bmw.de>2021-11-04 12:22:01 +0100
committerSimon Westphahl <simon.westphahl@bmw.de>2021-11-04 15:15:15 +0100
commit0b048295e4e25e337194053cfa3bbe91e1a50e80 (patch)
tree3ca8cd8a6279028a55b5dd6e02b7196c428861f4 /zuul
parent9fca9da2062796c50e056171b8b28ce047f011e4 (diff)
downloadzuul-0b048295e4e25e337194053cfa3bbe91e1a50e80.tar.gz
Add source interface for getting the cache ltime
In order to save a list of ltimes for each connection we need a source interface to get the current ltime of a project branch cache. Change-Id: If01db0698024beeed813d2c9910651c757377865
Diffstat (limited to 'zuul')
-rw-r--r--zuul/driver/gerrit/gerritsource.py3
-rw-r--r--zuul/driver/git/gitsource.py3
-rw-r--r--zuul/driver/github/githubsource.py3
-rw-r--r--zuul/driver/gitlab/gitlabsource.py3
-rw-r--r--zuul/driver/pagure/paguresource.py3
-rw-r--r--zuul/source/__init__.py4
6 files changed, 19 insertions, 0 deletions
diff --git a/zuul/driver/gerrit/gerritsource.py b/zuul/driver/gerrit/gerritsource.py
index 1c5449226..55a8957fb 100644
--- a/zuul/driver/gerrit/gerritsource.py
+++ b/zuul/driver/gerrit/gerritsource.py
@@ -128,6 +128,9 @@ class GerritSource(BaseSource):
def getProjectBranches(self, project, tenant, min_ltime=-1):
return self.connection.getProjectBranches(project, tenant, min_ltime)
+ def getProjectBranchCacheLtime(self):
+ return self.connection._branch_cache.ltime
+
def getGitUrl(self, project):
return self.connection.getGitUrl(project)
diff --git a/zuul/driver/git/gitsource.py b/zuul/driver/git/gitsource.py
index 5448e7fd4..3c4f88608 100644
--- a/zuul/driver/git/gitsource.py
+++ b/zuul/driver/git/gitsource.py
@@ -60,6 +60,9 @@ class GitSource(BaseSource):
def getProjectBranches(self, project, tenant, min_ltime=-1):
return self.connection.getProjectBranches(project, tenant, min_ltime)
+ def getProjectBranchCacheLtime(self):
+ return -1
+
def getGitUrl(self, project):
return self.connection.getGitUrl(project)
diff --git a/zuul/driver/github/githubsource.py b/zuul/driver/github/githubsource.py
index 5e14e66ef..8c08a8b13 100644
--- a/zuul/driver/github/githubsource.py
+++ b/zuul/driver/github/githubsource.py
@@ -114,6 +114,9 @@ class GithubSource(BaseSource):
def getProjectBranches(self, project, tenant, min_ltime=-1):
return self.connection.getProjectBranches(project, tenant, min_ltime)
+ def getProjectBranchCacheLtime(self):
+ return self.connection._branch_cache.ltime
+
def getProjectOpenChanges(self, project):
"""Get the open changes for a project."""
raise NotImplementedError()
diff --git a/zuul/driver/gitlab/gitlabsource.py b/zuul/driver/gitlab/gitlabsource.py
index f35cae44e..bda18736a 100644
--- a/zuul/driver/gitlab/gitlabsource.py
+++ b/zuul/driver/gitlab/gitlabsource.py
@@ -102,6 +102,9 @@ class GitlabSource(BaseSource):
def getProjectBranches(self, project, tenant, min_ltime=-1):
return self.connection.getProjectBranches(project, tenant, min_ltime)
+ def getProjectBranchCacheLtime(self):
+ return self.connection._branch_cache.ltime
+
def getProjectOpenChanges(self, project):
"""Get the open changes for a project."""
raise NotImplementedError()
diff --git a/zuul/driver/pagure/paguresource.py b/zuul/driver/pagure/paguresource.py
index c24edf2f3..25d7533d7 100644
--- a/zuul/driver/pagure/paguresource.py
+++ b/zuul/driver/pagure/paguresource.py
@@ -108,6 +108,9 @@ class PagureSource(BaseSource):
def getProjectBranches(self, project, tenant, min_ltime=-1):
return self.connection.getProjectBranches(project, tenant, min_ltime)
+ def getProjectBranchCacheLtime(self):
+ return self.connection._branch_cache.ltime
+
def getProjectOpenChanges(self, project):
"""Get the open changes for a project."""
raise NotImplementedError()
diff --git a/zuul/source/__init__.py b/zuul/source/__init__.py
index 3c068b46f..d3cf490a1 100644
--- a/zuul/source/__init__.py
+++ b/zuul/source/__init__.py
@@ -126,6 +126,10 @@ class BaseSource(object, metaclass=abc.ABCMeta):
"""
@abc.abstractmethod
+ def getProjectBranchCacheLtime(self):
+ """Return the current ltime of the project branch cache."""
+
+ @abc.abstractmethod
def getRequireFilters(self, config):
"""Return a list of ChangeFilters for the scheduler to match against.
"""