-
Notifications
You must be signed in to change notification settings - Fork 179
/
sync.go
59 lines (52 loc) · 1.17 KB
/
sync.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package factories
import (
"github.com/rs/zerolog"
"github.com/onflow/flow-go/engine/collection"
syncengine "github.com/onflow/flow-go/engine/collection/synchronization"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module"
"github.com/onflow/flow-go/module/chainsync"
"github.com/onflow/flow-go/network"
"github.com/onflow/flow-go/state/cluster"
"github.com/onflow/flow-go/storage"
)
type SyncEngineFactory struct {
log zerolog.Logger
net network.EngineRegistry
me module.Local
metrics module.EngineMetrics
}
func NewSyncEngineFactory(
log zerolog.Logger,
metrics module.EngineMetrics,
net network.EngineRegistry,
me module.Local,
) (*SyncEngineFactory, error) {
factory := &SyncEngineFactory{
log: log,
me: me,
net: net,
metrics: metrics,
}
return factory, nil
}
func (f *SyncEngineFactory) Create(
participants flow.IdentityList,
state cluster.State,
blocks storage.ClusterBlocks,
core *chainsync.Core,
comp collection.Compliance,
) (*syncengine.Engine, error) {
engine, err := syncengine.New(
f.log,
f.metrics,
f.net,
f.me,
participants,
state,
blocks,
comp,
core,
)
return engine, err
}