Merge pull request #66 from nspcc-dev/update-to-neofs-api-v0.7.1

Update to NeoFS API v0.7.1
This commit is contained in:
Evgeniy Kulikov 2020-04-20 14:00:44 +03:00 committed by GitHub
commit 92da09ac42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 11 deletions

View file

@ -1,4 +1,4 @@
PROTO_VERSION=v0.7.0 PROTO_VERSION=v0.7.1
PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz
B=\033[0;1m B=\033[0;1m
@ -9,14 +9,14 @@ R=\033[0m
# Dependencies # Dependencies
deps: deps:
@echo "${B}${G}=> Golang modules ${R}" @echo "${B}${G} Golang modules ${R}"
@go mod tidy -v @go mod tidy -v
@go mod vendor @go mod vendor
@echo "${B}${G}=> Cleanup old files ${R}" @echo "${B}${G} Cleanup old files ${R}"
@find . -type f -name '*.proto' -not -path './vendor/*' -not -name '*_test.proto' -exec rm {} \; @find . -type f -name '*.proto' -not -path './vendor/*' -not -name '*_test.proto' -exec rm {} \;
@echo "${B}${G}=> NeoFS Proto files ${R}" @echo "${B}${G} NeoFS Proto files ${R}"
@mkdir -p ./vendor/proto @mkdir -p ./vendor/proto
@curl -sL -o ./vendor/proto.tar.gz $(PROTO_URL) @curl -sL -o ./vendor/proto.tar.gz $(PROTO_URL)
@tar -xzf ./vendor/proto.tar.gz --strip-components 1 -C ./vendor/proto @tar -xzf ./vendor/proto.tar.gz --strip-components 1 -C ./vendor/proto
@ -24,7 +24,7 @@ deps:
cp $$f/*.proto ./$$(basename $$f); \ cp $$f/*.proto ./$$(basename $$f); \
done done
@echo "${B}${G}=> Cleanup ${R}" @echo "${B}${G} Cleanup ${R}"
@rm -rf ./vendor/proto @rm -rf ./vendor/proto
@rm -rf ./vendor/proto.tar.gz @rm -rf ./vendor/proto.tar.gz
@ -48,14 +48,14 @@ docgen: deps
# Regenerate proto files: # Regenerate proto files:
protoc: deps protoc: deps
@echo "${B}${G}=> Cleanup old files ${R}" @echo "${B}${G} Cleanup old files ${R}"
@find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \; @find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \;
@echo "${B}${G}=> Install specific version for gogo-proto ${R}" @echo "${B}${G} Install specific version for gogo-proto ${R}"
@go list -f '{{.Path}}/...@{{.Version}}' -m github.com/gogo/protobuf | xargs go get -v @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/gogo/protobuf | xargs go get -v
@echo "${B}${G}=> Install specific version for protobuf lib ${R}" @echo "${B}${G} Install specific version for protobuf lib ${R}"
@go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v
@echo "${B}${G}=> Protoc generate ${R}" @echo "${B}${G} Protoc generate ${R}"
@for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \
echo "${B}${G}⇒ Processing $$f ${R}"; \ echo "${B}${G}⇒ Processing $$f ${R}"; \
protoc \ protoc \

View file

@ -8,6 +8,8 @@
- [Status](#state.Status) - [Status](#state.Status)
- Messages - Messages
- [ChangeStateRequest](#state.ChangeStateRequest)
- [ChangeStateResponse](#state.ChangeStateResponse)
- [DumpRequest](#state.DumpRequest) - [DumpRequest](#state.DumpRequest)
- [DumpResponse](#state.DumpResponse) - [DumpResponse](#state.DumpResponse)
- [DumpVarsRequest](#state.DumpVarsRequest) - [DumpVarsRequest](#state.DumpVarsRequest)
@ -34,7 +36,8 @@
<a name="state.Status"></a> <a name="state.Status"></a>
### Service "state.Status" ### Service "state.Status"
Status service provides node's healthcheck and status info Status service provides node's healthcheck and status info.
TODO: decide how to describe auth and were contains permissions.
``` ```
rpc Netmap(NetmapRequest) returns (.bootstrap.SpreadMap); rpc Netmap(NetmapRequest) returns (.bootstrap.SpreadMap);
@ -42,6 +45,7 @@ rpc Metrics(MetricsRequest) returns (MetricsResponse);
rpc HealthCheck(HealthRequest) returns (HealthResponse); rpc HealthCheck(HealthRequest) returns (HealthResponse);
rpc DumpConfig(DumpRequest) returns (DumpResponse); rpc DumpConfig(DumpRequest) returns (DumpResponse);
rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse);
rpc ChangeState(ChangeStateRequest) returns (ChangeStateResponse);
``` ```
@ -85,9 +89,38 @@ The request should be signed.
| Name | Input | Output | | Name | Input | Output |
| ---- | ----- | ------ | | ---- | ----- | ------ |
| DumpVars | [DumpVarsRequest](#state.DumpVarsRequest) | [DumpVarsResponse](#state.DumpVarsResponse) | | DumpVars | [DumpVarsRequest](#state.DumpVarsRequest) | [DumpVarsResponse](#state.DumpVarsResponse) |
#### Method ChangeState
ChangeState allows to change current node state of node.
To permit access, used server config options.
The request should be signed.
| Name | Input | Output |
| ---- | ----- | ------ |
| ChangeState | [ChangeStateRequest](#state.ChangeStateRequest) | [ChangeStateResponse](#state.ChangeStateResponse) |
<!-- end services --> <!-- end services -->
<a name="state.ChangeStateRequest"></a>
### Message ChangeStateRequest
ChangeStateRequest contains a new state of node.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| state | [ChangeStateRequest.State](#state.ChangeStateRequest.State) | | State is a new state of node. |
| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) |
| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) |
<a name="state.ChangeStateResponse"></a>
### Message ChangeStateResponse
ChangeStateResponse is an empty response, that returns when RPC invoked without errors.
<a name="state.DumpRequest"></a> <a name="state.DumpRequest"></a>
### Message DumpRequest ### Message DumpRequest
@ -198,6 +231,19 @@ NetmapRequest message to request current node netmap
<!-- end messages --> <!-- end messages -->
<a name="state.ChangeStateRequest.State"></a>
### ChangeStateRequest.State
| Name | Number | Description |
| ---- | ------ | ----------- |
| Unknown | 0 | Unknown is default value. Does nothing. |
| Online | 1 | Online used when need to set node to the online state. |
| Offline | 2 | Offline used when need to set node to the offline state. |
<!-- end enums --> <!-- end enums -->

Binary file not shown.

View file

@ -10,7 +10,8 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true; option (gogoproto.stable_marshaler_all) = true;
// Status service provides node's healthcheck and status info // Status service provides node's healthcheck and status info.
// TODO: decide how to describe auth and were contains permissions.
service Status { service Status {
// Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap)
rpc Netmap(NetmapRequest) returns (bootstrap.SpreadMap); rpc Netmap(NetmapRequest) returns (bootstrap.SpreadMap);
@ -27,6 +28,10 @@ service Status {
// To permit access, used server config options. // To permit access, used server config options.
// The request should be signed. // The request should be signed.
rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse);
// ChangeState allows to change current node state of node.
// To permit access, used server config options.
// The request should be signed.
rpc ChangeState(ChangeStateRequest) returns (ChangeStateResponse);
} }
// NetmapRequest message to request current node netmap // NetmapRequest message to request current node netmap
@ -95,3 +100,25 @@ message DumpVarsRequest {
message DumpVarsResponse { message DumpVarsResponse {
bytes Variables = 1; bytes Variables = 1;
} }
// ChangeStateRequest contains a new state of node.
message ChangeStateRequest {
enum State {
// Unknown is default value. Does nothing.
Unknown = 0;
// Online used when need to set node to the online state.
Online = 1;
// Offline used when need to set node to the offline state.
Offline = 2;
}
// State is a new state of node.
State state = 1;
// RequestMetaHeader contains information about request meta headers (should be embedded into message)
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
}
// ChangeStateResponse is an empty response, that returns when RPC invoked without errors.
message ChangeStateResponse {}