frostfs-node/pkg/core/client/client.go
Leonard Lyubich 7f5fb130c0 [#961] *: Support NeoFS API status returns
Upgrade NeoFS API Go library to version with status returns. Make all API
clients to pull out and return errors from failed statuses. Make signature
service to respond with status if client version supports it.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-24 09:26:40 +03:00

48 lines
1.1 KiB
Go

package client
import (
rawclient "github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
"github.com/nspcc-dev/neofs-node/pkg/network"
"github.com/nspcc-dev/neofs-sdk-go/client"
)
// Client is an interface of NeoFS storage
// node's client.
type Client interface {
client.Client
// RawForAddress must return rawclient.Client
// for the passed network.Address.
RawForAddress(network.Address) *rawclient.Client
}
// NodeInfo groups information about NeoFS storage node needed for Client construction.
type NodeInfo struct {
addrGroup network.AddressGroup
key []byte
}
// SetAddressGroup sets group of network addresses.
func (x *NodeInfo) SetAddressGroup(v network.AddressGroup) {
x.addrGroup = v
}
// AddressGroup returns group of network addresses.
func (x NodeInfo) AddressGroup() network.AddressGroup {
return x.addrGroup
}
// SetPublicKey sets public key in a binary format.
//
// Argument must not be mutated.
func (x *NodeInfo) SetPublicKey(v []byte) {
x.key = v
}
// PublicKey returns public key in a binary format.
//
// Result must not be mutated.
func (x *NodeInfo) PublicKey() []byte {
return x.key
}