From a97cd97789c3b7e0a42ffadc59f1da7ee9368672 Mon Sep 17 00:00:00 2001 From: Michal Niewrzal Date: Wed, 28 Sep 2022 10:56:11 +0200 Subject: [PATCH] satellite/orders: remove unused service dependency Orders service doesn't need buckets service anymore. Change-Id: I27853cda87e82b528f53667e4b4866801f7bfb62 --- cmd/tools/segment-verify/main.go | 2 +- satellite/api.go | 1 - satellite/core.go | 10 ---------- satellite/orders/service.go | 12 +----------- satellite/repairer.go | 9 --------- 5 files changed, 2 insertions(+), 32 deletions(-) diff --git a/cmd/tools/segment-verify/main.go b/cmd/tools/segment-verify/main.go index 6d19eff87..f2b9d3713 100644 --- a/cmd/tools/segment-verify/main.go +++ b/cmd/tools/segment-verify/main.go @@ -149,7 +149,7 @@ func verifySegmentsRange(cmd *cobra.Command, args []string) error { return Error.Wrap(err) } - ordersService, err := orders.NewService(log.Named("orders"), signing.SignerFromFullIdentity(identity), overlay, db.Orders(), db.Buckets(), satelliteCfg.Orders) + ordersService, err := orders.NewService(log.Named("orders"), signing.SignerFromFullIdentity(identity), overlay, db.Orders(), satelliteCfg.Orders) if err != nil { return Error.Wrap(err) } diff --git a/satellite/api.go b/satellite/api.go index df48c1023..ce7a1aa40 100644 --- a/satellite/api.go +++ b/satellite/api.go @@ -374,7 +374,6 @@ func NewAPI(log *zap.Logger, full *identity.FullIdentity, db DB, signing.SignerFromFullIdentity(peer.Identity), peer.Overlay.Service, peer.Orders.DB, - peer.Buckets.Service, config.Orders, ) if err != nil { diff --git a/satellite/core.go b/satellite/core.go index 41f359aa8..ebb82b66d 100644 --- a/satellite/core.go +++ b/satellite/core.go @@ -31,7 +31,6 @@ import ( "storj.io/storj/satellite/accounting/rolluparchive" "storj.io/storj/satellite/accounting/tally" "storj.io/storj/satellite/audit" - "storj.io/storj/satellite/buckets" "storj.io/storj/satellite/console/consoleauth" "storj.io/storj/satellite/console/emailreminders" "storj.io/storj/satellite/gracefulexit" @@ -151,10 +150,6 @@ type Core struct { Metrics struct { Chore *metrics.Chore } - - Buckets struct { - Service *buckets.Service - } } // New creates a new satellite. @@ -171,10 +166,6 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, Services: lifecycle.NewGroup(log.Named("services")), } - { // setup buckets service - peer.Buckets.Service = buckets.NewService(db.Buckets(), metabaseDB) - } - { // setup debug var err error if config.Debug.Address != "" { @@ -301,7 +292,6 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, signing.SignerFromFullIdentity(peer.Identity), peer.Overlay.Service, peer.Orders.DB, - peer.Buckets.Service, config.Orders, ) if err != nil { diff --git a/satellite/orders/service.go b/satellite/orders/service.go index b077ba89d..55e5bc738 100644 --- a/satellite/orders/service.go +++ b/satellite/orders/service.go @@ -16,7 +16,6 @@ import ( "storj.io/common/pb" "storj.io/common/signing" "storj.io/common/storj" - "storj.io/common/uuid" "storj.io/storj/satellite/internalpb" "storj.io/storj/satellite/metabase" "storj.io/storj/satellite/overlay" @@ -40,12 +39,6 @@ type Config struct { OrdersSemaphoreSize int `help:"how many concurrent orders to process at once. zero is unlimited" default:"2"` } -// BucketsDB returns information about buckets. -type BucketsDB interface { - // GetBucketID returns an existing bucket id. - GetBucketID(ctx context.Context, bucket metabase.BucketLocation) (id uuid.UUID, err error) -} - // Service for creating order limits. // // architecture: Service @@ -54,7 +47,6 @@ type Service struct { satellite signing.Signer overlay *overlay.Service orders DB - buckets BucketsDB encryptionKeys EncryptionKeys @@ -67,8 +59,7 @@ type Service struct { // NewService creates new service for creating order limits. func NewService( log *zap.Logger, satellite signing.Signer, overlay *overlay.Service, - orders DB, buckets BucketsDB, - config Config, + orders DB, config Config, ) (*Service, error) { if config.EncryptionKeys.Default.IsZero() { return nil, Error.New("encryption keys must be specified to include encrypted metadata") @@ -79,7 +70,6 @@ func NewService( satellite: satellite, overlay: overlay, orders: orders, - buckets: buckets, encryptionKeys: config.EncryptionKeys, diff --git a/satellite/repairer.go b/satellite/repairer.go index 1a93f1475..b88e620b8 100644 --- a/satellite/repairer.go +++ b/satellite/repairer.go @@ -71,10 +71,6 @@ type Repairer struct { EcRepairer *repairer.ECRepairer SegmentRepairer *repairer.SegmentRepairer Repairer *repairer.Service - - Buckets struct { - Service *buckets.Service - } } // NewRepairer creates a new repairer peer. @@ -177,10 +173,6 @@ func NewRepairer(log *zap.Logger, full *identity.FullIdentity, }) } - { // setup buckets service - peer.Buckets.Service = buckets.NewService(bucketsDB, metabaseDB) - } - { // setup orders peer.Orders.DB = rollupsWriteCache peer.Orders.Chore = orders.NewChore(log.Named("orders:chore"), rollupsWriteCache, config.Orders) @@ -198,7 +190,6 @@ func NewRepairer(log *zap.Logger, full *identity.FullIdentity, signing.SignerFromFullIdentity(peer.Identity), peer.Overlay, peer.Orders.DB, - peer.Buckets.Service, config.Orders, ) if err != nil {