From 46942282e5412f6837675bb56b5c737a6ac37466 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 20 Apr 2020 13:53:56 +0300 Subject: [PATCH 1/4] make: update to NeoFS API v0.7.1 --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 0caa683..29f41bc 100644 --- a/Makefile +++ b/Makefile @@ -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 B=\033[0;1m @@ -9,14 +9,14 @@ R=\033[0m # Dependencies deps: - @echo "${B}${G}=> Golang modules ${R}" + @echo "${B}${G}⇒ Golang modules ${R}" @go mod tidy -v @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 {} \; - @echo "${B}${G}=> NeoFS Proto files ${R}" + @echo "${B}${G}⇒ NeoFS Proto files ${R}" @mkdir -p ./vendor/proto @curl -sL -o ./vendor/proto.tar.gz $(PROTO_URL) @tar -xzf ./vendor/proto.tar.gz --strip-components 1 -C ./vendor/proto @@ -24,7 +24,7 @@ deps: cp $$f/*.proto ./$$(basename $$f); \ done - @echo "${B}${G}=> Cleanup ${R}" + @echo "${B}${G}⇒ Cleanup ${R}" @rm -rf ./vendor/proto @rm -rf ./vendor/proto.tar.gz @@ -48,14 +48,14 @@ docgen: deps # Regenerate proto files: 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 {} \; - @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 - @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 - @echo "${B}${G}=> Protoc generate ${R}" + @echo "${B}${G}⇒ Protoc generate ${R}" @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ echo "${B}${G}⇒ Processing $$f ${R}"; \ protoc \ From bef32abb9ca601347d168241f16b8b183ee781b4 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 20 Apr 2020 13:54:34 +0300 Subject: [PATCH 2/4] proto: regenerate files --- state/service.pb.go | Bin 62254 -> 75369 bytes state/service.proto | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/state/service.pb.go b/state/service.pb.go index 4c7db88a496621662c50e4b4518cae4a5fa2d645..187949bb3d221ca977353c12963e8d9f5680dc54 100644 GIT binary patch delta 6537 zcmb_gTaO$^6;^zSnTZ22YsYaClA0wkGk96|Wp2G>QIH`QVzR*(;mA04Pj|I<;@zJ0 zOs{v0v$T-l0VP33EgUJ~<`+OnAfgcpFT^qth=&LP5sx7IAyG`E06&13s_!d1-QHc` zftOKNb)EXo`ObGv)%4HaT7TvB4L|?M`ZPJcAjO_pKRzz^Cw?OL$&-t6kQ~K8bmPQz z%H^OJ4-!!=mv-+K2jdfQZz&etfe2;fFU}?6ls~s9C&g!aavowJtaLckcq+wrG8FkrRZ_tK>NNrsM+d$%sgb8 zNHHyJVn)&b3TjsVCsea!by%P}aNBD|XM6OV*Sa zH*}6qluNc6GEhBo^oS0q;c|IxkXX@n6!|kS1ULdT1#=x^N?2;+YZy~P*ccj+Dd7Mo zT8slx9j+Nrc6syIY`N5z$znei3;kZwoBV9NIRChcv$_^lU}1tJnE*PHJqa(*E> zJ$`KT?zX4b-I6oQF5V}0<;JGO&n$~&!{fa8c3nL z{nZ_h6;@x~^lD-J&Q9;cIW*%N(d;P&m$z?C!HkRE~`$i%D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6#Fr@5AMbdIAaSJ%p!K#6 z5U0s{qcxuqTJ?dMH4W7k(AEnl(Xw+_E~0cjrfc@}z_bi)%F5el%ZPRuI8|TMKSkI# zB}zG!Pymt%gBm1^{5n}Ng)`3&OcXzZ$pudka?U{^Gn6o4oE zq>Giiw}`6bWQ3)Twq)PptVlv}OPp4^naxh)=fQu052%l(Y0qr)(JVBpoe27YZ=l&P z*2yAq_DzoxPc_t}=l4YIYcDc6!sG(Q!d-%}OfKy8gmyQ3t3rlRJt>0MyFv}ZpijsD zQ6xr?q+VjYjY6Ukwd~c1RIeyR+fM;}@pfN1|9<&VN9hx#OSI30Uk=~S2{LMB&3fgD%U@PnZp7LZX8 zpx{uAcwl7jLCH^=-Ym}X=a*_w*HUIbTPGUdbZbskrQU8U7kY194^)0pe1qe+BnEi* z)KieQ=-O>Nhfm*YviFfSKkpsY(|_+Ck6t|e{Q1idUVD7=A0s;}-~a#s diff --git a/state/service.proto b/state/service.proto index bebc913..410a000 100644 --- a/state/service.proto +++ b/state/service.proto @@ -10,7 +10,8 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto"; 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 { // Netmap request allows to receive current [bootstrap.SpreadMap](bootstrap.md#bootstrap.SpreadMap) rpc Netmap(NetmapRequest) returns (bootstrap.SpreadMap); @@ -27,6 +28,10 @@ service Status { // To permit access, used server config options. // The request should be signed. 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 @@ -95,3 +100,25 @@ message DumpVarsRequest { message DumpVarsResponse { 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 {} \ No newline at end of file From e03b922dd4947e13bd93a2e005f79aeeaf56ae2f Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 20 Apr 2020 13:54:49 +0300 Subject: [PATCH 3/4] docs: regenerate files --- docs/state.md | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/state.md b/docs/state.md index 2b3de4a..3b7b89d 100644 --- a/docs/state.md +++ b/docs/state.md @@ -8,6 +8,8 @@ - [Status](#state.Status) - Messages + - [ChangeStateRequest](#state.ChangeStateRequest) + - [ChangeStateResponse](#state.ChangeStateResponse) - [DumpRequest](#state.DumpRequest) - [DumpResponse](#state.DumpResponse) - [DumpVarsRequest](#state.DumpVarsRequest) @@ -34,7 +36,8 @@ ### 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); @@ -42,6 +45,7 @@ rpc Metrics(MetricsRequest) returns (MetricsResponse); rpc HealthCheck(HealthRequest) returns (HealthResponse); rpc DumpConfig(DumpRequest) returns (DumpResponse); rpc DumpVars(DumpVarsRequest) returns (DumpVarsResponse); +rpc ChangeState(ChangeStateRequest) returns (ChangeStateResponse); ``` @@ -85,9 +89,38 @@ The request should be signed. | Name | Input | Output | | ---- | ----- | ------ | | 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) | + + +### 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) | + + + + +### Message ChangeStateResponse +ChangeStateResponse is an empty response, that returns when RPC invoked without errors. + + + ### Message DumpRequest @@ -198,6 +231,19 @@ NetmapRequest message to request current node netmap + + + +### 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. | + + From 91e0b2699d8c7d329ba3a198fb84546584008eca Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Mon, 20 Apr 2020 14:03:24 +0300 Subject: [PATCH 4/4] CHANGELOG --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d96a2eb..14b7a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Changelog This is the changelog for NeoFS-API-Go +## [0.7.1] - 2020-04-20 + +### Added + +- Method to change current node state. (`state.ChangeState`) + +### Updated + +- NeoFS API v0.7.1 + ## [0.7.0] - 2020-04-16 ### Updated @@ -262,3 +272,4 @@ Initial public release [0.6.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.0...v0.6.1 [0.6.2]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.1...v0.6.2 [0.7.0]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.6.2...v0.7.0 +[0.7.1]: https://github.com/nspcc-dev/neofs-api-go/compare/v0.7.0...v0.7.1