Skip to content

Commit

Permalink
neofs-lens: rename inspect commands to get (#2594)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-khimov authored Sep 29, 2023
2 parents 1968c36 + b8f088b commit 225a796
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 18 additions & 5 deletions cmd/neofs-lens/internal/blobovnicza/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,33 @@ 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() {
common.AddAddressFlag(inspectCMD, &vAddress)
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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-lens/internal/blobovnicza/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
19 changes: 15 additions & 4 deletions cmd/neofs-lens/internal/meta/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions cmd/neofs-lens/internal/meta/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func init() {
listGraveyardCMD,
listGarbageCMD,
writeObjectCMD,
getCMD,
)
}

Expand Down
23 changes: 18 additions & 5 deletions cmd/neofs-lens/internal/peapod/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,33 @@ 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() {
common.AddAddressFlag(inspectCMD, &vAddress)
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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-lens/internal/peapod/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 17 additions & 3 deletions cmd/neofs-lens/internal/storage/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,35 @@ 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() {
common.AddAddressFlag(storageInspectObjCMD, &vAddress)
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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-lens/internal/storage/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var Root = &cobra.Command{

func init() {
Root.AddCommand(
storageInspectObjCMD,
storageInspectObjCMD, storageGetObjCMD,
)
}

Expand Down
21 changes: 17 additions & 4 deletions cmd/neofs-lens/internal/writecache/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,33 @@ 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() {
common.AddAddressFlag(inspectCMD, &vAddress)
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()

Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-lens/internal/writecache/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 225a796

Please sign in to comment.