Add v2 version to go module name

Replace all elements from `v2` to root directory.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-11-16 20:30:55 +03:00 committed by Alex Vanin
parent 2d70391e31
commit 25da5d2e13
267 changed files with 116 additions and 17991 deletions

771
netmap/convert.go Normal file
View file

@ -0,0 +1,771 @@
package netmap
import (
netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
refsGRPC "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/message"
)
func (f *Filter) ToGRPCMessage() grpc.Message {
var m *netmap.Filter
if f != nil {
m = new(netmap.Filter)
m.SetKey(f.key)
m.SetValue(f.value)
m.SetName(f.name)
m.SetOp(OperationToGRPCMessage(f.op))
m.SetFilters(FiltersToGRPC(f.filters))
}
return m
}
func (f *Filter) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.Filter)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
f.filters, err = FiltersFromGRPC(v.GetFilters())
if err != nil {
return err
}
f.key = v.GetKey()
f.value = v.GetValue()
f.name = v.GetName()
f.op = OperationFromGRPCMessage(v.GetOp())
return nil
}
func FiltersToGRPC(fs []*Filter) (res []*netmap.Filter) {
if fs != nil {
res = make([]*netmap.Filter, 0, len(fs))
for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*netmap.Filter))
}
}
return
}
func FiltersFromGRPC(fs []*netmap.Filter) (res []*Filter, err error) {
if fs != nil {
res = make([]*Filter, 0, len(fs))
for i := range fs {
var f *Filter
if fs[i] != nil {
f = new(Filter)
err = f.FromGRPCMessage(fs[i])
if err != nil {
return
}
}
res = append(res, f)
}
}
return
}
func (s *Selector) ToGRPCMessage() grpc.Message {
var m *netmap.Selector
if s != nil {
m = new(netmap.Selector)
m.SetName(s.name)
m.SetAttribute(s.attribute)
m.SetFilter(s.filter)
m.SetCount(s.count)
m.SetClause(ClauseToGRPCMessage(s.clause))
}
return m
}
func (s *Selector) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.Selector)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
s.name = v.GetName()
s.attribute = v.GetAttribute()
s.filter = v.GetFilter()
s.count = v.GetCount()
s.clause = ClauseFromGRPCMessage(v.GetClause())
return nil
}
func SelectorsToGRPC(ss []*Selector) (res []*netmap.Selector) {
if ss != nil {
res = make([]*netmap.Selector, 0, len(ss))
for i := range ss {
res = append(res, ss[i].ToGRPCMessage().(*netmap.Selector))
}
}
return
}
func SelectorsFromGRPC(ss []*netmap.Selector) (res []*Selector, err error) {
if ss != nil {
res = make([]*Selector, 0, len(ss))
for i := range ss {
var s *Selector
if ss[i] != nil {
s = new(Selector)
err = s.FromGRPCMessage(ss[i])
if err != nil {
return
}
}
res = append(res, s)
}
}
return
}
func (r *Replica) ToGRPCMessage() grpc.Message {
var m *netmap.Replica
if r != nil {
m = new(netmap.Replica)
m.SetSelector(r.selector)
m.SetCount(r.count)
}
return m
}
func (r *Replica) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.Replica)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
r.selector = v.GetSelector()
r.count = v.GetCount()
return nil
}
func ReplicasToGRPC(rs []*Replica) (res []*netmap.Replica) {
if rs != nil {
res = make([]*netmap.Replica, 0, len(rs))
for i := range rs {
res = append(res, rs[i].ToGRPCMessage().(*netmap.Replica))
}
}
return
}
func ReplicasFromGRPC(rs []*netmap.Replica) (res []*Replica, err error) {
if rs != nil {
res = make([]*Replica, 0, len(rs))
for i := range rs {
var r *Replica
if rs[i] != nil {
r = new(Replica)
err = r.FromGRPCMessage(rs[i])
if err != nil {
return
}
}
res = append(res, r)
}
}
return
}
func (p *PlacementPolicy) ToGRPCMessage() grpc.Message {
var m *netmap.PlacementPolicy
if p != nil {
m = new(netmap.PlacementPolicy)
m.SetFilters(FiltersToGRPC(p.filters))
m.SetSelectors(SelectorsToGRPC(p.selectors))
m.SetReplicas(ReplicasToGRPC(p.replicas))
m.SetContainerBackupFactor(p.backupFactor)
}
return m
}
func (p *PlacementPolicy) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.PlacementPolicy)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
p.filters, err = FiltersFromGRPC(v.GetFilters())
if err != nil {
return err
}
p.selectors, err = SelectorsFromGRPC(v.GetSelectors())
if err != nil {
return err
}
p.replicas, err = ReplicasFromGRPC(v.GetReplicas())
if err != nil {
return err
}
p.backupFactor = v.GetContainerBackupFactor()
return nil
}
func ClauseToGRPCMessage(n Clause) netmap.Clause {
return netmap.Clause(n)
}
func ClauseFromGRPCMessage(n netmap.Clause) Clause {
return Clause(n)
}
func OperationToGRPCMessage(n Operation) netmap.Operation {
return netmap.Operation(n)
}
func OperationFromGRPCMessage(n netmap.Operation) Operation {
return Operation(n)
}
func NodeStateToGRPCMessage(n NodeState) netmap.NodeInfo_State {
return netmap.NodeInfo_State(n)
}
func NodeStateFromRPCMessage(n netmap.NodeInfo_State) NodeState {
return NodeState(n)
}
func (a *Attribute) ToGRPCMessage() grpc.Message {
var m *netmap.NodeInfo_Attribute
if a != nil {
m = new(netmap.NodeInfo_Attribute)
m.SetKey(a.key)
m.SetValue(a.value)
m.SetParents(a.parents)
}
return m
}
func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NodeInfo_Attribute)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
a.key = v.GetKey()
a.value = v.GetValue()
a.parents = v.GetParents()
return nil
}
func AttributesToGRPC(as []*Attribute) (res []*netmap.NodeInfo_Attribute) {
if as != nil {
res = make([]*netmap.NodeInfo_Attribute, 0, len(as))
for i := range as {
res = append(res, as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute))
}
}
return
}
func AttributesFromGRPC(as []*netmap.NodeInfo_Attribute) (res []*Attribute, err error) {
if as != nil {
res = make([]*Attribute, 0, len(as))
for i := range as {
var a *Attribute
if as[i] != nil {
a = new(Attribute)
err = a.FromGRPCMessage(as[i])
if err != nil {
return
}
}
res = append(res, a)
}
}
return
}
func (ni *NodeInfo) ToGRPCMessage() grpc.Message {
var m *netmap.NodeInfo
if ni != nil {
m = new(netmap.NodeInfo)
m.SetPublicKey(ni.publicKey)
m.SetAddresses(ni.addresses)
m.SetState(NodeStateToGRPCMessage(ni.state))
m.SetAttributes(AttributesToGRPC(ni.attributes))
}
return m
}
func (ni *NodeInfo) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NodeInfo)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
ni.attributes, err = AttributesFromGRPC(v.GetAttributes())
if err != nil {
return err
}
ni.publicKey = v.GetPublicKey()
ni.addresses = v.GetAddresses()
ni.state = NodeStateFromRPCMessage(v.GetState())
return nil
}
func (l *LocalNodeInfoRequestBody) ToGRPCMessage() grpc.Message {
var m *netmap.LocalNodeInfoRequest_Body
if l != nil {
m = new(netmap.LocalNodeInfoRequest_Body)
}
return m
}
func (l *LocalNodeInfoRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.LocalNodeInfoRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
return nil
}
func (l *LocalNodeInfoRequest) ToGRPCMessage() grpc.Message {
var m *netmap.LocalNodeInfoRequest
if l != nil {
m = new(netmap.LocalNodeInfoRequest)
m.SetBody(l.body.ToGRPCMessage().(*netmap.LocalNodeInfoRequest_Body))
l.RequestHeaders.ToMessage(m)
}
return m
}
func (l *LocalNodeInfoRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.LocalNodeInfoRequest)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
l.body = nil
} else {
if l.body == nil {
l.body = new(LocalNodeInfoRequestBody)
}
err = l.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return l.RequestHeaders.FromMessage(v)
}
func (l *LocalNodeInfoResponseBody) ToGRPCMessage() grpc.Message {
var m *netmap.LocalNodeInfoResponse_Body
if l != nil {
m = new(netmap.LocalNodeInfoResponse_Body)
m.SetVersion(l.version.ToGRPCMessage().(*refsGRPC.Version))
m.SetNodeInfo(l.nodeInfo.ToGRPCMessage().(*netmap.NodeInfo))
}
return m
}
func (l *LocalNodeInfoResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.LocalNodeInfoResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
version := v.GetVersion()
if version == nil {
l.version = nil
} else {
if l.version == nil {
l.version = new(refs.Version)
}
err = l.version.FromGRPCMessage(version)
if err != nil {
return err
}
}
nodeInfo := v.GetNodeInfo()
if nodeInfo == nil {
l.nodeInfo = nil
} else {
if l.nodeInfo == nil {
l.nodeInfo = new(NodeInfo)
}
err = l.nodeInfo.FromGRPCMessage(nodeInfo)
}
return err
}
func (l *LocalNodeInfoResponse) ToGRPCMessage() grpc.Message {
var m *netmap.LocalNodeInfoResponse
if l != nil {
m = new(netmap.LocalNodeInfoResponse)
m.SetBody(l.body.ToGRPCMessage().(*netmap.LocalNodeInfoResponse_Body))
l.ResponseHeaders.ToMessage(m)
}
return m
}
func (l *LocalNodeInfoResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.LocalNodeInfoResponse)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
l.body = nil
} else {
if l.body == nil {
l.body = new(LocalNodeInfoResponseBody)
}
err = l.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return l.ResponseHeaders.FromMessage(v)
}
func (x *NetworkParameter) ToGRPCMessage() grpc.Message {
var m *netmap.NetworkConfig_Parameter
if x != nil {
m = new(netmap.NetworkConfig_Parameter)
m.SetKey(x.k)
m.SetValue(x.v)
}
return m
}
func (x *NetworkParameter) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NetworkConfig_Parameter)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
x.k = v.GetKey()
x.v = v.GetValue()
return nil
}
func (x *NetworkConfig) ToGRPCMessage() grpc.Message {
var m *netmap.NetworkConfig
if x != nil {
m = new(netmap.NetworkConfig)
var ps []*netmap.NetworkConfig_Parameter
if ln := len(x.ps); ln > 0 {
ps = make([]*netmap.NetworkConfig_Parameter, 0, ln)
for i := 0; i < ln; i++ {
ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
}
}
m.SetParameters(ps)
}
return m
}
func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NetworkConfig)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var (
ps []*NetworkParameter
psV2 = v.GetParameters()
)
if psV2 != nil {
ln := len(psV2)
ps = make([]*NetworkParameter, 0, ln)
for i := 0; i < ln; i++ {
var p *NetworkParameter
if psV2[i] != nil {
p = new(NetworkParameter)
if err := p.FromGRPCMessage(psV2[i]); err != nil {
return err
}
}
ps = append(ps, p)
}
}
x.ps = ps
return nil
}
func (i *NetworkInfo) ToGRPCMessage() grpc.Message {
var m *netmap.NetworkInfo
if i != nil {
m = new(netmap.NetworkInfo)
m.SetMagicNumber(i.magicNum)
m.SetCurrentEpoch(i.curEpoch)
m.SetMsPerBlock(i.msPerBlock)
m.SetNetworkConfig(i.netCfg.ToGRPCMessage().(*netmap.NetworkConfig))
}
return m
}
func (i *NetworkInfo) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NetworkInfo)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
netCfg := v.GetNetworkConfig()
if netCfg == nil {
i.netCfg = nil
} else {
if i.netCfg == nil {
i.netCfg = new(NetworkConfig)
}
err = i.netCfg.FromGRPCMessage(netCfg)
if err != nil {
return err
}
}
i.magicNum = v.GetMagicNumber()
i.curEpoch = v.GetCurrentEpoch()
i.msPerBlock = v.GetMsPerBlock()
return nil
}
func (l *NetworkInfoRequestBody) ToGRPCMessage() grpc.Message {
var m *netmap.NetworkInfoRequest_Body
if l != nil {
m = new(netmap.NetworkInfoRequest_Body)
}
return m
}
func (l *NetworkInfoRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NetworkInfoRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
return nil
}
func (l *NetworkInfoRequest) ToGRPCMessage() grpc.Message {
var m *netmap.NetworkInfoRequest
if l != nil {
m = new(netmap.NetworkInfoRequest)
m.SetBody(l.body.ToGRPCMessage().(*netmap.NetworkInfoRequest_Body))
l.RequestHeaders.ToMessage(m)
}
return m
}
func (l *NetworkInfoRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NetworkInfoRequest)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
l.body = nil
} else {
if l.body == nil {
l.body = new(NetworkInfoRequestBody)
}
err = l.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return l.RequestHeaders.FromMessage(v)
}
func (i *NetworkInfoResponseBody) ToGRPCMessage() grpc.Message {
var m *netmap.NetworkInfoResponse_Body
if i != nil {
m = new(netmap.NetworkInfoResponse_Body)
m.SetNetworkInfo(i.netInfo.ToGRPCMessage().(*netmap.NetworkInfo))
}
return m
}
func (i *NetworkInfoResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NetworkInfoResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
netInfo := v.GetNetworkInfo()
if netInfo == nil {
i.netInfo = nil
} else {
if i.netInfo == nil {
i.netInfo = new(NetworkInfo)
}
err = i.netInfo.FromGRPCMessage(netInfo)
}
return err
}
func (l *NetworkInfoResponse) ToGRPCMessage() grpc.Message {
var m *netmap.NetworkInfoResponse
if l != nil {
m = new(netmap.NetworkInfoResponse)
m.SetBody(l.body.ToGRPCMessage().(*netmap.NetworkInfoResponse_Body))
l.ResponseHeaders.ToMessage(m)
}
return m
}
func (l *NetworkInfoResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*netmap.NetworkInfoResponse)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
l.body = nil
} else {
if l.body == nil {
l.body = new(NetworkInfoResponseBody)
}
err = l.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return l.ResponseHeaders.FromMessage(v)
}

111
netmap/grpc/service.go Normal file
View file

@ -0,0 +1,111 @@
package netmap
import (
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
)
// SetBody sets body of the request.
func (m *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *LocalNodeInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *LocalNodeInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetVersion sets version of response body.
func (m *LocalNodeInfoResponse_Body) SetVersion(v *refs.Version) {
if m != nil {
m.Version = v
}
}
// SetNodeInfo sets node info of response body.
func (m *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) {
if m != nil {
m.NodeInfo = v
}
}
// SetBody sets body of the response.
func (m *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *LocalNodeInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *LocalNodeInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetBody sets body of the request.
func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) {
if x != nil {
x.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (x *NetworkInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) {
if x != nil {
x.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (x *NetworkInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
if x != nil {
x.VerifyHeader = v
}
}
// SetNetworkInfo sets information about the network.
func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) {
if x != nil {
x.NetworkInfo = v
}
}
// SetBody sets body of the response.
func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) {
if x != nil {
x.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (x *NetworkInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
if x != nil {
x.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (x *NetworkInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
if x != nil {
x.VerifyHeader = v
}
}

777
netmap/grpc/service.pb.go generated Normal file
View file

@ -0,0 +1,777 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.18.0
// source: v2/netmap/grpc/service.proto
package netmap
import (
grpc1 "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Get NodeInfo structure from the particular node directly
type LocalNodeInfoRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Body of the LocalNodeInfo request message
Body *LocalNodeInfoRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"`
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"`
}
func (x *LocalNodeInfoRequest) Reset() {
*x = LocalNodeInfoRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LocalNodeInfoRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LocalNodeInfoRequest) ProtoMessage() {}
func (x *LocalNodeInfoRequest) ProtoReflect() protoreflect.Message {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LocalNodeInfoRequest.ProtoReflect.Descriptor instead.
func (*LocalNodeInfoRequest) Descriptor() ([]byte, []int) {
return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{0}
}
func (x *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *LocalNodeInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
// Local Node Info, including API Version in use
type LocalNodeInfoResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Body of the balance response message.
Body *LocalNodeInfoResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect response execution.
MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"`
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"`
}
func (x *LocalNodeInfoResponse) Reset() {
*x = LocalNodeInfoResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LocalNodeInfoResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LocalNodeInfoResponse) ProtoMessage() {}
func (x *LocalNodeInfoResponse) ProtoReflect() protoreflect.Message {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LocalNodeInfoResponse.ProtoReflect.Descriptor instead.
func (*LocalNodeInfoResponse) Descriptor() ([]byte, []int) {
return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{1}
}
func (x *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *LocalNodeInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
// Get NetworkInfo structure with the network view from particular node.
type NetworkInfoRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Body of the NetworkInfo request message
Body *NetworkInfoRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"`
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"`
}
func (x *NetworkInfoRequest) Reset() {
*x = NetworkInfoRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NetworkInfoRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NetworkInfoRequest) ProtoMessage() {}
func (x *NetworkInfoRequest) ProtoReflect() protoreflect.Message {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NetworkInfoRequest.ProtoReflect.Descriptor instead.
func (*NetworkInfoRequest) Descriptor() ([]byte, []int) {
return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{2}
}
func (x *NetworkInfoRequest) GetBody() *NetworkInfoRequest_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *NetworkInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *NetworkInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
// Response with NetworkInfo structure including current epoch and
// sidechain magic number.
type NetworkInfoResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Body of the NetworkInfo response message.
Body *NetworkInfoResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect response execution.
MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader,proto3" json:"meta_header,omitempty"`
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader,proto3" json:"verify_header,omitempty"`
}
func (x *NetworkInfoResponse) Reset() {
*x = NetworkInfoResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NetworkInfoResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NetworkInfoResponse) ProtoMessage() {}
func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NetworkInfoResponse.ProtoReflect.Descriptor instead.
func (*NetworkInfoResponse) Descriptor() ([]byte, []int) {
return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{3}
}
func (x *NetworkInfoResponse) GetBody() *NetworkInfoResponse_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *NetworkInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *NetworkInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
// LocalNodeInfo request body is empty.
type LocalNodeInfoRequest_Body struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *LocalNodeInfoRequest_Body) Reset() {
*x = LocalNodeInfoRequest_Body{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LocalNodeInfoRequest_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LocalNodeInfoRequest_Body) ProtoMessage() {}
func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LocalNodeInfoRequest_Body.ProtoReflect.Descriptor instead.
func (*LocalNodeInfoRequest_Body) Descriptor() ([]byte, []int) {
return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{0, 0}
}
// Local Node Info, including API Version in use.
type LocalNodeInfoResponse_Body struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Latest NeoFS API version in use
Version *grpc1.Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
// NodeInfo structure with recent information from node itself
NodeInfo *NodeInfo `protobuf:"bytes,2,opt,name=node_info,json=nodeInfo,proto3" json:"node_info,omitempty"`
}
func (x *LocalNodeInfoResponse_Body) Reset() {
*x = LocalNodeInfoResponse_Body{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LocalNodeInfoResponse_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LocalNodeInfoResponse_Body) ProtoMessage() {}
func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LocalNodeInfoResponse_Body.ProtoReflect.Descriptor instead.
func (*LocalNodeInfoResponse_Body) Descriptor() ([]byte, []int) {
return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{1, 0}
}
func (x *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version {
if x != nil {
return x.Version
}
return nil
}
func (x *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo {
if x != nil {
return x.NodeInfo
}
return nil
}
// NetworkInfo request body is empty.
type NetworkInfoRequest_Body struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *NetworkInfoRequest_Body) Reset() {
*x = NetworkInfoRequest_Body{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NetworkInfoRequest_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NetworkInfoRequest_Body) ProtoMessage() {}
func (x *NetworkInfoRequest_Body) ProtoReflect() protoreflect.Message {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NetworkInfoRequest_Body.ProtoReflect.Descriptor instead.
func (*NetworkInfoRequest_Body) Descriptor() ([]byte, []int) {
return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{2, 0}
}
// Information about the network.
type NetworkInfoResponse_Body struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// NetworkInfo structure with recent information.
NetworkInfo *NetworkInfo `protobuf:"bytes,1,opt,name=network_info,json=networkInfo,proto3" json:"network_info,omitempty"`
}
func (x *NetworkInfoResponse_Body) Reset() {
*x = NetworkInfoResponse_Body{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NetworkInfoResponse_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NetworkInfoResponse_Body) ProtoMessage() {}
func (x *NetworkInfoResponse_Body) ProtoReflect() protoreflect.Message {
mi := &file_v2_netmap_grpc_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NetworkInfoResponse_Body.ProtoReflect.Descriptor instead.
func (*NetworkInfoResponse_Body) Descriptor() ([]byte, []int) {
return file_v2_netmap_grpc_service_proto_rawDescGZIP(), []int{3, 0}
}
func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo {
if x != nil {
return x.NetworkInfo
}
return nil
}
var File_v2_netmap_grpc_service_proto protoreflect.FileDescriptor
var file_v2_netmap_grpc_service_proto_rawDesc = []byte{
0x0a, 0x1c, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63,
0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10,
0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70,
0x1a, 0x1a, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63,
0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x76, 0x32,
0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x76, 0x32, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xf9, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64,
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04,
0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f,
0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a,
0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73,
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65,
0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65,
0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68,
0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65,
0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22,
0xe9, 0x02, 0x0a, 0x15, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73,
0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c,
0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d,
0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61,
0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x72, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12,
0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66,
0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76,
0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66,
0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xf5, 0x01, 0x0a, 0x12,
0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74,
0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64,
0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e,
0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65,
0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69,
0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76,
0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42,
0x6f, 0x64, 0x79, 0x22, 0xbb, 0x02, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x04, 0x62,
0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74,
0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d,
0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61,
0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12,
0x40, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76,
0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66,
0x6f, 0x32, 0xcd, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65,
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64,
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e,
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e,
0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65,
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x42, 0x56, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d,
0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e,
0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41,
0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_v2_netmap_grpc_service_proto_rawDescOnce sync.Once
file_v2_netmap_grpc_service_proto_rawDescData = file_v2_netmap_grpc_service_proto_rawDesc
)
func file_v2_netmap_grpc_service_proto_rawDescGZIP() []byte {
file_v2_netmap_grpc_service_proto_rawDescOnce.Do(func() {
file_v2_netmap_grpc_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_netmap_grpc_service_proto_rawDescData)
})
return file_v2_netmap_grpc_service_proto_rawDescData
}
var file_v2_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_v2_netmap_grpc_service_proto_goTypes = []interface{}{
(*LocalNodeInfoRequest)(nil), // 0: neo.fs.v2.netmap.LocalNodeInfoRequest
(*LocalNodeInfoResponse)(nil), // 1: neo.fs.v2.netmap.LocalNodeInfoResponse
(*NetworkInfoRequest)(nil), // 2: neo.fs.v2.netmap.NetworkInfoRequest
(*NetworkInfoResponse)(nil), // 3: neo.fs.v2.netmap.NetworkInfoResponse
(*LocalNodeInfoRequest_Body)(nil), // 4: neo.fs.v2.netmap.LocalNodeInfoRequest.Body
(*LocalNodeInfoResponse_Body)(nil), // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.Body
(*NetworkInfoRequest_Body)(nil), // 6: neo.fs.v2.netmap.NetworkInfoRequest.Body
(*NetworkInfoResponse_Body)(nil), // 7: neo.fs.v2.netmap.NetworkInfoResponse.Body
(*grpc.RequestMetaHeader)(nil), // 8: neo.fs.v2.session.RequestMetaHeader
(*grpc.RequestVerificationHeader)(nil), // 9: neo.fs.v2.session.RequestVerificationHeader
(*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader
(*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader
(*grpc1.Version)(nil), // 12: neo.fs.v2.refs.Version
(*NodeInfo)(nil), // 13: neo.fs.v2.netmap.NodeInfo
(*NetworkInfo)(nil), // 14: neo.fs.v2.netmap.NetworkInfo
}
var file_v2_netmap_grpc_service_proto_depIdxs = []int32{
4, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body
8, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader
9, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader
5, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body
10, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader
11, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader
6, // 6: neo.fs.v2.netmap.NetworkInfoRequest.body:type_name -> neo.fs.v2.netmap.NetworkInfoRequest.Body
8, // 7: neo.fs.v2.netmap.NetworkInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader
9, // 8: neo.fs.v2.netmap.NetworkInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader
7, // 9: neo.fs.v2.netmap.NetworkInfoResponse.body:type_name -> neo.fs.v2.netmap.NetworkInfoResponse.Body
10, // 10: neo.fs.v2.netmap.NetworkInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader
11, // 11: neo.fs.v2.netmap.NetworkInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader
12, // 12: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version
13, // 13: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo
14, // 14: neo.fs.v2.netmap.NetworkInfoResponse.Body.network_info:type_name -> neo.fs.v2.netmap.NetworkInfo
0, // 15: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest
2, // 16: neo.fs.v2.netmap.NetmapService.NetworkInfo:input_type -> neo.fs.v2.netmap.NetworkInfoRequest
1, // 17: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse
3, // 18: neo.fs.v2.netmap.NetmapService.NetworkInfo:output_type -> neo.fs.v2.netmap.NetworkInfoResponse
17, // [17:19] is the sub-list for method output_type
15, // [15:17] is the sub-list for method input_type
15, // [15:15] is the sub-list for extension type_name
15, // [15:15] is the sub-list for extension extendee
0, // [0:15] is the sub-list for field type_name
}
func init() { file_v2_netmap_grpc_service_proto_init() }
func file_v2_netmap_grpc_service_proto_init() {
if File_v2_netmap_grpc_service_proto != nil {
return
}
file_v2_netmap_grpc_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_v2_netmap_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LocalNodeInfoRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_v2_netmap_grpc_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LocalNodeInfoResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_v2_netmap_grpc_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NetworkInfoRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_v2_netmap_grpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NetworkInfoResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_v2_netmap_grpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LocalNodeInfoRequest_Body); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_v2_netmap_grpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LocalNodeInfoResponse_Body); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_v2_netmap_grpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NetworkInfoRequest_Body); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_v2_netmap_grpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NetworkInfoResponse_Body); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_v2_netmap_grpc_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_v2_netmap_grpc_service_proto_goTypes,
DependencyIndexes: file_v2_netmap_grpc_service_proto_depIdxs,
MessageInfos: file_v2_netmap_grpc_service_proto_msgTypes,
}.Build()
File_v2_netmap_grpc_service_proto = out.File
file_v2_netmap_grpc_service_proto_rawDesc = nil
file_v2_netmap_grpc_service_proto_goTypes = nil
file_v2_netmap_grpc_service_proto_depIdxs = nil
}

167
netmap/grpc/service_grpc.pb.go generated Normal file
View file

@ -0,0 +1,167 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package netmap
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// NetmapServiceClient is the client API for NetmapService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type NetmapServiceClient interface {
// Get NodeInfo structure from the particular node directly. Node information
// can be taken from `Netmap` smart contract, but in some cases the one may
// want to get recent information directly, or to talk to the node not yet
// present in `Network Map` to find out what API version can be used for
// further communication. Can also be used to check if node is up and running.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS):
// information about the server has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON).
LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error)
// Read recent information about the NeoFS network.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS):
// information about the current network state has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON).
NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error)
}
type netmapServiceClient struct {
cc grpc.ClientConnInterface
}
func NewNetmapServiceClient(cc grpc.ClientConnInterface) NetmapServiceClient {
return &netmapServiceClient{cc}
}
func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) {
out := new(LocalNodeInfoResponse)
err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) {
out := new(NetworkInfoResponse)
err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/NetworkInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// NetmapServiceServer is the server API for NetmapService service.
// All implementations should embed UnimplementedNetmapServiceServer
// for forward compatibility
type NetmapServiceServer interface {
// Get NodeInfo structure from the particular node directly. Node information
// can be taken from `Netmap` smart contract, but in some cases the one may
// want to get recent information directly, or to talk to the node not yet
// present in `Network Map` to find out what API version can be used for
// further communication. Can also be used to check if node is up and running.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS):
// information about the server has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON).
LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error)
// Read recent information about the NeoFS network.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS):
// information about the current network state has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON).
NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error)
}
// UnimplementedNetmapServiceServer should be embedded to have forward compatible implementations.
type UnimplementedNetmapServiceServer struct {
}
func (UnimplementedNetmapServiceServer) LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LocalNodeInfo not implemented")
}
func (UnimplementedNetmapServiceServer) NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NetworkInfo not implemented")
}
// UnsafeNetmapServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to NetmapServiceServer will
// result in compilation errors.
type UnsafeNetmapServiceServer interface {
mustEmbedUnimplementedNetmapServiceServer()
}
func RegisterNetmapServiceServer(s grpc.ServiceRegistrar, srv NetmapServiceServer) {
s.RegisterService(&NetmapService_ServiceDesc, srv)
}
func _NetmapService_LocalNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LocalNodeInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NetmapServiceServer).LocalNodeInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NetmapServiceServer).LocalNodeInfo(ctx, req.(*LocalNodeInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _NetmapService_NetworkInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NetworkInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NetmapServiceServer).NetworkInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/neo.fs.v2.netmap.NetmapService/NetworkInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NetmapServiceServer).NetworkInfo(ctx, req.(*NetworkInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
// NetmapService_ServiceDesc is the grpc.ServiceDesc for NetmapService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var NetmapService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "neo.fs.v2.netmap.NetmapService",
HandlerType: (*NetmapServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "LocalNodeInfo",
Handler: _NetmapService_LocalNodeInfo_Handler,
},
{
MethodName: "NetworkInfo",
Handler: _NetmapService_NetworkInfo_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "v2/netmap/grpc/service.proto",
}

257
netmap/grpc/types.go Normal file
View file

@ -0,0 +1,257 @@
package netmap
// SetReplicas of placement policy.
func (m *PlacementPolicy) SetReplicas(v []*Replica) {
if m != nil {
m.Replicas = v
}
}
// SetContainerBackupFactor of placement policy.
func (m *PlacementPolicy) SetContainerBackupFactor(v uint32) {
if m != nil {
m.ContainerBackupFactor = v
}
}
// SetSelectors of placement policy.
func (m *PlacementPolicy) SetSelectors(v []*Selector) {
if m != nil {
m.Selectors = v
}
}
// SetFilters of placement policy.
func (m *PlacementPolicy) SetFilters(v []*Filter) {
if m != nil {
m.Filters = v
}
}
// SetName of placement filter.
func (m *Filter) SetName(v string) {
if m != nil {
m.Name = v
}
}
// SetKey of placement filter.
func (m *Filter) SetKey(v string) {
if m != nil {
m.Key = v
}
}
// SetOperation of placement filter.
func (m *Filter) SetOp(v Operation) {
if m != nil {
m.Op = v
}
}
// SetValue of placement filter.
func (m *Filter) SetValue(v string) {
if m != nil {
m.Value = v
}
}
// SetFilters sets sub-filters of placement filter.
func (m *Filter) SetFilters(v []*Filter) {
if m != nil {
m.Filters = v
}
}
// SetName of placement selector.
func (m *Selector) SetName(v string) {
if m != nil {
m.Name = v
}
}
// SetCount of nodes of placement selector.
func (m *Selector) SetCount(v uint32) {
if m != nil {
m.Count = v
}
}
// SetAttribute of nodes of placement selector.
func (m *Selector) SetAttribute(v string) {
if m != nil {
m.Attribute = v
}
}
// SetFilter of placement selector.
func (m *Selector) SetFilter(v string) {
if m != nil {
m.Filter = v
}
}
// SetClause of placement selector.
func (m *Selector) SetClause(v Clause) {
if m != nil {
m.Clause = v
}
}
// SetCount of object replica.
func (m *Replica) SetCount(v uint32) {
if m != nil {
m.Count = v
}
}
// SetSelector of object replica.
func (m *Replica) SetSelector(v string) {
if m != nil {
m.Selector = v
}
}
// SetKey sets key to the node attribute.
func (m *NodeInfo_Attribute) SetKey(v string) {
if m != nil {
m.Key = v
}
}
// SetValue sets value of the node attribute.
func (m *NodeInfo_Attribute) SetValue(v string) {
if m != nil {
m.Value = v
}
}
// SetParent sets value of the node parents.
func (m *NodeInfo_Attribute) SetParents(v []string) {
if m != nil {
m.Parents = v
}
}
// SetAddress sets node network address.
//
// Deprecated: use SetAddresses.
func (m *NodeInfo) SetAddress(v string) {
m.SetAddresses([]string{v})
}
// SetAddresses sets list of network addresses of the node.
func (m *NodeInfo) SetAddresses(v []string) {
if m != nil {
m.Addresses = v
}
}
// SetPublicKey sets node public key in a binary format.
func (m *NodeInfo) SetPublicKey(v []byte) {
if m != nil {
m.PublicKey = v
}
}
// SetAttributes sets list of the node attributes.
func (m *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) {
if m != nil {
m.Attributes = v
}
}
// SetState sets node state.
func (m *NodeInfo) SetState(v NodeInfo_State) {
if m != nil {
m.State = v
}
}
// SetCurrentEpoch sets number of the current epoch.
func (x *NetworkInfo) SetCurrentEpoch(v uint64) {
if x != nil {
x.CurrentEpoch = v
}
}
// SetMagicNumber sets magic number of the sidechain.
func (x *NetworkInfo) SetMagicNumber(v uint64) {
if x != nil {
x.MagicNumber = v
}
}
// SetMsPerBlock sets MillisecondsPerBlock network parameter.
func (x *NetworkInfo) SetMsPerBlock(v int64) {
if x != nil {
x.MsPerBlock = v
}
}
// SetNetworkConfig sets NeoFS network configuration.
func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) {
if x != nil {
x.NetworkConfig = v
}
}
// FromString parses Clause from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Clause) FromString(s string) bool {
i, ok := Clause_value[s]
if ok {
*x = Clause(i)
}
return ok
}
// FromString parses Operation from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
i, ok := Operation_value[s]
if ok {
*x = Operation(i)
}
return ok
}
// FromString parses NodeInfo_State from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *NodeInfo_State) FromString(s string) bool {
i, ok := NodeInfo_State_value[s]
if ok {
*x = NodeInfo_State(i)
}
return ok
}
// SetKey sets parameter key.
func (x *NetworkConfig_Parameter) SetKey(v []byte) {
if x != nil {
x.Key = v
}
}
// SetValue sets parameter value.
func (x *NetworkConfig_Parameter) SetValue(v []byte) {
if x != nil {
x.Value = v
}
}
// SetParameters sets NeoFS network parameters.
func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) {
if x != nil {
x.Parameters = v
}
}

1205
netmap/grpc/types.pb.go generated Normal file

File diff suppressed because it is too large Load diff

62
netmap/json.go Normal file
View file

@ -0,0 +1,62 @@
package netmap
import (
netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/message"
)
func (p *PlacementPolicy) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(p)
}
func (p *PlacementPolicy) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(p, data, new(netmap.PlacementPolicy))
}
func (f *Filter) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(f)
}
func (f *Filter) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(f, data, new(netmap.Filter))
}
func (s *Selector) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(s)
}
func (s *Selector) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(s, data, new(netmap.Selector))
}
func (r *Replica) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(r)
}
func (r *Replica) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(r, data, new(netmap.Replica))
}
func (a *Attribute) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(a)
}
func (a *Attribute) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(a, data, new(netmap.NodeInfo_Attribute))
}
func (ni *NodeInfo) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(ni)
}
func (ni *NodeInfo) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(ni, data, new(netmap.NodeInfo))
}
func (i *NetworkInfo) MarshalJSON() ([]byte, error) {
return message.MarshalJSON(i)
}
func (i *NetworkInfo) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(i, data, new(netmap.NetworkInfo))
}

674
netmap/marshal.go Normal file
View file

@ -0,0 +1,674 @@
package netmap
import (
netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/message"
protoutil "github.com/nspcc-dev/neofs-api-go/v2/util/proto"
)
const (
nameFilterField = 1
keyFilterField = 2
opFilterField = 3
valueFilterField = 4
filtersFilterField = 5
nameSelectorField = 1
countSelectorField = 2
clauseSelectorField = 3
attributeSelectorField = 4
filterSelectorField = 5
countReplicaField = 1
selectorReplicaField = 2
replicasPolicyField = 1
backupPolicyField = 2
selectorsPolicyField = 3
filtersPolicyField = 4
keyAttributeField = 1
valueAttributeField = 2
parentsAttributeField = 3
keyNodeInfoField = 1
addressNodeInfoField = 2
attributesNodeInfoField = 3
stateNodeInfoField = 4
versionInfoResponseBodyField = 1
nodeInfoResponseBodyField = 2
)
func (f *Filter) StableMarshal(buf []byte) ([]byte, error) {
if f == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, f.StableSize())
}
var (
offset, n int
err error
)
n, err = protoutil.StringMarshal(nameFilterField, buf[offset:], f.name)
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.StringMarshal(keyFilterField, buf[offset:], f.key)
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.EnumMarshal(opFilterField, buf[offset:], int32(f.op))
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.StringMarshal(valueFilterField, buf[offset:], f.value)
if err != nil {
return nil, err
}
offset += n
for i := range f.filters {
n, err = protoutil.NestedStructureMarshal(filtersFilterField, buf[offset:], f.filters[i])
if err != nil {
return nil, err
}
offset += n
}
return buf, nil
}
func (f *Filter) StableSize() (size int) {
size += protoutil.StringSize(nameFilterField, f.name)
size += protoutil.StringSize(keyFilterField, f.key)
size += protoutil.EnumSize(opFilterField, int32(f.op))
size += protoutil.StringSize(valueFilterField, f.value)
for i := range f.filters {
size += protoutil.NestedStructureSize(filtersFilterField, f.filters[i])
}
return size
}
func (f *Filter) Unmarshal(data []byte) error {
return message.Unmarshal(f, data, new(netmap.Filter))
}
func (s *Selector) StableMarshal(buf []byte) ([]byte, error) {
if s == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, s.StableSize())
}
var (
offset, n int
err error
)
n, err = protoutil.StringMarshal(nameSelectorField, buf[offset:], s.name)
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.UInt32Marshal(countSelectorField, buf[offset:], s.count)
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.EnumMarshal(clauseSelectorField, buf[offset:], int32(s.clause))
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.StringMarshal(attributeSelectorField, buf[offset:], s.attribute)
if err != nil {
return nil, err
}
offset += n
_, err = protoutil.StringMarshal(filterSelectorField, buf[offset:], s.filter)
if err != nil {
return nil, err
}
return buf, nil
}
func (s *Selector) StableSize() (size int) {
size += protoutil.StringSize(nameSelectorField, s.name)
size += protoutil.UInt32Size(countSelectorField, s.count)
size += protoutil.EnumSize(countSelectorField, int32(s.clause))
size += protoutil.StringSize(attributeSelectorField, s.attribute)
size += protoutil.StringSize(filterSelectorField, s.filter)
return size
}
func (s *Selector) Unmarshal(data []byte) error {
return message.Unmarshal(s, data, new(netmap.Selector))
}
func (r *Replica) StableMarshal(buf []byte) ([]byte, error) {
if r == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
var (
offset, n int
err error
)
n, err = protoutil.UInt32Marshal(countReplicaField, buf[offset:], r.count)
if err != nil {
return nil, err
}
offset += n
_, err = protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector)
if err != nil {
return nil, err
}
return buf, nil
}
func (r *Replica) StableSize() (size int) {
size += protoutil.UInt32Size(countReplicaField, r.count)
size += protoutil.StringSize(selectorReplicaField, r.selector)
return size
}
func (r *Replica) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(netmap.Replica))
}
func (p *PlacementPolicy) StableMarshal(buf []byte) ([]byte, error) {
if p == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, p.StableSize())
}
var (
offset, n int
err error
)
for i := range p.replicas {
n, err = protoutil.NestedStructureMarshal(replicasPolicyField, buf[offset:], p.replicas[i])
if err != nil {
return nil, err
}
offset += n
}
n, err = protoutil.UInt32Marshal(backupPolicyField, buf[offset:], p.backupFactor)
if err != nil {
return nil, err
}
offset += n
for i := range p.selectors {
n, err = protoutil.NestedStructureMarshal(selectorsPolicyField, buf[offset:], p.selectors[i])
if err != nil {
return nil, err
}
offset += n
}
for i := range p.filters {
n, err = protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], p.filters[i])
if err != nil {
return nil, err
}
offset += n
}
return buf, nil
}
func (p *PlacementPolicy) StableSize() (size int) {
for i := range p.replicas {
size += protoutil.NestedStructureSize(replicasPolicyField, p.replicas[i])
}
size += protoutil.UInt32Size(backupPolicyField, p.backupFactor)
for i := range p.selectors {
size += protoutil.NestedStructureSize(selectorsPolicyField, p.selectors[i])
}
for i := range p.filters {
size += protoutil.NestedStructureSize(filtersPolicyField, p.filters[i])
}
return size
}
func (p *PlacementPolicy) Unmarshal(data []byte) error {
return message.Unmarshal(p, data, new(netmap.PlacementPolicy))
}
func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) {
if a == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, a.StableSize())
}
var (
offset, n int
err error
)
n, err = protoutil.StringMarshal(keyAttributeField, buf[offset:], a.key)
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.StringMarshal(valueAttributeField, buf[offset:], a.value)
if err != nil {
return nil, err
}
offset += n
for i := range a.parents {
n, err = protoutil.StringMarshal(parentsAttributeField, buf[offset:], a.parents[i])
if err != nil {
return nil, err
}
offset += n
}
return buf, nil
}
func (a *Attribute) StableSize() (size int) {
if a == nil {
return 0
}
size += protoutil.StringSize(keyAttributeField, a.key)
size += protoutil.StringSize(valueAttributeField, a.value)
for i := range a.parents {
size += protoutil.StringSize(parentsAttributeField, a.parents[i])
}
return size
}
func (a *Attribute) Unmarshal(data []byte) error {
return message.Unmarshal(a, data, new(netmap.NodeInfo_Attribute))
}
func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) {
if ni == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, ni.StableSize())
}
var (
offset, n int
err error
)
n, err = protoutil.BytesMarshal(keyNodeInfoField, buf[offset:], ni.publicKey)
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.RepeatedStringMarshal(addressNodeInfoField, buf[offset:], ni.addresses)
if err != nil {
return nil, err
}
offset += n
for i := range ni.attributes {
n, err = protoutil.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], ni.attributes[i])
if err != nil {
return nil, err
}
offset += n
}
_, err = protoutil.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state))
if err != nil {
return nil, err
}
return buf, nil
}
func (ni *NodeInfo) StableSize() (size int) {
if ni == nil {
return 0
}
size += protoutil.BytesSize(keyNodeInfoField, ni.publicKey)
size += protoutil.RepeatedStringSize(addressNodeInfoField, ni.addresses)
for i := range ni.attributes {
size += protoutil.NestedStructureSize(attributesNodeInfoField, ni.attributes[i])
}
size += protoutil.EnumSize(stateNodeInfoField, int32(ni.state))
return size
}
func (ni *NodeInfo) Unmarshal(data []byte) error {
return message.Unmarshal(ni, data, new(netmap.NodeInfo))
}
func (l *LocalNodeInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) {
return nil, nil
}
func (l *LocalNodeInfoRequestBody) StableSize() (size int) {
return 0
}
func (l *LocalNodeInfoRequestBody) Unmarshal([]byte) error {
return nil
}
func (l *LocalNodeInfoResponseBody) StableMarshal(buf []byte) ([]byte, error) {
if l == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, l.StableSize())
}
var (
offset, n int
err error
)
n, err = protoutil.NestedStructureMarshal(versionInfoResponseBodyField, buf[offset:], l.version)
if err != nil {
return nil, err
}
offset += n
_, err = protoutil.NestedStructureMarshal(nodeInfoResponseBodyField, buf[offset:], l.nodeInfo)
if err != nil {
return nil, err
}
return buf, nil
}
func (l *LocalNodeInfoResponseBody) StableSize() (size int) {
if l == nil {
return 0
}
size += protoutil.NestedStructureSize(versionInfoResponseBodyField, l.version)
size += protoutil.NestedStructureSize(nodeInfoResponseBodyField, l.nodeInfo)
return size
}
func (l *LocalNodeInfoResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(l, data, new(netmap.LocalNodeInfoResponse_Body))
}
const (
_ = iota
netPrmKeyFNum
netPrmValFNum
)
func (x *NetworkParameter) StableMarshal(buf []byte) ([]byte, error) {
if x == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, x.StableSize())
}
var (
offset, n int
err error
)
n, err = protoutil.BytesMarshal(netPrmKeyFNum, buf[offset:], x.k)
if err != nil {
return nil, err
}
offset += n
_, err = protoutil.BytesMarshal(netPrmValFNum, buf[offset:], x.v)
if err != nil {
return nil, err
}
return buf, nil
}
func (x *NetworkParameter) StableSize() (size int) {
if x == nil {
return 0
}
size += protoutil.BytesSize(netPrmKeyFNum, x.k)
size += protoutil.BytesSize(netPrmValFNum, x.v)
return size
}
const (
_ = iota
netCfgPrmsFNum
)
func (x *NetworkConfig) StableMarshal(buf []byte) ([]byte, error) {
if x == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, x.StableSize())
}
var (
offset, n int
err error
)
for i := range x.ps {
n, err = protoutil.NestedStructureMarshal(netCfgPrmsFNum, buf[offset:], x.ps[i])
if err != nil {
return nil, err
}
offset += n
}
return buf, nil
}
func (x *NetworkConfig) StableSize() (size int) {
if x == nil {
return 0
}
for i := range x.ps {
size += protoutil.NestedStructureSize(netCfgPrmsFNum, x.ps[i])
}
return size
}
const (
_ = iota
netInfoCurEpochFNum
netInfoMagicNumFNum
netInfoMSPerBlockFNum
netInfoCfgFNum
)
func (i *NetworkInfo) StableMarshal(buf []byte) ([]byte, error) {
if i == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, i.StableSize())
}
var (
offset, n int
err error
)
n, err = protoutil.UInt64Marshal(netInfoCurEpochFNum, buf[offset:], i.curEpoch)
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.UInt64Marshal(netInfoMagicNumFNum, buf[offset:], i.magicNum)
if err != nil {
return nil, err
}
offset += n
n, err = protoutil.Int64Marshal(netInfoMSPerBlockFNum, buf[offset:], i.msPerBlock)
if err != nil {
return nil, err
}
offset += n
_, err = protoutil.NestedStructureMarshal(netInfoCfgFNum, buf[offset:], i.netCfg)
if err != nil {
return nil, err
}
return buf, nil
}
func (i *NetworkInfo) StableSize() (size int) {
if i == nil {
return 0
}
size += protoutil.UInt64Size(netInfoCurEpochFNum, i.curEpoch)
size += protoutil.UInt64Size(netInfoMagicNumFNum, i.magicNum)
size += protoutil.Int64Size(netInfoMSPerBlockFNum, i.msPerBlock)
size += protoutil.NestedStructureSize(netInfoCfgFNum, i.netCfg)
return size
}
func (i *NetworkInfo) Unmarshal(data []byte) error {
return message.Unmarshal(i, data, new(netmap.NetworkInfo))
}
func (l *NetworkInfoRequestBody) StableMarshal(buf []byte) ([]byte, error) {
return nil, nil
}
func (l *NetworkInfoRequestBody) StableSize() (size int) {
return 0
}
func (l *NetworkInfoRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(l, data, new(netmap.NetworkInfoRequest_Body))
}
const (
_ = iota
netInfoRespBodyNetInfoFNum
)
func (i *NetworkInfoResponseBody) StableMarshal(buf []byte) ([]byte, error) {
if i == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, i.StableSize())
}
_, err := protoutil.NestedStructureMarshal(netInfoRespBodyNetInfoFNum, buf, i.netInfo)
if err != nil {
return nil, err
}
return buf, nil
}
func (i *NetworkInfoResponseBody) StableSize() (size int) {
if i == nil {
return 0
}
size += protoutil.NestedStructureSize(netInfoRespBodyNetInfoFNum, i.netInfo)
return size
}
func (i *NetworkInfoResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(i, data, new(netmap.NetworkInfoResponse_Body))
}

27
netmap/message_test.go Normal file
View file

@ -0,0 +1,27 @@
package netmap_test
import (
"testing"
netmaptest "github.com/nspcc-dev/neofs-api-go/v2/netmap/test"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/message"
messagetest "github.com/nspcc-dev/neofs-api-go/v2/rpc/message/test"
)
func TestMessageConvert(t *testing.T) {
messagetest.TestRPCMessage(t,
func(empty bool) message.Message { return netmaptest.GenerateFilter(empty) },
func(empty bool) message.Message { return netmaptest.GenerateSelector(empty) },
func(empty bool) message.Message { return netmaptest.GenerateReplica(empty) },
func(empty bool) message.Message { return netmaptest.GeneratePlacementPolicy(empty) },
func(empty bool) message.Message { return netmaptest.GenerateAttribute(empty) },
func(empty bool) message.Message { return netmaptest.GenerateNodeInfo(empty) },
func(empty bool) message.Message { return netmaptest.GenerateLocalNodeInfoRequest(empty) },
func(empty bool) message.Message { return netmaptest.GenerateLocalNodeInfoResponseBody(empty) },
func(empty bool) message.Message { return netmaptest.GenerateNetworkParameter(empty) },
func(empty bool) message.Message { return netmaptest.GenerateNetworkConfig(empty) },
func(empty bool) message.Message { return netmaptest.GenerateNetworkInfo(empty) },
func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoRequest(empty) },
func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoResponseBody(empty) },
)
}

68
netmap/string.go Normal file
View file

@ -0,0 +1,68 @@
package netmap
import (
netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc"
)
// String returns string representation of Clause.
func (x Clause) String() string {
return ClauseToGRPCMessage(x).String()
}
// FromString parses Clause from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Clause) FromString(s string) bool {
var g netmap.Clause
ok := g.FromString(s)
if ok {
*x = ClauseFromGRPCMessage(g)
}
return ok
}
// String returns string representation of Operation.
func (x Operation) String() string {
return OperationToGRPCMessage(x).String()
}
// FromString parses Operation from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
var g netmap.Operation
ok := g.FromString(s)
if ok {
*x = OperationFromGRPCMessage(g)
}
return ok
}
// String returns string representation of NodeState.
func (x NodeState) String() string {
return NodeStateToGRPCMessage(x).String()
}
// FromString parses NodeState from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *NodeState) FromString(s string) bool {
var g netmap.NodeInfo_State
ok := g.FromString(s)
if ok {
*x = NodeStateFromRPCMessage(g)
}
return ok
}

268
netmap/test/generate.go Normal file
View file

@ -0,0 +1,268 @@
package netmaptest
import (
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test"
sessiontest "github.com/nspcc-dev/neofs-api-go/v2/session/test"
)
func GenerateFilter(empty bool) *netmap.Filter {
return generateFilter(empty, true)
}
func generateFilter(empty, withSub bool) *netmap.Filter {
m := new(netmap.Filter)
if !empty {
m.SetKey("filter key")
m.SetValue("filter value")
m.SetName("filter name")
m.SetOp(1)
if withSub {
m.SetFilters([]*netmap.Filter{
generateFilter(empty, false),
generateFilter(empty, false),
})
}
}
return m
}
func GenerateFilters(empty bool) []*netmap.Filter {
var res []*netmap.Filter
if !empty {
res = append(res,
GenerateFilter(false),
GenerateFilter(false),
)
}
return res
}
func GenerateSelector(empty bool) *netmap.Selector {
m := new(netmap.Selector)
if !empty {
m.SetCount(66)
m.SetAttribute("selector attribute")
m.SetFilter("select filter")
m.SetName("select name")
m.SetClause(1)
}
return m
}
func GenerateSelectors(empty bool) []*netmap.Selector {
var res []*netmap.Selector
if !empty {
res = append(res,
GenerateSelector(false),
GenerateSelector(false),
)
}
return res
}
func GenerateReplica(empty bool) *netmap.Replica {
m := new(netmap.Replica)
if !empty {
m.SetCount(42)
m.SetSelector("replica selector")
}
return m
}
func GenerateReplicas(empty bool) []*netmap.Replica {
var res []*netmap.Replica
if !empty {
res = append(res,
GenerateReplica(false),
GenerateReplica(false),
)
}
return res
}
func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy {
m := new(netmap.PlacementPolicy)
if !empty {
m.SetContainerBackupFactor(322)
m.SetFilters(GenerateFilters(false))
m.SetSelectors(GenerateSelectors(false))
m.SetReplicas(GenerateReplicas(false))
}
return m
}
func GenerateAttribute(empty bool) *netmap.Attribute {
m := new(netmap.Attribute)
if !empty {
m.SetKey("attribute key")
m.SetValue("attribute val")
}
return m
}
func GenerateAttributes(empty bool) []*netmap.Attribute {
var res []*netmap.Attribute
if !empty {
res = append(res,
GenerateAttribute(false),
GenerateAttribute(false),
)
}
return res
}
func GenerateNodeInfo(empty bool) *netmap.NodeInfo {
m := new(netmap.NodeInfo)
if !empty {
m.SetAddresses("node address", "node address 2")
m.SetPublicKey([]byte{1, 2, 3})
m.SetState(33)
m.SetAttributes(GenerateAttributes(empty))
}
return m
}
func GenerateLocalNodeInfoRequestBody(empty bool) *netmap.LocalNodeInfoRequestBody {
m := new(netmap.LocalNodeInfoRequestBody)
return m
}
func GenerateLocalNodeInfoRequest(empty bool) *netmap.LocalNodeInfoRequest {
m := new(netmap.LocalNodeInfoRequest)
if !empty {
m.SetBody(GenerateLocalNodeInfoRequestBody(false))
}
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
return m
}
func GenerateLocalNodeInfoResponseBody(empty bool) *netmap.LocalNodeInfoResponseBody {
m := new(netmap.LocalNodeInfoResponseBody)
if !empty {
m.SetNodeInfo(GenerateNodeInfo(false))
}
m.SetVersion(refstest.GenerateVersion(empty))
return m
}
func GenerateLocalNodeInfoResponse(empty bool) *netmap.LocalNodeInfoResponse {
m := new(netmap.LocalNodeInfoResponse)
if !empty {
m.SetBody(GenerateLocalNodeInfoResponseBody(false))
}
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
return m
}
func GenerateNetworkParameter(empty bool) *netmap.NetworkParameter {
m := new(netmap.NetworkParameter)
if !empty {
m.SetKey([]byte("key"))
m.SetValue([]byte("value"))
}
return m
}
func GenerateNetworkConfig(empty bool) *netmap.NetworkConfig {
m := new(netmap.NetworkConfig)
if !empty {
m.SetParameters(
GenerateNetworkParameter(empty),
GenerateNetworkParameter(empty),
)
}
return m
}
func GenerateNetworkInfo(empty bool) *netmap.NetworkInfo {
m := new(netmap.NetworkInfo)
if !empty {
m.SetMagicNumber(228)
m.SetCurrentEpoch(666)
m.SetMsPerBlock(5678)
m.SetNetworkConfig(GenerateNetworkConfig(empty))
}
return m
}
func GenerateNetworkInfoRequestBody(empty bool) *netmap.NetworkInfoRequestBody {
m := new(netmap.NetworkInfoRequestBody)
return m
}
func GenerateNetworkInfoRequest(empty bool) *netmap.NetworkInfoRequest {
m := new(netmap.NetworkInfoRequest)
if !empty {
m.SetBody(GenerateNetworkInfoRequestBody(false))
}
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
return m
}
func GenerateNetworkInfoResponseBody(empty bool) *netmap.NetworkInfoResponseBody {
m := new(netmap.NetworkInfoResponseBody)
if !empty {
m.SetNetworkInfo(GenerateNetworkInfo(false))
}
return m
}
func GenerateNetworkInfoResponse(empty bool) *netmap.NetworkInfoResponse {
m := new(netmap.NetworkInfoResponse)
if !empty {
m.SetBody(GenerateNetworkInfoResponseBody(false))
}
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
return m
}

714
netmap/types.go Normal file
View file

@ -0,0 +1,714 @@
package netmap
import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-api-go/v2/session"
)
type LocalNodeInfoRequest struct {
body *LocalNodeInfoRequestBody
session.RequestHeaders
}
type LocalNodeInfoResponse struct {
body *LocalNodeInfoResponseBody
session.ResponseHeaders
}
// NetworkInfoRequest is a structure of NetworkInfo request.
type NetworkInfoRequest struct {
body *NetworkInfoRequestBody
session.RequestHeaders
}
// NetworkInfoResponse is a structure of NetworkInfo response.
type NetworkInfoResponse struct {
body *NetworkInfoResponseBody
session.ResponseHeaders
}
type Filter struct {
name string
key string
op Operation
value string
filters []*Filter
}
type Selector struct {
name string
count uint32
clause Clause
attribute string
filter string
}
type Replica struct {
count uint32
selector string
}
type Operation uint32
type PlacementPolicy struct {
replicas []*Replica
backupFactor uint32
selectors []*Selector
filters []*Filter
}
// Attribute of storage node.
type Attribute struct {
key string
value string
parents []string
}
// NodeInfo of storage node.
type NodeInfo struct {
publicKey []byte
addresses []string
attributes []*Attribute
state NodeState
}
// NodeState of storage node.
type NodeState uint32
// Clause of placement selector.
type Clause uint32
type LocalNodeInfoRequestBody struct{}
type LocalNodeInfoResponseBody struct {
version *refs.Version
nodeInfo *NodeInfo
}
const (
UnspecifiedState NodeState = iota
Online
Offline
)
const (
UnspecifiedOperation Operation = iota
EQ
NE
GT
GE
LT
LE
OR
AND
)
const (
UnspecifiedClause Clause = iota
Same
Distinct
)
func (f *Filter) GetFilters() []*Filter {
if f != nil {
return f.filters
}
return nil
}
func (f *Filter) SetFilters(filters []*Filter) {
if f != nil {
f.filters = filters
}
}
func (f *Filter) GetValue() string {
if f != nil {
return f.value
}
return ""
}
func (f *Filter) SetValue(value string) {
if f != nil {
f.value = value
}
}
func (f *Filter) GetOp() Operation {
if f != nil {
return f.op
}
return UnspecifiedOperation
}
func (f *Filter) SetOp(op Operation) {
if f != nil {
f.op = op
}
}
func (f *Filter) GetKey() string {
if f != nil {
return f.key
}
return ""
}
func (f *Filter) SetKey(key string) {
if f != nil {
f.key = key
}
}
func (f *Filter) GetName() string {
if f != nil {
return f.name
}
return ""
}
func (f *Filter) SetName(name string) {
if f != nil {
f.name = name
}
}
func (s *Selector) GetFilter() string {
if s != nil {
return s.filter
}
return ""
}
func (s *Selector) SetFilter(filter string) {
if s != nil {
s.filter = filter
}
}
func (s *Selector) GetAttribute() string {
if s != nil {
return s.attribute
}
return ""
}
func (s *Selector) SetAttribute(attribute string) {
if s != nil {
s.attribute = attribute
}
}
func (s *Selector) GetClause() Clause {
if s != nil {
return s.clause
}
return UnspecifiedClause
}
func (s *Selector) SetClause(clause Clause) {
if s != nil {
s.clause = clause
}
}
func (s *Selector) GetCount() uint32 {
if s != nil {
return s.count
}
return 0
}
func (s *Selector) SetCount(count uint32) {
if s != nil {
s.count = count
}
}
func (s *Selector) GetName() string {
if s != nil {
return s.name
}
return ""
}
func (s *Selector) SetName(name string) {
if s != nil {
s.name = name
}
}
func (r *Replica) GetSelector() string {
if r != nil {
return r.selector
}
return ""
}
func (r *Replica) SetSelector(selector string) {
if r != nil {
r.selector = selector
}
}
func (r *Replica) GetCount() uint32 {
if r != nil {
return r.count
}
return 0
}
func (r *Replica) SetCount(count uint32) {
if r != nil {
r.count = count
}
}
func (p *PlacementPolicy) GetFilters() []*Filter {
if p != nil {
return p.filters
}
return nil
}
func (p *PlacementPolicy) SetFilters(filters []*Filter) {
if p != nil {
p.filters = filters
}
}
func (p *PlacementPolicy) GetSelectors() []*Selector {
if p != nil {
return p.selectors
}
return nil
}
func (p *PlacementPolicy) SetSelectors(selectors []*Selector) {
if p != nil {
p.selectors = selectors
}
}
func (p *PlacementPolicy) GetContainerBackupFactor() uint32 {
if p != nil {
return p.backupFactor
}
return 0
}
func (p *PlacementPolicy) SetContainerBackupFactor(backupFactor uint32) {
if p != nil {
p.backupFactor = backupFactor
}
}
func (p *PlacementPolicy) GetReplicas() []*Replica {
return p.replicas
}
func (p *PlacementPolicy) SetReplicas(replicas []*Replica) {
p.replicas = replicas
}
func (a *Attribute) GetKey() string {
if a != nil {
return a.key
}
return ""
}
func (a *Attribute) SetKey(v string) {
if a != nil {
a.key = v
}
}
func (a *Attribute) GetValue() string {
if a != nil {
return a.value
}
return ""
}
func (a *Attribute) SetValue(v string) {
if a != nil {
a.value = v
}
}
func (a *Attribute) GetParents() []string {
if a != nil {
return a.parents
}
return nil
}
func (a *Attribute) SetParents(parent []string) {
if a != nil {
a.parents = parent
}
}
func (ni *NodeInfo) GetPublicKey() []byte {
if ni != nil {
return ni.publicKey
}
return nil
}
func (ni *NodeInfo) SetPublicKey(v []byte) {
if ni != nil {
ni.publicKey = v
}
}
// GetAddress returns node's network address.
//
// Deprecated: use IterateAddresses.
func (ni *NodeInfo) GetAddress() (addr string) {
ni.IterateAddresses(func(s string) bool {
addr = s
return true
})
return
}
// SetAddress sets node's network address.
//
// Deprecated: use SetAddresses.
func (ni *NodeInfo) SetAddress(v string) {
ni.SetAddresses(v)
}
// SetAddresses sets list of network addresses of the node.
func (ni *NodeInfo) SetAddresses(v ...string) {
if ni != nil {
ni.addresses = v
}
}
// NumberOfAddresses returns number of network addresses of the node.
func (ni *NodeInfo) NumberOfAddresses() int {
if ni != nil {
return len(ni.addresses)
}
return 0
}
// IterateAddresses iterates over network addresses of the node.
// Breaks iteration on f's true return.
//
// Handler should not be nil.
func (ni *NodeInfo) IterateAddresses(f func(string) bool) {
if ni != nil {
for i := range ni.addresses {
if f(ni.addresses[i]) {
break
}
}
}
}
func (ni *NodeInfo) GetAttributes() []*Attribute {
if ni != nil {
return ni.attributes
}
return nil
}
func (ni *NodeInfo) SetAttributes(v []*Attribute) {
if ni != nil {
ni.attributes = v
}
}
func (ni *NodeInfo) GetState() NodeState {
if ni != nil {
return ni.state
}
return UnspecifiedState
}
func (ni *NodeInfo) SetState(state NodeState) {
if ni != nil {
ni.state = state
}
}
func (l *LocalNodeInfoResponseBody) GetVersion() *refs.Version {
if l != nil {
return l.version
}
return nil
}
func (l *LocalNodeInfoResponseBody) SetVersion(version *refs.Version) {
if l != nil {
l.version = version
}
}
func (l *LocalNodeInfoResponseBody) GetNodeInfo() *NodeInfo {
if l != nil {
return l.nodeInfo
}
return nil
}
func (l *LocalNodeInfoResponseBody) SetNodeInfo(nodeInfo *NodeInfo) {
if l != nil {
l.nodeInfo = nodeInfo
}
}
func (l *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequestBody {
if l != nil {
return l.body
}
return nil
}
func (l *LocalNodeInfoRequest) SetBody(body *LocalNodeInfoRequestBody) {
if l != nil {
l.body = body
}
}
func (l *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponseBody {
if l != nil {
return l.body
}
return nil
}
func (l *LocalNodeInfoResponse) SetBody(body *LocalNodeInfoResponseBody) {
if l != nil {
l.body = body
}
}
// NetworkParameter represents NeoFS network parameter.
type NetworkParameter struct {
k, v []byte
}
// GetKey returns parameter key.
func (x *NetworkParameter) GetKey() []byte {
if x != nil {
return x.k
}
return nil
}
// SetKey sets parameter key.
func (x *NetworkParameter) SetKey(k []byte) {
if x != nil {
x.k = k
}
}
// GetValue returns parameter value.
func (x *NetworkParameter) GetValue() []byte {
if x != nil {
return x.v
}
return nil
}
// SetValue sets parameter value.
func (x *NetworkParameter) SetValue(v []byte) {
if x != nil {
x.v = v
}
}
// NetworkConfig represents NeoFS network configuration.
type NetworkConfig struct {
ps []*NetworkParameter
}
// NumberOfParameters returns number of network parameters.
func (x *NetworkConfig) NumberOfParameters() int {
if x != nil {
return len(x.ps)
}
return 0
}
// IterateParameters iterates over network parameters.
// Breaks iteration on f's true return.
//
// Handler must not be nil.
func (x *NetworkConfig) IterateParameters(f func(*NetworkParameter) bool) {
if x != nil {
for i := range x.ps {
if f(x.ps[i]) {
break
}
}
}
}
// SetParameters sets list of network parameters.
func (x *NetworkConfig) SetParameters(v ...*NetworkParameter) {
if x != nil {
x.ps = v
}
}
// NetworkInfo groups information about
// NeoFS network.
type NetworkInfo struct {
curEpoch, magicNum uint64
msPerBlock int64
netCfg *NetworkConfig
}
// GetCurrentEpoch returns number of the current epoch.
func (i *NetworkInfo) GetCurrentEpoch() uint64 {
if i != nil {
return i.curEpoch
}
return 0
}
// SetCurrentEpoch sets number of the current epoch.
func (i *NetworkInfo) SetCurrentEpoch(epoch uint64) {
if i != nil {
i.curEpoch = epoch
}
}
// GetMagicNumber returns magic number of the sidechain.
func (i *NetworkInfo) GetMagicNumber() uint64 {
if i != nil {
return i.magicNum
}
return 0
}
// SetMagicNumber sets magic number of the sidechain.
func (i *NetworkInfo) SetMagicNumber(magic uint64) {
if i != nil {
i.magicNum = magic
}
}
// GetMsPerBlock returns MillisecondsPerBlock network parameter.
func (i *NetworkInfo) GetMsPerBlock() int64 {
if i != nil {
return i.msPerBlock
}
return 0
}
// SetMsPerBlock sets MillisecondsPerBlock network parameter.
func (i *NetworkInfo) SetMsPerBlock(v int64) {
if i != nil {
i.msPerBlock = v
}
}
// GetNetworkConfig returns NeoFS network configuration.
func (i *NetworkInfo) GetNetworkConfig() *NetworkConfig {
if i != nil {
return i.netCfg
}
return nil
}
// SetNetworkConfig sets NeoFS network configuration.
func (i *NetworkInfo) SetNetworkConfig(v *NetworkConfig) {
if i != nil {
i.netCfg = v
}
}
// NetworkInfoRequestBody is a structure of NetworkInfo request body.
type NetworkInfoRequestBody struct{}
// NetworkInfoResponseBody is a structure of NetworkInfo response body.
type NetworkInfoResponseBody struct {
netInfo *NetworkInfo
}
// GetNetworkInfo returns information about the NeoFS network.
func (i *NetworkInfoResponseBody) GetNetworkInfo() *NetworkInfo {
if i != nil {
return i.netInfo
}
return nil
}
// SetNetworkInfo sets information about the NeoFS network.
func (i *NetworkInfoResponseBody) SetNetworkInfo(netInfo *NetworkInfo) {
if i != nil {
i.netInfo = netInfo
}
}
func (l *NetworkInfoRequest) GetBody() *NetworkInfoRequestBody {
if l != nil {
return l.body
}
return nil
}
func (l *NetworkInfoRequest) SetBody(body *NetworkInfoRequestBody) {
if l != nil {
l.body = body
}
}
func (l *NetworkInfoResponse) GetBody() *NetworkInfoResponseBody {
if l != nil {
return l.body
}
return nil
}
func (l *NetworkInfoResponse) SetBody(body *NetworkInfoResponseBody) {
if l != nil {
l.body = body
}
}