node configuration command proto
This commit is contained in:
parent
dc910d51c5
commit
f9b306abc7
File diff suppressed because it is too large
Load Diff
@ -44,6 +44,7 @@ type DRPCCoordinatorClient interface {
|
||||
FileLimitCheck(ctx context.Context, in *FileLimitCheckRequest) (*FileLimitCheckResponse, error)
|
||||
SpaceStatusCheck(ctx context.Context, in *SpaceStatusCheckRequest) (*SpaceStatusCheckResponse, error)
|
||||
SpaceStatusChange(ctx context.Context, in *SpaceStatusChangeRequest) (*SpaceStatusChangeResponse, error)
|
||||
NetworkConfiguration(ctx context.Context, in *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error)
|
||||
}
|
||||
|
||||
type drpcCoordinatorClient struct {
|
||||
@ -92,11 +93,21 @@ func (c *drpcCoordinatorClient) SpaceStatusChange(ctx context.Context, in *Space
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcCoordinatorClient) NetworkConfiguration(ctx context.Context, in *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error) {
|
||||
out := new(NetworkConfigurationResponse)
|
||||
err := c.cc.Invoke(ctx, "/coordinator.Coordinator/NetworkConfiguration", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DRPCCoordinatorServer interface {
|
||||
SpaceSign(context.Context, *SpaceSignRequest) (*SpaceSignResponse, error)
|
||||
FileLimitCheck(context.Context, *FileLimitCheckRequest) (*FileLimitCheckResponse, error)
|
||||
SpaceStatusCheck(context.Context, *SpaceStatusCheckRequest) (*SpaceStatusCheckResponse, error)
|
||||
SpaceStatusChange(context.Context, *SpaceStatusChangeRequest) (*SpaceStatusChangeResponse, error)
|
||||
NetworkConfiguration(context.Context, *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error)
|
||||
}
|
||||
|
||||
type DRPCCoordinatorUnimplementedServer struct{}
|
||||
@ -117,9 +128,13 @@ func (s *DRPCCoordinatorUnimplementedServer) SpaceStatusChange(context.Context,
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCCoordinatorUnimplementedServer) NetworkConfiguration(context.Context, *NetworkConfigurationRequest) (*NetworkConfigurationResponse, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
type DRPCCoordinatorDescription struct{}
|
||||
|
||||
func (DRPCCoordinatorDescription) NumMethods() int { return 4 }
|
||||
func (DRPCCoordinatorDescription) NumMethods() int { return 5 }
|
||||
|
||||
func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
@ -159,6 +174,15 @@ func (DRPCCoordinatorDescription) Method(n int) (string, drpc.Encoding, drpc.Rec
|
||||
in1.(*SpaceStatusChangeRequest),
|
||||
)
|
||||
}, DRPCCoordinatorServer.SpaceStatusChange, true
|
||||
case 4:
|
||||
return "/coordinator.Coordinator/NetworkConfiguration", drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCCoordinatorServer).
|
||||
NetworkConfiguration(
|
||||
ctx,
|
||||
in1.(*NetworkConfigurationRequest),
|
||||
)
|
||||
}, DRPCCoordinatorServer.NetworkConfiguration, true
|
||||
default:
|
||||
return "", nil, nil, nil, false
|
||||
}
|
||||
@ -231,3 +255,19 @@ func (x *drpcCoordinator_SpaceStatusChangeStream) SendAndClose(m *SpaceStatusCha
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCCoordinator_NetworkConfigurationStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*NetworkConfigurationResponse) error
|
||||
}
|
||||
|
||||
type drpcCoordinator_NetworkConfigurationStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcCoordinator_NetworkConfigurationStream) SendAndClose(m *NetworkConfigurationResponse) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_coordinator_coordinatorproto_protos_coordinator_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
@ -18,6 +18,9 @@ service Coordinator {
|
||||
|
||||
// SpaceStatusChange changes the status of space
|
||||
rpc SpaceStatusChange(SpaceStatusChangeRequest) returns (SpaceStatusChangeResponse);
|
||||
|
||||
// NetworkConfiguration retrieves the latest network configuration
|
||||
rpc NetworkConfiguration(NetworkConfigurationRequest) returns (NetworkConfigurationResponse);
|
||||
}
|
||||
|
||||
message SpaceSignRequest {
|
||||
@ -109,3 +112,34 @@ message SpaceStatusChangeRequest {
|
||||
message SpaceStatusChangeResponse {
|
||||
SpaceStatusPayload payload = 1;
|
||||
}
|
||||
|
||||
// NetworkConfigurationRequest contains the requested configurationId, it can be empty to request the latest version
|
||||
message NetworkConfigurationRequest {
|
||||
string configurationId = 1;
|
||||
}
|
||||
|
||||
// NetworkConfigurationResponse contains list of nodes
|
||||
message NetworkConfigurationResponse {
|
||||
string configurationId = 1;
|
||||
repeated Node nodes = 2;
|
||||
}
|
||||
|
||||
// NodeType determines the type of API that a node supports
|
||||
enum NodeType {
|
||||
// TreeAPI supports space/tree sync api
|
||||
TreeAPI = 0;
|
||||
// FileAPI support file api
|
||||
FileAPI = 1;
|
||||
// CoordinatorAPI supports coordinator api
|
||||
CoordinatorAPI = 2;
|
||||
}
|
||||
|
||||
// Node describes one node in the network
|
||||
message Node {
|
||||
// peerId - it's a peer identifier (libp2p format string) so it's an encoded publicKey
|
||||
string peerId = 1;
|
||||
// list of node addresses
|
||||
repeated string addresses = 2;
|
||||
// list of supported APIs
|
||||
repeated NodeType types = 3;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user