From b8f088b3a1bb267f3fa39cdcea9df2fc4dfa837a Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Tue, 26 Sep 2023 17:41:01 +0400 Subject: [PATCH] neofs-lens: rename `inspect` commands to `get` In neofs-lens, we have renamed the `inspect` commands to `get` to better reflect their functionality. All of these commands now return an object, which aligns with the `get` convention and makes their purpose more intuitive and understandable. Closes: #2548. Signed-off-by: Ekaterina Pavlova --- CHANGELOG.md | 1 + .../internal/blobovnicza/inspect.go | 23 +++++++++++++++---- cmd/neofs-lens/internal/blobovnicza/root.go | 2 +- cmd/neofs-lens/internal/meta/inspect.go | 19 +++++++++++---- cmd/neofs-lens/internal/meta/root.go | 1 + cmd/neofs-lens/internal/peapod/inspect.go | 23 +++++++++++++++---- cmd/neofs-lens/internal/peapod/root.go | 2 +- cmd/neofs-lens/internal/storage/inspect.go | 20 +++++++++++++--- cmd/neofs-lens/internal/storage/root.go | 2 +- cmd/neofs-lens/internal/writecache/inspect.go | 21 +++++++++++++---- cmd/neofs-lens/internal/writecache/root.go | 2 +- 11 files changed, 91 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c24a74adb2..b5eedecf03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Changelog for NeoFS Node ### Updated - Update minimal supported Go version up to v1.19 (#2485) - Update `neo-go` to `v0.102.0` (#2221, #2309, #2596) +- `neofs-lens` `inspect` object commands to `get` with `inspect` deprecation (#2548) ### Updating from v0.38.1 diff --git a/cmd/neofs-lens/internal/blobovnicza/inspect.go b/cmd/neofs-lens/internal/blobovnicza/inspect.go index c637b0f2a7..b9dbab8044 100644 --- a/cmd/neofs-lens/internal/blobovnicza/inspect.go +++ b/cmd/neofs-lens/internal/blobovnicza/inspect.go @@ -9,10 +9,18 @@ import ( ) var inspectCMD = &cobra.Command{ - Use: "inspect", - Short: "Object inspection", - Long: `Inspect specific object in a blobovnicza.`, - Run: inspectFunc, + Use: "inspect", + Short: "Object inspection", + Long: `Inspect specific object in a blobovnicza.`, + Deprecated: "will be removed in the next release. Use `get` instead.", + Run: getFunc, +} + +var getCMD = &cobra.Command{ + Use: "get", + Short: "Get object", + Long: `Get specific object from a blobovnicza.`, + Run: getFunc, } func init() { @@ -20,9 +28,14 @@ func init() { common.AddComponentPathFlag(inspectCMD, &vPath) common.AddOutputFileFlag(inspectCMD, &vOut) common.AddPayloadOnlyFlag(inspectCMD, &vPayloadOnly) + + common.AddAddressFlag(getCMD, &vAddress) + common.AddComponentPathFlag(getCMD, &vPath) + common.AddOutputFileFlag(getCMD, &vOut) + common.AddPayloadOnlyFlag(getCMD, &vPayloadOnly) } -func inspectFunc(cmd *cobra.Command, _ []string) { +func getFunc(cmd *cobra.Command, _ []string) { var addr oid.Address err := addr.DecodeString(vAddress) diff --git a/cmd/neofs-lens/internal/blobovnicza/root.go b/cmd/neofs-lens/internal/blobovnicza/root.go index b3eebe77cf..d34d853992 100644 --- a/cmd/neofs-lens/internal/blobovnicza/root.go +++ b/cmd/neofs-lens/internal/blobovnicza/root.go @@ -20,7 +20,7 @@ var Root = &cobra.Command{ } func init() { - Root.AddCommand(listCMD, inspectCMD) + Root.AddCommand(listCMD, inspectCMD, getCMD) } func openBlobovnicza(cmd *cobra.Command) *blobovnicza.Blobovnicza { diff --git a/cmd/neofs-lens/internal/meta/inspect.go b/cmd/neofs-lens/internal/meta/inspect.go index 6f083247b0..7a817679a1 100644 --- a/cmd/neofs-lens/internal/meta/inspect.go +++ b/cmd/neofs-lens/internal/meta/inspect.go @@ -13,18 +13,29 @@ import ( ) var inspectCMD = &cobra.Command{ - Use: "inspect", + Use: "inspect", + Short: "Object inspection", + Long: `Inspect specific object in a metabase.`, + Deprecated: "will be removed in the next release. Use `get` instead.", + Run: getFunc, +} + +var getCMD = &cobra.Command{ + Use: "get", Short: "Object inspection", - Long: `Inspect specific object in a metabase.`, - Run: inspectFunc, + Long: `Get specific object from a metabase.`, + Run: getFunc, } func init() { common.AddAddressFlag(inspectCMD, &vAddress) common.AddComponentPathFlag(inspectCMD, &vPath) + + common.AddAddressFlag(getCMD, &vAddress) + common.AddComponentPathFlag(getCMD, &vPath) } -func inspectFunc(cmd *cobra.Command, _ []string) { +func getFunc(cmd *cobra.Command, _ []string) { var addr oid.Address err := addr.DecodeString(vAddress) diff --git a/cmd/neofs-lens/internal/meta/root.go b/cmd/neofs-lens/internal/meta/root.go index 40392c29ec..3df4a6df6b 100644 --- a/cmd/neofs-lens/internal/meta/root.go +++ b/cmd/neofs-lens/internal/meta/root.go @@ -34,6 +34,7 @@ func init() { listGraveyardCMD, listGarbageCMD, writeObjectCMD, + getCMD, ) } diff --git a/cmd/neofs-lens/internal/peapod/inspect.go b/cmd/neofs-lens/internal/peapod/inspect.go index 8135872cf6..75bc766ba4 100644 --- a/cmd/neofs-lens/internal/peapod/inspect.go +++ b/cmd/neofs-lens/internal/peapod/inspect.go @@ -7,10 +7,18 @@ import ( ) var inspectCMD = &cobra.Command{ - Use: "inspect", - Short: "Object inspection", - Long: `Inspect specific object in a Peapod.`, - Run: inspectFunc, + Use: "inspect", + Short: "Object inspection", + Long: `Inspect specific object in a Peapod.`, + Deprecated: "will be removed in the next release. Use `get` instead.", + Run: getFunc, +} + +var getCMD = &cobra.Command{ + Use: "get", + Short: "Get object", + Long: `Get specific object from a Peapod.`, + Run: getFunc, } func init() { @@ -18,9 +26,14 @@ func init() { common.AddComponentPathFlag(inspectCMD, &vPath) common.AddOutputFileFlag(inspectCMD, &vOut) common.AddPayloadOnlyFlag(inspectCMD, &vPayloadOnly) + + common.AddAddressFlag(getCMD, &vAddress) + common.AddComponentPathFlag(getCMD, &vPath) + common.AddOutputFileFlag(getCMD, &vOut) + common.AddPayloadOnlyFlag(getCMD, &vPayloadOnly) } -func inspectFunc(cmd *cobra.Command, _ []string) { +func getFunc(cmd *cobra.Command, _ []string) { var getPrm blobstorcommon.GetPrm err := getPrm.Address.DecodeString(vAddress) diff --git a/cmd/neofs-lens/internal/peapod/root.go b/cmd/neofs-lens/internal/peapod/root.go index ee77c18be4..15055ee192 100644 --- a/cmd/neofs-lens/internal/peapod/root.go +++ b/cmd/neofs-lens/internal/peapod/root.go @@ -21,7 +21,7 @@ var Root = &cobra.Command{ } func init() { - Root.AddCommand(listCMD, inspectCMD) + Root.AddCommand(listCMD, inspectCMD, getCMD) } // open and returns read-only peapod.Peapod located in vPath. diff --git a/cmd/neofs-lens/internal/storage/inspect.go b/cmd/neofs-lens/internal/storage/inspect.go index fecce16b54..c1c3487692 100644 --- a/cmd/neofs-lens/internal/storage/inspect.go +++ b/cmd/neofs-lens/internal/storage/inspect.go @@ -8,11 +8,20 @@ import ( ) var storageInspectObjCMD = &cobra.Command{ - Use: "inspect", + Use: "inspect", + Short: "Get object from the NeoFS node's storage snapshot", + Long: "Get object from the NeoFS node's storage snapshot", + Deprecated: "will be removed in the next release. Use `get` instead.", + Args: cobra.NoArgs, + Run: getFunc, +} + +var storageGetObjCMD = &cobra.Command{ + Use: "get", Short: "Get object from the NeoFS node's storage snapshot", Long: "Get object from the NeoFS node's storage snapshot", Args: cobra.NoArgs, - Run: inspectObject, + Run: getFunc, } func init() { @@ -20,9 +29,14 @@ func init() { common.AddOutputFileFlag(storageInspectObjCMD, &vOut) common.AddConfigFileFlag(storageInspectObjCMD, &vConfig) common.AddPayloadOnlyFlag(storageInspectObjCMD, &vPayloadOnly) + + common.AddAddressFlag(storageGetObjCMD, &vAddress) + common.AddOutputFileFlag(storageGetObjCMD, &vOut) + common.AddConfigFileFlag(storageGetObjCMD, &vConfig) + common.AddPayloadOnlyFlag(storageGetObjCMD, &vPayloadOnly) } -func inspectObject(cmd *cobra.Command, _ []string) { +func getFunc(cmd *cobra.Command, _ []string) { var addr oid.Address err := addr.DecodeString(vAddress) diff --git a/cmd/neofs-lens/internal/storage/root.go b/cmd/neofs-lens/internal/storage/root.go index 208394757a..4430924973 100644 --- a/cmd/neofs-lens/internal/storage/root.go +++ b/cmd/neofs-lens/internal/storage/root.go @@ -44,7 +44,7 @@ var Root = &cobra.Command{ func init() { Root.AddCommand( - storageInspectObjCMD, + storageInspectObjCMD, storageGetObjCMD, ) } diff --git a/cmd/neofs-lens/internal/writecache/inspect.go b/cmd/neofs-lens/internal/writecache/inspect.go index 17683e8cfd..f0f2f943d0 100644 --- a/cmd/neofs-lens/internal/writecache/inspect.go +++ b/cmd/neofs-lens/internal/writecache/inspect.go @@ -8,10 +8,18 @@ import ( ) var inspectCMD = &cobra.Command{ - Use: "inspect", + Use: "inspect", + Short: "Object inspection", + Long: `Inspect specific object in a write-cache.`, + Deprecated: "will be removed in the next release. Use `get` instead.", + Run: getFunc, +} + +var getCMD = &cobra.Command{ + Use: "get", Short: "Object inspection", - Long: `Inspect specific object in a write-cache.`, - Run: inspectFunc, + Long: `Get specific object from a write-cache.`, + Run: getFunc, } func init() { @@ -19,9 +27,14 @@ func init() { common.AddComponentPathFlag(inspectCMD, &vPath) common.AddOutputFileFlag(inspectCMD, &vOut) common.AddPayloadOnlyFlag(inspectCMD, &vPayloadOnly) + + common.AddAddressFlag(getCMD, &vAddress) + common.AddComponentPathFlag(getCMD, &vPath) + common.AddOutputFileFlag(getCMD, &vOut) + common.AddPayloadOnlyFlag(getCMD, &vPayloadOnly) } -func inspectFunc(cmd *cobra.Command, _ []string) { +func getFunc(cmd *cobra.Command, _ []string) { db := openWC(cmd) defer db.Close() diff --git a/cmd/neofs-lens/internal/writecache/root.go b/cmd/neofs-lens/internal/writecache/root.go index fdd13f0cc4..53c902dfa5 100644 --- a/cmd/neofs-lens/internal/writecache/root.go +++ b/cmd/neofs-lens/internal/writecache/root.go @@ -21,7 +21,7 @@ var Root = &cobra.Command{ } func init() { - Root.AddCommand(listCMD, inspectCMD) + Root.AddCommand(listCMD, inspectCMD, getCMD) } func openWC(cmd *cobra.Command) *bbolt.DB {