forked from TrueCloudLab/frostfs-api-go
Merge pull request #40 from nspcc-dev/prepare-for-separated-proto-lib
Use separated proto repository
This commit is contained in:
commit
048cd413cf
72 changed files with 134 additions and 108 deletions
26
CHANGELOG.md
26
CHANGELOG.md
|
@ -111,16 +111,16 @@ associated with owner id
|
||||||
|
|
||||||
Initial public release
|
Initial public release
|
||||||
|
|
||||||
[0.2.0]: https://github.com/nspcc-dev/neofs-proto/compare/v0.1.0...v0.2.0
|
[0.2.0]: https://github.com/nspcc-dev/neofs-api/compare/v0.1.0...v0.2.0
|
||||||
[0.2.1]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.0...v0.2.1
|
[0.2.1]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.0...v0.2.1
|
||||||
[0.2.2]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.1...v0.2.2
|
[0.2.2]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.1...v0.2.2
|
||||||
[0.2.3]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.2...v0.2.3
|
[0.2.3]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.2...v0.2.3
|
||||||
[0.2.4]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.3...v0.2.4
|
[0.2.4]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.3...v0.2.4
|
||||||
[0.2.5]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.4...v0.2.5
|
[0.2.5]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.4...v0.2.5
|
||||||
[0.2.6]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.5...v0.2.6
|
[0.2.6]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.5...v0.2.6
|
||||||
[0.2.7]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.6...v0.2.7
|
[0.2.7]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.6...v0.2.7
|
||||||
[0.2.8]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.7...v0.2.8
|
[0.2.8]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.7...v0.2.8
|
||||||
[0.2.9]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.8...v0.2.9
|
[0.2.9]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.8...v0.2.9
|
||||||
[0.2.10]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.9...v0.2.10
|
[0.2.10]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.9...v0.2.10
|
||||||
[0.2.11]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.10...v0.2.11
|
[0.2.11]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.10...v0.2.11
|
||||||
[0.2.12]: https://github.com/nspcc-dev/neofs-proto/compare/v0.2.11...v0.2.12
|
[0.2.12]: https://github.com/nspcc-dev/neofs-api/compare/v0.2.11...v0.2.12
|
||||||
|
|
39
Makefile
39
Makefile
|
@ -1,7 +1,34 @@
|
||||||
|
PROTO_VERSION=master
|
||||||
|
PROTO_URL=https://bitbucket.org/nspcc-dev/neofs-proto/get/$(PROTO_VERSION).tar.gz
|
||||||
|
|
||||||
B=\033[0;1m
|
B=\033[0;1m
|
||||||
G=\033[0;92m
|
G=\033[0;92m
|
||||||
R=\033[0m
|
R=\033[0m
|
||||||
|
|
||||||
|
.PHONY: deps format docgen protoc
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
deps:
|
||||||
|
@echo "${B}${G}=> Golang modules ${R}"
|
||||||
|
@go mod tidy -v
|
||||||
|
@go mod vendor
|
||||||
|
|
||||||
|
@echo "${B}${G}=> Cleanup old files ${R}"
|
||||||
|
@find . -type f -name '*.pb.go' -not -path './vendor/*' -exec rm {} \;
|
||||||
|
@find . -type f -name '*.proto' -not -path './vendor/*' -not -name '*_test.proto' -exec rm {} \;
|
||||||
|
|
||||||
|
@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
|
||||||
|
@for f in `find ./vendor/proto -type f -name '*.proto' -exec dirname {} \; | sort -u `; do \
|
||||||
|
cp $$f/*.proto ./$$(basename $$f); \
|
||||||
|
done
|
||||||
|
|
||||||
|
@echo "${B}${G}=> Cleanup ${R}"
|
||||||
|
@rm -rf ./vendor/proto
|
||||||
|
@rm -rf ./vendor/proto.tar.gz
|
||||||
|
|
||||||
# Reformat code
|
# Reformat code
|
||||||
format:
|
format:
|
||||||
@[ ! -z `which goimports` ] || (echo "install goimports" && exit 2)
|
@[ ! -z `which goimports` ] || (echo "install goimports" && exit 2)
|
||||||
|
@ -11,7 +38,7 @@ format:
|
||||||
done
|
done
|
||||||
|
|
||||||
# Regenerate documentation for protot files:
|
# Regenerate documentation for protot files:
|
||||||
docgen:
|
docgen: deps
|
||||||
@for f in `find . -type f -name '*.proto' -not -path './vendor/*' -exec dirname {} \; | sort -u `; do \
|
@for f in `find . -type f -name '*.proto' -not -path './vendor/*' -exec dirname {} \; | sort -u `; do \
|
||||||
echo "${B}${G}⇒ Documentation for $$(basename $$f) ${R}"; \
|
echo "${B}${G}⇒ Documentation for $$(basename $$f) ${R}"; \
|
||||||
protoc \
|
protoc \
|
||||||
|
@ -21,14 +48,12 @@ docgen:
|
||||||
done
|
done
|
||||||
|
|
||||||
# Regenerate proto files:
|
# Regenerate proto files:
|
||||||
protoc:
|
protoc: deps
|
||||||
@go mod tidy -v
|
@echo "${B}${G}=> Install specific version for gogo-proto ${R}"
|
||||||
@go mod vendor
|
|
||||||
# Install specific version for gogo-proto
|
|
||||||
@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
|
||||||
# Install specific version for protobuf lib
|
@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
|
||||||
# Protoc generate
|
@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 \
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package accounting
|
package accounting
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/nspcc-dev/neofs-proto/decimal"
|
"github.com/nspcc-dev/neofs-api/decimal"
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package accounting;
|
package accounting;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/accounting";
|
option go_package = "github.com/nspcc-dev/neofs-api/accounting";
|
||||||
|
|
||||||
import "service/meta.proto";
|
import "service/meta.proto";
|
||||||
import "service/verify.proto";
|
import "service/verify.proto";
|
||||||
|
|
|
@ -7,11 +7,11 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
|
"github.com/nspcc-dev/neofs-api/chain"
|
||||||
|
"github.com/nspcc-dev/neofs-api/decimal"
|
||||||
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-proto/chain"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/decimal"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package accounting;
|
package accounting;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/accounting";
|
option go_package = "github.com/nspcc-dev/neofs-api/accounting";
|
||||||
|
|
||||||
import "decimal/decimal.proto";
|
import "decimal/decimal.proto";
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
@ -85,7 +85,7 @@ message Tx {
|
||||||
|
|
||||||
message Settlement {
|
message Settlement {
|
||||||
message Receiver {
|
message Receiver {
|
||||||
// To is the address of funds recipient
|
// To is the address of funds recipient
|
||||||
string To = 1;
|
string To = 1;
|
||||||
// Amount is the amount of funds that will be sent
|
// Amount is the amount of funds that will be sent
|
||||||
decimal.Decimal Amount = 2;
|
decimal.Decimal Amount = 2;
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
|
"github.com/nspcc-dev/neofs-api/chain"
|
||||||
|
"github.com/nspcc-dev/neofs-api/decimal"
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
"github.com/nspcc-dev/neofs-crypto/test"
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/nspcc-dev/neofs-proto/chain"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/decimal"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func TestCheque(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("marshal/unmarshal", func(t *testing.T) {
|
t.Run("marshal/unmarshal", func(t *testing.T) {
|
||||||
var b2 = new(Cheque)
|
b2 := new(Cheque)
|
||||||
|
|
||||||
key1 := test.DecodeKey(0)
|
key1 := test.DecodeKey(0)
|
||||||
key2 := test.DecodeKey(1)
|
key2 := test.DecodeKey(1)
|
||||||
|
@ -67,7 +67,7 @@ func TestCheque(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("example from SC", func(t *testing.T) {
|
t.Run("example from SC", func(t *testing.T) {
|
||||||
var pathToCheque = "fixtures/cheque_data"
|
pathToCheque := "fixtures/cheque_data"
|
||||||
expect, err := ioutil.ReadFile(pathToCheque)
|
expect, err := ioutil.ReadFile(pathToCheque)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package accounting
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package accounting;
|
package accounting;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/accounting";
|
option go_package = "github.com/nspcc-dev/neofs-api/accounting";
|
||||||
|
|
||||||
import "service/meta.proto";
|
import "service/meta.proto";
|
||||||
import "service/verify.proto";
|
import "service/verify.proto";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package bootstrap
|
package bootstrap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/nspcc-dev/neofs-proto/service"
|
"github.com/nspcc-dev/neofs-api/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NodeType type alias.
|
// NodeType type alias.
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package bootstrap;
|
package bootstrap;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap";
|
option go_package = "github.com/nspcc-dev/neofs-api/bootstrap";
|
||||||
|
|
||||||
import "service/meta.proto";
|
import "service/meta.proto";
|
||||||
import "service/verify.proto";
|
import "service/verify.proto";
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/nspcc-dev/neofs-proto/object"
|
"github.com/nspcc-dev/neofs-api/object"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package bootstrap;
|
package bootstrap;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap";
|
option go_package = "github.com/nspcc-dev/neofs-api/bootstrap";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/crypto/ripemd160"
|
"golang.org/x/crypto/ripemd160"
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package container;
|
package container;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/container";
|
option go_package = "github.com/nspcc-dev/neofs-api/container";
|
||||||
|
|
||||||
import "service/meta.proto";
|
import "service/meta.proto";
|
||||||
import "service/verify.proto";
|
import "service/verify.proto";
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
"github.com/nspcc-dev/neofs-crypto/test"
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/nspcc-dev/netmap"
|
"github.com/nspcc-dev/netmap"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package container;
|
package container;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/container";
|
option go_package = "github.com/nspcc-dev/neofs-api/container";
|
||||||
|
|
||||||
import "github.com/nspcc-dev/netmap/selector.proto";
|
import "github.com/nspcc-dev/netmap/selector.proto";
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
"github.com/nspcc-dev/neofs-crypto/test"
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/nspcc-dev/netmap"
|
"github.com/nspcc-dev/netmap"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package decimal;
|
package decimal;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/decimal";
|
option go_package = "github.com/nspcc-dev/neofs-api/decimal";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/nspcc-dev/neofs-proto
|
module github.com/nspcc-dev/neofs-api
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
"github.com/nspcc-dev/tzhash/tz"
|
"github.com/nspcc-dev/tzhash/tz"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
@ -70,7 +70,7 @@ func (h Hash) Verify(data []byte) bool { return h.Equal(Sum(data)) }
|
||||||
|
|
||||||
// Validate checks if combined hashes are equal to current Hash.
|
// Validate checks if combined hashes are equal to current Hash.
|
||||||
func (h Hash) Validate(hashes []Hash) bool {
|
func (h Hash) Validate(hashes []Hash) bool {
|
||||||
var hashBytes = make([][]byte, 0, len(hashes))
|
hashBytes := make([][]byte, 0, len(hashes))
|
||||||
for i := range hashes {
|
for i := range hashes {
|
||||||
hashBytes = append(hashBytes, hashes[i].Bytes())
|
hashBytes = append(hashBytes, hashes[i].Bytes())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package object
|
package object
|
||||||
|
|
||||||
// todo: all extensions must be transferred to the separate util library
|
// todo: all extensions must be transferred to the separate util library
|
||||||
|
|
||||||
import "github.com/nspcc-dev/neofs-proto/storagegroup"
|
import "github.com/nspcc-dev/neofs-api/storagegroup"
|
||||||
|
|
||||||
// IsLinking checks if object has children links to another objects.
|
// IsLinking checks if object has children links to another objects.
|
||||||
// We have to check payload size because zero-object must have zero
|
// We have to check payload size because zero-object must have zero
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package object
|
package object
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/nspcc-dev/neofs-proto/hash"
|
"github.com/nspcc-dev/neofs-api/hash"
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
"github.com/nspcc-dev/neofs-proto/service"
|
"github.com/nspcc-dev/neofs-api/service"
|
||||||
"github.com/nspcc-dev/neofs-proto/session"
|
"github.com/nspcc-dev/neofs-api/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package object;
|
package object;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/object";
|
option go_package = "github.com/nspcc-dev/neofs-api/object";
|
||||||
|
|
||||||
import "refs/types.proto";
|
import "refs/types.proto";
|
||||||
import "object/types.proto";
|
import "object/types.proto";
|
||||||
|
|
|
@ -3,8 +3,8 @@ package object
|
||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
"github.com/nspcc-dev/neofs-proto/storagegroup"
|
"github.com/nspcc-dev/neofs-api/storagegroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Here are defined getter functions for objects that contain storage group
|
// Here are defined getter functions for objects that contain storage group
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-proto/hash"
|
"github.com/nspcc-dev/neofs-api/hash"
|
||||||
"github.com/nspcc-dev/neofs-proto/storagegroup"
|
"github.com/nspcc-dev/neofs-api/storagegroup"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
"github.com/nspcc-dev/neofs-proto/session"
|
"github.com/nspcc-dev/neofs-api/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package object;
|
package object;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/object";
|
option go_package = "github.com/nspcc-dev/neofs-api/object";
|
||||||
|
|
||||||
import "refs/types.proto";
|
import "refs/types.proto";
|
||||||
import "session/types.proto";
|
import "session/types.proto";
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-proto/session"
|
"github.com/nspcc-dev/neofs-api/session"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,10 @@ func (m Object) Verify() error {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
checksum []byte
|
checksum []byte
|
||||||
pubkey []byte
|
pubkey []byte
|
||||||
)
|
)
|
||||||
ind, ih := m.LastHeader(HeaderType(IntegrityHdr))
|
ind, ih := m.LastHeader(HeaderType(IntegrityHdr))
|
||||||
if ih == nil || ind != len(m.Headers) - 1{
|
if ih == nil || ind != len(m.Headers)-1 {
|
||||||
return ErrHeaderNotFound
|
return ErrHeaderNotFound
|
||||||
}
|
}
|
||||||
integrity := ih.Value.(*Header_Integrity).Integrity
|
integrity := ih.Value.(*Header_Integrity).Integrity
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"github.com/nspcc-dev/neofs-api/container"
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
|
"github.com/nspcc-dev/neofs-api/session"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-crypto/test"
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/nspcc-dev/neofs-proto/container"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/session"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -128,7 +128,6 @@ func TestObject_Verify(t *testing.T) {
|
||||||
// re-sign object
|
// re-sign object
|
||||||
obj.Sign(sessionkey)
|
obj.Sign(sessionkey)
|
||||||
|
|
||||||
|
|
||||||
t.Run("incorrect with bad public key", func(t *testing.T) {
|
t.Run("incorrect with bad public key", func(t *testing.T) {
|
||||||
err = obj.Verify()
|
err = obj.Verify()
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package query;
|
package query;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/query";
|
option go_package = "github.com/nspcc-dev/neofs-api/query";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
|
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
"github.com/nspcc-dev/neofs-proto/chain"
|
"github.com/nspcc-dev/neofs-api/chain"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/nspcc-dev/neofs-proto/chain"
|
"github.com/nspcc-dev/neofs-api/chain"
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
BIN
refs/types.pb.go
BIN
refs/types.pb.go
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package refs;
|
package refs;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/refs";
|
option go_package = "github.com/nspcc-dev/neofs-api/refs";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
@ -94,7 +94,7 @@ func IRNonForwarding(role NodeRole) TTLCondition {
|
||||||
|
|
||||||
// ProcessRequestTTL validates and update ttl requests.
|
// ProcessRequestTTL validates and update ttl requests.
|
||||||
func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error {
|
func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error {
|
||||||
var ttl = req.GetTTL()
|
ttl := req.GetTTL()
|
||||||
|
|
||||||
if ttl == ZeroTTL {
|
if ttl == ZeroTTL {
|
||||||
return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err()
|
return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err()
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package service;
|
package service;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/service";
|
option go_package = "github.com/nspcc-dev/neofs-api/service";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package service;
|
package service;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/service";
|
option go_package = "github.com/nspcc-dev/neofs-api/service";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-crypto/test"
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package service;
|
package service;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/service";
|
option go_package = "github.com/nspcc-dev/neofs-api/service";
|
||||||
|
|
||||||
import "service/meta.proto";
|
import "service/meta.proto";
|
||||||
import "service/verify.proto";
|
import "service/verify.proto";
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package session;
|
package session;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/session";
|
option go_package = "github.com/nspcc-dev/neofs-api/session";
|
||||||
|
|
||||||
import "session/types.proto";
|
import "session/types.proto";
|
||||||
import "service/meta.proto";
|
import "service/meta.proto";
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type simpleStore struct {
|
type simpleStore struct {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ func TestTokenStore(t *testing.T) {
|
||||||
|
|
||||||
// create new token
|
// create new token
|
||||||
token := s.New(TokenParams{
|
token := s.New(TokenParams{
|
||||||
ObjectID: []ObjectID{oid},
|
ObjectID: []ObjectID{oid},
|
||||||
OwnerID: c.OwnerID,
|
OwnerID: c.OwnerID,
|
||||||
PublicKeys: pk,
|
PublicKeys: pk,
|
||||||
})
|
})
|
||||||
signToken(t, token, c)
|
signToken(t, token, c)
|
||||||
|
@ -74,9 +74,10 @@ func TestTokenStore(t *testing.T) {
|
||||||
|
|
||||||
// create and sign another token by the same client
|
// create and sign another token by the same client
|
||||||
t1 = s.New(TokenParams{
|
t1 = s.New(TokenParams{
|
||||||
ObjectID: []ObjectID{oid},
|
ObjectID: []ObjectID{oid},
|
||||||
OwnerID: c.OwnerID,
|
OwnerID: c.OwnerID,
|
||||||
PublicKeys: pk})
|
PublicKeys: pk,
|
||||||
|
})
|
||||||
|
|
||||||
signToken(t, t1, c)
|
signToken(t, t1, c)
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neofs-api/chain"
|
||||||
|
"github.com/nspcc-dev/neofs-api/internal"
|
||||||
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||||
"github.com/nspcc-dev/neofs-proto/chain"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/internal"
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ func (m *Token) Sign(key *ecdsa.PrivateKey) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPublicKeys sets owner's public keys to the token
|
// SetPublicKeys sets owner's public keys to the token
|
||||||
func (m *Token) SetPublicKeys(keys... *ecdsa.PublicKey) {
|
func (m *Token) SetPublicKeys(keys ...*ecdsa.PublicKey) {
|
||||||
m.PublicKeys = m.PublicKeys[:0]
|
m.PublicKeys = m.PublicKeys[:0]
|
||||||
for i := range keys {
|
for i := range keys {
|
||||||
m.PublicKeys = append(m.PublicKeys, crypto.MarshalPublicKey(keys[i]))
|
m.PublicKeys = append(m.PublicKeys, crypto.MarshalPublicKey(keys[i]))
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package session;
|
package session;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/session";
|
option go_package = "github.com/nspcc-dev/neofs-api/session";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package state;
|
package state;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/state";
|
option go_package = "github.com/nspcc-dev/neofs-api/state";
|
||||||
|
|
||||||
import "service/meta.proto";
|
import "service/meta.proto";
|
||||||
import "service/verify.proto";
|
import "service/verify.proto";
|
||||||
|
|
|
@ -3,7 +3,7 @@ package storagegroup
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"github.com/mr-tron/base58"
|
"github.com/mr-tron/base58"
|
||||||
"github.com/nspcc-dev/neofs-proto/hash"
|
"github.com/nspcc-dev/neofs-api/hash"
|
||||||
"github.com/nspcc-dev/neofs-proto/refs"
|
"github.com/nspcc-dev/neofs-api/refs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package storagegroup;
|
package storagegroup;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-proto/storagegroup";
|
option go_package = "github.com/nspcc-dev/neofs-api/storagegroup";
|
||||||
|
|
||||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue