You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add min/max time filter to blockscopy and change min duration default to 0 (#261)
* Add min/max time filter to blockscopy and change min duration default to 0
Signed-off-by: Marco Pracucci <[email protected]>
* Explain the time format for min/max time params
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Copy file name to clipboardExpand all lines: cmd/blockscopy/main.go
+31-12Lines changed: 31 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@ type config struct {
37
37
sourceBucketstring
38
38
destBucketstring
39
39
minBlockDuration time.Duration
40
+
minTime flagext.Time
41
+
maxTime flagext.Time
40
42
tenantConcurrencyint
41
43
blocksConcurrencyint
42
44
copyPeriod time.Duration
@@ -50,7 +52,9 @@ type config struct {
50
52
func (c*config) RegisterFlags(f*flag.FlagSet) {
51
53
f.StringVar(&c.sourceBucket, "source-bucket", "", "Source GCS bucket with blocks.")
52
54
f.StringVar(&c.destBucket, "destination-bucket", "", "Destination GCS bucket with blocks.")
53
-
f.DurationVar(&c.minBlockDuration, "min-block-duration", 24*time.Hour, "If non-zero, ignore blocks that cover block range smaller than this.")
55
+
f.DurationVar(&c.minBlockDuration, "min-block-duration", 0, "If non-zero, ignore blocks that cover block range smaller than this.")
56
+
f.Var(&c.minTime, "min-time", fmt.Sprintf("If set, only blocks with MinTime >= this value are copied. The supported time format is %q.", time.RFC3339))
57
+
f.Var(&c.maxTime, "max-time", fmt.Sprintf("If set, only blocks with MaxTime <= this value are copied. The supported time format is %q.", time.RFC3339))
54
58
f.IntVar(&c.tenantConcurrency, "tenant-concurrency", 5, "How many tenants to process at once.")
55
59
f.IntVar(&c.blocksConcurrency, "block-concurrency", 5, "How many blocks to copy at once per tenant.")
56
60
f.DurationVar(&c.copyPeriod, "copy-period", 0, "How often to repeat the copy. If set to 0, copy is done once, and program stops. Otherwise program keeps running and copying blocks until terminated.")
0 commit comments