[#1513] Upgrade NeoFS SDK Go with changed netmap package

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-06-09 02:18:26 +03:00 committed by LeL
parent 24b4c1ecf4
commit 21d2f8f861
70 changed files with 878 additions and 992 deletions

View file

@ -37,7 +37,7 @@ func initNodeInfoCmd() {
nodeInfoCmd.Flags().Bool(nodeInfoJSONFlag, false, "print node info in JSON format")
}
func prettyPrintNodeInfo(cmd *cobra.Command, i *netmap.NodeInfo) {
func prettyPrintNodeInfo(cmd *cobra.Command, i netmap.NodeInfo) {
isJSON, _ := cmd.Flags().GetBool(nodeInfoJSONFlag)
if isJSON {
common.PrettyPrintJSON(cmd, i, "node info")
@ -45,12 +45,24 @@ func prettyPrintNodeInfo(cmd *cobra.Command, i *netmap.NodeInfo) {
}
cmd.Println("key:", hex.EncodeToString(i.PublicKey()))
cmd.Println("state:", i.State())
netmap.IterateAllAddresses(i, func(s string) {
var stateWord string
switch {
default:
stateWord = "<undefined>"
case i.IsOnline():
stateWord = "online"
case i.IsOffline():
stateWord = "offline"
}
cmd.Println("state:", stateWord)
netmap.IterateNetworkEndpoints(i, func(s string) {
cmd.Println("address:", s)
})
for _, attribute := range i.Attributes() {
cmd.Printf("attribute: %s=%s\n", attribute.Key(), attribute.Value())
}
i.IterateAttributes(func(key, value string) {
cmd.Printf("attribute: %s=%s\n", key, value)
})
}