-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/control service object list (#2933)
Closes #2853.
- Loading branch information
Showing
25 changed files
with
1,230 additions
and
544 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package control | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var objectCmd = &cobra.Command{ | ||
Use: "object", | ||
Short: "Direct object operations with storage engine", | ||
} | ||
|
||
func initControlObjectsCmd() { | ||
objectCmd.AddCommand(listObjectsCmd) | ||
objectCmd.AddCommand(objectStatusCmd) | ||
|
||
initControlObjectsListCmd() | ||
initObjectStatusFlags() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package control | ||
|
||
import ( | ||
rawclient "github.com/nspcc-dev/neofs-api-go/v2/rpc/client" | ||
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/common" | ||
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/commonflags" | ||
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/key" | ||
"github.com/nspcc-dev/neofs-node/pkg/services/control" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var listObjectsCmd = &cobra.Command{ | ||
Use: "list", | ||
Short: "Get list of all objects in the storage node", | ||
Long: "Get list of all objects in the storage node", | ||
Args: cobra.NoArgs, | ||
Run: listObjects, | ||
} | ||
|
||
func initControlObjectsListCmd() { | ||
initControlFlags(listObjectsCmd) | ||
} | ||
|
||
func listObjects(cmd *cobra.Command, _ []string) { | ||
ctx, cancel := commonflags.GetCommandContext(cmd) | ||
defer cancel() | ||
|
||
pk := key.Get(cmd) | ||
|
||
req := &control.ListObjectsRequest{ | ||
Body: &control.ListObjectsRequest_Body{}, | ||
} | ||
signRequest(cmd, pk, req) | ||
|
||
cli := getClient(ctx, cmd) | ||
|
||
err := cli.ExecRaw(func(client *rawclient.Client) error { | ||
return control.ListObjects(client, req, func(r *control.ListObjectsResponse) { | ||
verifyResponse(cmd, r.GetSignature(), r.GetBody()) | ||
|
||
for _, address := range r.GetBody().GetObjectAddress() { | ||
cmd.Println(string(address)) | ||
} | ||
}) | ||
}) | ||
common.ExitOnErr(cmd, "rpc error: %w", err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.