diff --git a/cmd/satellite/repair_segment.go b/cmd/satellite/repair_segment.go index 0f9910396..0691d165f 100644 --- a/cmd/satellite/repair_segment.go +++ b/cmd/satellite/repair_segment.go @@ -94,8 +94,7 @@ func cmdRepairSegment(cmd *cobra.Command, args []string) (err error) { dialer := rpc.NewDefaultDialer(tlsOptions) - // mail service is nil - overlay, err := overlay.NewService(log.Named("overlay"), db.OverlayCache(), db.NodeEvents(), nil, config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) + overlay, err := overlay.NewService(log.Named("overlay"), db.OverlayCache(), db.NodeEvents(), config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) if err != nil { return err } diff --git a/cmd/tools/segment-verify/main.go b/cmd/tools/segment-verify/main.go index 934680f05..431b79443 100644 --- a/cmd/tools/segment-verify/main.go +++ b/cmd/tools/segment-verify/main.go @@ -203,7 +203,7 @@ func verifySegments(cmd *cobra.Command, args []string) error { dialer := rpc.NewDefaultDialer(tlsOptions) // setup dependencies for verification - overlay, err := overlay.NewService(log.Named("overlay"), db.OverlayCache(), db.NodeEvents(), nil, "", "", satelliteCfg.Overlay) + overlay, err := overlay.NewService(log.Named("overlay"), db.OverlayCache(), db.NodeEvents(), "", "", satelliteCfg.Overlay) if err != nil { return Error.Wrap(err) } diff --git a/satellite/api.go b/satellite/api.go index d91634e20..0d19f8b83 100644 --- a/satellite/api.go +++ b/satellite/api.go @@ -289,7 +289,7 @@ func NewAPI(log *zap.Logger, full *identity.FullIdentity, db DB, { // setup overlay peer.Overlay.DB = peer.DB.OverlayCache() - peer.Overlay.Service, err = overlay.NewService(peer.Log.Named("overlay"), peer.Overlay.DB, peer.DB.NodeEvents(), peer.Mail.Service, config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) + peer.Overlay.Service, err = overlay.NewService(peer.Log.Named("overlay"), peer.Overlay.DB, peer.DB.NodeEvents(), config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) if err != nil { return nil, errs.Combine(err, peer.Close()) } diff --git a/satellite/auditor.go b/satellite/auditor.go index 69ecbe551..49e976ab5 100644 --- a/satellite/auditor.go +++ b/satellite/auditor.go @@ -142,22 +142,9 @@ func NewAuditor(log *zap.Logger, full *identity.FullIdentity, peer.Dialer = rpc.NewDefaultDialer(tlsOptions) } - { // setup mail - var err error - peer.Mail, err = setupMailService(peer.Log, *config) - if err != nil { - return nil, errs.Combine(err, peer.Close()) - } - - peer.Services.Add(lifecycle.Item{ - Name: "mail:service", - Close: peer.Mail.Close, - }) - } - { // setup overlay var err error - peer.Overlay, err = overlay.NewService(log.Named("overlay"), overlayCache, nodeEvents, peer.Mail, config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) + peer.Overlay, err = overlay.NewService(log.Named("overlay"), overlayCache, nodeEvents, config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) if err != nil { return nil, errs.Combine(err, peer.Close()) } diff --git a/satellite/core.go b/satellite/core.go index 8896c0be3..5217114b3 100644 --- a/satellite/core.go +++ b/satellite/core.go @@ -263,7 +263,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, { // setup overlay peer.Overlay.DB = peer.DB.OverlayCache() - peer.Overlay.Service, err = overlay.NewService(peer.Log.Named("overlay"), peer.Overlay.DB, peer.DB.NodeEvents(), peer.Mail.Service, config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) + peer.Overlay.Service, err = overlay.NewService(peer.Log.Named("overlay"), peer.Overlay.DB, peer.DB.NodeEvents(), config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) if err != nil { return nil, errs.Combine(err, peer.Close()) } diff --git a/satellite/overlay/benchmark_test.go b/satellite/overlay/benchmark_test.go index 5bc6ca029..f5c929cd4 100644 --- a/satellite/overlay/benchmark_test.go +++ b/satellite/overlay/benchmark_test.go @@ -357,7 +357,7 @@ func BenchmarkNodeSelection(b *testing.B) { } }) - service, err := overlay.NewService(zap.NewNop(), overlaydb, db.NodeEvents(), nil, "", "", overlay.Config{ + service, err := overlay.NewService(zap.NewNop(), overlaydb, db.NodeEvents(), "", "", overlay.Config{ Node: nodeSelectionConfig, NodeSelectionCache: overlay.UploadSelectionCacheConfig{ Staleness: time.Hour, diff --git a/satellite/overlay/service.go b/satellite/overlay/service.go index 6eb47acbf..194c5e46a 100644 --- a/satellite/overlay/service.go +++ b/satellite/overlay/service.go @@ -18,7 +18,6 @@ import ( "storj.io/common/sync2" "storj.io/private/version" "storj.io/storj/satellite/geoip" - "storj.io/storj/satellite/mailservice" "storj.io/storj/satellite/metabase" "storj.io/storj/satellite/nodeevents" ) @@ -310,7 +309,6 @@ type Service struct { log *zap.Logger db DB nodeEvents nodeevents.DB - mail *mailservice.Service satelliteName string satelliteAddress string config Config @@ -325,7 +323,7 @@ type Service struct { type LastNetFunc func(config NodeSelectionConfig, ip net.IP, port string) (string, error) // NewService returns a new Service. -func NewService(log *zap.Logger, db DB, nodeEvents nodeevents.DB, mailService *mailservice.Service, satelliteAddr, satelliteName string, config Config) (*Service, error) { +func NewService(log *zap.Logger, db DB, nodeEvents nodeevents.DB, satelliteAddr, satelliteName string, config Config) (*Service, error) { err := config.Node.AsOfSystemTime.isValid() if err != nil { return nil, errs.Wrap(err) @@ -358,7 +356,6 @@ func NewService(log *zap.Logger, db DB, nodeEvents nodeevents.DB, mailService *m log: log, db: db, nodeEvents: nodeEvents, - mail: mailService, satelliteAddress: satelliteAddr, satelliteName: satelliteName, config: config, diff --git a/satellite/overlay/service_test.go b/satellite/overlay/service_test.go index 34c042181..e68a52200 100644 --- a/satellite/overlay/service_test.go +++ b/satellite/overlay/service_test.go @@ -73,7 +73,7 @@ func testCache(ctx *testcontext.Context, t *testing.T, store overlay.DB, nodeEve serviceCtx, serviceCancel := context.WithCancel(ctx) defer serviceCancel() - service, err := overlay.NewService(zaptest.NewLogger(t), store, nodeEvents, nil, "", "", serviceConfig) + service, err := overlay.NewService(zaptest.NewLogger(t), store, nodeEvents, "", "", serviceConfig) require.NoError(t, err) ctx.Go(func() error { return service.Run(serviceCtx) }) defer ctx.Check(service.Close) diff --git a/satellite/rangedloop.go b/satellite/rangedloop.go index 32c319ab6..cc2dc53aa 100644 --- a/satellite/rangedloop.go +++ b/satellite/rangedloop.go @@ -20,7 +20,6 @@ import ( "storj.io/storj/satellite/audit" "storj.io/storj/satellite/gc/bloomfilter" "storj.io/storj/satellite/gracefulexit" - "storj.io/storj/satellite/mailservice" "storj.io/storj/satellite/metabase" "storj.io/storj/satellite/metabase/rangedloop" "storj.io/storj/satellite/metrics" @@ -51,10 +50,6 @@ type RangedLoop struct { Observer rangedloop.Observer } - Mail struct { - Service *mailservice.Service - } - Overlay struct { Service *overlay.Service } @@ -132,20 +127,8 @@ func NewRangedLoop(log *zap.Logger, db DB, metabaseDB *metabase.DB, config *Conf db.StoragenodeAccounting()) } - { // setup mail service - peer.Mail.Service, err = setupMailService(peer.Log, *config) - if err != nil { - return nil, errs.Combine(err, peer.Close()) - } - - peer.Services.Add(lifecycle.Item{ - Name: "mail:service", - Close: peer.Mail.Service.Close, - }) - } - { // setup overlay - peer.Overlay.Service, err = overlay.NewService(peer.Log.Named("overlay"), peer.DB.OverlayCache(), peer.DB.NodeEvents(), peer.Mail.Service, config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) + peer.Overlay.Service, err = overlay.NewService(peer.Log.Named("overlay"), peer.DB.OverlayCache(), peer.DB.NodeEvents(), config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) if err != nil { return nil, errs.Combine(err, peer.Close()) } diff --git a/satellite/repair/checker/online_test.go b/satellite/repair/checker/online_test.go index f92ba9ca8..eb57e8967 100644 --- a/satellite/repair/checker/online_test.go +++ b/satellite/repair/checker/online_test.go @@ -24,7 +24,7 @@ func TestReliabilityCache_Concurrent(t *testing.T) { ctx := testcontext.New(t) defer ctx.Cleanup() - overlayCache, err := overlay.NewService(zap.NewNop(), fakeOverlayDB{}, fakeNodeEvents{}, nil, "", "", overlay.Config{ + overlayCache, err := overlay.NewService(zap.NewNop(), fakeOverlayDB{}, fakeNodeEvents{}, "", "", overlay.Config{ NodeSelectionCache: overlay.UploadSelectionCacheConfig{ Staleness: 2 * time.Nanosecond, }, diff --git a/satellite/repairer.go b/satellite/repairer.go index 7bdec9d7e..32d0cefa2 100644 --- a/satellite/repairer.go +++ b/satellite/repairer.go @@ -26,7 +26,6 @@ import ( version_checker "storj.io/storj/private/version/checker" "storj.io/storj/satellite/audit" "storj.io/storj/satellite/buckets" - "storj.io/storj/satellite/mailservice" "storj.io/storj/satellite/metabase" "storj.io/storj/satellite/nodeevents" "storj.io/storj/satellite/orders" @@ -58,7 +57,6 @@ type Repairer struct { Server *debug.Server } - Mail *mailservice.Service Overlay *overlay.Service Reputation *reputation.Service Orders struct { @@ -143,22 +141,9 @@ func NewRepairer(log *zap.Logger, full *identity.FullIdentity, peer.Dialer = rpc.NewDefaultDialer(tlsOptions) } - { // setup mail - var err error - peer.Mail, err = setupMailService(peer.Log, *config) - if err != nil { - return nil, errs.Combine(err, peer.Close()) - } - - peer.Services.Add(lifecycle.Item{ - Name: "mail:service", - Close: peer.Mail.Close, - }) - } - { // setup overlay var err error - peer.Overlay, err = overlay.NewService(log.Named("overlay"), overlayCache, nodeEvents, peer.Mail, config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) + peer.Overlay, err = overlay.NewService(log.Named("overlay"), overlayCache, nodeEvents, config.Console.ExternalAddress, config.Console.SatelliteName, config.Overlay) if err != nil { return nil, errs.Combine(err, peer.Close()) }