aboutsummaryrefslogtreecommitdiffstats
path: root/entity/dag/clock.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-08-13 12:08:48 +0200
committerMichael Muré <batolettre@gmail.com>2022-08-18 15:55:48 +0200
commit45f5f852b71a63c142bca8b05efe53eebf142594 (patch)
treecb92d9f598b13dda69fbbc652a21d0ad8dc314c2 /entity/dag/clock.go
parentcd52872475f1b39f3fb6546606c1e78afb6c08e3 (diff)
downloadgit-bug-45f5f852b71a63c142bca8b05efe53eebf142594.tar.gz
core: generalized resolvers to resolve any entity time when unmarshalling an operation
Diffstat (limited to 'entity/dag/clock.go')
-rw-r--r--entity/dag/clock.go21
1 files changed, 7 insertions, 14 deletions
diff --git a/entity/dag/clock.go b/entity/dag/clock.go
index 793fa1bf..74a6cd73 100644
--- a/entity/dag/clock.go
+++ b/entity/dag/clock.go
@@ -3,7 +3,8 @@ package dag
import (
"fmt"
- "github.com/MichaelMure/git-bug/identity"
+ "golang.org/x/sync/errgroup"
+
"github.com/MichaelMure/git-bug/repository"
)
@@ -18,21 +19,13 @@ func ClockLoader(defs ...Definition) repository.ClockLoader {
return repository.ClockLoader{
Clocks: clocks,
Witnesser: func(repo repository.ClockedRepo) error {
- // we need to actually load the identities because of the commit signature check when reading,
- // which require the full identities with crypto keys
- resolver := identity.NewCachedResolver(identity.NewSimpleResolver(repo))
-
+ var errG errgroup.Group
for _, def := range defs {
- // we actually just need to read all entities,
- // as that will create and update the clocks
- // TODO: concurrent loading to be faster?
- for b := range ReadAll(def, repo, resolver) {
- if b.Err != nil {
- return b.Err
- }
- }
+ errG.Go(func() error {
+ return ReadAllClocksNoCheck(def, repo)
+ })
}
- return nil
+ return errG.Wait()
},
}
}