github.com/amazechain/amc@v0.1.3/internal/sync/options.go (about) 1 package sync 2 3 import ( 4 "github.com/amazechain/amc/common" 5 "github.com/amazechain/amc/internal/p2p" 6 ) 7 8 type Option func(s *Service) error 9 10 func WithP2P(p2p p2p.P2P) Option { 11 return func(s *Service) error { 12 s.cfg.p2p = p2p 13 return nil 14 } 15 } 16 17 func WithChainService(chain common.IBlockChain) Option { 18 return func(s *Service) error { 19 s.cfg.chain = chain 20 return nil 21 } 22 } 23 24 func WithInitialSync(initialSync Checker) Option { 25 return func(s *Service) error { 26 s.cfg.initialSync = initialSync 27 return nil 28 } 29 }