[#155] Update neofs-api-go with refactored pkg/netmap

Refactored pkg/netmap package provides JSON converters for
NodeInfo and PlacementPolicy structures, that has been used
by client applications.

It also updates Node structure itself so it is a part of
grpc <-> v2 <-> pkg conversion chain.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-11-05 18:51:43 +03:00 committed by Alex Vanin
parent 9f8eb0fd51
commit 65be09d3db
16 changed files with 100 additions and 125 deletions

View file

@ -139,7 +139,7 @@ It will be stored in sidechain when inner ring will accepts it.`,
}
cnr := container.New()
cnr.SetPlacementPolicy(placementPolicy)
cnr.SetPlacementPolicy(placementPolicy.ToV2())
cnr.SetBasicACL(basicACL)
cnr.SetAttributes(attributes)
cnr.SetNonce(nonce[:])
@ -531,7 +531,7 @@ func parseContainerPolicy(policyString string) (*netmap.PlacementPolicy, error)
return result, nil
}
result, err = policy.FromJSON([]byte(policyString))
result, err = netmap.PlacementPolicyFromJSON([]byte(policyString))
if err == nil {
printVerbose("Parsed JSON encoded policy")
return result, nil
@ -684,7 +684,8 @@ func prettyPrintContainer(cnr *container.Container, jsonEncoding bool) {
}
fmt.Println("placement policy:")
fmt.Println(strings.Join(policy.Encode(cnr.GetPlacementPolicy()), "\n"))
cnrPolicy := netmap.NewPlacementPolicyFromV2(cnr.GetPlacementPolicy())
fmt.Println(strings.Join(policy.Encode(cnrPolicy), "\n"))
}
func parseEACL(eaclPath string) (*eacl.Table, error) {