Add support to batch-expire jobs (#4677)
This commit is contained in:
@@ -140,6 +140,11 @@ var traceCallTypes = map[string]func(o *madmin.ServiceTraceOpts) (help string){
|
||||
o.BatchKeyRotation = true
|
||||
return "Trace Batch KeyRotation (alias: brot)"
|
||||
},
|
||||
"batch-expiration": func(o *madmin.ServiceTraceOpts) string {
|
||||
o.BatchExpire = true
|
||||
return "Trace Batch Expiration (alias: bexp)"
|
||||
},
|
||||
|
||||
"decommission": func(o *madmin.ServiceTraceOpts) string {
|
||||
o.Decommission = true
|
||||
return "Trace Decommission operations (alias: decom)"
|
||||
|
||||
@@ -80,10 +80,14 @@ func mainBatchGenerate(ctx *cli.Context) error {
|
||||
adminClient, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize admin connection.")
|
||||
|
||||
switch jobType {
|
||||
case string(madmin.BatchJobReplicate):
|
||||
case string(madmin.BatchJobKeyRotate):
|
||||
default:
|
||||
var found bool
|
||||
for _, job := range madmin.SupportedJobTypes {
|
||||
if jobType == string(job) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
fatalIf(errInvalidArgument().Trace(jobType), "Unable to generate a job template for the specified job type")
|
||||
}
|
||||
|
||||
|
||||
@@ -229,6 +229,17 @@ func (m *batchJobMetricsUI) View() string {
|
||||
addLine("Transferred: ", humanize.IBytes(uint64(m.current.Replicate.BytesTransferred)))
|
||||
addLine("Elapsed: ", accElapsedTime.String())
|
||||
addLine("CurrObjName: ", m.current.Replicate.Object)
|
||||
case string(madmin.BatchJobExpire):
|
||||
addLine("JobType: ", m.current.JobType)
|
||||
addLine("Objects: ", m.current.Expired.Objects)
|
||||
addLine("FailedObjects: ", m.current.Expired.ObjectsFailed)
|
||||
addLine("CurrObjName: ", m.current.Expired.Object)
|
||||
|
||||
if !m.current.LastUpdate.IsZero() {
|
||||
accElapsedTime := m.current.LastUpdate.Sub(m.current.StartTime)
|
||||
addLine("Elapsed: ", accElapsedTime.String())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
table.AppendBulk(data)
|
||||
|
||||
Reference in New Issue
Block a user