diff --git a/service/r2/service.go b/service/r2/service.go index 0e681b5..877cad2 100644 --- a/service/r2/service.go +++ b/service/r2/service.go @@ -25,12 +25,10 @@ import ( "errors" "fmt" "net/http" - "time" "github.com/m3db/m3ctl/auth" mservice "github.com/m3db/m3ctl/service" "github.com/m3db/m3ctl/service/r2/store" - "github.com/m3db/m3metrics/rules" "github.com/m3db/m3x/clock" "github.com/m3db/m3x/instrument" "github.com/m3db/m3x/log" @@ -134,13 +132,12 @@ func registerRoute(router *mux.Router, path, method string, h r2Handler, hf r2Ha // service handles all of the endpoints for r2. type service struct { - rootPrefix string - store store.Store - authService auth.HTTPAuthService - logger log.Logger - nowFn clock.NowFn - metrics serviceMetrics - updateHelper rules.RuleSetUpdateHelper + rootPrefix string + store store.Store + authService auth.HTTPAuthService + logger log.Logger + nowFn clock.NowFn + metrics serviceMetrics } // NewService creates a new r2 service using a given store. @@ -150,16 +147,14 @@ func NewService( store store.Store, iOpts instrument.Options, clockOpts clock.Options, - rulePropagationDelay time.Duration, ) mservice.Service { return &service{ - rootPrefix: rootPrefix, - store: store, - authService: authService, - logger: iOpts.Logger(), - nowFn: clockOpts.NowFn(), - metrics: newServiceMetrics(iOpts.MetricsScope(), iOpts.MetricsSamplingRate()), - updateHelper: rules.NewRuleSetUpdateHelper(rulePropagationDelay), + rootPrefix: rootPrefix, + store: store, + authService: authService, + logger: iOpts.Logger(), + nowFn: clockOpts.NowFn(), + metrics: newServiceMetrics(iOpts.MetricsScope(), iOpts.MetricsSamplingRate()), } } diff --git a/service/r2/store/stub/store.go b/service/r2/store/stub/store.go index 783580c..09c5ddb 100644 --- a/service/r2/store/stub/store.go +++ b/service/r2/store/stub/store.go @@ -25,6 +25,8 @@ import ( "fmt" "time" + "github.com/pborman/uuid" + "github.com/m3db/m3ctl/service/r2" r2store "github.com/m3db/m3ctl/service/r2/store" "github.com/m3db/m3metrics/policy" @@ -32,7 +34,6 @@ import ( "github.com/m3db/m3metrics/rules/models" "github.com/m3db/m3metrics/rules/models/changes" "github.com/m3db/m3x/instrument" - "github.com/pborman/uuid" ) type mappingRuleHistories map[string][]*models.MappingRuleView diff --git a/services/r2ctl/config/r2ctl.go b/services/r2ctl/config/r2ctl.go index 18500cf..6df44ff 100644 --- a/services/r2ctl/config/r2ctl.go +++ b/services/r2ctl/config/r2ctl.go @@ -53,14 +53,14 @@ type Configuration struct { Metrics instrument.MetricsConfiguration `yaml:"metrics"` // Store configuration. - Store R2StoreConfiguration `yaml:"store"` + Store r2StoreConfiguration `yaml:"store"` // Simple Auth Config. Auth *auth.SimpleAuthConfig `yaml:"auth"` } -// R2StoreConfiguration has all the fields necessary for an R2 store. -type R2StoreConfiguration struct { +// r2StoreConfiguration has all the fields necessary for an R2 store. +type r2StoreConfiguration struct { // Stub means use the stub store. Stub bool `yaml:"stub"` @@ -69,7 +69,7 @@ type R2StoreConfiguration struct { } // NewR2Store creates a new R2 store. -func (c R2StoreConfiguration) NewR2Store(instrumentOpts instrument.Options) (r2store.Store, error) { +func (c r2StoreConfiguration) NewR2Store(instrumentOpts instrument.Options) (r2store.Store, error) { if c.Stub { return stub.NewStore(instrumentOpts), nil } diff --git a/services/r2ctl/main/main.go b/services/r2ctl/main/main.go index 3524980..c58182f 100644 --- a/services/r2ctl/main/main.go +++ b/services/r2ctl/main/main.go @@ -43,7 +43,6 @@ const ( portEnvVar = "R2CTL_PORT" r2apiPrefix = "/r2/v1/" gracefulShutdownTimeout = 15 * time.Second - defaultPropagationDelay = time.Minute ) func main() { @@ -109,20 +108,12 @@ func main() { "service-name": "r2", }) r2ServiceInstrumentOpts := instrumentOpts.SetMetricsScope(r2ServiceScope) - var propagationDelay time.Duration - if cfg.Store.KV != nil { - propagationDelay = cfg.Store.KV.PropagationDelay - } else { - propagationDelay = defaultPropagationDelay - } - r2Service := r2.NewService( r2apiPrefix, authService, store, r2ServiceInstrumentOpts, clock.NewOptions(), - propagationDelay, ) // Create health service.