aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cache/cache.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/cache/cache.go b/cache/cache.go
index a46922be..7c5a80ce 100644
--- a/cache/cache.go
+++ b/cache/cache.go
@@ -11,8 +11,13 @@ import (
type Cache interface {
RegisterRepository(ref string, repo repository.Repo)
RegisterDefaultRepository(repo repository.Repo)
+
ResolveRepo(ref string) (CachedRepo, error)
DefaultRepo() (CachedRepo, error)
+
+ // Shortcut to resolve on the default repo for convenience
+ DefaultResolveBug(id string) (CachedBug, error)
+ DefaultResolveBugPrefix(prefix string) (CachedBug, error)
}
type CachedRepo interface {
@@ -66,6 +71,26 @@ func (c *DefaultCache) ResolveRepo(ref string) (CachedRepo, error) {
return r, nil
}
+func (c *DefaultCache) DefaultResolveBug(id string) (CachedBug, error) {
+ repo, err := c.DefaultRepo()
+
+ if err != nil {
+ return nil, err
+ }
+
+ return repo.ResolveBug(id)
+}
+
+func (c *DefaultCache) DefaultResolveBugPrefix(prefix string) (CachedBug, error) {
+ repo, err := c.DefaultRepo()
+
+ if err != nil {
+ return nil, err
+ }
+
+ return repo.ResolveBugPrefix(prefix)
+}
+
// Repo ------------------------
type CachedRepoImpl struct {