diff --git a/sync/options.go b/sync/options.go index 7264a3b5..6938dc34 100644 --- a/sync/options.go +++ b/sync/options.go @@ -5,10 +5,9 @@ import ( "time" ) -// Options is the functional option that is applied to the Syner instance +// Option is the functional option that is applied to the Syner instance // to configure its parameters. -// TODO(@Wondertan): rename to single Option in some breaking release -type Options func(*Parameters) +type Option func(*Parameters) // Parameters is the set of parameters that must be configured for the syncer. type Parameters struct { @@ -47,7 +46,7 @@ func (p *Parameters) Validate() error { // WithBlockTime is a functional option that configures the // `blockTime` parameter. -func WithBlockTime(duration time.Duration) Options { +func WithBlockTime(duration time.Duration) Option { return func(p *Parameters) { p.blockTime = duration } @@ -55,7 +54,7 @@ func WithBlockTime(duration time.Duration) Options { // WithRecencyThreshold is a functional option that configures the // `recencyThreshold` parameter. -func WithRecencyThreshold(threshold time.Duration) Options { +func WithRecencyThreshold(threshold time.Duration) Option { return func(p *Parameters) { p.recencyThreshold = threshold } @@ -63,14 +62,14 @@ func WithRecencyThreshold(threshold time.Duration) Options { // WithTrustingPeriod is a functional option that configures the // `TrustingPeriod` parameter. -func WithTrustingPeriod(duration time.Duration) Options { +func WithTrustingPeriod(duration time.Duration) Option { return func(p *Parameters) { p.TrustingPeriod = duration } } // WithParams is a functional option that overrides Parameters. -func WithParams(new Parameters) Options { +func WithParams(new Parameters) Option { return func(old *Parameters) { *old = new } diff --git a/sync/sync.go b/sync/sync.go index b0cfa705..9fb97f41 100644 --- a/sync/sync.go +++ b/sync/sync.go @@ -59,7 +59,7 @@ func NewSyncer[H header.Header[H]]( getter header.Getter[H], store header.Store[H], sub header.Subscriber[H], - opts ...Options, + opts ...Option, ) (*Syncer[H], error) { params := DefaultParameters() for _, opt := range opts {