[#311] services/control: Define NetmapSnapshot rpc

Add NetmapSnapshot rpc to ControlService protobuf definition. Recompile
proto files. Add required method to server structure.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-14 19:06:49 +03:00 committed by Alex Vanin
parent 88023f3655
commit 28777911fb
4 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,12 @@
package control
import (
"context"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
)
// NetmapSnapshot reads network map snapshot from Netmap storage.
func (s *Server) NetmapSnapshot(ctx context.Context, req *control.NetmapSnapshotRequest) (*control.NetmapSnapshotResponse, error) {
panic("implement me")
}

View file

@ -58,3 +58,38 @@ func (m *HealthCheckResponse) ReadSignedData(buf []byte) ([]byte, error) {
func (m *HealthCheckResponse) SignedDataSize() int { func (m *HealthCheckResponse) SignedDataSize() int {
return m.GetBody().Size() return m.GetBody().Size()
} }
// SetBody sets get netmap snapshot request body.
func (m *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetSignature sets signature of the netmap snapshot request body.
func (m *NetmapSnapshotRequest) SetSignature(body *Signature) {
if m != nil {
m.Signature = body
}
}
// SetNetmap sets structure of the current network map.
func (m *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) {
if m != nil {
m.Netmap = v
}
}
// SetBody sets get netmap snapshot response body.
func (m *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetSignature sets signature of the get netmap snapshot response body.
func (m *NetmapSnapshotResponse) SetSignature(v *Signature) {
if m != nil {
m.Signature = v
}
}

Binary file not shown.

View file

@ -10,6 +10,9 @@ option go_package = "github.com/nspcc-dev/neofs-node/pkg/services/control";
service ControlService { service ControlService {
// Performs health check of the storage node. // Performs health check of the storage node.
rpc HealthCheck (HealthCheckRequest) returns (HealthCheckResponse); rpc HealthCheck (HealthCheckRequest) returns (HealthCheckResponse);
// Returns network map snapshot of the current NeoFS epoch.
rpc NetmapSnapshot (NetmapSnapshotRequest) returns (NetmapSnapshotResponse);
} }
// Health check request. // Health check request.
@ -39,3 +42,31 @@ message HealthCheckResponse {
// Body signature. // Body signature.
Signature signature = 2; Signature signature = 2;
} }
// Get netmap snapshot request.
message NetmapSnapshotRequest {
// Get netmap snapshot request body.
message Body {
}
// Body of get netmap snapshot request message.
Body body = 1;
// Body signature.
Signature signature = 2;
}
// Get netmap snapshot request.
message NetmapSnapshotResponse {
// Get netmap snapshot response body
message Body {
// Structure of the requested network map.
Netmap netmap = 1 [json_name = "netmap"];
}
// Body of get netmap snapshot response message.
Body body = 1;
// Body signature.
Signature signature = 2;
}