satellite/metainfo: Add Delete Service config

Change-Id: I0a6e3ce1adfe1488eb23da9dda92877af1834599
This commit is contained in:
Rafael Gomes 2020-07-09 12:32:35 -03:00 committed by Yingrong Zhao
parent 50ac53f764
commit 935f44ddb7
4 changed files with 32 additions and 12 deletions

View File

@ -51,6 +51,7 @@ import (
"storj.io/storj/satellite/marketingweb"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/satellite/metainfo/expireddeletion"
"storj.io/storj/satellite/metainfo/objectdeletion"
"storj.io/storj/satellite/metainfo/piecedeletion"
"storj.io/storj/satellite/metrics"
"storj.io/storj/satellite/nodestats"
@ -460,6 +461,10 @@ func (planet *Planet) newSatellites(count int, satelliteDatabases satellitedbtes
RequestTimeout: 2 * time.Second,
FailThreshold: 2 * time.Second,
},
ObjectDeletion: objectdeletion.Config{
MaxObjectsPerRequest: 100,
ZombieSegmentsPerRequest: 3,
},
},
Orders: orders.Config{
Expiration: 7 * 24 * time.Hour,

View File

@ -11,6 +11,7 @@ import (
"storj.io/common/memory"
"storj.io/storj/private/dbutil"
"storj.io/storj/satellite/metainfo/objectdeletion"
"storj.io/storj/satellite/metainfo/piecedeletion"
"storj.io/storj/storage"
"storj.io/storj/storage/cockroachkv"
@ -55,18 +56,19 @@ type ProjectLimitConfig struct {
// Config is a configuration struct that is everything you need to start a metainfo.
type Config struct {
DatabaseURL string `help:"the database connection string to use" default:"postgres://"`
MinRemoteSegmentSize memory.Size `default:"1240" help:"minimum remote segment size"`
MaxInlineSegmentSize memory.Size `default:"4KiB" help:"maximum inline segment size"`
MaxSegmentSize memory.Size `default:"64MiB" help:"maximum segment size"`
MaxMetadataSize memory.Size `default:"2KiB" help:"maximum segment metadata size"`
MaxCommitInterval time.Duration `default:"48h" help:"maximum time allowed to pass between creating and committing a segment"`
Overlay bool `default:"true" help:"toggle flag if overlay is enabled"`
RS RSConfig `help:"redundancy scheme configuration"`
Loop LoopConfig `help:"loop configuration"`
RateLimiter RateLimiterConfig `help:"rate limiter configuration"`
ProjectLimits ProjectLimitConfig `help:"project limit configuration"`
PieceDeletion piecedeletion.Config `help:"piece deletion configuration"`
DatabaseURL string `help:"the database connection string to use" default:"postgres://"`
MinRemoteSegmentSize memory.Size `default:"1240" help:"minimum remote segment size"`
MaxInlineSegmentSize memory.Size `default:"4KiB" help:"maximum inline segment size"`
MaxSegmentSize memory.Size `default:"64MiB" help:"maximum segment size"`
MaxMetadataSize memory.Size `default:"2KiB" help:"maximum segment metadata size"`
MaxCommitInterval time.Duration `default:"48h" help:"maximum time allowed to pass between creating and committing a segment"`
Overlay bool `default:"true" help:"toggle flag if overlay is enabled"`
RS RSConfig `help:"redundancy scheme configuration"`
Loop LoopConfig `help:"loop configuration"`
RateLimiter RateLimiterConfig `help:"rate limiter configuration"`
ProjectLimits ProjectLimitConfig `help:"project limit configuration"`
PieceDeletion piecedeletion.Config `help:"piece deletion configuration"`
ObjectDeletion objectdeletion.Config `help:"object deletion configuration"`
}
// PointerDB stores pointers.

View File

@ -29,6 +29,7 @@ import (
"storj.io/storj/satellite/accounting"
"storj.io/storj/satellite/attribution"
"storj.io/storj/satellite/console"
"storj.io/storj/satellite/metainfo/objectdeletion"
"storj.io/storj/satellite/metainfo/piecedeletion"
"storj.io/storj/satellite/metainfo/pointerverification"
"storj.io/storj/satellite/orders"
@ -69,6 +70,7 @@ type Endpoint struct {
log *zap.Logger
metainfo *Service
deletePieces *piecedeletion.Service
deleteObjects *objectdeletion.Service
orders *orders.Service
overlay *overlay.Service
attributions attribution.DB
@ -100,10 +102,15 @@ func NewEndpoint(log *zap.Logger, metainfo *Service, deletePieces *piecedeletion
if err != nil {
return nil, err
}
objectDeletion, err := objectdeletion.NewService(log, metainfo, config.ObjectDeletion)
if err != nil {
return nil, err
}
return &Endpoint{
log: log,
metainfo: metainfo,
deletePieces: deletePieces,
deleteObjects: objectDeletion,
orders: orders,
overlay: cache,
attributions: attributions,

View File

@ -340,6 +340,12 @@ identity.key-path: /root/.local/share/storj/identity/satellite/identity.key
# minimum remote segment size
# metainfo.min-remote-segment-size: 1.2 KiB
# maximum number of requests per batch
# metainfo.object-deletion.max-objects-per-request: 100
# number of segments per request when looking for zombie segments
# metainfo.object-deletion.zombie-segments-per-request: 3
# toggle flag if overlay is enabled
# metainfo.overlay: true