Skip to content

Commit

Permalink
Avoid re-parsing config history elements
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Dec 5, 2019
1 parent f3b2d54 commit 9dfb284
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions cmd/admin-config-history.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/console"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio/pkg/madmin"
)

var historyListFlags = []cli.Flag{
Expand Down Expand Up @@ -74,9 +73,9 @@ Date: {{.CreateTime}}
var HistoryTemplate = template.Must(template.New("history-list").Funcs(funcMap).Parse(History))

type historyEntry struct {
RestoreID string `json:"restoreId"`
CreateTime string `json:"createTime"`
Targets madmin.Targets `json:"targets"`
RestoreID string `json:"restoreId"`
CreateTime string `json:"createTime"`
Targets string `json:"targets"`
}

// configHistoryMessage container to hold locks information.
Expand Down Expand Up @@ -144,8 +143,7 @@ func mainAdminConfigHistory(ctx *cli.Context) error {
RestoreID: chEntry.RestoreID,
CreateTime: chEntry.CreateTimeFormatted(),
}
hentries[i].Targets, e = madmin.ParseSubSysTarget([]byte(chEntry.Data))
fatalIf(probe.NewError(e), "Unable to parse invalid history entry.")
hentries[i].Targets = chEntry.Data
}

// Print
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/mattn/go-isatty v0.0.7
github.com/mattn/go-runewidth v0.0.5 // indirect
github.com/minio/cli v1.22.0
github.com/minio/minio v0.0.0-20191204233237-c9940d8c3f1f
github.com/minio/minio v0.0.0-20191205124742-d8e3de0cae46
github.com/minio/minio-go/v6 v6.0.43
github.com/minio/sha256-simd v0.1.1
github.com/mitchellh/go-homedir v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ github.com/minio/minio v0.0.0-20190510004154-ac3b59645e92/go.mod h1:yFbQSwuA61mB
github.com/minio/minio v0.0.0-20190903181048-8a71b0ec5a72/go.mod h1:H8OUaOxwJIALXHlfMpk2ESvk81dW+F7tSnrZi7rln/k=
github.com/minio/minio v0.0.0-20190927193314-1c5b05c130fa/go.mod h1:47wx8w7yKTFAPw/hbmYPL4prsPivh6QuUqjTykftGgg=
github.com/minio/minio v0.0.0-20191001201215-ff5bf519522f/go.mod h1:+vpJpzImdz4NCQto3r6/vF/24jWeEs5i3lsDfRmEcl4=
github.com/minio/minio v0.0.0-20191204233237-c9940d8c3f1f h1:0Gm4h5JyOTpOfA8RRWdmE5ZGwCVp/TynsCdSt1BF1Mc=
github.com/minio/minio v0.0.0-20191204233237-c9940d8c3f1f/go.mod h1:3bY3lz9Uby83qOp5RsnPu4JJwiskVK088E7F4CRSdxI=
github.com/minio/minio v0.0.0-20191205124742-d8e3de0cae46 h1:6Oyny/iVD88fCrp3g4WbBjQJRdnzPZZO8aYI8tdONkY=
github.com/minio/minio v0.0.0-20191205124742-d8e3de0cae46/go.mod h1:3bY3lz9Uby83qOp5RsnPu4JJwiskVK088E7F4CRSdxI=
github.com/minio/minio-go v0.0.0-20190227180923-59af836a7e6d h1:gptD0/Hnam7h4Iq9D/33fscRpHfzOOUqUbH2nPw9HcU=
github.com/minio/minio-go v0.0.0-20190227180923-59af836a7e6d/go.mod h1:/haSOWG8hQNx2+JOfLJ9GKp61EAmgPwRVw/Sac0NzaM=
github.com/minio/minio-go v0.0.0-20190313212832-5d20267d970d/go.mod h1:/haSOWG8hQNx2+JOfLJ9GKp61EAmgPwRVw/Sac0NzaM=
Expand Down

0 comments on commit 9dfb284

Please sign in to comment.