forked from TrueCloudLab/frostfs-sdk-go
[#276] Merge repo with frostfs-api-go
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
5361f0eceb
commit
6ce73790ea
337 changed files with 66666 additions and 283 deletions
62
api/rpc/netmap.go
Normal file
62
api/rpc/netmap.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package rpc
|
||||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/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.SnapshotRequest,
|
||||
opts ...client.CallOption,
|
||||
) (*netmap.SnapshotResponse, error) {
|
||||
resp := new(netmap.SnapshotResponse)
|
||||
|
||||
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapSnapshot), req, resp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue