forked from TrueCloudLab/frostfs-node
Move to frostfs-node
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
42554a9298
commit
923f84722a
934 changed files with 3470 additions and 3451 deletions
34
cmd/frostfs-cli/modules/netmap/get_epoch.go
Normal file
34
cmd/frostfs-cli/modules/netmap/get_epoch.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
package netmap
|
||||
|
||||
import (
|
||||
internalclient "github.com/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
||||
"github.com/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
|
||||
"github.com/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
||||
"github.com/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var getEpochCmd = &cobra.Command{
|
||||
Use: "epoch",
|
||||
Short: "Get current epoch number",
|
||||
Long: "Get current epoch number",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
p := key.GetOrGenerate(cmd)
|
||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||
|
||||
var prm internalclient.NetworkInfoPrm
|
||||
prm.SetClient(cli)
|
||||
|
||||
res, err := internalclient.NetworkInfo(prm)
|
||||
common.ExitOnErr(cmd, "rpc error: %w", err)
|
||||
|
||||
netInfo := res.NetworkInfo()
|
||||
|
||||
cmd.Println(netInfo.CurrentEpoch())
|
||||
},
|
||||
}
|
||||
|
||||
func initGetEpochCmd() {
|
||||
commonflags.Init(getEpochCmd)
|
||||
commonflags.InitAPI(getEpochCmd)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue