frostfs-api-go/rpc/netmap.go
Airat Arifullin 2511f4ca70
All checks were successful
Tests and linters / Tests (1.19) (pull_request) Successful in 1m39s
Tests and linters / Lint (pull_request) Successful in 1m46s
Tests and linters / Tests with -race (pull_request) Successful in 3m12s
Tests and linters / Tests (1.20) (pull_request) Successful in 7m6s
[#40] types: Generate StableMarshaler/StableSize methods for protobufs
* Add plugin option for protogen in Makefile
* Fix the generator for the plugin in util/protogen
* Erase convertable types, move helpful methods to gRPC protobufs
* Erase helpers for convertations
* Generate StableMarshlal/StableSize for protobufs by the protoc plugin

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
2023-07-10 15:29:21 +03:00

63 lines
1.6 KiB
Go

package rpc
import (
netmap "git.frostfs.info/TrueCloudLab/aarifullin/v2/netmap/grpc"
"git.frostfs.info/TrueCloudLab/aarifullin/v2/rpc/client"
"git.frostfs.info/TrueCloudLab/aarifullin/v2/rpc/common"
)
const serviceNetmap = serviceNamePrefix + "netmap.NetmapService"
const (
rpcNetmapNodeInfo = "LocalNodeInfo"
rpcNetmapNetInfo = "NetworkInfo"
rpcNetmapSnapshot = "NetmapSnapshot"
)
// LocalNodeInfo executes NetmapService.LocalNodeInfo RPC.
func LocalNodeInfo(
cli *client.Client,
req *netmap.LocalNodeInfoRequest,
opts ...client.CallOption,
) (*netmap.LocalNodeInfoResponse, error) {
resp := new(netmap.LocalNodeInfoResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapNodeInfo), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
// NetworkInfo executes NetmapService.NetworkInfo RPC.
func NetworkInfo(
cli *client.Client,
req *netmap.NetworkInfoRequest,
opts ...client.CallOption,
) (*netmap.NetworkInfoResponse, error) {
resp := new(netmap.NetworkInfoResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapNetInfo), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
// NetMapSnapshot executes NetmapService.NetmapSnapshot RPC.
func NetMapSnapshot(
cli *client.Client,
req *netmap.NetmapSnapshotRequest,
opts ...client.CallOption,
) (*netmap.NetmapSnapshotResponse, error) {
resp := new(netmap.NetmapSnapshotResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapSnapshot), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}