diff options
author | Michael Muré <batolettre@gmail.com> | 2022-08-13 12:08:48 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-08-18 15:55:48 +0200 |
commit | 45f5f852b71a63c142bca8b05efe53eebf142594 (patch) | |
tree | cb92d9f598b13dda69fbbc652a21d0ad8dc314c2 /cache/repo_cache.go | |
parent | cd52872475f1b39f3fb6546606c1e78afb6c08e3 (diff) | |
download | git-bug-45f5f852b71a63c142bca8b05efe53eebf142594.tar.gz |
core: generalized resolvers to resolve any entity time when unmarshalling an operation
Diffstat (limited to 'cache/repo_cache.go')
-rw-r--r-- | cache/repo_cache.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go index 53948331..8af221bb 100644 --- a/cache/repo_cache.go +++ b/cache/repo_cache.go @@ -49,6 +49,9 @@ type RepoCache struct { // the name of the repository, as defined in the MultiRepoCache name string + // resolvers for all known entities + resolvers entity.Resolvers + // maximum number of loaded bugs maxLoadedBugs int @@ -84,6 +87,8 @@ func NewNamedRepoCache(r repository.ClockedRepo, name string) (*RepoCache, error identities: make(map[entity.Id]*IdentityCache), } + c.resolvers = makeResolvers(c) + err := c.lock() if err != nil { return &RepoCache{}, err @@ -168,13 +173,6 @@ func (c *RepoCache) Close() error { } func (c *RepoCache) buildCache() error { - // TODO: make that parallel - - c.muBug.Lock() - defer c.muBug.Unlock() - c.muIdentity.Lock() - defer c.muIdentity.Unlock() - _, _ = fmt.Fprintf(os.Stderr, "Building identity cache... ") c.identitiesExcerpts = make(map[entity.Id]*IdentityExcerpt) @@ -195,7 +193,7 @@ func (c *RepoCache) buildCache() error { c.bugExcerpts = make(map[entity.Id]*BugExcerpt) - allBugs := bug.ReadAllWithResolver(c.repo, newIdentityCacheResolverNoLock(c)) + allBugs := bug.ReadAllWithResolver(c.repo, c.resolvers) // wipe the index just to be sure err := c.repo.ClearBleveIndex("bug") |