2022-05-31 06:53:54 +00:00
|
|
|
package netmap
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
|
|
|
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
2022-05-31 06:53:54 +00:00
|
|
|
"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)
|
|
|
|
|
2023-09-06 12:53:53 +00:00
|
|
|
prm := internalclient.NetworkInfoPrm{
|
|
|
|
Client: cli,
|
|
|
|
}
|
2022-05-31 06:53:54 +00:00
|
|
|
|
2023-05-24 13:51:57 +00:00
|
|
|
res, err := internalclient.NetworkInfo(cmd.Context(), prm)
|
2023-01-16 09:20:16 +00:00
|
|
|
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
2022-05-31 06:53:54 +00:00
|
|
|
|
|
|
|
netInfo := res.NetworkInfo()
|
|
|
|
|
|
|
|
cmd.Println(netInfo.CurrentEpoch())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func initGetEpochCmd() {
|
|
|
|
commonflags.Init(getEpochCmd)
|
|
|
|
commonflags.InitAPI(getEpochCmd)
|
|
|
|
}
|