Skip to content

Commit

Permalink
follow-up
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Jan 4, 2024
1 parent 931b611 commit 8cf4c57
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 18 deletions.
29 changes: 19 additions & 10 deletions cmd/cli/cli/bucket_hdlr.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@ var (
Action: mvBucketHandler,
BashComplete: manyBucketsCompletions([]cli.BashCompleteFunc{}, 0, 2),
}
bucketCmdSetProps = cli.Command{
Name: cmdSetBprops,
Usage: "update bucket properties; the command accepts both JSON-formatted input and plain Name=Value pairs, e.g.:\n" +
indent1 + "\t* ais bucket props set ais://nnn backend_bck=s3://mmm\n" +
indent1 + "\t* ais bucket props set ais://nnn backend_bck=none\n" +
indent1 + "\t* ais bucket props set gs://vvv versioning.validate_warm_get=false versioning.sync_warm_get=true\n" +
indent1 + "\t* ais bucket props set gs://vvv mirror.enabled=true mirror.copies=4 checksum.type=md5\n" +
indent1 + "\t* ais bucket props set s3://mmm ec.enabled true ec.data_slices 6 ec.parity_slices 4 --force\n" +
indent1 + "\tReferences:\n" +
indent1 + "\t* for details and many more examples, see docs/cli/bucket.md\n" +
indent1 + "\t* to show bucket properties (names and current values), use 'ais bucket show'",
ArgsUsage: bucketPropsArgument,
Flags: bucketCmdsFlags[cmdSetBprops],
Action: setPropsHandler,
BashComplete: bucketCompletions(
bcmplop{additionalCompletions: []cli.BashCompleteFunc{bpropCompletions}},
),
}

bucketCmd = cli.Command{
Name: commandBucket,
Expand Down Expand Up @@ -218,16 +236,7 @@ var (
Usage: "show, update or reset bucket properties",
Action: showBckPropsHandler,
Subcommands: []cli.Command{
{
Name: cmdSetBprops,
Usage: "update bucket properties",
ArgsUsage: bucketPropsArgument,
Flags: bucketCmdsFlags[cmdSetBprops],
Action: setPropsHandler,
BashComplete: bucketCompletions(
bcmplop{additionalCompletions: []cli.BashCompleteFunc{bpropCompletions}},
),
},
bucketCmdSetProps,
{
Name: cmdResetBprops,
Usage: "reset bucket properties",
Expand Down
14 changes: 9 additions & 5 deletions cmd/cli/cli/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,20 +474,24 @@ var (
latestVersionFlag = cli.BoolFlag{
Name: "latest",
Usage: "GET, prefetch, or copy the latest object version from the associated remote bucket;\n" +
indent1 + "\tallows operation-level control without changing bucket configuration\n" +
indent1 + "\t(see also: 'ais bucket props ... versioning.validate_warm_get')",
indent1 + "\tallows operation-level control over object version synchronization _without_ changing bucket configuration\n" +
indent1 + "\t(the latter can be done using 'ais bucket props set BUCKET versioning')",
}

averageSizeFlag = cli.BoolFlag{Name: "average-size", Usage: "show average GET, PUT, etc. request size"}

ignoreErrorFlag = cli.BoolFlag{
Name: "ignore-error",
Usage: "ignore \"soft\" failures, such as \"bucket already exists\", etc.",
Usage: "ignore \"soft\" failures such as \"bucket already exists\", etc.",
}

bucketPropsFlag = cli.StringFlag{
Name: "props",
Usage: "bucket properties, e.g. --props=\"mirror.enabled=true mirror.copies=4 checksum.type=md5\"",
Name: "props",
Usage: "create bucket with the specified (non-default) properties, e.g.:\n" +
indent1 + "\t* ais create ais://mmm --props=\"versioning.validate_warm_get=false versioning.sync_warm_get=true\"\n" +
indent1 + "\t* ais create ais://nnn --props='mirror.enabled=true mirror.copies=4 checksum.type=md5'\n" +
indent1 + "\t(tip: use '--props' to override properties that a new bucket inherits from cluster config at creation time;\n" +
indent1 + "\t see also: 'ais bucket props show' and 'ais bucket props set')",
}

forceFlag = cli.BoolFlag{Name: "force,f", Usage: "force an action"}
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

// direct
require (
github.com/NVIDIA/aistore v1.3.22-0.20240103194416-6c392663de57
github.com/NVIDIA/aistore v1.3.22-0.20240103204855-931b61196f9d
github.com/fatih/color v1.16.0
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo v1.16.5
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
code.cloudfoundry.org/bytefmt v0.0.0-20190710193110-1eb035ffe2b6/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/NVIDIA/aistore v1.3.22-0.20240103194416-6c392663de57 h1:MVioJtJDm3Jvtx/AuSIW8lxdzBMxWHBfUDfIto+M0eA=
github.com/NVIDIA/aistore v1.3.22-0.20240103194416-6c392663de57/go.mod h1:jpWmGuqxnY+akx81S5eqHhGdgSENm0mVYRrVbpCW4/I=
github.com/NVIDIA/aistore v1.3.22-0.20240103204855-931b61196f9d h1:egELPvC4dg42ASwZSe93f46e5HSBFLeFbIcyuBY/JRk=
github.com/NVIDIA/aistore v1.3.22-0.20240103204855-931b61196f9d/go.mod h1:jpWmGuqxnY+akx81S5eqHhGdgSENm0mVYRrVbpCW4/I=
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
Expand Down
2 changes: 2 additions & 0 deletions cmn/tests/iter_fields_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ var _ = Describe("IterFields", func() {

"versioning.enabled": false,
"versioning.validate_warm_get": false,
"versioning.sync_warm_get": false,

"checksum.type": cos.ChecksumXXHash,
"checksum.validate_warm_get": false,
Expand Down Expand Up @@ -134,6 +135,7 @@ var _ = Describe("IterFields", func() {

"versioning.enabled": (*bool)(nil),
"versioning.validate_warm_get": (*bool)(nil),
"versioning.sync_warm_get": (*bool)(nil),

"checksum.type": apc.String(cos.ChecksumXXHash),
"checksum.validate_warm_get": (*bool)(nil),
Expand Down

0 comments on commit 8cf4c57

Please sign in to comment.