diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.forgejo/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.md rename to .forgejo/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.forgejo/ISSUE_TEMPLATE/config.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/config.yml rename to .forgejo/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.forgejo/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from .github/ISSUE_TEMPLATE/feature_request.md rename to .forgejo/ISSUE_TEMPLATE/feature_request.md diff --git a/.forgejo/workflows/codegen.yml b/.forgejo/workflows/codegen.yml new file mode 100644 index 00000000..521f7f7a --- /dev/null +++ b/.forgejo/workflows/codegen.yml @@ -0,0 +1,22 @@ +name: Code generation +on: [pull_request] + +jobs: + wrappers: + name: Generate proto + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.23' + - name: Generate proto + run: make protoc + # The command seems to be non-deterministic. + # However, with >20 runs I haven't been able to reproduce the issue. + # This `git diff` is here to print diff in case we catch the behaviour again. + - name: Print diff + run: git diff HEAD + - name: Check that nothing has changed + run: git diff-index --exit-code HEAD diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml index a5614a5a..89a6face 100644 --- a/.forgejo/workflows/dco.yml +++ b/.forgejo/workflows/dco.yml @@ -13,9 +13,9 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: '1.21' + go-version: '1.23' - name: Run commit format checker - uses: https://git.frostfs.info/TrueCloudLab/dco-go@v2 + uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3 with: from: 'origin/${{ github.event.pull_request.base.ref }}' diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index 946e6854..c4cb72ad 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.21' + go-version: '1.23' cache: true - name: Install linters @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go_versions: [ '1.20', '1.21' ] + go_versions: [ '1.22', '1.23' ] fail-fast: false steps: - uses: actions/checkout@v3 diff --git a/.gitattributes b/.gitattributes index b371347c..f7ff250c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,6 @@ /pkg/policy/parser/generate.go diff **/*.interp -diff **/*.tokens -diff +/**/*.pb.go -diff -merge +/**/*.pb.go linguist-generated=true +/go.sum -diff diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index c9344451..00000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @TrueCloudLab/storage-core @TrueCloudLab/storage-services diff --git a/.gitignore b/.gitignore index 56593076..bf9e06c3 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,7 @@ coverage.txt coverage.html # antlr tool jar -antlr-*.jar +antlr*.jar # tempfiles .cache diff --git a/.gitlint b/.gitlint deleted file mode 100644 index a1bb93d0..00000000 --- a/.gitlint +++ /dev/null @@ -1,10 +0,0 @@ -[general] -fail-without-commits=true -contrib=CC1 - -[title-match-regex] -regex=^\[\#[0-9Xx]+\]\s - -[ignore-by-title] -regex=^Release(.*) -ignore=title-match-regex diff --git a/.golangci.yml b/.golangci.yml index aca07466..95a6fdc1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,7 +12,8 @@ run: # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: tab + formats: + - format: tab # all available settings of specific linters linters-settings: @@ -51,7 +52,7 @@ linters: - bidichk - durationcheck - exhaustive - - exportloopref + - copyloopvar - gofmt - goimports - misspell @@ -62,5 +63,7 @@ linters: - funlen - gocognit - contextcheck + - protogetter + - intrange disable-all: true fast: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f7f66f14..0c5b130e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,13 +18,19 @@ repos: - id: end-of-file-fixer exclude: "(.key|.interp|.tokens)$" - - repo: https://github.com/golangci/golangci-lint - rev: v1.51.2 + - repo: local hooks: - - id: golangci-lint + - id: go-unit-tests + name: go unit tests + entry: make test GOFLAGS='' + pass_filenames: false + types: [go] + language: system - - repo: https://github.com/jorisroovers/gitlint - rev: v0.18.0 + - repo: local hooks: - - id: gitlint - stages: [commit-msg] + - id: make-lint + name: Run Make Lint + entry: make lint + language: system + pass_filenames: false diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000..f1641739 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,3 @@ +.* @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-services-committers @TrueCloudLab/storage-services-developers +.forgejo/.* @potyarkin +Makefile @potyarkin diff --git a/Dockerfile b/Dockerfile index a4cfb15a..8c1ae08d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21 +FROM golang:1.22 -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install make openjdk-11-jre -y +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install make openjdk-17-jre -y WORKDIR /work diff --git a/Makefile b/Makefile index 84e18a95..27bff9bf 100755 --- a/Makefile +++ b/Makefile @@ -1,15 +1,84 @@ #!/usr/bin/make -f -ANTLR_VERSION="4.13.0" +ANTLR_VERSION=4.13.1 TMP_DIR := .cache -LINT_VERSION ?= 1.55.0 -TRUECLOUDLAB_LINT_VERSION ?= 0.0.2 +LINT_VERSION ?= 1.61.0 +TRUECLOUDLAB_LINT_VERSION ?= 0.0.7 OUTPUT_LINT_DIR ?= $(shell pwd)/bin LINT_DIR = $(OUTPUT_LINT_DIR)/golangci-lint-$(LINT_VERSION)-v$(TRUECLOUDLAB_LINT_VERSION) +PROTOC_VERSION ?= 29.2 +PROTOC_GEN_GO_VERSION ?= $(shell go list -f '{{.Version}}' -m google.golang.org/protobuf) +PROTOC_GEN_GRPC_GO_VERSION ?= 1.5.1 +PROTOC_OS_VERSION=osx-x86_64 +ifeq ($(shell uname), Linux) + PROTOC_OS_VERSION=linux-x86_64 +endif + +BIN = bin +PROTOBUF_DIR ?= $(abspath $(BIN))/protobuf +PROTOC_DIR ?= $(PROTOBUF_DIR)/protoc-v$(PROTOC_VERSION) +PROTOC_GEN_GO_DIR ?= $(PROTOBUF_DIR)/protoc-gen-go-$(PROTOC_GEN_GO_VERSION) + + +.PHONY: dep imports protoc test lint help $(BIN)/protogen protoc-test + # Run tests +test: GOFLAGS ?= "-cover -count=1" test: - @go test ./... -cover -count=1 + @GOFLAGS=$(GOFLAGS) go test ./... + +# Reformat imports +imports: + @echo "⇒ Processing goimports check" + @for f in `find . -type f -name '*.go' -not -name '*.pb.go' -prune`; do \ + goimports -w $$f; \ + done + +# Install protoc +protoc-install: + @rm -rf $(PROTOBUF_DIR) + @mkdir -p $(PROTOBUF_DIR) + @echo "⇒ Installing protoc... " + @wget -q -O $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip 'https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-$(PROTOC_OS_VERSION).zip' + @unzip -q -o $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip -d $(PROTOC_DIR) + @rm $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip + @echo "⇒ Installing protoc-gen-go..." + @GOBIN=$(PROTOC_GEN_GO_DIR) go install -v google.golang.org/protobuf/...@$(PROTOC_GEN_GO_VERSION) + @echo "⇒ Installing protoc-gen-go-grpc..." + @GOBIN=$(PROTOC_GEN_GO_DIR) go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@v$(PROTOC_GEN_GRPC_GO_VERSION) + + +# Regenerate code for proto files +protoc: + @if [ ! -d "$(PROTOC_DIR)" ] || [ ! -d "$(PROTOC_GEN_GO_DIR)" ]; then \ + make protoc-install; \ + fi + # Protoc generate + @for f in `find . -type f -name '*.proto' -not -path './bin/*'`; do \ + echo "⇒ Processing $$f "; \ + $(PROTOC_DIR)/bin/protoc \ + --plugin=protoc-gen-go=$(PROTOC_GEN_GO_DIR)/protoc-gen-go \ + --plugin=protoc-gen-go-grpc=$(PROTOC_GEN_GO_DIR)/protoc-gen-go-grpc \ + --go_out=. --go_opt=paths=source_relative \ + --go_opt=default_api_level=API_HYBRID \ + --go-grpc_opt=require_unimplemented_servers=false \ + --go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \ + done + +$(BIN)/protogen: + @go build -v -trimpath \ + -o $(BIN)/protogen \ + ./api/util/protogen + +protoc-test: protoc $(BIN)/protogen + @$(PROTOC_DIR)/bin/protoc \ + --go_out=. --go_opt=paths=source_relative \ + --plugin=protoc-gen-go-frostfs=$(abspath $(BIN)/protogen) \ + --go-frostfs_opt=Mapi/util/proto/test/test.proto=git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/test/custom \ + --go-frostfs_opt=module=git.frostfs.info/TrueCloudLab/frostfs-sdk-go \ + --go-frostfs_out=. --go-frostfs_opt=paths=import \ + ./api/util/proto/test/test.proto # Pull go dependencies dep: @@ -52,7 +121,8 @@ format: policy: @wget -q https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar -O antlr4-tool.jar - @java -Xmx500M -cp "`pwd`/antlr4-tool.jar" "org.antlr.v4.Tool" -o `pwd`/netmap/parser/ -Dlanguage=Go -no-listener -visitor `pwd`/netmap/parser/Query.g4 `pwd`/netmap/parser/QueryLexer.g4 + @java -Xmx500M -cp antlr4-tool.jar org.antlr.v4.Tool -Dlanguage=Go \ + -no-listener -visitor netmap/parser/Query.g4 netmap/parser/QueryLexer.g4 # Run `make %` in truecloudlab/frostfs-sdk-go container(Golang+Java) docker/%: @@ -76,3 +146,15 @@ help: @echo ' Targets:' @echo '' @awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u + +# Activate pre-commit hooks +pre-commit: + pre-commit install --hook-type pre-commit + +# Deactivate pre-commit hooks +unpre-commit: + pre-commit uninstall --hook-type pre-commit + +# Run pre-commit hooks +pre-commit-run: + @pre-commit run --all-files --hook-stage manual diff --git a/accounting/decimal.go b/accounting/decimal.go index bb01f289..b6d73863 100644 --- a/accounting/decimal.go +++ b/accounting/decimal.go @@ -1,10 +1,10 @@ package accounting -import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" +import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" // Decimal represents decimal number for accounting operations. // -// Decimal is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting.Decimal +// Decimal is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting.Decimal // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. diff --git a/accounting/decimal_test.go b/accounting/decimal_test.go index af46dd43..cdc6b699 100644 --- a/accounting/decimal_test.go +++ b/accounting/decimal_test.go @@ -3,8 +3,8 @@ package accounting_test import ( "testing" - v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting" + v2accounting "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" "github.com/stretchr/testify/require" ) diff --git a/accounting/doc.go b/accounting/doc.go index defcb0d3..d5a9bfb1 100644 --- a/accounting/doc.go +++ b/accounting/doc.go @@ -13,7 +13,7 @@ Instances can be also used to process FrostFS API V2 protocol messages On client side: - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" + import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" var msg accounting.Decimal dec.WriteToV2(&msg) diff --git a/ape/chain.go b/ape/chain.go new file mode 100644 index 00000000..5a5548d8 --- /dev/null +++ b/ape/chain.go @@ -0,0 +1,52 @@ +package ape + +import ( + "errors" + "fmt" + + apeV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" +) + +var ( + ErrInvalidChainRepresentation = errors.New("invalid chain representation") +) + +// ChainID is Chain's identifier. +type ChainID []byte + +// Chain is an SDK representation for v2's Chain. +// +// Note that Chain (as well as v2's Chain) and all related entities +// are NOT operated by Access-Policy-Engine (APE). The client is responsible +// to convert these types to policy-engine entities. +type Chain struct { + // Raw is the encoded chain kind. + // It assumes that Raw's bytes are the result of encoding provided by + // policy-engine package. + Raw []byte +} + +// ToV2 converts Chain to v2. +func (c *Chain) ToV2() *apeV2.Chain { + v2ct := new(apeV2.Chain) + + if c.Raw != nil { + v2Raw := new(apeV2.ChainRaw) + v2Raw.SetRaw(c.Raw) + v2ct.SetKind(v2Raw) + } + + return v2ct +} + +// ReadFromV2 fills Chain from v2. +func (c *Chain) ReadFromV2(v2ct *apeV2.Chain) error { + switch v := v2ct.GetKind().(type) { + default: + return fmt.Errorf("unsupported chain kind: %T", v) + case *apeV2.ChainRaw: + raw := v.GetRaw() + c.Raw = raw + } + return nil +} diff --git a/ape/chain_target.go b/ape/chain_target.go new file mode 100644 index 00000000..cb63db7b --- /dev/null +++ b/ape/chain_target.go @@ -0,0 +1,53 @@ +package ape + +import ( + apeV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" +) + +// TargetType is an SDK representation for v2's TargetType. +type TargetType apeV2.TargetType + +const ( + TargetTypeUndefined TargetType = iota + TargetTypeNamespace + TargetTypeContainer + TargetTypeUser + TargetTypeGroup +) + +// ToV2 converts TargetType to v2. +func (targetType TargetType) ToV2() apeV2.TargetType { + return apeV2.TargetType(targetType) +} + +// FromV2 reads TargetType to v2. +func (targetType *TargetType) FromV2(v2targetType apeV2.TargetType) { + *targetType = TargetType(v2targetType) +} + +// ChainTarget is an SDK representation for v2's ChainTarget. +// +// Note that ChainTarget (as well as v2's ChainTarget) and all related entities +// are NOT operated by Access-Policy-Engine (APE). The client is responsible +// to convert these types to policy-engine entities. +type ChainTarget struct { + TargetType TargetType + + Name string +} + +// ToV2 converts ChainTarget to v2. +func (ct *ChainTarget) ToV2() *apeV2.ChainTarget { + v2ct := new(apeV2.ChainTarget) + + v2ct.SetTargetType(ct.TargetType.ToV2()) + v2ct.SetName(ct.Name) + + return v2ct +} + +// FromV2 reads ChainTarget frpm v2. +func (ct *ChainTarget) FromV2(v2ct *apeV2.ChainTarget) { + ct.TargetType.FromV2(v2ct.GetTargetType()) + ct.Name = v2ct.GetName() +} diff --git a/ape/chain_target_test.go b/ape/chain_target_test.go new file mode 100644 index 00000000..e7416d1e --- /dev/null +++ b/ape/chain_target_test.go @@ -0,0 +1,65 @@ +package ape_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" + "github.com/stretchr/testify/require" + + apeV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" +) + +var ( + m = map[ape.TargetType]apeV2.TargetType{ + ape.TargetTypeUndefined: apeV2.TargetTypeUndefined, + ape.TargetTypeNamespace: apeV2.TargetTypeNamespace, + ape.TargetTypeContainer: apeV2.TargetTypeContainer, + ape.TargetTypeUser: apeV2.TargetTypeUser, + ape.TargetTypeGroup: apeV2.TargetTypeGroup, + } +) + +func TestTargetType(t *testing.T) { + for typesdk, typev2 := range m { + t.Run("from sdk to v2 "+typev2.String(), func(t *testing.T) { + v2 := typesdk.ToV2() + require.Equal(t, v2, typev2) + }) + + t.Run("from v2 to sdk "+typev2.String(), func(t *testing.T) { + var typ ape.TargetType + typ.FromV2(typev2) + require.Equal(t, typesdk, typ) + }) + } +} + +func TestChainTarget(t *testing.T) { + var ( + typ = ape.TargetTypeNamespace + name = "namespaceXXYYZZ" + ) + + t.Run("from sdk to v2", func(t *testing.T) { + ct := ape.ChainTarget{ + TargetType: typ, + Name: name, + } + + v2 := ct.ToV2() + require.Equal(t, m[typ], v2.GetTargetType()) + require.Equal(t, name, v2.GetName()) + }) + + t.Run("from v2 to sdk", func(t *testing.T) { + v2 := &apeV2.ChainTarget{} + v2.SetTargetType(m[typ]) + v2.SetName(name) + + var ct ape.ChainTarget + ct.FromV2(v2) + + require.Equal(t, typ, ct.TargetType) + require.Equal(t, name, ct.Name) + }) +} diff --git a/ape/chain_test.go b/ape/chain_test.go new file mode 100644 index 00000000..4e47fc66 --- /dev/null +++ b/ape/chain_test.go @@ -0,0 +1,43 @@ +package ape_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" + "github.com/stretchr/testify/require" + + apeV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" +) + +const ( + encoded = `{"ID":"","Rules":[{"Status":"Allow","Actions":{"Inverted":false,"Names":["GetObject"]},"Resources":{"Inverted":false,"Names":["native:object/*"]},"Any":false,"Condition":[{"Op":"StringEquals","Object":"Resource","Key":"Department","Value":"HR"}]}],"MatchType":"DenyPriority"}` +) + +func TestChainData(t *testing.T) { + t.Run("raw chain", func(t *testing.T) { + var c ape.Chain + + b := []byte(encoded) + c.Raw = b + + v2, ok := c.ToV2().GetKind().(*apeV2.ChainRaw) + require.True(t, ok) + require.Equal(t, b, v2.Raw) + }) +} + +func TestChainMessageV2(t *testing.T) { + b := []byte(encoded) + + v2Raw := &apeV2.ChainRaw{} + v2Raw.SetRaw(b) + + v2 := &apeV2.Chain{} + v2.SetKind(v2Raw) + + var c ape.Chain + c.ReadFromV2(v2) + + require.NotNil(t, c.Raw) + require.Equal(t, b, c.Raw) +} diff --git a/ape/grpc/types_frostfs.pb.go b/ape/grpc/types_frostfs.pb.go new file mode 100644 index 00000000..c16e8673 --- /dev/null +++ b/ape/grpc/types_frostfs.pb.go @@ -0,0 +1,424 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package ape + +import ( + json "encoding/json" + fmt "fmt" + pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + strconv "strconv" +) + +type TargetType int32 + +const ( + TargetType_UNDEFINED TargetType = 0 + TargetType_NAMESPACE TargetType = 1 + TargetType_CONTAINER TargetType = 2 + TargetType_USER TargetType = 3 + TargetType_GROUP TargetType = 4 +) + +var ( + TargetType_name = map[int32]string{ + 0: "UNDEFINED", + 1: "NAMESPACE", + 2: "CONTAINER", + 3: "USER", + 4: "GROUP", + } + TargetType_value = map[string]int32{ + "UNDEFINED": 0, + "NAMESPACE": 1, + "CONTAINER": 2, + "USER": 3, + "GROUP": 4, + } +) + +func (x TargetType) String() string { + if v, ok := TargetType_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *TargetType) FromString(s string) bool { + if v, ok := TargetType_value[s]; ok { + *x = TargetType(v) + return true + } + return false +} + +type ChainTarget struct { + Type TargetType `json:"type"` + Name string `json:"name"` +} + +var ( + _ encoding.ProtoMarshaler = (*ChainTarget)(nil) + _ encoding.ProtoUnmarshaler = (*ChainTarget)(nil) + _ json.Marshaler = (*ChainTarget)(nil) + _ json.Unmarshaler = (*ChainTarget)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ChainTarget) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.Type)) + size += proto.StringSize(2, x.Name) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *ChainTarget) MarshalProtobuf(dst []byte) []byte { + m := pool.MarshalerPool.Get() + defer pool.MarshalerPool.Put(m) + x.EmitProtobuf(m.MessageMarshaler()) + dst = m.Marshal(dst) + return dst +} + +func (x *ChainTarget) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if int32(x.Type) != 0 { + mm.AppendInt32(1, int32(x.Type)) + } + if len(x.Name) != 0 { + mm.AppendString(2, x.Name) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *ChainTarget) UnmarshalProtobuf(src []byte) (err error) { + var fc easyproto.FieldContext + for len(src) > 0 { + src, err = fc.NextField(src) + if err != nil { + return fmt.Errorf("cannot read next field in %s", "ChainTarget") + } + switch fc.FieldNum { + case 1: // Type + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Type") + } + x.Type = TargetType(data) + case 2: // Name + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Name") + } + x.Name = data + } + } + return nil +} +func (x *ChainTarget) GetType() TargetType { + if x != nil { + return x.Type + } + return 0 +} +func (x *ChainTarget) SetType(v TargetType) { + x.Type = v +} +func (x *ChainTarget) GetName() string { + if x != nil { + return x.Name + } + return "" +} +func (x *ChainTarget) SetName(v string) { + x.Name = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *ChainTarget) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *ChainTarget) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + first := true + out.RawByte('{') + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"type\":" + out.RawString(prefix) + v := int32(x.Type) + if vv, ok := TargetType_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"name\":" + out.RawString(prefix) + out.String(x.Name) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *ChainTarget) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *ChainTarget) UnmarshalEasyJSON(in *jlexer.Lexer) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "type": + { + var f TargetType + var parsedValue TargetType + switch v := in.Interface().(type) { + case string: + if vv, ok := TargetType_value[v]; ok { + parsedValue = TargetType(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = TargetType(vv) + case float64: + parsedValue = TargetType(v) + } + f = parsedValue + x.Type = f + } + case "name": + { + var f string + f = in.String() + x.Name = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Chain struct { + Kind isChain_Kind +} + +var ( + _ encoding.ProtoMarshaler = (*Chain)(nil) + _ encoding.ProtoUnmarshaler = (*Chain)(nil) + _ json.Marshaler = (*Chain)(nil) + _ json.Unmarshaler = (*Chain)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Chain) StableSize() (size int) { + if x == nil { + return 0 + } + if inner, ok := x.Kind.(*Chain_Raw); ok { + size += proto.BytesSize(1, inner.Raw) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Chain) MarshalProtobuf(dst []byte) []byte { + m := pool.MarshalerPool.Get() + defer pool.MarshalerPool.Put(m) + x.EmitProtobuf(m.MessageMarshaler()) + dst = m.Marshal(dst) + return dst +} + +func (x *Chain) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if inner, ok := x.Kind.(*Chain_Raw); ok { + if len(inner.Raw) != 0 { + mm.AppendBytes(1, inner.Raw) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Chain) UnmarshalProtobuf(src []byte) (err error) { + var fc easyproto.FieldContext + for len(src) > 0 { + src, err = fc.NextField(src) + if err != nil { + return fmt.Errorf("cannot read next field in %s", "Chain") + } + switch fc.FieldNum { + case 1: // Raw + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "Raw") + } + x.Kind = &Chain_Raw{Raw: data} + } + } + return nil +} +func (x *Chain) GetKind() isChain_Kind { + if x != nil { + return x.Kind + } + return nil +} +func (x *Chain) SetKind(v isChain_Kind) { + x.Kind = v +} +func (x *Chain) GetRaw() []byte { + if xx, ok := x.GetKind().(*Chain_Raw); ok { + return xx.Raw + } + return nil +} +func (x *Chain) SetRaw(v *Chain_Raw) { + x.Kind = v +} +func (x *Chain_Raw) GetRaw() []byte { + if x != nil { + return x.Raw + } + return nil +} +func (x *Chain_Raw) SetRaw(v []byte) { + x.Raw = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Chain) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Chain) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + first := true + out.RawByte('{') + switch xx := x.Kind.(type) { + case *Chain_Raw: + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"raw\":" + out.RawString(prefix) + if xx.Raw != nil { + out.Base64Bytes(xx.Raw) + } else { + out.String("") + } + } + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Chain) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Chain) UnmarshalEasyJSON(in *jlexer.Lexer) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "raw": + xx := new(Chain_Raw) + x.Kind = xx + { + var f []byte + f = in.Bytes() + xx.Raw = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type isChain_Kind interface { + isChain_Kind() +} + +type Chain_Raw struct { + Raw []byte +} + +func (*Chain_Raw) isChain_Kind() {} diff --git a/ape/grpc/types_frostfs_fuzz.go b/ape/grpc/types_frostfs_fuzz.go new file mode 100644 index 00000000..b7bf3674 --- /dev/null +++ b/ape/grpc/types_frostfs_fuzz.go @@ -0,0 +1,45 @@ +//go:build gofuzz +// +build gofuzz + +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package ape + +func DoFuzzProtoChainTarget(data []byte) int { + msg := new(ChainTarget) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONChainTarget(data []byte) int { + msg := new(ChainTarget) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoChain(data []byte) int { + msg := new(Chain) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONChain(data []byte) int { + msg := new(Chain) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} diff --git a/ape/grpc/types_frostfs_test.go b/ape/grpc/types_frostfs_test.go new file mode 100644 index 00000000..93d7eeab --- /dev/null +++ b/ape/grpc/types_frostfs_test.go @@ -0,0 +1,31 @@ +//go:build gofuzz +// +build gofuzz + +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package ape + +import ( + testing "testing" +) + +func FuzzProtoChainTarget(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoChainTarget(data) + }) +} +func FuzzJSONChainTarget(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONChainTarget(data) + }) +} +func FuzzProtoChain(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoChain(data) + }) +} +func FuzzJSONChain(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONChain(data) + }) +} diff --git a/api/accounting/accounting.go b/api/accounting/accounting.go new file mode 100644 index 00000000..04603cd1 --- /dev/null +++ b/api/accounting/accounting.go @@ -0,0 +1,104 @@ +package accounting + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" +) + +type BalanceRequestBody struct { + ownerID *refs.OwnerID +} + +type BalanceResponseBody struct { + bal *Decimal +} + +type Decimal struct { + val int64 + + prec uint32 +} + +type BalanceRequest struct { + body *BalanceRequestBody + + session.RequestHeaders +} + +type BalanceResponse struct { + body *BalanceResponseBody + + session.ResponseHeaders +} + +func (b *BalanceRequestBody) GetOwnerID() *refs.OwnerID { + if b != nil { + return b.ownerID + } + + return nil +} + +func (b *BalanceRequestBody) SetOwnerID(v *refs.OwnerID) { + b.ownerID = v +} + +func (b *BalanceRequest) GetBody() *BalanceRequestBody { + if b != nil { + return b.body + } + + return nil +} + +func (b *BalanceRequest) SetBody(v *BalanceRequestBody) { + b.body = v +} + +func (d *Decimal) GetValue() int64 { + if d != nil { + return d.val + } + + return 0 +} + +func (d *Decimal) SetValue(v int64) { + d.val = v +} + +func (d *Decimal) GetPrecision() uint32 { + if d != nil { + return d.prec + } + + return 0 +} + +func (d *Decimal) SetPrecision(v uint32) { + d.prec = v +} + +func (br *BalanceResponseBody) GetBalance() *Decimal { + if br != nil { + return br.bal + } + + return nil +} + +func (br *BalanceResponseBody) SetBalance(v *Decimal) { + br.bal = v +} + +func (br *BalanceResponse) GetBody() *BalanceResponseBody { + if br != nil { + return br.body + } + + return nil +} + +func (br *BalanceResponse) SetBody(v *BalanceResponseBody) { + br.body = v +} diff --git a/api/accounting/convert.go b/api/accounting/convert.go new file mode 100644 index 00000000..53b7491f --- /dev/null +++ b/api/accounting/convert.go @@ -0,0 +1,178 @@ +package accounting + +import ( + accounting "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (b *BalanceRequestBody) ToGRPCMessage() grpc.Message { + var m *accounting.BalanceRequest_Body + + if b != nil { + m = new(accounting.BalanceRequest_Body) + + m.SetOwnerId(b.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + } + + return m +} + +func (b *BalanceRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.BalanceRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + ownerID := v.GetOwnerId() + if ownerID == nil { + b.ownerID = nil + } else { + if b.ownerID == nil { + b.ownerID = new(refs.OwnerID) + } + + err = b.ownerID.FromGRPCMessage(ownerID) + } + + return err +} + +func (b *BalanceRequest) ToGRPCMessage() grpc.Message { + var m *accounting.BalanceRequest + + if b != nil { + m = new(accounting.BalanceRequest) + + m.SetBody(b.body.ToGRPCMessage().(*accounting.BalanceRequest_Body)) + b.RequestHeaders.ToMessage(m) + } + + return m +} + +func (b *BalanceRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.BalanceRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + b.body = nil + } else { + if b.body == nil { + b.body = new(BalanceRequestBody) + } + + err = b.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return b.RequestHeaders.FromMessage(v) +} + +func (d *Decimal) ToGRPCMessage() grpc.Message { + var m *accounting.Decimal + + if d != nil { + m = new(accounting.Decimal) + + m.SetValue(d.val) + m.SetPrecision(d.prec) + } + + return m +} + +func (d *Decimal) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.Decimal) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + d.val = v.GetValue() + d.prec = v.GetPrecision() + + return nil +} + +func (br *BalanceResponseBody) ToGRPCMessage() grpc.Message { + var m *accounting.BalanceResponse_Body + + if br != nil { + m = new(accounting.BalanceResponse_Body) + + m.SetBalance(br.bal.ToGRPCMessage().(*accounting.Decimal)) + } + + return m +} + +func (br *BalanceResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.BalanceResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + bal := v.GetBalance() + if bal == nil { + br.bal = nil + } else { + if br.bal == nil { + br.bal = new(Decimal) + } + + err = br.bal.FromGRPCMessage(bal) + } + + return err +} + +func (br *BalanceResponse) ToGRPCMessage() grpc.Message { + var m *accounting.BalanceResponse + + if br != nil { + m = new(accounting.BalanceResponse) + + m.SetBody(br.body.ToGRPCMessage().(*accounting.BalanceResponse_Body)) + br.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (br *BalanceResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*accounting.BalanceResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + br.body = nil + } else { + if br.body == nil { + br.body = new(BalanceResponseBody) + } + + err = br.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return br.ResponseHeaders.FromMessage(v) +} diff --git a/api/accounting/grpc/service.pb.go b/api/accounting/grpc/service.pb.go new file mode 100644 index 00000000..96cc7b13 --- /dev/null +++ b/api/accounting/grpc/service.pb.go @@ -0,0 +1,559 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/accounting/grpc/service.proto + +//go:build !protoopaque + +package accounting + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// BalanceRequest message +type BalanceRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of the balance request message. + Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BalanceRequest) Reset() { + *x = BalanceRequest{} + mi := &file_api_accounting_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BalanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceRequest) ProtoMessage() {} + +func (x *BalanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BalanceRequest) GetBody() *BalanceRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *BalanceRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *BalanceRequest) SetBody(v *BalanceRequest_Body) { + x.Body = v +} + +func (x *BalanceRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *BalanceRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *BalanceRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *BalanceRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *BalanceRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *BalanceRequest) ClearBody() { + x.Body = nil +} + +func (x *BalanceRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *BalanceRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type BalanceRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the balance request message. + Body *BalanceRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 BalanceRequest_builder) Build() *BalanceRequest { + m0 := &BalanceRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// BalanceResponse message +type BalanceResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of the balance response message. + Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BalanceResponse) Reset() { + *x = BalanceResponse{} + mi := &file_api_accounting_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BalanceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceResponse) ProtoMessage() {} + +func (x *BalanceResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BalanceResponse) GetBody() *BalanceResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *BalanceResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *BalanceResponse) SetBody(v *BalanceResponse_Body) { + x.Body = v +} + +func (x *BalanceResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *BalanceResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *BalanceResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *BalanceResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *BalanceResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *BalanceResponse) ClearBody() { + x.Body = nil +} + +func (x *BalanceResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *BalanceResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type BalanceResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the balance response message. + Body *BalanceResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 BalanceResponse_builder) Build() *BalanceResponse { + m0 := &BalanceResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// To indicate the account for which the balance is requested, its identifier +// is used. It can be any existing account in FrostFS sidechain `Balance` +// smart contract. If omitted, client implementation MUST set it to the +// request's signer `OwnerID`. +type BalanceRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Valid user identifier in `OwnerID` format for which the balance is + // requested. Required field. + OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BalanceRequest_Body) Reset() { + *x = BalanceRequest_Body{} + mi := &file_api_accounting_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BalanceRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceRequest_Body) ProtoMessage() {} + +func (x *BalanceRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *BalanceRequest_Body) SetOwnerId(v *grpc1.OwnerID) { + x.OwnerId = v +} + +func (x *BalanceRequest_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *BalanceRequest_Body) ClearOwnerId() { + x.OwnerId = nil +} + +type BalanceRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Valid user identifier in `OwnerID` format for which the balance is + // requested. Required field. + OwnerId *grpc1.OwnerID +} + +func (b0 BalanceRequest_Body_builder) Build() *BalanceRequest_Body { + m0 := &BalanceRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.OwnerId = b.OwnerId + return m0 +} + +// The amount of funds in GAS token for the `OwnerID`'s account requested. +// Balance is given in the `Decimal` format to avoid precision issues with +// rounding. +type BalanceResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Amount of funds in GAS token for the requested account. + Balance *Decimal `protobuf:"bytes,1,opt,name=balance" json:"balance,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BalanceResponse_Body) Reset() { + *x = BalanceResponse_Body{} + mi := &file_api_accounting_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BalanceResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceResponse_Body) ProtoMessage() {} + +func (x *BalanceResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BalanceResponse_Body) GetBalance() *Decimal { + if x != nil { + return x.Balance + } + return nil +} + +func (x *BalanceResponse_Body) SetBalance(v *Decimal) { + x.Balance = v +} + +func (x *BalanceResponse_Body) HasBalance() bool { + if x == nil { + return false + } + return x.Balance != nil +} + +func (x *BalanceResponse_Body) ClearBalance() { + x.Balance = nil +} + +type BalanceResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Amount of funds in GAS token for the requested account. + Balance *Decimal +} + +func (b0 BalanceResponse_Body_builder) Build() *BalanceResponse_Body { + m0 := &BalanceResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Balance = b.Balance + return m0 +} + +var File_api_accounting_grpc_service_proto protoreflect.FileDescriptor + +var file_api_accounting_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, + 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x02, 0x0a, 0x0e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, + 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, + 0x3a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xae, 0x02, 0x0a, 0x0f, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3f, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, 0x63, 0x69, + 0x6d, 0x61, 0x6c, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x32, 0x6b, 0x0a, 0x11, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x56, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x24, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6e, 0x5a, 0x4b, 0x67, 0x69, 0x74, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, + 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_accounting_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_api_accounting_grpc_service_proto_goTypes = []any{ + (*BalanceRequest)(nil), // 0: neo.fs.v2.accounting.BalanceRequest + (*BalanceResponse)(nil), // 1: neo.fs.v2.accounting.BalanceResponse + (*BalanceRequest_Body)(nil), // 2: neo.fs.v2.accounting.BalanceRequest.Body + (*BalanceResponse_Body)(nil), // 3: neo.fs.v2.accounting.BalanceResponse.Body + (*grpc.RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 5: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 6: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader + (*grpc1.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID + (*Decimal)(nil), // 9: neo.fs.v2.accounting.Decimal +} +var file_api_accounting_grpc_service_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.accounting.BalanceRequest.body:type_name -> neo.fs.v2.accounting.BalanceRequest.Body + 4, // 1: neo.fs.v2.accounting.BalanceRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 5, // 2: neo.fs.v2.accounting.BalanceRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 3, // 3: neo.fs.v2.accounting.BalanceResponse.body:type_name -> neo.fs.v2.accounting.BalanceResponse.Body + 6, // 4: neo.fs.v2.accounting.BalanceResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 7, // 5: neo.fs.v2.accounting.BalanceResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.accounting.BalanceRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 9, // 7: neo.fs.v2.accounting.BalanceResponse.Body.balance:type_name -> neo.fs.v2.accounting.Decimal + 0, // 8: neo.fs.v2.accounting.AccountingService.Balance:input_type -> neo.fs.v2.accounting.BalanceRequest + 1, // 9: neo.fs.v2.accounting.AccountingService.Balance:output_type -> neo.fs.v2.accounting.BalanceResponse + 9, // [9:10] is the sub-list for method output_type + 8, // [8:9] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_api_accounting_grpc_service_proto_init() } +func file_api_accounting_grpc_service_proto_init() { + if File_api_accounting_grpc_service_proto != nil { + return + } + file_api_accounting_grpc_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_accounting_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_accounting_grpc_service_proto_goTypes, + DependencyIndexes: file_api_accounting_grpc_service_proto_depIdxs, + MessageInfos: file_api_accounting_grpc_service_proto_msgTypes, + }.Build() + File_api_accounting_grpc_service_proto = out.File + file_api_accounting_grpc_service_proto_rawDesc = nil + file_api_accounting_grpc_service_proto_goTypes = nil + file_api_accounting_grpc_service_proto_depIdxs = nil +} diff --git a/api/accounting/grpc/service_grpc.pb.go b/api/accounting/grpc/service_grpc.pb.go new file mode 100644 index 00000000..92e2ced7 --- /dev/null +++ b/api/accounting/grpc/service_grpc.pb.go @@ -0,0 +1,143 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.2 +// source: api/accounting/grpc/service.proto + +package accounting + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + AccountingService_Balance_FullMethodName = "/neo.fs.v2.accounting.AccountingService/Balance" +) + +// AccountingServiceClient is the client API for AccountingService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Accounting service provides methods for interaction with FrostFS sidechain +// via other FrostFS nodes to get information about the account balance. Deposit +// and Withdraw operations can't be implemented here, as they require Mainnet +// FrostFS smart contract invocation. Transfer operations between internal +// FrostFS accounts are possible if both use the same token type. +type AccountingServiceClient interface { + // Returns the amount of funds in GAS token for the requested FrostFS account. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // balance has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) +} + +type accountingServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAccountingServiceClient(cc grpc.ClientConnInterface) AccountingServiceClient { + return &accountingServiceClient{cc} +} + +func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BalanceResponse) + err := c.cc.Invoke(ctx, AccountingService_Balance_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AccountingServiceServer is the server API for AccountingService service. +// All implementations should embed UnimplementedAccountingServiceServer +// for forward compatibility. +// +// Accounting service provides methods for interaction with FrostFS sidechain +// via other FrostFS nodes to get information about the account balance. Deposit +// and Withdraw operations can't be implemented here, as they require Mainnet +// FrostFS smart contract invocation. Transfer operations between internal +// FrostFS accounts are possible if both use the same token type. +type AccountingServiceServer interface { + // Returns the amount of funds in GAS token for the requested FrostFS account. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // balance has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) +} + +// UnimplementedAccountingServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedAccountingServiceServer struct{} + +func (UnimplementedAccountingServiceServer) Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") +} +func (UnimplementedAccountingServiceServer) testEmbeddedByValue() {} + +// UnsafeAccountingServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AccountingServiceServer will +// result in compilation errors. +type UnsafeAccountingServiceServer interface { + mustEmbedUnimplementedAccountingServiceServer() +} + +func RegisterAccountingServiceServer(s grpc.ServiceRegistrar, srv AccountingServiceServer) { + // If the following call pancis, it indicates UnimplementedAccountingServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&AccountingService_ServiceDesc, srv) +} + +func _AccountingService_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountingServiceServer).Balance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AccountingService_Balance_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountingServiceServer).Balance(ctx, req.(*BalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AccountingService_ServiceDesc is the grpc.ServiceDesc for AccountingService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AccountingService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.accounting.AccountingService", + HandlerType: (*AccountingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Balance", + Handler: _AccountingService_Balance_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/accounting/grpc/service.proto", +} diff --git a/api/accounting/grpc/service_protoopaque.pb.go b/api/accounting/grpc/service_protoopaque.pb.go new file mode 100644 index 00000000..c5d62ece --- /dev/null +++ b/api/accounting/grpc/service_protoopaque.pb.go @@ -0,0 +1,544 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/accounting/grpc/service.proto + +//go:build protoopaque + +package accounting + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// BalanceRequest message +type BalanceRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BalanceRequest) Reset() { + *x = BalanceRequest{} + mi := &file_api_accounting_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BalanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceRequest) ProtoMessage() {} + +func (x *BalanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BalanceRequest) GetBody() *BalanceRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *BalanceRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *BalanceRequest) SetBody(v *BalanceRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *BalanceRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *BalanceRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *BalanceRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *BalanceRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *BalanceRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *BalanceRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *BalanceRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *BalanceRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type BalanceRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the balance request message. + Body *BalanceRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 BalanceRequest_builder) Build() *BalanceRequest { + m0 := &BalanceRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// BalanceResponse message +type BalanceResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BalanceResponse) Reset() { + *x = BalanceResponse{} + mi := &file_api_accounting_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BalanceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceResponse) ProtoMessage() {} + +func (x *BalanceResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BalanceResponse) GetBody() *BalanceResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *BalanceResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *BalanceResponse) SetBody(v *BalanceResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *BalanceResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *BalanceResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *BalanceResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *BalanceResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *BalanceResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *BalanceResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *BalanceResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *BalanceResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type BalanceResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the balance response message. + Body *BalanceResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 BalanceResponse_builder) Build() *BalanceResponse { + m0 := &BalanceResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// To indicate the account for which the balance is requested, its identifier +// is used. It can be any existing account in FrostFS sidechain `Balance` +// smart contract. If omitted, client implementation MUST set it to the +// request's signer `OwnerID`. +type BalanceRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BalanceRequest_Body) Reset() { + *x = BalanceRequest_Body{} + mi := &file_api_accounting_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BalanceRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceRequest_Body) ProtoMessage() {} + +func (x *BalanceRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *BalanceRequest_Body) SetOwnerId(v *grpc1.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *BalanceRequest_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *BalanceRequest_Body) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +type BalanceRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Valid user identifier in `OwnerID` format for which the balance is + // requested. Required field. + OwnerId *grpc1.OwnerID +} + +func (b0 BalanceRequest_Body_builder) Build() *BalanceRequest_Body { + m0 := &BalanceRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_OwnerId = b.OwnerId + return m0 +} + +// The amount of funds in GAS token for the `OwnerID`'s account requested. +// Balance is given in the `Decimal` format to avoid precision issues with +// rounding. +type BalanceResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Balance *Decimal `protobuf:"bytes,1,opt,name=balance" json:"balance,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BalanceResponse_Body) Reset() { + *x = BalanceResponse_Body{} + mi := &file_api_accounting_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BalanceResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BalanceResponse_Body) ProtoMessage() {} + +func (x *BalanceResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BalanceResponse_Body) GetBalance() *Decimal { + if x != nil { + return x.xxx_hidden_Balance + } + return nil +} + +func (x *BalanceResponse_Body) SetBalance(v *Decimal) { + x.xxx_hidden_Balance = v +} + +func (x *BalanceResponse_Body) HasBalance() bool { + if x == nil { + return false + } + return x.xxx_hidden_Balance != nil +} + +func (x *BalanceResponse_Body) ClearBalance() { + x.xxx_hidden_Balance = nil +} + +type BalanceResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Amount of funds in GAS token for the requested account. + Balance *Decimal +} + +func (b0 BalanceResponse_Body_builder) Build() *BalanceResponse_Body { + m0 := &BalanceResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Balance = b.Balance + return m0 +} + +var File_api_accounting_grpc_service_proto protoreflect.FileDescriptor + +var file_api_accounting_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, + 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x02, 0x0a, 0x0e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, + 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, + 0x3a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, + 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xae, 0x02, 0x0a, 0x0f, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3f, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, 0x63, 0x69, + 0x6d, 0x61, 0x6c, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x32, 0x6b, 0x0a, 0x11, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x56, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x24, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6e, 0x5a, 0x4b, 0x67, 0x69, 0x74, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, + 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_accounting_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_api_accounting_grpc_service_proto_goTypes = []any{ + (*BalanceRequest)(nil), // 0: neo.fs.v2.accounting.BalanceRequest + (*BalanceResponse)(nil), // 1: neo.fs.v2.accounting.BalanceResponse + (*BalanceRequest_Body)(nil), // 2: neo.fs.v2.accounting.BalanceRequest.Body + (*BalanceResponse_Body)(nil), // 3: neo.fs.v2.accounting.BalanceResponse.Body + (*grpc.RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 5: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 6: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader + (*grpc1.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID + (*Decimal)(nil), // 9: neo.fs.v2.accounting.Decimal +} +var file_api_accounting_grpc_service_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.accounting.BalanceRequest.body:type_name -> neo.fs.v2.accounting.BalanceRequest.Body + 4, // 1: neo.fs.v2.accounting.BalanceRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 5, // 2: neo.fs.v2.accounting.BalanceRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 3, // 3: neo.fs.v2.accounting.BalanceResponse.body:type_name -> neo.fs.v2.accounting.BalanceResponse.Body + 6, // 4: neo.fs.v2.accounting.BalanceResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 7, // 5: neo.fs.v2.accounting.BalanceResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.accounting.BalanceRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 9, // 7: neo.fs.v2.accounting.BalanceResponse.Body.balance:type_name -> neo.fs.v2.accounting.Decimal + 0, // 8: neo.fs.v2.accounting.AccountingService.Balance:input_type -> neo.fs.v2.accounting.BalanceRequest + 1, // 9: neo.fs.v2.accounting.AccountingService.Balance:output_type -> neo.fs.v2.accounting.BalanceResponse + 9, // [9:10] is the sub-list for method output_type + 8, // [8:9] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_api_accounting_grpc_service_proto_init() } +func file_api_accounting_grpc_service_proto_init() { + if File_api_accounting_grpc_service_proto != nil { + return + } + file_api_accounting_grpc_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_accounting_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_accounting_grpc_service_proto_goTypes, + DependencyIndexes: file_api_accounting_grpc_service_proto_depIdxs, + MessageInfos: file_api_accounting_grpc_service_proto_msgTypes, + }.Build() + File_api_accounting_grpc_service_proto = out.File + file_api_accounting_grpc_service_proto_rawDesc = nil + file_api_accounting_grpc_service_proto_goTypes = nil + file_api_accounting_grpc_service_proto_depIdxs = nil +} diff --git a/api/accounting/grpc/types.pb.go b/api/accounting/grpc/types.pb.go new file mode 100644 index 00000000..760deed5 --- /dev/null +++ b/api/accounting/grpc/types.pb.go @@ -0,0 +1,186 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/accounting/grpc/types.proto + +//go:build !protoopaque + +package accounting + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Standard floating point data type can't be used in FrostFS due to inexactness +// of the result when doing lots of small number operations. To solve the lost +// precision issue, special `Decimal` format is used for monetary computations. +// +// Please see [The General Decimal Arithmetic +// Specification](http://speleotrove.com/decimal/) for detailed problem +// description. +type Decimal struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Number in the smallest Token fractions. + Value *int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + // Precision value indicating how many smallest fractions can be in one + // integer. + Precision *uint32 `protobuf:"varint,2,opt,name=precision" json:"precision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Decimal) Reset() { + *x = Decimal{} + mi := &file_api_accounting_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Decimal) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Decimal) ProtoMessage() {} + +func (x *Decimal) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Decimal) GetValue() int64 { + if x != nil && x.Value != nil { + return *x.Value + } + return 0 +} + +func (x *Decimal) GetPrecision() uint32 { + if x != nil && x.Precision != nil { + return *x.Precision + } + return 0 +} + +func (x *Decimal) SetValue(v int64) { + x.Value = &v +} + +func (x *Decimal) SetPrecision(v uint32) { + x.Precision = &v +} + +func (x *Decimal) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *Decimal) HasPrecision() bool { + if x == nil { + return false + } + return x.Precision != nil +} + +func (x *Decimal) ClearValue() { + x.Value = nil +} + +func (x *Decimal) ClearPrecision() { + x.Precision = nil +} + +type Decimal_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Number in the smallest Token fractions. + Value *int64 + // Precision value indicating how many smallest fractions can be in one + // integer. + Precision *uint32 +} + +func (b0 Decimal_builder) Build() *Decimal { + m0 := &Decimal{} + b, x := &b0, m0 + _, _ = b, x + x.Value = b.Value + x.Precision = b.Precision + return m0 +} + +var File_api_accounting_grpc_types_proto protoreflect.FileDescriptor + +var file_api_accounting_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x3d, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x69, 0x6d, + 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x63, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x70, 0x72, 0x65, + 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x6e, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, + 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, + 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, + 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x70, 0xe8, 0x07, +} + +var file_api_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_api_accounting_grpc_types_proto_goTypes = []any{ + (*Decimal)(nil), // 0: neo.fs.v2.accounting.Decimal +} +var file_api_accounting_grpc_types_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_api_accounting_grpc_types_proto_init() } +func file_api_accounting_grpc_types_proto_init() { + if File_api_accounting_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_accounting_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_accounting_grpc_types_proto_goTypes, + DependencyIndexes: file_api_accounting_grpc_types_proto_depIdxs, + MessageInfos: file_api_accounting_grpc_types_proto_msgTypes, + }.Build() + File_api_accounting_grpc_types_proto = out.File + file_api_accounting_grpc_types_proto_rawDesc = nil + file_api_accounting_grpc_types_proto_goTypes = nil + file_api_accounting_grpc_types_proto_depIdxs = nil +} diff --git a/api/accounting/grpc/types_protoopaque.pb.go b/api/accounting/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..49a80caf --- /dev/null +++ b/api/accounting/grpc/types_protoopaque.pb.go @@ -0,0 +1,195 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/accounting/grpc/types.proto + +//go:build protoopaque + +package accounting + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Standard floating point data type can't be used in FrostFS due to inexactness +// of the result when doing lots of small number operations. To solve the lost +// precision issue, special `Decimal` format is used for monetary computations. +// +// Please see [The General Decimal Arithmetic +// Specification](http://speleotrove.com/decimal/) for detailed problem +// description. +type Decimal struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Value int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + xxx_hidden_Precision uint32 `protobuf:"varint,2,opt,name=precision" json:"precision,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Decimal) Reset() { + *x = Decimal{} + mi := &file_api_accounting_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Decimal) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Decimal) ProtoMessage() {} + +func (x *Decimal) ProtoReflect() protoreflect.Message { + mi := &file_api_accounting_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Decimal) GetValue() int64 { + if x != nil { + return x.xxx_hidden_Value + } + return 0 +} + +func (x *Decimal) GetPrecision() uint32 { + if x != nil { + return x.xxx_hidden_Precision + } + return 0 +} + +func (x *Decimal) SetValue(v int64) { + x.xxx_hidden_Value = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *Decimal) SetPrecision(v uint32) { + x.xxx_hidden_Precision = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *Decimal) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Decimal) HasPrecision() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Decimal) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Value = 0 +} + +func (x *Decimal) ClearPrecision() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Precision = 0 +} + +type Decimal_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Number in the smallest Token fractions. + Value *int64 + // Precision value indicating how many smallest fractions can be in one + // integer. + Precision *uint32 +} + +func (b0 Decimal_builder) Build() *Decimal { + m0 := &Decimal{} + b, x := &b0, m0 + _, _ = b, x + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Value = *b.Value + } + if b.Precision != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Precision = *b.Precision + } + return m0 +} + +var File_api_accounting_grpc_types_proto protoreflect.FileDescriptor + +var file_api_accounting_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x3d, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x69, 0x6d, + 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x63, + 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x70, 0x72, 0x65, + 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x6e, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, + 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, + 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, + 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x70, 0xe8, 0x07, +} + +var file_api_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_api_accounting_grpc_types_proto_goTypes = []any{ + (*Decimal)(nil), // 0: neo.fs.v2.accounting.Decimal +} +var file_api_accounting_grpc_types_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_api_accounting_grpc_types_proto_init() } +func file_api_accounting_grpc_types_proto_init() { + if File_api_accounting_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_accounting_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_accounting_grpc_types_proto_goTypes, + DependencyIndexes: file_api_accounting_grpc_types_proto_depIdxs, + MessageInfos: file_api_accounting_grpc_types_proto_msgTypes, + }.Build() + File_api_accounting_grpc_types_proto = out.File + file_api_accounting_grpc_types_proto_rawDesc = nil + file_api_accounting_grpc_types_proto_goTypes = nil + file_api_accounting_grpc_types_proto_depIdxs = nil +} diff --git a/api/accounting/json.go b/api/accounting/json.go new file mode 100644 index 00000000..c5ff977e --- /dev/null +++ b/api/accounting/json.go @@ -0,0 +1,14 @@ +package accounting + +import ( + accounting "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (d *Decimal) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(d) +} + +func (d *Decimal) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(d, data, new(accounting.Decimal)) +} diff --git a/api/accounting/marshal.go b/api/accounting/marshal.go new file mode 100644 index 00000000..84771ccd --- /dev/null +++ b/api/accounting/marshal.go @@ -0,0 +1,104 @@ +package accounting + +import ( + accounting "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + decimalValueField = 1 + decimalPrecisionField = 2 + + balanceReqBodyOwnerField = 1 + + balanceRespBodyDecimalField = 1 +) + +func (d *Decimal) StableMarshal(buf []byte) []byte { + if d == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, d.StableSize()) + } + + var offset int + + offset += protoutil.Int64Marshal(decimalValueField, buf[offset:], d.val) + protoutil.UInt32Marshal(decimalPrecisionField, buf[offset:], d.prec) + + return buf +} + +func (d *Decimal) StableSize() (size int) { + if d == nil { + return 0 + } + + size += protoutil.Int64Size(decimalValueField, d.val) + size += protoutil.UInt32Size(decimalPrecisionField, d.prec) + + return size +} + +func (d *Decimal) Unmarshal(data []byte) error { + return message.Unmarshal(d, data, new(accounting.Decimal)) +} + +func (b *BalanceRequestBody) StableMarshal(buf []byte) []byte { + if b == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, b.StableSize()) + } + + protoutil.NestedStructureMarshal(balanceReqBodyOwnerField, buf, b.ownerID) + + return buf +} + +func (b *BalanceRequestBody) StableSize() (size int) { + if b == nil { + return 0 + } + + size = protoutil.NestedStructureSize(balanceReqBodyOwnerField, b.ownerID) + + return size +} + +func (b *BalanceRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(b, data, new(accounting.BalanceRequest_Body)) +} + +func (br *BalanceResponseBody) StableMarshal(buf []byte) []byte { + if br == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, br.StableSize()) + } + + protoutil.NestedStructureMarshal(balanceRespBodyDecimalField, buf, br.bal) + + return buf +} + +func (br *BalanceResponseBody) StableSize() (size int) { + if br == nil { + return 0 + } + + size = protoutil.NestedStructureSize(balanceRespBodyDecimalField, br.bal) + + return size +} + +func (br *BalanceResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(br, data, new(accounting.BalanceResponse_Body)) +} diff --git a/api/accounting/message_test.go b/api/accounting/message_test.go new file mode 100644 index 00000000..214c1713 --- /dev/null +++ b/api/accounting/message_test.go @@ -0,0 +1,19 @@ +package accounting_test + +import ( + "testing" + + accountingtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" +) + +func TestMessage(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return accountingtest.GenerateDecimal(empty) }, + func(empty bool) message.Message { return accountingtest.GenerateBalanceRequestBody(empty) }, + func(empty bool) message.Message { return accountingtest.GenerateBalanceRequest(empty) }, + func(empty bool) message.Message { return accountingtest.GenerateBalanceResponseBody(empty) }, + func(empty bool) message.Message { return accountingtest.GenerateBalanceResponse(empty) }, + ) +} diff --git a/api/accounting/test/generate.go b/api/accounting/test/generate.go new file mode 100644 index 00000000..e9f45df5 --- /dev/null +++ b/api/accounting/test/generate.go @@ -0,0 +1,64 @@ +package accountingtest + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" + accountingtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/test" +) + +func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest { + m := new(accounting.BalanceRequest) + + if !empty { + m.SetBody(GenerateBalanceRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateBalanceRequestBody(empty bool) *accounting.BalanceRequestBody { + m := new(accounting.BalanceRequestBody) + + if !empty { + m.SetOwnerID(accountingtest.GenerateOwnerID(false)) + } + + return m +} + +func GenerateBalanceResponse(empty bool) *accounting.BalanceResponse { + m := new(accounting.BalanceResponse) + + if !empty { + m.SetBody(GenerateBalanceResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateBalanceResponseBody(empty bool) *accounting.BalanceResponseBody { + m := new(accounting.BalanceResponseBody) + + if !empty { + m.SetBalance(GenerateDecimal(false)) + } + + return m +} + +func GenerateDecimal(empty bool) *accounting.Decimal { + m := new(accounting.Decimal) + + if !empty { + m.SetValue(1) + m.SetPrecision(2) + } + + return m +} diff --git a/api/acl/bench_test.go b/api/acl/bench_test.go new file mode 100644 index 00000000..200270c5 --- /dev/null +++ b/api/acl/bench_test.go @@ -0,0 +1,51 @@ +package acl_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + aclGrpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc" + acltest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/test" +) + +func BenchmarkTable_ToGRPCMessage(b *testing.B) { + const size = 4 + + tb := new(acl.Table) + rs := make([]acl.Record, size) + for i := range rs { + fs := make([]acl.HeaderFilter, size) + for j := range fs { + fs[j] = *acltest.GenerateFilter(false) + } + ts := make([]acl.Target, size) + for j := range ts { + ts[j] = *acltest.GenerateTarget(false) + } + + rs[i].SetFilters(fs) + rs[i].SetTargets(ts) + } + tb.SetRecords(rs) + + raw := tb.ToGRPCMessage() + + b.Run("to grpc message", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + raw := tb.ToGRPCMessage() + if len(tb.GetRecords()) != len(raw.(*aclGrpc.EACLTable).Records) { + b.FailNow() + } + } + }) + b.Run("from grpc message", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + tb := new(acl.Table) + if tb.FromGRPCMessage(raw) != nil { + b.FailNow() + } + } + }) +} diff --git a/api/acl/convert.go b/api/acl/convert.go new file mode 100644 index 00000000..a72260e2 --- /dev/null +++ b/api/acl/convert.go @@ -0,0 +1,592 @@ +package acl + +import ( + acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" + apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +// RoleToGRPCField converts unified role enum into grpc enum. +func RoleToGRPCField(t Role) acl.Role { + switch t { + case RoleUser: + return acl.Role_USER + case RoleSystem: + return acl.Role_SYSTEM + case RoleOthers: + return acl.Role_OTHERS + default: + return acl.Role_ROLE_UNSPECIFIED + } +} + +// RoleFromGRPCField converts grpc enum into unified role enum. +func RoleFromGRPCField(t acl.Role) Role { + switch t { + case acl.Role_USER: + return RoleUser + case acl.Role_SYSTEM: + return RoleSystem + case acl.Role_OTHERS: + return RoleOthers + default: + return RoleUnknown + } +} + +// OperationToGRPCField converts unified operation enum into grpc enum. +func OperationToGRPCField(t Operation) acl.Operation { + switch t { + case OperationPut: + return acl.Operation_PUT + case OperationDelete: + return acl.Operation_DELETE + case OperationGet: + return acl.Operation_GET + case OperationHead: + return acl.Operation_HEAD + case OperationSearch: + return acl.Operation_SEARCH + case OperationRange: + return acl.Operation_GETRANGE + case OperationRangeHash: + return acl.Operation_GETRANGEHASH + default: + return acl.Operation_OPERATION_UNSPECIFIED + } +} + +// OperationFromGRPCField converts grpc enum into unified operation enum. +func OperationFromGRPCField(t acl.Operation) Operation { + switch t { + case acl.Operation_PUT: + return OperationPut + case acl.Operation_DELETE: + return OperationDelete + case acl.Operation_GET: + return OperationGet + case acl.Operation_HEAD: + return OperationHead + case acl.Operation_SEARCH: + return OperationSearch + case acl.Operation_GETRANGE: + return OperationRange + case acl.Operation_GETRANGEHASH: + return OperationRangeHash + default: + return OperationUnknown + } +} + +// ActionToGRPCField converts unified action enum into grpc enum. +func ActionToGRPCField(t Action) acl.Action { + switch t { + case ActionDeny: + return acl.Action_DENY + case ActionAllow: + return acl.Action_ALLOW + default: + return acl.Action_ACTION_UNSPECIFIED + } +} + +// ActionFromGRPCField converts grpc enum into unified action enum. +func ActionFromGRPCField(t acl.Action) Action { + switch t { + case acl.Action_DENY: + return ActionDeny + case acl.Action_ALLOW: + return ActionAllow + default: + return ActionUnknown + } +} + +// HeaderTypeToGRPCField converts unified header type enum into grpc enum. +func HeaderTypeToGRPCField(t HeaderType) acl.HeaderType { + switch t { + case HeaderTypeRequest: + return acl.HeaderType_REQUEST + case HeaderTypeObject: + return acl.HeaderType_OBJECT + case HeaderTypeService: + return acl.HeaderType_SERVICE + default: + return acl.HeaderType_HEADER_UNSPECIFIED + } +} + +// HeaderTypeFromGRPCField converts grpc enum into unified header type enum. +func HeaderTypeFromGRPCField(t acl.HeaderType) HeaderType { + switch t { + case acl.HeaderType_REQUEST: + return HeaderTypeRequest + case acl.HeaderType_OBJECT: + return HeaderTypeObject + case acl.HeaderType_SERVICE: + return HeaderTypeService + default: + return HeaderTypeUnknown + } +} + +// MatchTypeToGRPCField converts unified match type enum into grpc enum. +func MatchTypeToGRPCField(t MatchType) acl.MatchType { + switch t { + case MatchTypeStringEqual: + return acl.MatchType_STRING_EQUAL + case MatchTypeStringNotEqual: + return acl.MatchType_STRING_NOT_EQUAL + default: + return acl.MatchType_MATCH_TYPE_UNSPECIFIED + } +} + +// MatchTypeFromGRPCField converts grpc enum into unified match type enum. +func MatchTypeFromGRPCField(t acl.MatchType) MatchType { + switch t { + case acl.MatchType_STRING_EQUAL: + return MatchTypeStringEqual + case acl.MatchType_STRING_NOT_EQUAL: + return MatchTypeStringNotEqual + default: + return MatchTypeUnknown + } +} + +func (f *HeaderFilter) ToGRPCMessage() grpc.Message { + var m *acl.EACLRecord_Filter + + if f != nil { + m = new(acl.EACLRecord_Filter) + + m.SetKey(f.key) + m.SetValue(f.value) + m.SetHeaderType(HeaderTypeToGRPCField(f.hdrType)) + m.SetMatchType(MatchTypeToGRPCField(f.matchType)) + } + + return m +} + +func (f *HeaderFilter) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.EACLRecord_Filter) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + f.key = v.GetKey() + f.value = v.GetValue() + f.hdrType = HeaderTypeFromGRPCField(v.GetHeaderType()) + f.matchType = MatchTypeFromGRPCField(v.GetMatchType()) + + return nil +} + +func HeaderFiltersToGRPC(fs []HeaderFilter) (res []*acl.EACLRecord_Filter) { + if fs != nil { + res = make([]*acl.EACLRecord_Filter, 0, len(fs)) + + for i := range fs { + res = append(res, fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter)) + } + } + + return +} + +func HeaderFiltersFromGRPC(fs []*acl.EACLRecord_Filter) (res []HeaderFilter, err error) { + if fs != nil { + res = make([]HeaderFilter, len(fs)) + + for i := range fs { + err = res[i].FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + } + + return +} + +func (t *Target) ToGRPCMessage() grpc.Message { + var m *acl.EACLRecord_Target + + if t != nil { + m = new(acl.EACLRecord_Target) + + m.SetRole(RoleToGRPCField(t.role)) + m.SetKeys(t.keys) + } + + return m +} + +func (t *Target) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.EACLRecord_Target) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + t.role = RoleFromGRPCField(v.GetRole()) + t.keys = v.GetKeys() + + return nil +} + +func TargetsToGRPC(ts []Target) (res []*acl.EACLRecord_Target) { + if ts != nil { + res = make([]*acl.EACLRecord_Target, 0, len(ts)) + + for i := range ts { + res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord_Target)) + } + } + + return +} + +func TargetsFromGRPC(fs []*acl.EACLRecord_Target) (res []Target, err error) { + if fs != nil { + res = make([]Target, len(fs)) + + for i := range fs { + err = res[i].FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + } + + return +} + +func (r *Record) ToGRPCMessage() grpc.Message { + var m *acl.EACLRecord + + if r != nil { + m = new(acl.EACLRecord) + + m.SetOperation(OperationToGRPCField(r.op)) + m.SetAction(ActionToGRPCField(r.action)) + m.SetFilters(HeaderFiltersToGRPC(r.filters)) + m.SetTargets(TargetsToGRPC(r.targets)) + } + + return m +} + +func (r *Record) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.EACLRecord) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.filters, err = HeaderFiltersFromGRPC(v.GetFilters()) + if err != nil { + return err + } + + r.targets, err = TargetsFromGRPC(v.GetTargets()) + if err != nil { + return err + } + + r.op = OperationFromGRPCField(v.GetOperation()) + r.action = ActionFromGRPCField(v.GetAction()) + + return nil +} + +func RecordsToGRPC(ts []Record) (res []*acl.EACLRecord) { + if ts != nil { + res = make([]*acl.EACLRecord, 0, len(ts)) + + for i := range ts { + res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord)) + } + } + + return +} + +func RecordsFromGRPC(fs []*acl.EACLRecord) (res []Record, err error) { + if fs != nil { + res = make([]Record, len(fs)) + + for i := range fs { + err = res[i].FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + } + + return +} + +func (t *Table) ToGRPCMessage() grpc.Message { + var m *acl.EACLTable + + if t != nil { + m = new(acl.EACLTable) + + m.SetVersion(t.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetContainerId(t.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetRecords(RecordsToGRPC(t.records)) + } + + return m +} + +func (t *Table) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.EACLTable) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + t.cid = nil + } else { + if t.cid == nil { + t.cid = new(refs.ContainerID) + } + + err = t.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } + + version := v.GetVersion() + if version == nil { + t.version = nil + } else { + if t.version == nil { + t.version = new(refs.Version) + } + + err = t.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + t.records, err = RecordsFromGRPC(v.GetRecords()) + + return err +} + +func (l *TokenLifetime) ToGRPCMessage() grpc.Message { + var m *acl.BearerToken_Body_TokenLifetime + + if l != nil { + m = new(acl.BearerToken_Body_TokenLifetime) + + m.SetExp(l.exp) + m.SetIat(l.iat) + m.SetNbf(l.nbf) + } + + return m +} + +func (l *TokenLifetime) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.BearerToken_Body_TokenLifetime) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + l.exp = v.GetExp() + l.iat = v.GetIat() + l.nbf = v.GetNbf() + + return nil +} + +func (c *APEOverride) ToGRPCMessage() grpc.Message { + var m *acl.BearerToken_Body_APEOverride + + if c != nil { + m = new(acl.BearerToken_Body_APEOverride) + + m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget)) + + if len(c.chains) > 0 { + apeChains := make([]*apeGRPC.Chain, len(c.chains)) + for i := range c.chains { + apeChains[i] = c.chains[i].ToGRPCMessage().(*apeGRPC.Chain) + } + m.SetChains(apeChains) + } + } + + return m +} + +func (c *APEOverride) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.BearerToken_Body_APEOverride) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + if targetGRPC := v.GetTarget(); targetGRPC != nil { + if c.target == nil { + c.target = new(ape.ChainTarget) + } + if err := c.target.FromGRPCMessage(v.GetTarget()); err != nil { + return err + } + } + + if apeChains := v.GetChains(); len(apeChains) > 0 { + c.chains = make([]*ape.Chain, len(apeChains)) + for i := range apeChains { + c.chains[i] = new(ape.Chain) + if err := c.chains[i].FromGRPCMessage(apeChains[i]); err != nil { + return err + } + } + } + + return nil +} + +func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message { + var m *acl.BearerToken_Body + + if bt != nil { + m = new(acl.BearerToken_Body) + + m.SetOwnerId(bt.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime)) + m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable)) + m.SetAllowImpersonate(bt.impersonate) + m.SetApeOverride(bt.apeOverride.ToGRPCMessage().(*acl.BearerToken_Body_APEOverride)) + } + + return m +} + +func (bt *BearerTokenBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.BearerToken_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + ownerID := v.GetOwnerId() + if ownerID == nil { + bt.ownerID = nil + } else { + if bt.ownerID == nil { + bt.ownerID = new(refs.OwnerID) + } + + err = bt.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + lifetime := v.GetLifetime() + if lifetime == nil { + bt.lifetime = nil + } else { + if bt.lifetime == nil { + bt.lifetime = new(TokenLifetime) + } + + err = bt.lifetime.FromGRPCMessage(lifetime) + if err != nil { + return err + } + } + + eacl := v.GetEaclTable() + if eacl == nil { + bt.eacl = nil + } else { + if bt.eacl == nil { + bt.eacl = new(Table) + } + + if err = bt.eacl.FromGRPCMessage(eacl); err != nil { + return err + } + } + + if apeOverrideGRPC := v.GetApeOverride(); apeOverrideGRPC != nil { + if bt.apeOverride == nil { + bt.apeOverride = new(APEOverride) + } + err = bt.apeOverride.FromGRPCMessage(apeOverrideGRPC) + if err != nil { + return err + } + } + + bt.impersonate = v.GetAllowImpersonate() + + return err +} + +func (bt *BearerToken) ToGRPCMessage() grpc.Message { + var m *acl.BearerToken + + if bt != nil { + m = new(acl.BearerToken) + + m.SetBody(bt.body.ToGRPCMessage().(*acl.BearerToken_Body)) + m.SetSignature(bt.sig.ToGRPCMessage().(*refsGRPC.Signature)) + } + + return m +} + +func (bt *BearerToken) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*acl.BearerToken) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + bt.body = nil + } else { + if bt.body == nil { + bt.body = new(BearerTokenBody) + } + + err = bt.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + bt.sig = nil + } else { + if bt.sig == nil { + bt.sig = new(refs.Signature) + } + + err = bt.sig.FromGRPCMessage(sig) + } + + return err +} diff --git a/api/acl/filters.go b/api/acl/filters.go new file mode 100644 index 00000000..c1d8afec --- /dev/null +++ b/api/acl/filters.go @@ -0,0 +1,33 @@ +package acl + +// ObjectFilterPrefix is a prefix of key to object header value or property. +const ObjectFilterPrefix = "$Object:" + +const ( + // FilterObjectVersion is a filter key to "version" field of the object header. + FilterObjectVersion = ObjectFilterPrefix + "version" + + // FilterObjectID is a filter key to "object_id" field of the object. + FilterObjectID = ObjectFilterPrefix + "objectID" + + // FilterObjectContainerID is a filter key to "container_id" field of the object header. + FilterObjectContainerID = ObjectFilterPrefix + "containerID" + + // FilterObjectOwnerID is a filter key to "owner_id" field of the object header. + FilterObjectOwnerID = ObjectFilterPrefix + "ownerID" + + // FilterObjectCreationEpoch is a filter key to "creation_epoch" field of the object header. + FilterObjectCreationEpoch = ObjectFilterPrefix + "creationEpoch" + + // FilterObjectPayloadLength is a filter key to "payload_length" field of the object header. + FilterObjectPayloadLength = ObjectFilterPrefix + "payloadLength" + + // FilterObjectPayloadHash is a filter key to "payload_hash" field of the object header. + FilterObjectPayloadHash = ObjectFilterPrefix + "payloadHash" + + // FilterObjectType is a filter key to "object_type" field of the object header. + FilterObjectType = ObjectFilterPrefix + "objectType" + + // FilterObjectHomomorphicHash is a filter key to "homomorphic_hash" field of the object header. + FilterObjectHomomorphicHash = ObjectFilterPrefix + "homomorphicHash" +) diff --git a/api/acl/grpc/types.pb.go b/api/acl/grpc/types.pb.go new file mode 100644 index 00000000..93fd0473 --- /dev/null +++ b/api/acl/grpc/types.pb.go @@ -0,0 +1,1534 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/acl/grpc/types.proto + +//go:build !protoopaque + +package acl + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Target role of the access control rule in access control list. +type Role int32 + +const ( + // Unspecified role, default value + Role_ROLE_UNSPECIFIED Role = 0 + // User target rule is applied if sender is the owner of the container + Role_USER Role = 1 + // System target rule is applied if sender is a storage node within the + // container or an inner ring node + Role_SYSTEM Role = 2 + // Others target rule is applied if sender is neither a user nor a system + // target + Role_OTHERS Role = 3 +) + +// Enum value maps for Role. +var ( + Role_name = map[int32]string{ + 0: "ROLE_UNSPECIFIED", + 1: "USER", + 2: "SYSTEM", + 3: "OTHERS", + } + Role_value = map[string]int32{ + "ROLE_UNSPECIFIED": 0, + "USER": 1, + "SYSTEM": 2, + "OTHERS": 3, + } +) + +func (x Role) Enum() *Role { + p := new(Role) + *p = x + return p +} + +func (x Role) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Role) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Role) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[0] +} + +func (x Role) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// MatchType is an enumeration of match types. +type MatchType int32 + +const ( + // Unspecified match type, default value. + MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 + // Return true if strings are equal + MatchType_STRING_EQUAL MatchType = 1 + // Return true if strings are different + MatchType_STRING_NOT_EQUAL MatchType = 2 +) + +// Enum value maps for MatchType. +var ( + MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", + } + MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, + } +) + +func (x MatchType) Enum() *MatchType { + p := new(MatchType) + *p = x + return p +} + +func (x MatchType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MatchType) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (MatchType) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[1] +} + +func (x MatchType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Request's operation type to match if the rule is applicable to a particular +// request. +type Operation int32 + +const ( + // Unspecified operation, default value + Operation_OPERATION_UNSPECIFIED Operation = 0 + // Get + Operation_GET Operation = 1 + // Head + Operation_HEAD Operation = 2 + // Put + Operation_PUT Operation = 3 + // Delete + Operation_DELETE Operation = 4 + // Search + Operation_SEARCH Operation = 5 + // GetRange + Operation_GETRANGE Operation = 6 + // GetRangeHash + Operation_GETRANGEHASH Operation = 7 +) + +// Enum value maps for Operation. +var ( + Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", + 1: "GET", + 2: "HEAD", + 3: "PUT", + 4: "DELETE", + 5: "SEARCH", + 6: "GETRANGE", + 7: "GETRANGEHASH", + } + Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "GET": 1, + "HEAD": 2, + "PUT": 3, + "DELETE": 4, + "SEARCH": 5, + "GETRANGE": 6, + "GETRANGEHASH": 7, + } +) + +func (x Operation) Enum() *Operation { + p := new(Operation) + *p = x + return p +} + +func (x Operation) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Operation) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (Operation) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[2] +} + +func (x Operation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Rule execution result action. Either allows or denies access if the rule's +// filters match. +type Action int32 + +const ( + // Unspecified action, default value + Action_ACTION_UNSPECIFIED Action = 0 + // Allow action + Action_ALLOW Action = 1 + // Deny action + Action_DENY Action = 2 +) + +// Enum value maps for Action. +var ( + Action_name = map[int32]string{ + 0: "ACTION_UNSPECIFIED", + 1: "ALLOW", + 2: "DENY", + } + Action_value = map[string]int32{ + "ACTION_UNSPECIFIED": 0, + "ALLOW": 1, + "DENY": 2, + } +) + +func (x Action) Enum() *Action { + p := new(Action) + *p = x + return p +} + +func (x Action) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Action) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[3].Descriptor() +} + +func (Action) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[3] +} + +func (x Action) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Enumeration of possible sources of Headers to apply filters. +type HeaderType int32 + +const ( + // Unspecified header, default value. + HeaderType_HEADER_UNSPECIFIED HeaderType = 0 + // Filter request headers + HeaderType_REQUEST HeaderType = 1 + // Filter object headers + HeaderType_OBJECT HeaderType = 2 + // Filter service headers. These are not processed by FrostFS nodes and + // exist for service use only. + HeaderType_SERVICE HeaderType = 3 +) + +// Enum value maps for HeaderType. +var ( + HeaderType_name = map[int32]string{ + 0: "HEADER_UNSPECIFIED", + 1: "REQUEST", + 2: "OBJECT", + 3: "SERVICE", + } + HeaderType_value = map[string]int32{ + "HEADER_UNSPECIFIED": 0, + "REQUEST": 1, + "OBJECT": 2, + "SERVICE": 3, + } +) + +func (x HeaderType) Enum() *HeaderType { + p := new(HeaderType) + *p = x + return p +} + +func (x HeaderType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HeaderType) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[4].Descriptor() +} + +func (HeaderType) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[4] +} + +func (x HeaderType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Describes a single eACL rule. +type EACLRecord struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // FrostFS request Verb to match + Operation *Operation `protobuf:"varint,1,opt,name=operation,enum=neo.fs.v2.acl.Operation" json:"operation,omitempty"` + // Rule execution result. Either allows or denies access if filters match. + Action *Action `protobuf:"varint,2,opt,name=action,enum=neo.fs.v2.acl.Action" json:"action,omitempty"` + // List of filters to match and see if rule is applicable + Filters []*EACLRecord_Filter `protobuf:"bytes,3,rep,name=filters" json:"filters,omitempty"` + // List of target subjects to apply ACL rule to + Targets []*EACLRecord_Target `protobuf:"bytes,4,rep,name=targets" json:"targets,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EACLRecord) Reset() { + *x = EACLRecord{} + mi := &file_api_acl_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EACLRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLRecord) ProtoMessage() {} + +func (x *EACLRecord) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EACLRecord) GetOperation() Operation { + if x != nil && x.Operation != nil { + return *x.Operation + } + return Operation_OPERATION_UNSPECIFIED +} + +func (x *EACLRecord) GetAction() Action { + if x != nil && x.Action != nil { + return *x.Action + } + return Action_ACTION_UNSPECIFIED +} + +func (x *EACLRecord) GetFilters() []*EACLRecord_Filter { + if x != nil { + return x.Filters + } + return nil +} + +func (x *EACLRecord) GetTargets() []*EACLRecord_Target { + if x != nil { + return x.Targets + } + return nil +} + +func (x *EACLRecord) SetOperation(v Operation) { + x.Operation = &v +} + +func (x *EACLRecord) SetAction(v Action) { + x.Action = &v +} + +func (x *EACLRecord) SetFilters(v []*EACLRecord_Filter) { + x.Filters = v +} + +func (x *EACLRecord) SetTargets(v []*EACLRecord_Target) { + x.Targets = v +} + +func (x *EACLRecord) HasOperation() bool { + if x == nil { + return false + } + return x.Operation != nil +} + +func (x *EACLRecord) HasAction() bool { + if x == nil { + return false + } + return x.Action != nil +} + +func (x *EACLRecord) ClearOperation() { + x.Operation = nil +} + +func (x *EACLRecord) ClearAction() { + x.Action = nil +} + +type EACLRecord_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // FrostFS request Verb to match + Operation *Operation + // Rule execution result. Either allows or denies access if filters match. + Action *Action + // List of filters to match and see if rule is applicable + Filters []*EACLRecord_Filter + // List of target subjects to apply ACL rule to + Targets []*EACLRecord_Target +} + +func (b0 EACLRecord_builder) Build() *EACLRecord { + m0 := &EACLRecord{} + b, x := &b0, m0 + _, _ = b, x + x.Operation = b.Operation + x.Action = b.Action + x.Filters = b.Filters + x.Targets = b.Targets + return m0 +} + +// Extended ACL rules table. A list of ACL rules defined additionally to Basic +// ACL. Extended ACL rules can be attached to a container and can be updated +// or may be defined in `BearerToken` structure. Please see the corresponding +// FrostFS Technical Specification section for detailed description. +type EACLTable struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // eACL format version. Effectively, the version of API library used to create + // eACL Table. + Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + // Identifier of the container that should use given access control rules + ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID" json:"container_id,omitempty"` + // List of Extended ACL rules + Records []*EACLRecord `protobuf:"bytes,3,rep,name=records" json:"records,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EACLTable) Reset() { + *x = EACLTable{} + mi := &file_api_acl_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EACLTable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLTable) ProtoMessage() {} + +func (x *EACLTable) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EACLTable) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} + +func (x *EACLTable) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *EACLTable) GetRecords() []*EACLRecord { + if x != nil { + return x.Records + } + return nil +} + +func (x *EACLTable) SetVersion(v *grpc.Version) { + x.Version = v +} + +func (x *EACLTable) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} + +func (x *EACLTable) SetRecords(v []*EACLRecord) { + x.Records = v +} + +func (x *EACLTable) HasVersion() bool { + if x == nil { + return false + } + return x.Version != nil +} + +func (x *EACLTable) HasContainerId() bool { + if x == nil { + return false + } + return x.ContainerId != nil +} + +func (x *EACLTable) ClearVersion() { + x.Version = nil +} + +func (x *EACLTable) ClearContainerId() { + x.ContainerId = nil +} + +type EACLTable_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // eACL format version. Effectively, the version of API library used to create + // eACL Table. + Version *grpc.Version + // Identifier of the container that should use given access control rules + ContainerId *grpc.ContainerID + // List of Extended ACL rules + Records []*EACLRecord +} + +func (b0 EACLTable_builder) Build() *EACLTable { + m0 := &EACLTable{} + b, x := &b0, m0 + _, _ = b, x + x.Version = b.Version + x.ContainerId = b.ContainerId + x.Records = b.Records + return m0 +} + +// BearerToken allows to attach signed Extended ACL rules to the request in +// `RequestMetaHeader`. If container's Basic ACL rules allow, the attached rule +// set will be checked instead of one attached to the container itself. Just +// like [JWT](https://jwt.io), it has a limited lifetime and scope, hence can be +// used in the similar use cases, like providing authorisation to externally +// authenticated party. +// +// BearerToken can be issued only by the container's owner and must be signed +// using the key associated with the container's `OwnerID`. +type BearerToken struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Bearer Token body + Body *BearerToken_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Signature of BearerToken body + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BearerToken) Reset() { + *x = BearerToken{} + mi := &file_api_acl_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BearerToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken) ProtoMessage() {} + +func (x *BearerToken) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BearerToken) GetBody() *BearerToken_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *BearerToken) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *BearerToken) SetBody(v *BearerToken_Body) { + x.Body = v +} + +func (x *BearerToken) SetSignature(v *grpc.Signature) { + x.Signature = v +} + +func (x *BearerToken) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *BearerToken) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *BearerToken) ClearBody() { + x.Body = nil +} + +func (x *BearerToken) ClearSignature() { + x.Signature = nil +} + +type BearerToken_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Bearer Token body + Body *BearerToken_Body + // Signature of BearerToken body + Signature *grpc.Signature +} + +func (b0 BearerToken_builder) Build() *BearerToken { + m0 := &BearerToken{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.Signature = b.Signature + return m0 +} + +// Filter to check particular properties of the request or the object. +// +// By default `key` field refers to the corresponding object's `Attribute`. +// Some Object's header fields can also be accessed by adding `$Object:` +// prefix to the name. Here is the list of fields available via this prefix: +// +// - $Object:version \ +// version +// - $Object:objectID \ +// object_id +// - $Object:containerID \ +// container_id +// - $Object:ownerID \ +// owner_id +// - $Object:creationEpoch \ +// creation_epoch +// - $Object:payloadLength \ +// payload_length +// - $Object:payloadHash \ +// payload_hash +// - $Object:objectType \ +// object_type +// - $Object:homomorphicHash \ +// homomorphic_hash +// +// Please note, that if request or response does not have object's headers of +// full object (Range, RangeHash, Search, Delete), it will not be possible to +// filter by object header fields or user attributes. From the well-known list +// only `$Object:objectID` and `$Object:containerID` will be available, as +// it's possible to take that information from the requested address. +type EACLRecord_Filter struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Define if Object or Request header will be used + HeaderType *HeaderType `protobuf:"varint,1,opt,name=header_type,json=headerType,enum=neo.fs.v2.acl.HeaderType" json:"header_type,omitempty"` + // Match operation type + MatchType *MatchType `protobuf:"varint,2,opt,name=match_type,json=matchType,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` + // Name of the Header to use + Key *string `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` + // Expected Header Value or pattern to match + Value *string `protobuf:"bytes,4,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EACLRecord_Filter) Reset() { + *x = EACLRecord_Filter{} + mi := &file_api_acl_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EACLRecord_Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLRecord_Filter) ProtoMessage() {} + +func (x *EACLRecord_Filter) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EACLRecord_Filter) GetHeaderType() HeaderType { + if x != nil && x.HeaderType != nil { + return *x.HeaderType + } + return HeaderType_HEADER_UNSPECIFIED +} + +func (x *EACLRecord_Filter) GetMatchType() MatchType { + if x != nil && x.MatchType != nil { + return *x.MatchType + } + return MatchType_MATCH_TYPE_UNSPECIFIED +} + +func (x *EACLRecord_Filter) GetKey() string { + if x != nil && x.Key != nil { + return *x.Key + } + return "" +} + +func (x *EACLRecord_Filter) GetValue() string { + if x != nil && x.Value != nil { + return *x.Value + } + return "" +} + +func (x *EACLRecord_Filter) SetHeaderType(v HeaderType) { + x.HeaderType = &v +} + +func (x *EACLRecord_Filter) SetMatchType(v MatchType) { + x.MatchType = &v +} + +func (x *EACLRecord_Filter) SetKey(v string) { + x.Key = &v +} + +func (x *EACLRecord_Filter) SetValue(v string) { + x.Value = &v +} + +func (x *EACLRecord_Filter) HasHeaderType() bool { + if x == nil { + return false + } + return x.HeaderType != nil +} + +func (x *EACLRecord_Filter) HasMatchType() bool { + if x == nil { + return false + } + return x.MatchType != nil +} + +func (x *EACLRecord_Filter) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *EACLRecord_Filter) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *EACLRecord_Filter) ClearHeaderType() { + x.HeaderType = nil +} + +func (x *EACLRecord_Filter) ClearMatchType() { + x.MatchType = nil +} + +func (x *EACLRecord_Filter) ClearKey() { + x.Key = nil +} + +func (x *EACLRecord_Filter) ClearValue() { + x.Value = nil +} + +type EACLRecord_Filter_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Define if Object or Request header will be used + HeaderType *HeaderType + // Match operation type + MatchType *MatchType + // Name of the Header to use + Key *string + // Expected Header Value or pattern to match + Value *string +} + +func (b0 EACLRecord_Filter_builder) Build() *EACLRecord_Filter { + m0 := &EACLRecord_Filter{} + b, x := &b0, m0 + _, _ = b, x + x.HeaderType = b.HeaderType + x.MatchType = b.MatchType + x.Key = b.Key + x.Value = b.Value + return m0 +} + +// Target to apply ACL rule. Can be a subject's role class or a list of public +// keys to match. +type EACLRecord_Target struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Target subject's role class + Role *Role `protobuf:"varint,1,opt,name=role,enum=neo.fs.v2.acl.Role" json:"role,omitempty"` + // List of public keys to identify target subject + Keys [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EACLRecord_Target) Reset() { + *x = EACLRecord_Target{} + mi := &file_api_acl_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EACLRecord_Target) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLRecord_Target) ProtoMessage() {} + +func (x *EACLRecord_Target) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EACLRecord_Target) GetRole() Role { + if x != nil && x.Role != nil { + return *x.Role + } + return Role_ROLE_UNSPECIFIED +} + +func (x *EACLRecord_Target) GetKeys() [][]byte { + if x != nil { + return x.Keys + } + return nil +} + +func (x *EACLRecord_Target) SetRole(v Role) { + x.Role = &v +} + +func (x *EACLRecord_Target) SetKeys(v [][]byte) { + x.Keys = v +} + +func (x *EACLRecord_Target) HasRole() bool { + if x == nil { + return false + } + return x.Role != nil +} + +func (x *EACLRecord_Target) ClearRole() { + x.Role = nil +} + +type EACLRecord_Target_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Target subject's role class + Role *Role + // List of public keys to identify target subject + Keys [][]byte +} + +func (b0 EACLRecord_Target_builder) Build() *EACLRecord_Target { + m0 := &EACLRecord_Target{} + b, x := &b0, m0 + _, _ = b, x + x.Role = b.Role + x.Keys = b.Keys + return m0 +} + +// Bearer Token body structure contains Extended ACL table issued by the +// container owner with additional information preventing token abuse. +type BearerToken_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Table of Extended ACL rules to use instead of the ones attached to the + // container. If it contains `container_id` field, bearer token is only + // valid for this specific container. Otherwise, any container of the same + // owner is allowed. + // + // Deprecated: eACL tables are no longer relevant - `APEOverrides` should be + // used instead. + EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable" json:"eacl_table,omitempty"` + // `OwnerID` defines to whom the token was issued. It must match the request + // originator's `OwnerID`. If empty, any token bearer will be accepted. + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + // Token expiration and valid time period parameters + Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime" json:"lifetime,omitempty"` + // AllowImpersonate flag to consider token signer as request owner. + // If this field is true extended ACL table in token body isn't processed. + AllowImpersonate *bool `protobuf:"varint,4,opt,name=allow_impersonate,json=allowImpersonate" json:"allow_impersonate,omitempty"` + // APE override for the target. + ApeOverride *BearerToken_Body_APEOverride `protobuf:"bytes,5,opt,name=ape_override,json=apeOverride" json:"ape_override,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BearerToken_Body) Reset() { + *x = BearerToken_Body{} + mi := &file_api_acl_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BearerToken_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken_Body) ProtoMessage() {} + +func (x *BearerToken_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BearerToken_Body) GetEaclTable() *EACLTable { + if x != nil { + return x.EaclTable + } + return nil +} + +func (x *BearerToken_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { + if x != nil { + return x.Lifetime + } + return nil +} + +func (x *BearerToken_Body) GetAllowImpersonate() bool { + if x != nil && x.AllowImpersonate != nil { + return *x.AllowImpersonate + } + return false +} + +func (x *BearerToken_Body) GetApeOverride() *BearerToken_Body_APEOverride { + if x != nil { + return x.ApeOverride + } + return nil +} + +func (x *BearerToken_Body) SetEaclTable(v *EACLTable) { + x.EaclTable = v +} + +func (x *BearerToken_Body) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} + +func (x *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) { + x.Lifetime = v +} + +func (x *BearerToken_Body) SetAllowImpersonate(v bool) { + x.AllowImpersonate = &v +} + +func (x *BearerToken_Body) SetApeOverride(v *BearerToken_Body_APEOverride) { + x.ApeOverride = v +} + +func (x *BearerToken_Body) HasEaclTable() bool { + if x == nil { + return false + } + return x.EaclTable != nil +} + +func (x *BearerToken_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *BearerToken_Body) HasLifetime() bool { + if x == nil { + return false + } + return x.Lifetime != nil +} + +func (x *BearerToken_Body) HasAllowImpersonate() bool { + if x == nil { + return false + } + return x.AllowImpersonate != nil +} + +func (x *BearerToken_Body) HasApeOverride() bool { + if x == nil { + return false + } + return x.ApeOverride != nil +} + +func (x *BearerToken_Body) ClearEaclTable() { + x.EaclTable = nil +} + +func (x *BearerToken_Body) ClearOwnerId() { + x.OwnerId = nil +} + +func (x *BearerToken_Body) ClearLifetime() { + x.Lifetime = nil +} + +func (x *BearerToken_Body) ClearAllowImpersonate() { + x.AllowImpersonate = nil +} + +func (x *BearerToken_Body) ClearApeOverride() { + x.ApeOverride = nil +} + +type BearerToken_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Table of Extended ACL rules to use instead of the ones attached to the + // container. If it contains `container_id` field, bearer token is only + // valid for this specific container. Otherwise, any container of the same + // owner is allowed. + // + // Deprecated: eACL tables are no longer relevant - `APEOverrides` should be + // used instead. + EaclTable *EACLTable + // `OwnerID` defines to whom the token was issued. It must match the request + // originator's `OwnerID`. If empty, any token bearer will be accepted. + OwnerId *grpc.OwnerID + // Token expiration and valid time period parameters + Lifetime *BearerToken_Body_TokenLifetime + // AllowImpersonate flag to consider token signer as request owner. + // If this field is true extended ACL table in token body isn't processed. + AllowImpersonate *bool + // APE override for the target. + ApeOverride *BearerToken_Body_APEOverride +} + +func (b0 BearerToken_Body_builder) Build() *BearerToken_Body { + m0 := &BearerToken_Body{} + b, x := &b0, m0 + _, _ = b, x + x.EaclTable = b.EaclTable + x.OwnerId = b.OwnerId + x.Lifetime = b.Lifetime + x.AllowImpersonate = b.AllowImpersonate + x.ApeOverride = b.ApeOverride + return m0 +} + +// Lifetime parameters of the token. Field names taken from +// [rfc7519](https://tools.ietf.org/html/rfc7519). +type BearerToken_Body_TokenLifetime struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Expiration Epoch + Exp *uint64 `protobuf:"varint,1,opt,name=exp" json:"exp,omitempty"` + // Not valid before Epoch + Nbf *uint64 `protobuf:"varint,2,opt,name=nbf" json:"nbf,omitempty"` + // Issued at Epoch + Iat *uint64 `protobuf:"varint,3,opt,name=iat" json:"iat,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BearerToken_Body_TokenLifetime) Reset() { + *x = BearerToken_Body_TokenLifetime{} + mi := &file_api_acl_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BearerToken_Body_TokenLifetime) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken_Body_TokenLifetime) ProtoMessage() {} + +func (x *BearerToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BearerToken_Body_TokenLifetime) GetExp() uint64 { + if x != nil && x.Exp != nil { + return *x.Exp + } + return 0 +} + +func (x *BearerToken_Body_TokenLifetime) GetNbf() uint64 { + if x != nil && x.Nbf != nil { + return *x.Nbf + } + return 0 +} + +func (x *BearerToken_Body_TokenLifetime) GetIat() uint64 { + if x != nil && x.Iat != nil { + return *x.Iat + } + return 0 +} + +func (x *BearerToken_Body_TokenLifetime) SetExp(v uint64) { + x.Exp = &v +} + +func (x *BearerToken_Body_TokenLifetime) SetNbf(v uint64) { + x.Nbf = &v +} + +func (x *BearerToken_Body_TokenLifetime) SetIat(v uint64) { + x.Iat = &v +} + +func (x *BearerToken_Body_TokenLifetime) HasExp() bool { + if x == nil { + return false + } + return x.Exp != nil +} + +func (x *BearerToken_Body_TokenLifetime) HasNbf() bool { + if x == nil { + return false + } + return x.Nbf != nil +} + +func (x *BearerToken_Body_TokenLifetime) HasIat() bool { + if x == nil { + return false + } + return x.Iat != nil +} + +func (x *BearerToken_Body_TokenLifetime) ClearExp() { + x.Exp = nil +} + +func (x *BearerToken_Body_TokenLifetime) ClearNbf() { + x.Nbf = nil +} + +func (x *BearerToken_Body_TokenLifetime) ClearIat() { + x.Iat = nil +} + +type BearerToken_Body_TokenLifetime_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Expiration Epoch + Exp *uint64 + // Not valid before Epoch + Nbf *uint64 + // Issued at Epoch + Iat *uint64 +} + +func (b0 BearerToken_Body_TokenLifetime_builder) Build() *BearerToken_Body_TokenLifetime { + m0 := &BearerToken_Body_TokenLifetime{} + b, x := &b0, m0 + _, _ = b, x + x.Exp = b.Exp + x.Nbf = b.Nbf + x.Iat = b.Iat + return m0 +} + +// APEOverride is the list of APE chains defined for a target. +// These chains are meant to serve as overrides to the already defined (or +// even undefined) APE chains for the target (see contract `Policy`). +// +// The server-side processing of the bearer token with set APE overrides +// must verify if a client is permitted to override chains for the target, +// preventing unauthorized access through the APE mechanism. +type BearerToken_Body_APEOverride struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Target for which chains are applied. + Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + // The list of APE chains. + Chains []*grpc1.Chain `protobuf:"bytes,2,rep,name=chains" json:"chains,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BearerToken_Body_APEOverride) Reset() { + *x = BearerToken_Body_APEOverride{} + mi := &file_api_acl_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BearerToken_Body_APEOverride) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken_Body_APEOverride) ProtoMessage() {} + +func (x *BearerToken_Body_APEOverride) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BearerToken_Body_APEOverride) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.Target + } + return nil +} + +func (x *BearerToken_Body_APEOverride) GetChains() []*grpc1.Chain { + if x != nil { + return x.Chains + } + return nil +} + +func (x *BearerToken_Body_APEOverride) SetTarget(v *grpc1.ChainTarget) { + x.Target = v +} + +func (x *BearerToken_Body_APEOverride) SetChains(v []*grpc1.Chain) { + x.Chains = v +} + +func (x *BearerToken_Body_APEOverride) HasTarget() bool { + if x == nil { + return false + } + return x.Target != nil +} + +func (x *BearerToken_Body_APEOverride) ClearTarget() { + x.Target = nil +} + +type BearerToken_Body_APEOverride_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Target for which chains are applied. + Target *grpc1.ChainTarget + // The list of APE chains. + Chains []*grpc1.Chain +} + +func (b0 BearerToken_Body_APEOverride_builder) Build() *BearerToken_Body_APEOverride { + m0 := &BearerToken_Body_APEOverride{} + b, x := &b0, m0 + _, _ = b, x + x.Target = b.Target + x.Chains = b.Chains + return m0 +} + +var File_api_acl_grpc_types_proto protoreflect.FileDescriptor + +var file_api_acl_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, + 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, + 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, + 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, + 0x12, 0x3a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, + 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x1a, 0xa5, 0x01, 0x0a, + 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x27, + 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x52, 0x6f, 0x6c, + 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, + 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x07, + 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, + 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x22, 0xf3, 0x04, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, + 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, + 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, + 0xf5, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, + 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, + 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, 0x54, 0x61, 0x62, 0x6c, + 0x65, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, + 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, + 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x73, + 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x49, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x4e, 0x0a, + 0x0c, 0x61, 0x70, 0x65, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x50, 0x45, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, + 0x52, 0x0b, 0x61, 0x70, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x1a, 0x45, 0x0a, + 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, + 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, + 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x03, 0x69, 0x61, 0x74, 0x1a, 0x71, 0x0a, 0x0b, 0x41, 0x50, 0x45, 0x4f, 0x76, 0x65, 0x72, 0x72, + 0x69, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, + 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x2a, 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, + 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, + 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, + 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, + 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, + 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, + 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, + 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, + 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, + 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, + 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, + 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, + 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x4a, 0x0a, 0x0a, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, + 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, + 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x59, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x2e, 0x66, + 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, + 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, + 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x6c, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, + 0x63, 0x6c, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_acl_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_api_acl_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_api_acl_grpc_types_proto_goTypes = []any{ + (Role)(0), // 0: neo.fs.v2.acl.Role + (MatchType)(0), // 1: neo.fs.v2.acl.MatchType + (Operation)(0), // 2: neo.fs.v2.acl.Operation + (Action)(0), // 3: neo.fs.v2.acl.Action + (HeaderType)(0), // 4: neo.fs.v2.acl.HeaderType + (*EACLRecord)(nil), // 5: neo.fs.v2.acl.EACLRecord + (*EACLTable)(nil), // 6: neo.fs.v2.acl.EACLTable + (*BearerToken)(nil), // 7: neo.fs.v2.acl.BearerToken + (*EACLRecord_Filter)(nil), // 8: neo.fs.v2.acl.EACLRecord.Filter + (*EACLRecord_Target)(nil), // 9: neo.fs.v2.acl.EACLRecord.Target + (*BearerToken_Body)(nil), // 10: neo.fs.v2.acl.BearerToken.Body + (*BearerToken_Body_TokenLifetime)(nil), // 11: neo.fs.v2.acl.BearerToken.Body.TokenLifetime + (*BearerToken_Body_APEOverride)(nil), // 12: neo.fs.v2.acl.BearerToken.Body.APEOverride + (*grpc.Version)(nil), // 13: neo.fs.v2.refs.Version + (*grpc.ContainerID)(nil), // 14: neo.fs.v2.refs.ContainerID + (*grpc.Signature)(nil), // 15: neo.fs.v2.refs.Signature + (*grpc.OwnerID)(nil), // 16: neo.fs.v2.refs.OwnerID + (*grpc1.ChainTarget)(nil), // 17: frostfs.v2.ape.ChainTarget + (*grpc1.Chain)(nil), // 18: frostfs.v2.ape.Chain +} +var file_api_acl_grpc_types_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.acl.EACLRecord.operation:type_name -> neo.fs.v2.acl.Operation + 3, // 1: neo.fs.v2.acl.EACLRecord.action:type_name -> neo.fs.v2.acl.Action + 8, // 2: neo.fs.v2.acl.EACLRecord.filters:type_name -> neo.fs.v2.acl.EACLRecord.Filter + 9, // 3: neo.fs.v2.acl.EACLRecord.targets:type_name -> neo.fs.v2.acl.EACLRecord.Target + 13, // 4: neo.fs.v2.acl.EACLTable.version:type_name -> neo.fs.v2.refs.Version + 14, // 5: neo.fs.v2.acl.EACLTable.container_id:type_name -> neo.fs.v2.refs.ContainerID + 5, // 6: neo.fs.v2.acl.EACLTable.records:type_name -> neo.fs.v2.acl.EACLRecord + 10, // 7: neo.fs.v2.acl.BearerToken.body:type_name -> neo.fs.v2.acl.BearerToken.Body + 15, // 8: neo.fs.v2.acl.BearerToken.signature:type_name -> neo.fs.v2.refs.Signature + 4, // 9: neo.fs.v2.acl.EACLRecord.Filter.header_type:type_name -> neo.fs.v2.acl.HeaderType + 1, // 10: neo.fs.v2.acl.EACLRecord.Filter.match_type:type_name -> neo.fs.v2.acl.MatchType + 0, // 11: neo.fs.v2.acl.EACLRecord.Target.role:type_name -> neo.fs.v2.acl.Role + 6, // 12: neo.fs.v2.acl.BearerToken.Body.eacl_table:type_name -> neo.fs.v2.acl.EACLTable + 16, // 13: neo.fs.v2.acl.BearerToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 11, // 14: neo.fs.v2.acl.BearerToken.Body.lifetime:type_name -> neo.fs.v2.acl.BearerToken.Body.TokenLifetime + 12, // 15: neo.fs.v2.acl.BearerToken.Body.ape_override:type_name -> neo.fs.v2.acl.BearerToken.Body.APEOverride + 17, // 16: neo.fs.v2.acl.BearerToken.Body.APEOverride.target:type_name -> frostfs.v2.ape.ChainTarget + 18, // 17: neo.fs.v2.acl.BearerToken.Body.APEOverride.chains:type_name -> frostfs.v2.ape.Chain + 18, // [18:18] is the sub-list for method output_type + 18, // [18:18] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name +} + +func init() { file_api_acl_grpc_types_proto_init() } +func file_api_acl_grpc_types_proto_init() { + if File_api_acl_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_acl_grpc_types_proto_rawDesc, + NumEnums: 5, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_acl_grpc_types_proto_goTypes, + DependencyIndexes: file_api_acl_grpc_types_proto_depIdxs, + EnumInfos: file_api_acl_grpc_types_proto_enumTypes, + MessageInfos: file_api_acl_grpc_types_proto_msgTypes, + }.Build() + File_api_acl_grpc_types_proto = out.File + file_api_acl_grpc_types_proto_rawDesc = nil + file_api_acl_grpc_types_proto_goTypes = nil + file_api_acl_grpc_types_proto_depIdxs = nil +} diff --git a/api/acl/grpc/types_protoopaque.pb.go b/api/acl/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..a0001bf7 --- /dev/null +++ b/api/acl/grpc/types_protoopaque.pb.go @@ -0,0 +1,1589 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/acl/grpc/types.proto + +//go:build protoopaque + +package acl + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Target role of the access control rule in access control list. +type Role int32 + +const ( + // Unspecified role, default value + Role_ROLE_UNSPECIFIED Role = 0 + // User target rule is applied if sender is the owner of the container + Role_USER Role = 1 + // System target rule is applied if sender is a storage node within the + // container or an inner ring node + Role_SYSTEM Role = 2 + // Others target rule is applied if sender is neither a user nor a system + // target + Role_OTHERS Role = 3 +) + +// Enum value maps for Role. +var ( + Role_name = map[int32]string{ + 0: "ROLE_UNSPECIFIED", + 1: "USER", + 2: "SYSTEM", + 3: "OTHERS", + } + Role_value = map[string]int32{ + "ROLE_UNSPECIFIED": 0, + "USER": 1, + "SYSTEM": 2, + "OTHERS": 3, + } +) + +func (x Role) Enum() *Role { + p := new(Role) + *p = x + return p +} + +func (x Role) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Role) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Role) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[0] +} + +func (x Role) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// MatchType is an enumeration of match types. +type MatchType int32 + +const ( + // Unspecified match type, default value. + MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 + // Return true if strings are equal + MatchType_STRING_EQUAL MatchType = 1 + // Return true if strings are different + MatchType_STRING_NOT_EQUAL MatchType = 2 +) + +// Enum value maps for MatchType. +var ( + MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", + } + MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, + } +) + +func (x MatchType) Enum() *MatchType { + p := new(MatchType) + *p = x + return p +} + +func (x MatchType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MatchType) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (MatchType) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[1] +} + +func (x MatchType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Request's operation type to match if the rule is applicable to a particular +// request. +type Operation int32 + +const ( + // Unspecified operation, default value + Operation_OPERATION_UNSPECIFIED Operation = 0 + // Get + Operation_GET Operation = 1 + // Head + Operation_HEAD Operation = 2 + // Put + Operation_PUT Operation = 3 + // Delete + Operation_DELETE Operation = 4 + // Search + Operation_SEARCH Operation = 5 + // GetRange + Operation_GETRANGE Operation = 6 + // GetRangeHash + Operation_GETRANGEHASH Operation = 7 +) + +// Enum value maps for Operation. +var ( + Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", + 1: "GET", + 2: "HEAD", + 3: "PUT", + 4: "DELETE", + 5: "SEARCH", + 6: "GETRANGE", + 7: "GETRANGEHASH", + } + Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "GET": 1, + "HEAD": 2, + "PUT": 3, + "DELETE": 4, + "SEARCH": 5, + "GETRANGE": 6, + "GETRANGEHASH": 7, + } +) + +func (x Operation) Enum() *Operation { + p := new(Operation) + *p = x + return p +} + +func (x Operation) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Operation) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (Operation) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[2] +} + +func (x Operation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Rule execution result action. Either allows or denies access if the rule's +// filters match. +type Action int32 + +const ( + // Unspecified action, default value + Action_ACTION_UNSPECIFIED Action = 0 + // Allow action + Action_ALLOW Action = 1 + // Deny action + Action_DENY Action = 2 +) + +// Enum value maps for Action. +var ( + Action_name = map[int32]string{ + 0: "ACTION_UNSPECIFIED", + 1: "ALLOW", + 2: "DENY", + } + Action_value = map[string]int32{ + "ACTION_UNSPECIFIED": 0, + "ALLOW": 1, + "DENY": 2, + } +) + +func (x Action) Enum() *Action { + p := new(Action) + *p = x + return p +} + +func (x Action) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Action) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[3].Descriptor() +} + +func (Action) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[3] +} + +func (x Action) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Enumeration of possible sources of Headers to apply filters. +type HeaderType int32 + +const ( + // Unspecified header, default value. + HeaderType_HEADER_UNSPECIFIED HeaderType = 0 + // Filter request headers + HeaderType_REQUEST HeaderType = 1 + // Filter object headers + HeaderType_OBJECT HeaderType = 2 + // Filter service headers. These are not processed by FrostFS nodes and + // exist for service use only. + HeaderType_SERVICE HeaderType = 3 +) + +// Enum value maps for HeaderType. +var ( + HeaderType_name = map[int32]string{ + 0: "HEADER_UNSPECIFIED", + 1: "REQUEST", + 2: "OBJECT", + 3: "SERVICE", + } + HeaderType_value = map[string]int32{ + "HEADER_UNSPECIFIED": 0, + "REQUEST": 1, + "OBJECT": 2, + "SERVICE": 3, + } +) + +func (x HeaderType) Enum() *HeaderType { + p := new(HeaderType) + *p = x + return p +} + +func (x HeaderType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HeaderType) Descriptor() protoreflect.EnumDescriptor { + return file_api_acl_grpc_types_proto_enumTypes[4].Descriptor() +} + +func (HeaderType) Type() protoreflect.EnumType { + return &file_api_acl_grpc_types_proto_enumTypes[4] +} + +func (x HeaderType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Describes a single eACL rule. +type EACLRecord struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Operation Operation `protobuf:"varint,1,opt,name=operation,enum=neo.fs.v2.acl.Operation" json:"operation,omitempty"` + xxx_hidden_Action Action `protobuf:"varint,2,opt,name=action,enum=neo.fs.v2.acl.Action" json:"action,omitempty"` + xxx_hidden_Filters *[]*EACLRecord_Filter `protobuf:"bytes,3,rep,name=filters" json:"filters,omitempty"` + xxx_hidden_Targets *[]*EACLRecord_Target `protobuf:"bytes,4,rep,name=targets" json:"targets,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EACLRecord) Reset() { + *x = EACLRecord{} + mi := &file_api_acl_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EACLRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLRecord) ProtoMessage() {} + +func (x *EACLRecord) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EACLRecord) GetOperation() Operation { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_Operation + } + } + return Operation_OPERATION_UNSPECIFIED +} + +func (x *EACLRecord) GetAction() Action { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 1) { + return x.xxx_hidden_Action + } + } + return Action_ACTION_UNSPECIFIED +} + +func (x *EACLRecord) GetFilters() []*EACLRecord_Filter { + if x != nil { + if x.xxx_hidden_Filters != nil { + return *x.xxx_hidden_Filters + } + } + return nil +} + +func (x *EACLRecord) GetTargets() []*EACLRecord_Target { + if x != nil { + if x.xxx_hidden_Targets != nil { + return *x.xxx_hidden_Targets + } + } + return nil +} + +func (x *EACLRecord) SetOperation(v Operation) { + x.xxx_hidden_Operation = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *EACLRecord) SetAction(v Action) { + x.xxx_hidden_Action = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *EACLRecord) SetFilters(v []*EACLRecord_Filter) { + x.xxx_hidden_Filters = &v +} + +func (x *EACLRecord) SetTargets(v []*EACLRecord_Target) { + x.xxx_hidden_Targets = &v +} + +func (x *EACLRecord) HasOperation() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *EACLRecord) HasAction() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *EACLRecord) ClearOperation() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Operation = Operation_OPERATION_UNSPECIFIED +} + +func (x *EACLRecord) ClearAction() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Action = Action_ACTION_UNSPECIFIED +} + +type EACLRecord_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // FrostFS request Verb to match + Operation *Operation + // Rule execution result. Either allows or denies access if filters match. + Action *Action + // List of filters to match and see if rule is applicable + Filters []*EACLRecord_Filter + // List of target subjects to apply ACL rule to + Targets []*EACLRecord_Target +} + +func (b0 EACLRecord_builder) Build() *EACLRecord { + m0 := &EACLRecord{} + b, x := &b0, m0 + _, _ = b, x + if b.Operation != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_Operation = *b.Operation + } + if b.Action != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_Action = *b.Action + } + x.xxx_hidden_Filters = &b.Filters + x.xxx_hidden_Targets = &b.Targets + return m0 +} + +// Extended ACL rules table. A list of ACL rules defined additionally to Basic +// ACL. Extended ACL rules can be attached to a container and can be updated +// or may be defined in `BearerToken` structure. Please see the corresponding +// FrostFS Technical Specification section for detailed description. +type EACLTable struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + xxx_hidden_ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID" json:"container_id,omitempty"` + xxx_hidden_Records *[]*EACLRecord `protobuf:"bytes,3,rep,name=records" json:"records,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EACLTable) Reset() { + *x = EACLTable{} + mi := &file_api_acl_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EACLTable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLTable) ProtoMessage() {} + +func (x *EACLTable) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EACLTable) GetVersion() *grpc.Version { + if x != nil { + return x.xxx_hidden_Version + } + return nil +} + +func (x *EACLTable) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.xxx_hidden_ContainerId + } + return nil +} + +func (x *EACLTable) GetRecords() []*EACLRecord { + if x != nil { + if x.xxx_hidden_Records != nil { + return *x.xxx_hidden_Records + } + } + return nil +} + +func (x *EACLTable) SetVersion(v *grpc.Version) { + x.xxx_hidden_Version = v +} + +func (x *EACLTable) SetContainerId(v *grpc.ContainerID) { + x.xxx_hidden_ContainerId = v +} + +func (x *EACLTable) SetRecords(v []*EACLRecord) { + x.xxx_hidden_Records = &v +} + +func (x *EACLTable) HasVersion() bool { + if x == nil { + return false + } + return x.xxx_hidden_Version != nil +} + +func (x *EACLTable) HasContainerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ContainerId != nil +} + +func (x *EACLTable) ClearVersion() { + x.xxx_hidden_Version = nil +} + +func (x *EACLTable) ClearContainerId() { + x.xxx_hidden_ContainerId = nil +} + +type EACLTable_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // eACL format version. Effectively, the version of API library used to create + // eACL Table. + Version *grpc.Version + // Identifier of the container that should use given access control rules + ContainerId *grpc.ContainerID + // List of Extended ACL rules + Records []*EACLRecord +} + +func (b0 EACLTable_builder) Build() *EACLTable { + m0 := &EACLTable{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Version = b.Version + x.xxx_hidden_ContainerId = b.ContainerId + x.xxx_hidden_Records = &b.Records + return m0 +} + +// BearerToken allows to attach signed Extended ACL rules to the request in +// `RequestMetaHeader`. If container's Basic ACL rules allow, the attached rule +// set will be checked instead of one attached to the container itself. Just +// like [JWT](https://jwt.io), it has a limited lifetime and scope, hence can be +// used in the similar use cases, like providing authorisation to externally +// authenticated party. +// +// BearerToken can be issued only by the container's owner and must be signed +// using the key associated with the container's `OwnerID`. +type BearerToken struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *BearerToken_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BearerToken) Reset() { + *x = BearerToken{} + mi := &file_api_acl_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BearerToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken) ProtoMessage() {} + +func (x *BearerToken) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BearerToken) GetBody() *BearerToken_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *BearerToken) GetSignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *BearerToken) SetBody(v *BearerToken_Body) { + x.xxx_hidden_Body = v +} + +func (x *BearerToken) SetSignature(v *grpc.Signature) { + x.xxx_hidden_Signature = v +} + +func (x *BearerToken) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *BearerToken) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *BearerToken) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *BearerToken) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +type BearerToken_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Bearer Token body + Body *BearerToken_Body + // Signature of BearerToken body + Signature *grpc.Signature +} + +func (b0 BearerToken_builder) Build() *BearerToken { + m0 := &BearerToken{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_Signature = b.Signature + return m0 +} + +// Filter to check particular properties of the request or the object. +// +// By default `key` field refers to the corresponding object's `Attribute`. +// Some Object's header fields can also be accessed by adding `$Object:` +// prefix to the name. Here is the list of fields available via this prefix: +// +// - $Object:version \ +// version +// - $Object:objectID \ +// object_id +// - $Object:containerID \ +// container_id +// - $Object:ownerID \ +// owner_id +// - $Object:creationEpoch \ +// creation_epoch +// - $Object:payloadLength \ +// payload_length +// - $Object:payloadHash \ +// payload_hash +// - $Object:objectType \ +// object_type +// - $Object:homomorphicHash \ +// homomorphic_hash +// +// Please note, that if request or response does not have object's headers of +// full object (Range, RangeHash, Search, Delete), it will not be possible to +// filter by object header fields or user attributes. From the well-known list +// only `$Object:objectID` and `$Object:containerID` will be available, as +// it's possible to take that information from the requested address. +type EACLRecord_Filter struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_HeaderType HeaderType `protobuf:"varint,1,opt,name=header_type,json=headerType,enum=neo.fs.v2.acl.HeaderType" json:"header_type,omitempty"` + xxx_hidden_MatchType MatchType `protobuf:"varint,2,opt,name=match_type,json=matchType,enum=neo.fs.v2.acl.MatchType" json:"match_type,omitempty"` + xxx_hidden_Key *string `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` + xxx_hidden_Value *string `protobuf:"bytes,4,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EACLRecord_Filter) Reset() { + *x = EACLRecord_Filter{} + mi := &file_api_acl_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EACLRecord_Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLRecord_Filter) ProtoMessage() {} + +func (x *EACLRecord_Filter) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EACLRecord_Filter) GetHeaderType() HeaderType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_HeaderType + } + } + return HeaderType_HEADER_UNSPECIFIED +} + +func (x *EACLRecord_Filter) GetMatchType() MatchType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 1) { + return x.xxx_hidden_MatchType + } + } + return MatchType_MATCH_TYPE_UNSPECIFIED +} + +func (x *EACLRecord_Filter) GetKey() string { + if x != nil { + if x.xxx_hidden_Key != nil { + return *x.xxx_hidden_Key + } + return "" + } + return "" +} + +func (x *EACLRecord_Filter) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *EACLRecord_Filter) SetHeaderType(v HeaderType) { + x.xxx_hidden_HeaderType = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *EACLRecord_Filter) SetMatchType(v MatchType) { + x.xxx_hidden_MatchType = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *EACLRecord_Filter) SetKey(v string) { + x.xxx_hidden_Key = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *EACLRecord_Filter) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *EACLRecord_Filter) HasHeaderType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *EACLRecord_Filter) HasMatchType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *EACLRecord_Filter) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *EACLRecord_Filter) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *EACLRecord_Filter) ClearHeaderType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_HeaderType = HeaderType_HEADER_UNSPECIFIED +} + +func (x *EACLRecord_Filter) ClearMatchType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_MatchType = MatchType_MATCH_TYPE_UNSPECIFIED +} + +func (x *EACLRecord_Filter) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Key = nil +} + +func (x *EACLRecord_Filter) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Value = nil +} + +type EACLRecord_Filter_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Define if Object or Request header will be used + HeaderType *HeaderType + // Match operation type + MatchType *MatchType + // Name of the Header to use + Key *string + // Expected Header Value or pattern to match + Value *string +} + +func (b0 EACLRecord_Filter_builder) Build() *EACLRecord_Filter { + m0 := &EACLRecord_Filter{} + b, x := &b0, m0 + _, _ = b, x + if b.HeaderType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_HeaderType = *b.HeaderType + } + if b.MatchType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_MatchType = *b.MatchType + } + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_Key = b.Key + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Target to apply ACL rule. Can be a subject's role class or a list of public +// keys to match. +type EACLRecord_Target struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Role Role `protobuf:"varint,1,opt,name=role,enum=neo.fs.v2.acl.Role" json:"role,omitempty"` + xxx_hidden_Keys [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EACLRecord_Target) Reset() { + *x = EACLRecord_Target{} + mi := &file_api_acl_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EACLRecord_Target) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EACLRecord_Target) ProtoMessage() {} + +func (x *EACLRecord_Target) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EACLRecord_Target) GetRole() Role { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_Role + } + } + return Role_ROLE_UNSPECIFIED +} + +func (x *EACLRecord_Target) GetKeys() [][]byte { + if x != nil { + return x.xxx_hidden_Keys + } + return nil +} + +func (x *EACLRecord_Target) SetRole(v Role) { + x.xxx_hidden_Role = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *EACLRecord_Target) SetKeys(v [][]byte) { + x.xxx_hidden_Keys = v +} + +func (x *EACLRecord_Target) HasRole() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *EACLRecord_Target) ClearRole() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Role = Role_ROLE_UNSPECIFIED +} + +type EACLRecord_Target_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Target subject's role class + Role *Role + // List of public keys to identify target subject + Keys [][]byte +} + +func (b0 EACLRecord_Target_builder) Build() *EACLRecord_Target { + m0 := &EACLRecord_Target{} + b, x := &b0, m0 + _, _ = b, x + if b.Role != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Role = *b.Role + } + x.xxx_hidden_Keys = b.Keys + return m0 +} + +// Bearer Token body structure contains Extended ACL table issued by the +// container owner with additional information preventing token abuse. +type BearerToken_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_EaclTable *EACLTable `protobuf:"bytes,1,opt,name=eacl_table,json=eaclTable" json:"eacl_table,omitempty"` + xxx_hidden_OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + xxx_hidden_Lifetime *BearerToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime" json:"lifetime,omitempty"` + xxx_hidden_AllowImpersonate bool `protobuf:"varint,4,opt,name=allow_impersonate,json=allowImpersonate" json:"allow_impersonate,omitempty"` + xxx_hidden_ApeOverride *BearerToken_Body_APEOverride `protobuf:"bytes,5,opt,name=ape_override,json=apeOverride" json:"ape_override,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BearerToken_Body) Reset() { + *x = BearerToken_Body{} + mi := &file_api_acl_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BearerToken_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken_Body) ProtoMessage() {} + +func (x *BearerToken_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BearerToken_Body) GetEaclTable() *EACLTable { + if x != nil { + return x.xxx_hidden_EaclTable + } + return nil +} + +func (x *BearerToken_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *BearerToken_Body) GetLifetime() *BearerToken_Body_TokenLifetime { + if x != nil { + return x.xxx_hidden_Lifetime + } + return nil +} + +func (x *BearerToken_Body) GetAllowImpersonate() bool { + if x != nil { + return x.xxx_hidden_AllowImpersonate + } + return false +} + +func (x *BearerToken_Body) GetApeOverride() *BearerToken_Body_APEOverride { + if x != nil { + return x.xxx_hidden_ApeOverride + } + return nil +} + +func (x *BearerToken_Body) SetEaclTable(v *EACLTable) { + x.xxx_hidden_EaclTable = v +} + +func (x *BearerToken_Body) SetOwnerId(v *grpc.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) { + x.xxx_hidden_Lifetime = v +} + +func (x *BearerToken_Body) SetAllowImpersonate(v bool) { + x.xxx_hidden_AllowImpersonate = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 5) +} + +func (x *BearerToken_Body) SetApeOverride(v *BearerToken_Body_APEOverride) { + x.xxx_hidden_ApeOverride = v +} + +func (x *BearerToken_Body) HasEaclTable() bool { + if x == nil { + return false + } + return x.xxx_hidden_EaclTable != nil +} + +func (x *BearerToken_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *BearerToken_Body) HasLifetime() bool { + if x == nil { + return false + } + return x.xxx_hidden_Lifetime != nil +} + +func (x *BearerToken_Body) HasAllowImpersonate() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *BearerToken_Body) HasApeOverride() bool { + if x == nil { + return false + } + return x.xxx_hidden_ApeOverride != nil +} + +func (x *BearerToken_Body) ClearEaclTable() { + x.xxx_hidden_EaclTable = nil +} + +func (x *BearerToken_Body) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +func (x *BearerToken_Body) ClearLifetime() { + x.xxx_hidden_Lifetime = nil +} + +func (x *BearerToken_Body) ClearAllowImpersonate() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_AllowImpersonate = false +} + +func (x *BearerToken_Body) ClearApeOverride() { + x.xxx_hidden_ApeOverride = nil +} + +type BearerToken_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Table of Extended ACL rules to use instead of the ones attached to the + // container. If it contains `container_id` field, bearer token is only + // valid for this specific container. Otherwise, any container of the same + // owner is allowed. + // + // Deprecated: eACL tables are no longer relevant - `APEOverrides` should be + // used instead. + EaclTable *EACLTable + // `OwnerID` defines to whom the token was issued. It must match the request + // originator's `OwnerID`. If empty, any token bearer will be accepted. + OwnerId *grpc.OwnerID + // Token expiration and valid time period parameters + Lifetime *BearerToken_Body_TokenLifetime + // AllowImpersonate flag to consider token signer as request owner. + // If this field is true extended ACL table in token body isn't processed. + AllowImpersonate *bool + // APE override for the target. + ApeOverride *BearerToken_Body_APEOverride +} + +func (b0 BearerToken_Body_builder) Build() *BearerToken_Body { + m0 := &BearerToken_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_EaclTable = b.EaclTable + x.xxx_hidden_OwnerId = b.OwnerId + x.xxx_hidden_Lifetime = b.Lifetime + if b.AllowImpersonate != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 5) + x.xxx_hidden_AllowImpersonate = *b.AllowImpersonate + } + x.xxx_hidden_ApeOverride = b.ApeOverride + return m0 +} + +// Lifetime parameters of the token. Field names taken from +// [rfc7519](https://tools.ietf.org/html/rfc7519). +type BearerToken_Body_TokenLifetime struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Exp uint64 `protobuf:"varint,1,opt,name=exp" json:"exp,omitempty"` + xxx_hidden_Nbf uint64 `protobuf:"varint,2,opt,name=nbf" json:"nbf,omitempty"` + xxx_hidden_Iat uint64 `protobuf:"varint,3,opt,name=iat" json:"iat,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BearerToken_Body_TokenLifetime) Reset() { + *x = BearerToken_Body_TokenLifetime{} + mi := &file_api_acl_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BearerToken_Body_TokenLifetime) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken_Body_TokenLifetime) ProtoMessage() {} + +func (x *BearerToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BearerToken_Body_TokenLifetime) GetExp() uint64 { + if x != nil { + return x.xxx_hidden_Exp + } + return 0 +} + +func (x *BearerToken_Body_TokenLifetime) GetNbf() uint64 { + if x != nil { + return x.xxx_hidden_Nbf + } + return 0 +} + +func (x *BearerToken_Body_TokenLifetime) GetIat() uint64 { + if x != nil { + return x.xxx_hidden_Iat + } + return 0 +} + +func (x *BearerToken_Body_TokenLifetime) SetExp(v uint64) { + x.xxx_hidden_Exp = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *BearerToken_Body_TokenLifetime) SetNbf(v uint64) { + x.xxx_hidden_Nbf = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *BearerToken_Body_TokenLifetime) SetIat(v uint64) { + x.xxx_hidden_Iat = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *BearerToken_Body_TokenLifetime) HasExp() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *BearerToken_Body_TokenLifetime) HasNbf() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *BearerToken_Body_TokenLifetime) HasIat() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *BearerToken_Body_TokenLifetime) ClearExp() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Exp = 0 +} + +func (x *BearerToken_Body_TokenLifetime) ClearNbf() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Nbf = 0 +} + +func (x *BearerToken_Body_TokenLifetime) ClearIat() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Iat = 0 +} + +type BearerToken_Body_TokenLifetime_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Expiration Epoch + Exp *uint64 + // Not valid before Epoch + Nbf *uint64 + // Issued at Epoch + Iat *uint64 +} + +func (b0 BearerToken_Body_TokenLifetime_builder) Build() *BearerToken_Body_TokenLifetime { + m0 := &BearerToken_Body_TokenLifetime{} + b, x := &b0, m0 + _, _ = b, x + if b.Exp != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_Exp = *b.Exp + } + if b.Nbf != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Nbf = *b.Nbf + } + if b.Iat != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Iat = *b.Iat + } + return m0 +} + +// APEOverride is the list of APE chains defined for a target. +// These chains are meant to serve as overrides to the already defined (or +// even undefined) APE chains for the target (see contract `Policy`). +// +// The server-side processing of the bearer token with set APE overrides +// must verify if a client is permitted to override chains for the target, +// preventing unauthorized access through the APE mechanism. +type BearerToken_Body_APEOverride struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + xxx_hidden_Chains *[]*grpc1.Chain `protobuf:"bytes,2,rep,name=chains" json:"chains,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BearerToken_Body_APEOverride) Reset() { + *x = BearerToken_Body_APEOverride{} + mi := &file_api_acl_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BearerToken_Body_APEOverride) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BearerToken_Body_APEOverride) ProtoMessage() {} + +func (x *BearerToken_Body_APEOverride) ProtoReflect() protoreflect.Message { + mi := &file_api_acl_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *BearerToken_Body_APEOverride) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.xxx_hidden_Target + } + return nil +} + +func (x *BearerToken_Body_APEOverride) GetChains() []*grpc1.Chain { + if x != nil { + if x.xxx_hidden_Chains != nil { + return *x.xxx_hidden_Chains + } + } + return nil +} + +func (x *BearerToken_Body_APEOverride) SetTarget(v *grpc1.ChainTarget) { + x.xxx_hidden_Target = v +} + +func (x *BearerToken_Body_APEOverride) SetChains(v []*grpc1.Chain) { + x.xxx_hidden_Chains = &v +} + +func (x *BearerToken_Body_APEOverride) HasTarget() bool { + if x == nil { + return false + } + return x.xxx_hidden_Target != nil +} + +func (x *BearerToken_Body_APEOverride) ClearTarget() { + x.xxx_hidden_Target = nil +} + +type BearerToken_Body_APEOverride_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Target for which chains are applied. + Target *grpc1.ChainTarget + // The list of APE chains. + Chains []*grpc1.Chain +} + +func (b0 BearerToken_Body_APEOverride_builder) Build() *BearerToken_Body_APEOverride { + m0 := &BearerToken_Body_APEOverride{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Target = b.Target + x.xxx_hidden_Chains = &b.Chains + return m0 +} + +var File_api_acl_grpc_types_proto protoreflect.FileDescriptor + +var file_api_acl_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, + 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, + 0x03, 0x0a, 0x0a, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, + 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, + 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, + 0x12, 0x3a, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, + 0x6c, 0x2e, 0x45, 0x41, 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x1a, 0xa5, 0x01, 0x0a, + 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x45, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x27, + 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x52, 0x6f, 0x6c, + 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, + 0x45, 0x41, 0x43, 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x07, + 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, + 0x43, 0x4c, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x73, 0x22, 0xf3, 0x04, 0x0a, 0x0b, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x33, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, + 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, + 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, + 0xf5, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x61, 0x63, 0x6c, + 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x45, 0x41, 0x43, + 0x4c, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x65, 0x61, 0x63, 0x6c, 0x54, 0x61, 0x62, 0x6c, + 0x65, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x49, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, + 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, + 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x73, + 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x49, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x4e, 0x0a, + 0x0c, 0x61, 0x70, 0x65, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x63, 0x6c, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x41, 0x50, 0x45, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, + 0x52, 0x0b, 0x61, 0x70, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x1a, 0x45, 0x0a, + 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, + 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, + 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x03, 0x69, 0x61, 0x74, 0x1a, 0x71, 0x0a, 0x0b, 0x41, 0x50, 0x45, 0x4f, 0x76, 0x65, 0x72, 0x72, + 0x69, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, + 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x2a, 0x3e, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, + 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, + 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x4f, + 0x54, 0x48, 0x45, 0x52, 0x53, 0x10, 0x03, 0x2a, 0x4f, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, + 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, + 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, + 0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, + 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, 0x52, + 0x43, 0x48, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, + 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x45, 0x54, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, + 0x53, 0x48, 0x10, 0x07, 0x2a, 0x35, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, + 0x0a, 0x12, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, + 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4e, 0x59, 0x10, 0x02, 0x2a, 0x4a, 0x0a, 0x0a, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x45, 0x41, + 0x44, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, + 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x03, 0x42, 0x59, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x2e, 0x66, + 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, + 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, + 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x6c, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x6c, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x2e, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, + 0x63, 0x6c, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_acl_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_api_acl_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_api_acl_grpc_types_proto_goTypes = []any{ + (Role)(0), // 0: neo.fs.v2.acl.Role + (MatchType)(0), // 1: neo.fs.v2.acl.MatchType + (Operation)(0), // 2: neo.fs.v2.acl.Operation + (Action)(0), // 3: neo.fs.v2.acl.Action + (HeaderType)(0), // 4: neo.fs.v2.acl.HeaderType + (*EACLRecord)(nil), // 5: neo.fs.v2.acl.EACLRecord + (*EACLTable)(nil), // 6: neo.fs.v2.acl.EACLTable + (*BearerToken)(nil), // 7: neo.fs.v2.acl.BearerToken + (*EACLRecord_Filter)(nil), // 8: neo.fs.v2.acl.EACLRecord.Filter + (*EACLRecord_Target)(nil), // 9: neo.fs.v2.acl.EACLRecord.Target + (*BearerToken_Body)(nil), // 10: neo.fs.v2.acl.BearerToken.Body + (*BearerToken_Body_TokenLifetime)(nil), // 11: neo.fs.v2.acl.BearerToken.Body.TokenLifetime + (*BearerToken_Body_APEOverride)(nil), // 12: neo.fs.v2.acl.BearerToken.Body.APEOverride + (*grpc.Version)(nil), // 13: neo.fs.v2.refs.Version + (*grpc.ContainerID)(nil), // 14: neo.fs.v2.refs.ContainerID + (*grpc.Signature)(nil), // 15: neo.fs.v2.refs.Signature + (*grpc.OwnerID)(nil), // 16: neo.fs.v2.refs.OwnerID + (*grpc1.ChainTarget)(nil), // 17: frostfs.v2.ape.ChainTarget + (*grpc1.Chain)(nil), // 18: frostfs.v2.ape.Chain +} +var file_api_acl_grpc_types_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.acl.EACLRecord.operation:type_name -> neo.fs.v2.acl.Operation + 3, // 1: neo.fs.v2.acl.EACLRecord.action:type_name -> neo.fs.v2.acl.Action + 8, // 2: neo.fs.v2.acl.EACLRecord.filters:type_name -> neo.fs.v2.acl.EACLRecord.Filter + 9, // 3: neo.fs.v2.acl.EACLRecord.targets:type_name -> neo.fs.v2.acl.EACLRecord.Target + 13, // 4: neo.fs.v2.acl.EACLTable.version:type_name -> neo.fs.v2.refs.Version + 14, // 5: neo.fs.v2.acl.EACLTable.container_id:type_name -> neo.fs.v2.refs.ContainerID + 5, // 6: neo.fs.v2.acl.EACLTable.records:type_name -> neo.fs.v2.acl.EACLRecord + 10, // 7: neo.fs.v2.acl.BearerToken.body:type_name -> neo.fs.v2.acl.BearerToken.Body + 15, // 8: neo.fs.v2.acl.BearerToken.signature:type_name -> neo.fs.v2.refs.Signature + 4, // 9: neo.fs.v2.acl.EACLRecord.Filter.header_type:type_name -> neo.fs.v2.acl.HeaderType + 1, // 10: neo.fs.v2.acl.EACLRecord.Filter.match_type:type_name -> neo.fs.v2.acl.MatchType + 0, // 11: neo.fs.v2.acl.EACLRecord.Target.role:type_name -> neo.fs.v2.acl.Role + 6, // 12: neo.fs.v2.acl.BearerToken.Body.eacl_table:type_name -> neo.fs.v2.acl.EACLTable + 16, // 13: neo.fs.v2.acl.BearerToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 11, // 14: neo.fs.v2.acl.BearerToken.Body.lifetime:type_name -> neo.fs.v2.acl.BearerToken.Body.TokenLifetime + 12, // 15: neo.fs.v2.acl.BearerToken.Body.ape_override:type_name -> neo.fs.v2.acl.BearerToken.Body.APEOverride + 17, // 16: neo.fs.v2.acl.BearerToken.Body.APEOverride.target:type_name -> frostfs.v2.ape.ChainTarget + 18, // 17: neo.fs.v2.acl.BearerToken.Body.APEOverride.chains:type_name -> frostfs.v2.ape.Chain + 18, // [18:18] is the sub-list for method output_type + 18, // [18:18] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name +} + +func init() { file_api_acl_grpc_types_proto_init() } +func file_api_acl_grpc_types_proto_init() { + if File_api_acl_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_acl_grpc_types_proto_rawDesc, + NumEnums: 5, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_acl_grpc_types_proto_goTypes, + DependencyIndexes: file_api_acl_grpc_types_proto_depIdxs, + EnumInfos: file_api_acl_grpc_types_proto_enumTypes, + MessageInfos: file_api_acl_grpc_types_proto_msgTypes, + }.Build() + File_api_acl_grpc_types_proto = out.File + file_api_acl_grpc_types_proto_rawDesc = nil + file_api_acl_grpc_types_proto_goTypes = nil + file_api_acl_grpc_types_proto_depIdxs = nil +} diff --git a/api/acl/json.go b/api/acl/json.go new file mode 100644 index 00000000..9192956e --- /dev/null +++ b/api/acl/json.go @@ -0,0 +1,70 @@ +package acl + +import ( + acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (f *HeaderFilter) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(f) +} + +func (f *HeaderFilter) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(f, data, new(acl.EACLRecord_Filter)) +} + +func (t *Target) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(t) +} + +func (t *Target) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(t, data, new(acl.EACLRecord_Target)) +} + +func (a *APEOverride) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(a) +} + +func (a *APEOverride) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(a, data, new(acl.BearerToken_Body_APEOverride)) +} + +func (r *Record) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(r) +} + +func (r *Record) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(r, data, new(acl.EACLRecord)) +} + +func (t *Table) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(t) +} + +func (t *Table) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(t, data, new(acl.EACLTable)) +} + +func (l *TokenLifetime) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(l) +} + +func (l *TokenLifetime) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(l, data, new(acl.BearerToken_Body_TokenLifetime)) +} + +func (bt *BearerTokenBody) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(bt) +} + +func (bt *BearerTokenBody) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(bt, data, new(acl.BearerToken_Body)) +} + +func (bt *BearerToken) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(bt) +} + +func (bt *BearerToken) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(bt, data, new(acl.BearerToken)) +} diff --git a/api/acl/marshal.go b/api/acl/marshal.go new file mode 100644 index 00000000..29bfa061 --- /dev/null +++ b/api/acl/marshal.go @@ -0,0 +1,350 @@ +package acl + +import ( + acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + filterHeaderTypeField = 1 + filterMatchTypeField = 2 + filterNameField = 3 + filterValueField = 4 + + targetTypeField = 1 + targetKeysField = 2 + + recordOperationField = 1 + recordActionField = 2 + recordFiltersField = 3 + recordTargetsField = 4 + + tableVersionField = 1 + tableContainerIDField = 2 + tableRecordsField = 3 + + lifetimeExpirationField = 1 + lifetimeNotValidBeforeField = 2 + lifetimeIssuedAtField = 3 + + tokenAPEChainsTargetField = 1 + tokenAPEChainsChainsField = 2 + + bearerTokenBodyACLField = 1 + bearerTokenBodyOwnerField = 2 + bearerTokenBodyLifetimeField = 3 + bearerTokenBodyImpersonate = 4 + bearerTokenTokenAPEChainsField = 5 + + bearerTokenBodyField = 1 + bearerTokenSignatureField = 2 +) + +// StableMarshal marshals unified acl table structure in a protobuf +// compatible way without field order shuffle. +func (t *Table) StableMarshal(buf []byte) []byte { + if t == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(tableVersionField, buf[offset:], t.version) + offset += protoutil.NestedStructureMarshal(tableContainerIDField, buf[offset:], t.cid) + + for i := range t.records { + offset += protoutil.NestedStructureMarshal(tableRecordsField, buf[offset:], &t.records[i]) + } + + return buf +} + +// StableSize of acl table structure marshalled by StableMarshal function. +func (t *Table) StableSize() (size int) { + if t == nil { + return 0 + } + + size += protoutil.NestedStructureSize(tableVersionField, t.version) + size += protoutil.NestedStructureSize(tableContainerIDField, t.cid) + + for i := range t.records { + size += protoutil.NestedStructureSize(tableRecordsField, &t.records[i]) + } + + return size +} + +func (t *Table) Unmarshal(data []byte) error { + return message.Unmarshal(t, data, new(acl.EACLTable)) +} + +// StableMarshal marshals unified acl record structure in a protobuf +// compatible way without field order shuffle. +func (r *Record) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += protoutil.EnumMarshal(recordOperationField, buf[offset:], int32(r.op)) + offset += protoutil.EnumMarshal(recordActionField, buf[offset:], int32(r.action)) + + for i := range r.filters { + offset += protoutil.NestedStructureMarshal(recordFiltersField, buf[offset:], &r.filters[i]) + } + + for i := range r.targets { + offset += protoutil.NestedStructureMarshal(recordTargetsField, buf[offset:], &r.targets[i]) + } + + return buf +} + +// StableSize of acl record structure marshalled by StableMarshal function. +func (r *Record) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.EnumSize(recordOperationField, int32(r.op)) + size += protoutil.EnumSize(recordActionField, int32(r.action)) + + for i := range r.filters { + size += protoutil.NestedStructureSize(recordFiltersField, &r.filters[i]) + } + + for i := range r.targets { + size += protoutil.NestedStructureSize(recordTargetsField, &r.targets[i]) + } + + return size +} + +func (r *Record) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(acl.EACLRecord)) +} + +// StableMarshal marshals unified header filter structure in a protobuf +// compatible way without field order shuffle. +func (f *HeaderFilter) StableMarshal(buf []byte) []byte { + if f == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, f.StableSize()) + } + + var offset int + + offset += protoutil.EnumMarshal(filterHeaderTypeField, buf[offset:], int32(f.hdrType)) + offset += protoutil.EnumMarshal(filterMatchTypeField, buf[offset:], int32(f.matchType)) + offset += protoutil.StringMarshal(filterNameField, buf[offset:], f.key) + protoutil.StringMarshal(filterValueField, buf[offset:], f.value) + + return buf +} + +// StableSize of header filter structure marshalled by StableMarshal function. +func (f *HeaderFilter) StableSize() (size int) { + if f == nil { + return 0 + } + + size += protoutil.EnumSize(filterHeaderTypeField, int32(f.hdrType)) + size += protoutil.EnumSize(filterMatchTypeField, int32(f.matchType)) + size += protoutil.StringSize(filterNameField, f.key) + size += protoutil.StringSize(filterValueField, f.value) + + return size +} + +func (f *HeaderFilter) Unmarshal(data []byte) error { + return message.Unmarshal(f, data, new(acl.EACLRecord_Filter)) +} + +// StableMarshal marshals unified role info structure in a protobuf +// compatible way without field order shuffle. +func (t *Target) StableMarshal(buf []byte) []byte { + if t == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var offset int + + offset += protoutil.EnumMarshal(targetTypeField, buf[offset:], int32(t.role)) + protoutil.RepeatedBytesMarshal(targetKeysField, buf[offset:], t.keys) + + return buf +} + +// StableSize of role info structure marshalled by StableMarshal function. +func (t *Target) StableSize() (size int) { + if t == nil { + return 0 + } + + size += protoutil.EnumSize(targetTypeField, int32(t.role)) + size += protoutil.RepeatedBytesSize(targetKeysField, t.keys) + + return size +} + +func (t *Target) Unmarshal(data []byte) error { + return message.Unmarshal(t, data, new(acl.EACLRecord_Target)) +} + +func (l *TokenLifetime) StableMarshal(buf []byte) []byte { + if l == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, l.StableSize()) + } + + var offset int + + offset += protoutil.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) + offset += protoutil.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) + protoutil.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) + + return buf +} + +func (l *TokenLifetime) StableSize() (size int) { + if l == nil { + return 0 + } + + size += protoutil.UInt64Size(lifetimeExpirationField, l.exp) + size += protoutil.UInt64Size(lifetimeNotValidBeforeField, l.nbf) + size += protoutil.UInt64Size(lifetimeIssuedAtField, l.iat) + + return size +} + +func (l *TokenLifetime) Unmarshal(data []byte) error { + return message.Unmarshal(l, data, new(acl.BearerToken_Body_TokenLifetime)) +} + +func (c *APEOverride) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(tokenAPEChainsTargetField, buf[offset:], c.target) + for i := range c.chains { + offset += protoutil.NestedStructureMarshal(tokenAPEChainsChainsField, buf[offset:], c.chains[i]) + } + + return buf +} + +func (c *APEOverride) StableSize() (size int) { + if c == nil { + return 0 + } + + size += protoutil.NestedStructureSize(tokenAPEChainsTargetField, c.target) + for i := range c.chains { + size += protoutil.NestedStructureSize(tokenAPEChainsChainsField, c.chains[i]) + } + + return size +} + +func (c *APEOverride) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(acl.BearerToken_Body_APEOverride)) +} + +func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte { + if bt == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, bt.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl) + offset += protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID) + offset += protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime) + offset += protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate) + protoutil.NestedStructureMarshal(bearerTokenTokenAPEChainsField, buf[offset:], bt.apeOverride) + + return buf +} + +func (bt *BearerTokenBody) StableSize() (size int) { + if bt == nil { + return 0 + } + + size += protoutil.NestedStructureSize(bearerTokenBodyACLField, bt.eacl) + size += protoutil.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID) + size += protoutil.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime) + size += protoutil.BoolSize(bearerTokenBodyImpersonate, bt.impersonate) + size += protoutil.NestedStructureSize(bearerTokenTokenAPEChainsField, bt.apeOverride) + + return size +} + +func (bt *BearerTokenBody) Unmarshal(data []byte) error { + return message.Unmarshal(bt, data, new(acl.BearerToken_Body)) +} + +func (bt *BearerToken) StableMarshal(buf []byte) []byte { + if bt == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, bt.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(bearerTokenBodyField, buf[offset:], bt.body) + protoutil.NestedStructureMarshal(bearerTokenSignatureField, buf[offset:], bt.sig) + + return buf +} + +func (bt *BearerToken) StableSize() (size int) { + if bt == nil { + return 0 + } + + size += protoutil.NestedStructureSize(bearerTokenBodyField, bt.body) + size += protoutil.NestedStructureSize(bearerTokenSignatureField, bt.sig) + + return size +} + +func (bt *BearerToken) Unmarshal(data []byte) error { + return message.Unmarshal(bt, data, new(acl.BearerToken)) +} diff --git a/api/acl/message_test.go b/api/acl/message_test.go new file mode 100644 index 00000000..01311377 --- /dev/null +++ b/api/acl/message_test.go @@ -0,0 +1,21 @@ +package acl_test + +import ( + "testing" + + acltest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return acltest.GenerateFilter(empty) }, + func(empty bool) message.Message { return acltest.GenerateTarget(empty) }, + func(empty bool) message.Message { return acltest.GenerateRecord(empty) }, + func(empty bool) message.Message { return acltest.GenerateTable(empty) }, + func(empty bool) message.Message { return acltest.GenerateTokenLifetime(empty) }, + func(empty bool) message.Message { return acltest.GenerateBearerTokenBody(empty) }, + func(empty bool) message.Message { return acltest.GenerateBearerToken(empty) }, + ) +} diff --git a/api/acl/string.go b/api/acl/string.go new file mode 100644 index 00000000..6874e3ad --- /dev/null +++ b/api/acl/string.go @@ -0,0 +1,98 @@ +package acl + +import ( + acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc" +) + +// String returns string representation of Action. +func (x Action) String() string { + return ActionToGRPCField(x).String() +} + +// FromString parses Action from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Action) FromString(s string) bool { + g, ok := acl.Action_value[s] + if ok { + *x = ActionFromGRPCField(acl.Action(g)) + } + + return ok +} + +// String returns string representation of Role. +func (x Role) String() string { + return RoleToGRPCField(x).String() +} + +// FromString parses Role from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Role) FromString(s string) bool { + g, ok := acl.Role_value[s] + + if ok { + *x = RoleFromGRPCField(acl.Role(g)) + } + + return ok +} + +// String returns string representation of Operation. +func (x Operation) String() string { + return OperationToGRPCField(x).String() +} + +// FromString parses Operation from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Operation) FromString(s string) bool { + g, ok := acl.Operation_value[s] + if ok { + *x = OperationFromGRPCField(acl.Operation(g)) + } + + return ok +} + +// String returns string representation of MatchType. +func (x MatchType) String() string { + return MatchTypeToGRPCField(x).String() +} + +// FromString parses MatchType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *MatchType) FromString(s string) bool { + g, ok := acl.MatchType_value[s] + + if ok { + *x = MatchTypeFromGRPCField(acl.MatchType(g)) + } + + return ok +} + +// String returns string representation of HeaderType. +func (x HeaderType) String() string { + return HeaderTypeToGRPCField(x).String() +} + +// FromString parses HeaderType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *HeaderType) FromString(s string) bool { + g, ok := acl.HeaderType_value[s] + + if ok { + *x = HeaderTypeFromGRPCField(acl.HeaderType(g)) + } + + return ok +} diff --git a/api/acl/test/generate.go b/api/acl/test/generate.go new file mode 100644 index 00000000..8b265ad9 --- /dev/null +++ b/api/acl/test/generate.go @@ -0,0 +1,144 @@ +package acltest + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + apetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/test" + accountingtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test" +) + +func GenerateBearerToken(empty bool) *acl.BearerToken { + m := new(acl.BearerToken) + + if !empty { + m.SetBody(GenerateBearerTokenBody(false)) + } + + m.SetSignature(accountingtest.GenerateSignature(empty)) + + return m +} + +func GenerateBearerTokenBody(empty bool) *acl.BearerTokenBody { + m := new(acl.BearerTokenBody) + + if !empty { + m.SetOwnerID(accountingtest.GenerateOwnerID(false)) + m.SetLifetime(GenerateTokenLifetime(false)) + m.SetAPEOverride(GenerateAPEOverride(empty)) + } + + return m +} + +func GenerateAPEOverride(empty bool) *acl.APEOverride { + var m *acl.APEOverride + + if !empty { + m = new(acl.APEOverride) + m.SetTarget(apetest.GenerateChainTarget(empty)) + m.SetChains(apetest.GenerateRawChains(false, 3)) + } + + return m +} + +func GenerateTable(empty bool) *acl.Table { + m := new(acl.Table) + + if !empty { + m.SetRecords(GenerateRecords(false)) + m.SetContainerID(accountingtest.GenerateContainerID(false)) + } + + m.SetVersion(accountingtest.GenerateVersion(empty)) + + return m +} + +func GenerateRecords(empty bool) []acl.Record { + var rs []acl.Record + + if !empty { + rs = append(rs, + *GenerateRecord(false), + *GenerateRecord(false), + ) + } + + return rs +} + +func GenerateRecord(empty bool) *acl.Record { + m := new(acl.Record) + + if !empty { + m.SetAction(acl.ActionAllow) + m.SetOperation(acl.OperationGet) + m.SetFilters(GenerateFilters(false)) + m.SetTargets(GenerateTargets(false)) + } + + return m +} + +func GenerateFilters(empty bool) []acl.HeaderFilter { + var fs []acl.HeaderFilter + + if !empty { + fs = append(fs, + *GenerateFilter(false), + *GenerateFilter(false), + ) + } + + return fs +} + +func GenerateFilter(empty bool) *acl.HeaderFilter { + m := new(acl.HeaderFilter) + + if !empty { + m.SetKey("key") + m.SetValue("val") + m.SetHeaderType(acl.HeaderTypeRequest) + m.SetMatchType(acl.MatchTypeStringEqual) + } + + return m +} + +func GenerateTargets(empty bool) []acl.Target { + var ts []acl.Target + + if !empty { + ts = append(ts, + *GenerateTarget(false), + *GenerateTarget(false), + ) + } + + return ts +} + +func GenerateTarget(empty bool) *acl.Target { + m := new(acl.Target) + + if !empty { + m.SetRole(acl.RoleSystem) + m.SetKeys([][]byte{{1}, {2}}) + } + + return m +} + +func GenerateTokenLifetime(empty bool) *acl.TokenLifetime { + m := new(acl.TokenLifetime) + + if !empty { + m.SetExp(1) + m.SetIat(2) + m.SetExp(3) + } + + return m +} diff --git a/api/acl/types.go b/api/acl/types.go new file mode 100644 index 00000000..e0bae3a4 --- /dev/null +++ b/api/acl/types.go @@ -0,0 +1,426 @@ +package acl + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" +) + +// HeaderFilter is a unified structure of FilterInfo +// message from proto definition. +type HeaderFilter struct { + hdrType HeaderType + + matchType MatchType + + key, value string +} + +// Target is a unified structure of Target +// message from proto definition. +type Target struct { + role Role + + keys [][]byte +} + +// Record is a unified structure of EACLRecord +// message from proto definition. +type Record struct { + op Operation + + action Action + + filters []HeaderFilter + + targets []Target +} + +// Table is a unified structure of EACLTable +// message from proto definition. +type Table struct { + version *refs.Version + + cid *refs.ContainerID + + records []Record +} + +type TokenLifetime struct { + exp, nbf, iat uint64 +} + +type APEOverride struct { + target *ape.ChainTarget + + chains []*ape.Chain +} + +type BearerTokenBody struct { + eacl *Table + + ownerID *refs.OwnerID + + lifetime *TokenLifetime + + apeOverride *APEOverride + + impersonate bool +} + +type BearerToken struct { + body *BearerTokenBody + + sig *refs.Signature +} + +// Target is a unified enum of MatchType enum from proto definition. +type MatchType uint32 + +// HeaderType is a unified enum of HeaderType enum from proto definition. +type HeaderType uint32 + +// Action is a unified enum of Action enum from proto definition. +type Action uint32 + +// Operation is a unified enum of Operation enum from proto definition. +type Operation uint32 + +// Role is a unified enum of Role enum from proto definition. +type Role uint32 + +const ( + MatchTypeUnknown MatchType = iota + MatchTypeStringEqual + MatchTypeStringNotEqual +) + +const ( + HeaderTypeUnknown HeaderType = iota + HeaderTypeRequest + HeaderTypeObject + HeaderTypeService +) + +const ( + ActionUnknown Action = iota + ActionAllow + ActionDeny +) + +const ( + OperationUnknown Operation = iota + OperationGet + OperationHead + OperationPut + OperationDelete + OperationSearch + OperationRange + OperationRangeHash +) + +const ( + RoleUnknown Role = iota + RoleUser + RoleSystem + RoleOthers +) + +func (f *HeaderFilter) GetHeaderType() HeaderType { + if f != nil { + return f.hdrType + } + + return HeaderTypeUnknown +} + +func (f *HeaderFilter) SetHeaderType(v HeaderType) { + f.hdrType = v +} + +func (f *HeaderFilter) GetMatchType() MatchType { + if f != nil { + return f.matchType + } + + return MatchTypeUnknown +} + +func (f *HeaderFilter) SetMatchType(v MatchType) { + f.matchType = v +} + +func (f *HeaderFilter) GetKey() string { + if f != nil { + return f.key + } + + return "" +} + +func (f *HeaderFilter) SetKey(v string) { + f.key = v +} + +func (f *HeaderFilter) GetValue() string { + if f != nil { + return f.value + } + + return "" +} + +func (f *HeaderFilter) SetValue(v string) { + f.value = v +} + +func (t *Target) GetRole() Role { + if t != nil { + return t.role + } + + return RoleUnknown +} + +func (t *Target) SetRole(v Role) { + t.role = v +} + +func (t *Target) GetKeys() [][]byte { + if t != nil { + return t.keys + } + + return nil +} + +func (t *Target) SetKeys(v [][]byte) { + t.keys = v +} + +func (r *Record) GetOperation() Operation { + if r != nil { + return r.op + } + + return OperationUnknown +} + +func (r *Record) SetOperation(v Operation) { + r.op = v +} + +func (r *Record) GetAction() Action { + if r != nil { + return r.action + } + + return ActionUnknown +} + +func (r *Record) SetAction(v Action) { + r.action = v +} + +func (r *Record) GetFilters() []HeaderFilter { + if r != nil { + return r.filters + } + + return nil +} + +func (r *Record) SetFilters(v []HeaderFilter) { + r.filters = v +} + +func (r *Record) GetTargets() []Target { + if r != nil { + return r.targets + } + + return nil +} + +func (r *Record) SetTargets(v []Target) { + r.targets = v +} + +func (t *Table) GetVersion() *refs.Version { + if t != nil { + return t.version + } + + return nil +} + +func (t *Table) SetVersion(v *refs.Version) { + t.version = v +} + +func (t *Table) GetContainerID() *refs.ContainerID { + if t != nil { + return t.cid + } + + return nil +} + +func (t *Table) SetContainerID(v *refs.ContainerID) { + t.cid = v +} + +func (t *Table) GetRecords() []Record { + if t != nil { + return t.records + } + + return nil +} + +func (t *Table) SetRecords(v []Record) { + t.records = v +} + +func (l *TokenLifetime) GetExp() uint64 { + if l != nil { + return l.exp + } + + return 0 +} + +func (l *TokenLifetime) SetExp(v uint64) { + l.exp = v +} + +func (l *TokenLifetime) GetNbf() uint64 { + if l != nil { + return l.nbf + } + + return 0 +} + +func (l *TokenLifetime) SetNbf(v uint64) { + l.nbf = v +} + +func (l *TokenLifetime) GetIat() uint64 { + if l != nil { + return l.iat + } + + return 0 +} + +func (l *TokenLifetime) SetIat(v uint64) { + l.iat = v +} + +func (bt *BearerTokenBody) GetEACL() *Table { + if bt != nil { + return bt.eacl + } + + return nil +} + +func (bt *BearerTokenBody) SetEACL(v *Table) { + bt.eacl = v +} + +func (t *APEOverride) GetTarget() *ape.ChainTarget { + if t == nil { + return nil + } + + return t.target +} + +func (t *APEOverride) GetChains() []*ape.Chain { + if t == nil { + return nil + } + + return t.chains +} + +func (t *APEOverride) SetTarget(v *ape.ChainTarget) { + t.target = v +} + +func (t *APEOverride) SetChains(v []*ape.Chain) { + t.chains = v +} + +func (bt *BearerTokenBody) GetAPEOverride() *APEOverride { + if bt != nil { + return bt.apeOverride + } + + return nil +} + +func (bt *BearerTokenBody) SetAPEOverride(v *APEOverride) { + bt.apeOverride = v +} + +func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID { + if bt != nil { + return bt.ownerID + } + + return nil +} + +func (bt *BearerTokenBody) SetOwnerID(v *refs.OwnerID) { + bt.ownerID = v +} + +func (bt *BearerTokenBody) GetLifetime() *TokenLifetime { + if bt != nil { + return bt.lifetime + } + + return nil +} + +func (bt *BearerTokenBody) SetLifetime(v *TokenLifetime) { + bt.lifetime = v +} + +func (bt *BearerTokenBody) GetImpersonate() bool { + if bt != nil { + return bt.impersonate + } + + return false +} + +func (bt *BearerTokenBody) SetImpersonate(v bool) { + bt.impersonate = v +} + +func (bt *BearerToken) GetBody() *BearerTokenBody { + if bt != nil { + return bt.body + } + + return nil +} + +func (bt *BearerToken) SetBody(v *BearerTokenBody) { + bt.body = v +} + +func (bt *BearerToken) GetSignature() *refs.Signature { + if bt != nil { + return bt.sig + } + + return nil +} + +func (bt *BearerToken) SetSignature(v *refs.Signature) { + bt.sig = v +} diff --git a/api/ape/convert.go b/api/ape/convert.go new file mode 100644 index 00000000..7ca60c30 --- /dev/null +++ b/api/ape/convert.go @@ -0,0 +1,131 @@ +package ape + +import ( + "fmt" + + ape "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func TargetTypeToGRPCField(typ TargetType) ape.TargetType { + switch typ { + case TargetTypeNamespace: + return ape.TargetType_NAMESPACE + case TargetTypeContainer: + return ape.TargetType_CONTAINER + case TargetTypeUser: + return ape.TargetType_USER + case TargetTypeGroup: + return ape.TargetType_GROUP + default: + return ape.TargetType_UNDEFINED + } +} + +func TargetTypeFromGRPCField(typ ape.TargetType) TargetType { + switch typ { + case ape.TargetType_NAMESPACE: + return TargetTypeNamespace + case ape.TargetType_CONTAINER: + return TargetTypeContainer + case ape.TargetType_USER: + return TargetTypeUser + case ape.TargetType_GROUP: + return TargetTypeGroup + default: + return TargetTypeUndefined + } +} + +func TargetTypeToGRPC(typ TargetType) ape.TargetType { + return ape.TargetType(typ) +} + +func TargetTypeFromGRPC(typ ape.TargetType) TargetType { + return TargetType(typ) +} + +func (v2 *ChainTarget) ToGRPCMessage() grpc.Message { + var mgrpc *ape.ChainTarget + + if v2 != nil { + mgrpc = new(ape.ChainTarget) + + mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType())) + mgrpc.SetName(v2.GetName()) + } + + return mgrpc +} + +func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*ape.ChainTarget) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType())) + v2.SetName(mgrpc.GetName()) + + return nil +} + +func (v2 *ChainRaw) ToGRPCMessage() grpc.Message { + var mgrpc *ape.Chain_Raw + + if v2 != nil { + mgrpc = new(ape.Chain_Raw) + mgrpc.Raw = v2.GetRaw() + } + + return mgrpc +} + +func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*ape.Chain_Raw) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + v2.SetRaw(mgrpc.Raw) + + return nil +} + +func (v2 *Chain) ToGRPCMessage() grpc.Message { + var mgrpc *ape.Chain + + if v2 != nil { + mgrpc = new(ape.Chain) + + switch chainKind := v2.GetKind().(type) { + default: + panic(fmt.Sprintf("unsupported chain kind: %T", chainKind)) + case *ChainRaw: + mgrpc.SetRaw(chainKind.GetRaw()) + } + } + + return mgrpc +} + +func (v2 *Chain) FromGRPCMessage(m grpc.Message) error { + mgrpc, ok := m.(*ape.Chain) + if !ok { + return message.NewUnexpectedMessageType(m, mgrpc) + } + + switch chainKind := mgrpc.GetKind().(type) { + default: + return fmt.Errorf("unsupported chain kind: %T", chainKind) + case *ape.Chain_Raw: + chainRaw := new(ChainRaw) + if err := chainRaw.FromGRPCMessage(chainKind); err != nil { + return err + } + v2.SetKind(chainRaw) + } + + return nil +} diff --git a/api/ape/grpc/types.pb.go b/api/ape/grpc/types.pb.go new file mode 100644 index 00000000..12bcaa78 --- /dev/null +++ b/api/ape/grpc/types.pb.go @@ -0,0 +1,376 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/ape/grpc/types.proto + +//go:build !protoopaque + +package ape + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// TargetType is a type target to which a rule chain is defined. +type TargetType int32 + +const ( + TargetType_UNDEFINED TargetType = 0 + TargetType_NAMESPACE TargetType = 1 + TargetType_CONTAINER TargetType = 2 + TargetType_USER TargetType = 3 + TargetType_GROUP TargetType = 4 +) + +// Enum value maps for TargetType. +var ( + TargetType_name = map[int32]string{ + 0: "UNDEFINED", + 1: "NAMESPACE", + 2: "CONTAINER", + 3: "USER", + 4: "GROUP", + } + TargetType_value = map[string]int32{ + "UNDEFINED": 0, + "NAMESPACE": 1, + "CONTAINER": 2, + "USER": 3, + "GROUP": 4, + } +) + +func (x TargetType) Enum() *TargetType { + p := new(TargetType) + *p = x + return p +} + +func (x TargetType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TargetType) Descriptor() protoreflect.EnumDescriptor { + return file_api_ape_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (TargetType) Type() protoreflect.EnumType { + return &file_api_ape_grpc_types_proto_enumTypes[0] +} + +func (x TargetType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// ChainTarget is an object to which a rule chain is defined. +type ChainTarget struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Type *TargetType `protobuf:"varint,1,opt,name=type,enum=frostfs.v2.ape.TargetType" json:"type,omitempty"` + Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChainTarget) Reset() { + *x = ChainTarget{} + mi := &file_api_ape_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChainTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChainTarget) ProtoMessage() {} + +func (x *ChainTarget) ProtoReflect() protoreflect.Message { + mi := &file_api_ape_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ChainTarget) GetType() TargetType { + if x != nil && x.Type != nil { + return *x.Type + } + return TargetType_UNDEFINED +} + +func (x *ChainTarget) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *ChainTarget) SetType(v TargetType) { + x.Type = &v +} + +func (x *ChainTarget) SetName(v string) { + x.Name = &v +} + +func (x *ChainTarget) HasType() bool { + if x == nil { + return false + } + return x.Type != nil +} + +func (x *ChainTarget) HasName() bool { + if x == nil { + return false + } + return x.Name != nil +} + +func (x *ChainTarget) ClearType() { + x.Type = nil +} + +func (x *ChainTarget) ClearName() { + x.Name = nil +} + +type ChainTarget_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Type *TargetType + Name *string +} + +func (b0 ChainTarget_builder) Build() *ChainTarget { + m0 := &ChainTarget{} + b, x := &b0, m0 + _, _ = b, x + x.Type = b.Type + x.Name = b.Name + return m0 +} + +// Chain is a chain of rules defined for a specific target. +type Chain struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Types that are valid to be assigned to Kind: + // + // *Chain_Raw + Kind isChain_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Chain) Reset() { + *x = Chain{} + mi := &file_api_ape_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Chain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Chain) ProtoMessage() {} + +func (x *Chain) ProtoReflect() protoreflect.Message { + mi := &file_api_ape_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Chain) GetKind() isChain_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *Chain) GetRaw() []byte { + if x != nil { + if x, ok := x.Kind.(*Chain_Raw); ok { + return x.Raw + } + } + return nil +} + +func (x *Chain) SetRaw(v []byte) { + if v == nil { + v = []byte{} + } + x.Kind = &Chain_Raw{v} +} + +func (x *Chain) HasKind() bool { + if x == nil { + return false + } + return x.Kind != nil +} + +func (x *Chain) HasRaw() bool { + if x == nil { + return false + } + _, ok := x.Kind.(*Chain_Raw) + return ok +} + +func (x *Chain) ClearKind() { + x.Kind = nil +} + +func (x *Chain) ClearRaw() { + if _, ok := x.Kind.(*Chain_Raw); ok { + x.Kind = nil + } +} + +const Chain_Kind_not_set_case case_Chain_Kind = 0 +const Chain_Raw_case case_Chain_Kind = 1 + +func (x *Chain) WhichKind() case_Chain_Kind { + if x == nil { + return Chain_Kind_not_set_case + } + switch x.Kind.(type) { + case *Chain_Raw: + return Chain_Raw_case + default: + return Chain_Kind_not_set_case + } +} + +type Chain_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Fields of oneof Kind: + // Raw representation of a serizalized rule chain. + Raw []byte + // -- end of Kind +} + +func (b0 Chain_builder) Build() *Chain { + m0 := &Chain{} + b, x := &b0, m0 + _, _ = b, x + if b.Raw != nil { + x.Kind = &Chain_Raw{b.Raw} + } + return m0 +} + +type case_Chain_Kind protoreflect.FieldNumber + +func (x case_Chain_Kind) String() string { + md := file_api_ape_grpc_types_proto_msgTypes[1].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isChain_Kind interface { + isChain_Kind() +} + +type Chain_Raw struct { + // Raw representation of a serizalized rule chain. + Raw []byte `protobuf:"bytes,1,opt,name=raw,oneof"` +} + +func (*Chain_Raw) isChain_Kind() {} + +var File_api_ape_grpc_types_proto protoreflect.FileDescriptor + +var file_api_ape_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x66, 0x72, 0x6f, 0x73, + 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x22, 0x51, 0x0a, 0x0b, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x23, 0x0a, + 0x05, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x03, 0x72, 0x61, 0x77, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, + 0x6e, 0x64, 0x2a, 0x4e, 0x0a, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x0d, 0x0a, 0x09, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x0d, + 0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x02, 0x12, 0x08, 0x0a, + 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x4f, 0x55, 0x50, + 0x10, 0x04, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, + 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x61, 0x70, 0x65, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_ape_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_ape_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_ape_grpc_types_proto_goTypes = []any{ + (TargetType)(0), // 0: frostfs.v2.ape.TargetType + (*ChainTarget)(nil), // 1: frostfs.v2.ape.ChainTarget + (*Chain)(nil), // 2: frostfs.v2.ape.Chain +} +var file_api_ape_grpc_types_proto_depIdxs = []int32{ + 0, // 0: frostfs.v2.ape.ChainTarget.type:type_name -> frostfs.v2.ape.TargetType + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_ape_grpc_types_proto_init() } +func file_api_ape_grpc_types_proto_init() { + if File_api_ape_grpc_types_proto != nil { + return + } + file_api_ape_grpc_types_proto_msgTypes[1].OneofWrappers = []any{ + (*Chain_Raw)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_ape_grpc_types_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_ape_grpc_types_proto_goTypes, + DependencyIndexes: file_api_ape_grpc_types_proto_depIdxs, + EnumInfos: file_api_ape_grpc_types_proto_enumTypes, + MessageInfos: file_api_ape_grpc_types_proto_msgTypes, + }.Build() + File_api_ape_grpc_types_proto = out.File + file_api_ape_grpc_types_proto_rawDesc = nil + file_api_ape_grpc_types_proto_goTypes = nil + file_api_ape_grpc_types_proto_depIdxs = nil +} diff --git a/api/ape/grpc/types_protoopaque.pb.go b/api/ape/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..100ea619 --- /dev/null +++ b/api/ape/grpc/types_protoopaque.pb.go @@ -0,0 +1,383 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/ape/grpc/types.proto + +//go:build protoopaque + +package ape + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// TargetType is a type target to which a rule chain is defined. +type TargetType int32 + +const ( + TargetType_UNDEFINED TargetType = 0 + TargetType_NAMESPACE TargetType = 1 + TargetType_CONTAINER TargetType = 2 + TargetType_USER TargetType = 3 + TargetType_GROUP TargetType = 4 +) + +// Enum value maps for TargetType. +var ( + TargetType_name = map[int32]string{ + 0: "UNDEFINED", + 1: "NAMESPACE", + 2: "CONTAINER", + 3: "USER", + 4: "GROUP", + } + TargetType_value = map[string]int32{ + "UNDEFINED": 0, + "NAMESPACE": 1, + "CONTAINER": 2, + "USER": 3, + "GROUP": 4, + } +) + +func (x TargetType) Enum() *TargetType { + p := new(TargetType) + *p = x + return p +} + +func (x TargetType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TargetType) Descriptor() protoreflect.EnumDescriptor { + return file_api_ape_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (TargetType) Type() protoreflect.EnumType { + return &file_api_ape_grpc_types_proto_enumTypes[0] +} + +func (x TargetType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// ChainTarget is an object to which a rule chain is defined. +type ChainTarget struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Type TargetType `protobuf:"varint,1,opt,name=type,enum=frostfs.v2.ape.TargetType" json:"type,omitempty"` + xxx_hidden_Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChainTarget) Reset() { + *x = ChainTarget{} + mi := &file_api_ape_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChainTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChainTarget) ProtoMessage() {} + +func (x *ChainTarget) ProtoReflect() protoreflect.Message { + mi := &file_api_ape_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ChainTarget) GetType() TargetType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_Type + } + } + return TargetType_UNDEFINED +} + +func (x *ChainTarget) GetName() string { + if x != nil { + if x.xxx_hidden_Name != nil { + return *x.xxx_hidden_Name + } + return "" + } + return "" +} + +func (x *ChainTarget) SetType(v TargetType) { + x.xxx_hidden_Type = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *ChainTarget) SetName(v string) { + x.xxx_hidden_Name = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *ChainTarget) HasType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *ChainTarget) HasName() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *ChainTarget) ClearType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Type = TargetType_UNDEFINED +} + +func (x *ChainTarget) ClearName() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Name = nil +} + +type ChainTarget_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Type *TargetType + Name *string +} + +func (b0 ChainTarget_builder) Build() *ChainTarget { + m0 := &ChainTarget{} + b, x := &b0, m0 + _, _ = b, x + if b.Type != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Type = *b.Type + } + if b.Name != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Name = b.Name + } + return m0 +} + +// Chain is a chain of rules defined for a specific target. +type Chain struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Kind isChain_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Chain) Reset() { + *x = Chain{} + mi := &file_api_ape_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Chain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Chain) ProtoMessage() {} + +func (x *Chain) ProtoReflect() protoreflect.Message { + mi := &file_api_ape_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Chain) GetRaw() []byte { + if x != nil { + if x, ok := x.xxx_hidden_Kind.(*chain_Raw); ok { + return x.Raw + } + } + return nil +} + +func (x *Chain) SetRaw(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Kind = &chain_Raw{v} +} + +func (x *Chain) HasKind() bool { + if x == nil { + return false + } + return x.xxx_hidden_Kind != nil +} + +func (x *Chain) HasRaw() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Kind.(*chain_Raw) + return ok +} + +func (x *Chain) ClearKind() { + x.xxx_hidden_Kind = nil +} + +func (x *Chain) ClearRaw() { + if _, ok := x.xxx_hidden_Kind.(*chain_Raw); ok { + x.xxx_hidden_Kind = nil + } +} + +const Chain_Kind_not_set_case case_Chain_Kind = 0 +const Chain_Raw_case case_Chain_Kind = 1 + +func (x *Chain) WhichKind() case_Chain_Kind { + if x == nil { + return Chain_Kind_not_set_case + } + switch x.xxx_hidden_Kind.(type) { + case *chain_Raw: + return Chain_Raw_case + default: + return Chain_Kind_not_set_case + } +} + +type Chain_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Fields of oneof xxx_hidden_Kind: + // Raw representation of a serizalized rule chain. + Raw []byte + // -- end of xxx_hidden_Kind +} + +func (b0 Chain_builder) Build() *Chain { + m0 := &Chain{} + b, x := &b0, m0 + _, _ = b, x + if b.Raw != nil { + x.xxx_hidden_Kind = &chain_Raw{b.Raw} + } + return m0 +} + +type case_Chain_Kind protoreflect.FieldNumber + +func (x case_Chain_Kind) String() string { + md := file_api_ape_grpc_types_proto_msgTypes[1].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isChain_Kind interface { + isChain_Kind() +} + +type chain_Raw struct { + // Raw representation of a serizalized rule chain. + Raw []byte `protobuf:"bytes,1,opt,name=raw,oneof"` +} + +func (*chain_Raw) isChain_Kind() {} + +var File_api_ape_grpc_types_proto protoreflect.FileDescriptor + +var file_api_ape_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x66, 0x72, 0x6f, 0x73, + 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x22, 0x51, 0x0a, 0x0b, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x23, 0x0a, + 0x05, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x03, 0x72, 0x61, 0x77, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, + 0x6e, 0x64, 0x2a, 0x4e, 0x0a, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x0d, 0x0a, 0x09, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x0d, + 0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x02, 0x12, 0x08, 0x0a, + 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x4f, 0x55, 0x50, + 0x10, 0x04, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, + 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, + 0x61, 0x70, 0x65, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_ape_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_ape_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_ape_grpc_types_proto_goTypes = []any{ + (TargetType)(0), // 0: frostfs.v2.ape.TargetType + (*ChainTarget)(nil), // 1: frostfs.v2.ape.ChainTarget + (*Chain)(nil), // 2: frostfs.v2.ape.Chain +} +var file_api_ape_grpc_types_proto_depIdxs = []int32{ + 0, // 0: frostfs.v2.ape.ChainTarget.type:type_name -> frostfs.v2.ape.TargetType + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_ape_grpc_types_proto_init() } +func file_api_ape_grpc_types_proto_init() { + if File_api_ape_grpc_types_proto != nil { + return + } + file_api_ape_grpc_types_proto_msgTypes[1].OneofWrappers = []any{ + (*chain_Raw)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_ape_grpc_types_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_ape_grpc_types_proto_goTypes, + DependencyIndexes: file_api_ape_grpc_types_proto_depIdxs, + EnumInfos: file_api_ape_grpc_types_proto_enumTypes, + MessageInfos: file_api_ape_grpc_types_proto_msgTypes, + }.Build() + File_api_ape_grpc_types_proto = out.File + file_api_ape_grpc_types_proto_rawDesc = nil + file_api_ape_grpc_types_proto_goTypes = nil + file_api_ape_grpc_types_proto_depIdxs = nil +} diff --git a/api/ape/json.go b/api/ape/json.go new file mode 100644 index 00000000..ffa3a8b6 --- /dev/null +++ b/api/ape/json.go @@ -0,0 +1,14 @@ +package ape + +import ( + ape "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (t *ChainTarget) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(t) +} + +func (t *ChainTarget) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(t, data, new(ape.ChainTarget)) +} diff --git a/api/ape/marshal.go b/api/ape/marshal.go new file mode 100644 index 00000000..e8f377b2 --- /dev/null +++ b/api/ape/marshal.go @@ -0,0 +1,92 @@ +package ape + +import ( + "fmt" + + ape "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + chainTargetTargetTypeField = 1 + chainTargetNameField = 2 + + chainRawField = 1 +) + +func (t *ChainTarget) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType)) + size += proto.StringSize(chainTargetNameField, t.name) + + return size +} + +func (t *ChainTarget) StableMarshal(buf []byte) []byte { + if t == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var offset int + + offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType)) + proto.StringMarshal(chainTargetNameField, buf[offset:], t.name) + + return buf +} + +func (t *ChainTarget) Unmarshal(data []byte) error { + return message.Unmarshal(t, data, new(ape.ChainTarget)) +} + +func (c *Chain) StableSize() (size int) { + if c == nil { + return 0 + } + + switch v := c.GetKind().(type) { + case *ChainRaw: + if v != nil { + size += proto.BytesSize(chainRawField, v.GetRaw()) + } + default: + panic(fmt.Sprintf("unsupported chain kind: %T", v)) + } + + return size +} + +func (c *Chain) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + switch v := c.GetKind().(type) { + case *ChainRaw: + if v != nil { + proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw()) + } + default: + panic(fmt.Sprintf("unsupported chain kind: %T", v)) + } + + return buf +} + +func (c *Chain) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(ape.Chain)) +} diff --git a/api/ape/message_test.go b/api/ape/message_test.go new file mode 100644 index 00000000..23b929b0 --- /dev/null +++ b/api/ape/message_test.go @@ -0,0 +1,15 @@ +package ape_test + +import ( + "testing" + + apetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return apetest.GenerateChainTarget(empty) }, + ) +} diff --git a/api/ape/string.go b/api/ape/string.go new file mode 100644 index 00000000..1d26c282 --- /dev/null +++ b/api/ape/string.go @@ -0,0 +1,18 @@ +package ape + +import ( + apegrpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" +) + +func (tt TargetType) String() string { + return TargetTypeToGRPCField(tt).String() +} + +func (tt *TargetType) FromString(s string) bool { + i, ok := apegrpc.TargetType_value[s] + if ok { + *tt = TargetType(i) + } + + return ok +} diff --git a/api/ape/test/generate.go b/api/ape/test/generate.go new file mode 100644 index 00000000..4fd3dc27 --- /dev/null +++ b/api/ape/test/generate.go @@ -0,0 +1,71 @@ +package test + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" +) + +func GenerateRawChains(empty bool, n int) []*ape.Chain { + if empty { + return []*ape.Chain{} + } + + res := make([]*ape.Chain, n) + for i := range res { + res[i] = GenerateRawChain(empty) + } + return res +} + +func GenerateRawChain(empty bool) *ape.Chain { + chRaw := new(ape.ChainRaw) + + if empty { + chRaw.SetRaw([]byte("{}")) + } else { + chRaw.SetRaw([]byte(`{ + "ID": "", + "Rules": [ + { + "Status": "Allow", + "Actions": { + "Inverted": false, + "Names": [ + "GetObject" + ] + }, + "Resources": { + "Inverted": false, + "Names": [ + "native:object/*" + ] + }, + "Any": false, + "Condition": [ + { + "Op": "StringEquals", + "Object": "Resource", + "Key": "Department", + "Value": "HR" + } + ] + } + ], + "MatchType": "DenyPriority" + }`)) + } + + ch := new(ape.Chain) + ch.SetKind(chRaw) + return ch +} + +func GenerateChainTarget(empty bool) *ape.ChainTarget { + m := new(ape.ChainTarget) + + if !empty { + m.SetTargetType(ape.TargetTypeContainer) + m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R") + } + + return m +} diff --git a/api/ape/types.go b/api/ape/types.go new file mode 100644 index 00000000..467a4412 --- /dev/null +++ b/api/ape/types.go @@ -0,0 +1,79 @@ +package ape + +type TargetType uint32 + +const ( + TargetTypeUndefined TargetType = iota + TargetTypeNamespace + TargetTypeContainer + TargetTypeUser + TargetTypeGroup +) + +type ChainTarget struct { + targeType TargetType + + name string +} + +func (ct *ChainTarget) SetTargetType(targeType TargetType) { + ct.targeType = targeType +} + +func (ct *ChainTarget) SetName(name string) { + ct.name = name +} + +func (ct *ChainTarget) GetTargetType() TargetType { + if ct != nil { + return ct.targeType + } + + return 0 +} + +func (ct *ChainTarget) GetName() string { + if ct != nil { + return ct.name + } + + return "" +} + +type chainKind interface { + isChainKind() +} + +type Chain struct { + kind chainKind +} + +func (c *Chain) SetKind(kind chainKind) { + c.kind = kind +} + +func (c *Chain) GetKind() chainKind { + if c == nil { + return nil + } + + return c.kind +} + +type ChainRaw struct { + Raw []byte +} + +func (*ChainRaw) isChainKind() {} + +func (c *ChainRaw) SetRaw(raw []byte) { + c.Raw = raw +} + +func (c *ChainRaw) GetRaw() []byte { + if c == nil { + return nil + } + + return c.Raw +} diff --git a/api/apemanager/convert.go b/api/apemanager/convert.go new file mode 100644 index 00000000..b24a5004 --- /dev/null +++ b/api/apemanager/convert.go @@ -0,0 +1,358 @@ +package apemanager + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" + apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + apemanager "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (reqBody *AddChainRequestBody) ToGRPCMessage() grpc.Message { + var reqBodygrpc *apemanager.AddChainRequest_Body + + if reqBody != nil { + reqBodygrpc = new(apemanager.AddChainRequest_Body) + + reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apeGRPC.ChainTarget)) + reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apeGRPC.Chain)) + } + + return reqBodygrpc +} + +func (reqBody *AddChainRequestBody) FromGRPCMessage(m grpc.Message) error { + reqBodygrpc, ok := m.(*apemanager.AddChainRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, reqBodygrpc) + } + + if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { + reqBody.target = new(ape.ChainTarget) + if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { + return err + } + } + + if chaingrpc := reqBodygrpc.GetChain(); chaingrpc != nil { + reqBody.chain = new(ape.Chain) + if err := reqBody.GetChain().FromGRPCMessage(chaingrpc); err != nil { + return err + } + } + + return nil +} + +func (req *AddChainRequest) ToGRPCMessage() grpc.Message { + var reqgrpc *apemanager.AddChainRequest + + if req != nil { + reqgrpc = new(apemanager.AddChainRequest) + + reqgrpc.SetBody(req.GetBody().ToGRPCMessage().(*apemanager.AddChainRequest_Body)) + req.RequestHeaders.ToMessage(reqgrpc) + } + + return reqgrpc +} + +func (req *AddChainRequest) FromGRPCMessage(m grpc.Message) error { + reqgrpc, ok := m.(*apemanager.AddChainRequest) + if !ok { + return message.NewUnexpectedMessageType(m, reqgrpc) + } + + if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil { + req.body = new(AddChainRequestBody) + if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil { + return err + } + } + + return req.RequestHeaders.FromMessage(reqgrpc) +} + +func (respBody *AddChainResponseBody) ToGRPCMessage() grpc.Message { + var respBodygrpc *apemanager.AddChainResponse_Body + + if respBody != nil { + respBodygrpc = new(apemanager.AddChainResponse_Body) + + respBodygrpc.SetChainId(respBody.GetChainID()) + } + + return respBodygrpc +} + +func (respBody *AddChainResponseBody) FromGRPCMessage(m grpc.Message) error { + respBodygrpc, ok := m.(*apemanager.AddChainResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, respBodygrpc) + } + + respBody.SetChainID(respBodygrpc.GetChainId()) + + return nil +} + +func (resp *AddChainResponse) ToGRPCMessage() grpc.Message { + var respgrpc *apemanager.AddChainResponse + + if resp != nil { + respgrpc = new(apemanager.AddChainResponse) + + respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.AddChainResponse_Body)) + resp.ResponseHeaders.ToMessage(respgrpc) + } + + return respgrpc +} + +func (resp *AddChainResponse) FromGRPCMessage(m grpc.Message) error { + respgrpc, ok := m.(*apemanager.AddChainResponse) + if !ok { + return message.NewUnexpectedMessageType(m, respgrpc) + } + + if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil { + resp.body = new(AddChainResponseBody) + if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil { + return err + } + } + + return resp.ResponseHeaders.FromMessage(respgrpc) +} + +func (reqBody *RemoveChainRequestBody) ToGRPCMessage() grpc.Message { + var reqBodygrpc *apemanager.RemoveChainRequest_Body + + if reqBody != nil { + reqBodygrpc = new(apemanager.RemoveChainRequest_Body) + + reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget)) + reqBodygrpc.SetChainId(reqBody.GetChainID()) + } + + return reqBodygrpc +} + +func (reqBody *RemoveChainRequestBody) FromGRPCMessage(m grpc.Message) error { + reqBodygrpc, ok := m.(*apemanager.RemoveChainRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, reqBodygrpc) + } + + if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { + reqBody.target = new(ape.ChainTarget) + if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { + return err + } + } + + reqBody.SetChainID(reqBodygrpc.GetChainId()) + + return nil +} + +func (req *RemoveChainRequest) ToGRPCMessage() grpc.Message { + var reqgrpc *apemanager.RemoveChainRequest + + if req != nil { + reqgrpc = new(apemanager.RemoveChainRequest) + + reqgrpc.SetBody(req.body.ToGRPCMessage().(*apemanager.RemoveChainRequest_Body)) + req.RequestHeaders.ToMessage(reqgrpc) + } + + return reqgrpc +} + +func (req *RemoveChainRequest) FromGRPCMessage(m grpc.Message) error { + reqgrpc, ok := m.(*apemanager.RemoveChainRequest) + if !ok { + return message.NewUnexpectedMessageType(m, reqgrpc) + } + + if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil { + req.body = new(RemoveChainRequestBody) + if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil { + return err + } + } + + return req.RequestHeaders.FromMessage(reqgrpc) +} + +func (respBody *RemoveChainResponseBody) ToGRPCMessage() grpc.Message { + var respBodygrpc *apemanager.RemoveChainResponse_Body + + if respBody != nil { + respBodygrpc = new(apemanager.RemoveChainResponse_Body) + } + + return respBodygrpc +} + +func (respBody *RemoveChainResponseBody) FromGRPCMessage(m grpc.Message) error { + respBodygrpc, ok := m.(*apemanager.RemoveChainResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, respBodygrpc) + } + + return nil +} + +func (resp *RemoveChainResponse) ToGRPCMessage() grpc.Message { + var respgrpc *apemanager.RemoveChainResponse + + if resp != nil { + respgrpc = new(apemanager.RemoveChainResponse) + + respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.RemoveChainResponse_Body)) + resp.ResponseHeaders.ToMessage(respgrpc) + } + + return respgrpc +} + +func (resp *RemoveChainResponse) FromGRPCMessage(m grpc.Message) error { + respgrpc, ok := m.(*apemanager.RemoveChainResponse) + if !ok { + return message.NewUnexpectedMessageType(m, respgrpc) + } + + if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil { + resp.body = new(RemoveChainResponseBody) + if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil { + return err + } + } + + return resp.ResponseHeaders.FromMessage(respgrpc) +} + +func (reqBody *ListChainsRequestBody) ToGRPCMessage() grpc.Message { + var reqBodygrpc *apemanager.ListChainsRequest_Body + + if reqBody != nil { + reqBodygrpc = new(apemanager.ListChainsRequest_Body) + + reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget)) + } + + return reqBodygrpc +} + +func (reqBody *ListChainsRequestBody) FromGRPCMessage(m grpc.Message) error { + reqBodygrpc, ok := m.(*apemanager.ListChainsRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, reqBodygrpc) + } + + if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil { + reqBody.target = new(ape.ChainTarget) + if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil { + return err + } + } + + return nil +} + +func (req *ListChainsRequest) ToGRPCMessage() grpc.Message { + var reqgrpc *apemanager.ListChainsRequest + + if req != nil { + reqgrpc = new(apemanager.ListChainsRequest) + + reqgrpc.SetBody(req.body.ToGRPCMessage().(*apemanager.ListChainsRequest_Body)) + req.RequestHeaders.ToMessage(reqgrpc) + } + + return reqgrpc +} + +func (req *ListChainsRequest) FromGRPCMessage(m grpc.Message) error { + reqgrpc, ok := m.(*apemanager.ListChainsRequest) + if !ok { + return message.NewUnexpectedMessageType(m, reqgrpc) + } + + if reqBodygrpc := reqgrpc.GetBody(); reqBodygrpc != nil { + req.body = new(ListChainsRequestBody) + if err := req.body.FromGRPCMessage(reqBodygrpc); err != nil { + return err + } + } + + return req.RequestHeaders.FromMessage(reqgrpc) +} + +func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message { + var respBodygrpc *apemanager.ListChainsResponse_Body + + if respBody != nil { + respBodygrpc = new(apemanager.ListChainsResponse_Body) + + chainsgrpc := make([]*apeGRPC.Chain, 0, len(respBody.GetChains())) + for _, chain := range respBody.GetChains() { + chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apeGRPC.Chain)) + } + + respBodygrpc.SetChains(chainsgrpc) + } + + return respBodygrpc +} + +func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error { + respBodygrpc, ok := m.(*apemanager.ListChainsResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, respBodygrpc) + } + + chains := make([]*ape.Chain, 0, len(respBodygrpc.GetChains())) + + for _, chaingrpc := range respBodygrpc.GetChains() { + chain := new(ape.Chain) + if err := chain.FromGRPCMessage(chaingrpc); err != nil { + return err + } + chains = append(chains, chain) + } + + respBody.SetChains(chains) + + return nil +} + +func (resp *ListChainsResponse) ToGRPCMessage() grpc.Message { + var respgrpc *apemanager.ListChainsResponse + + if resp != nil { + respgrpc = new(apemanager.ListChainsResponse) + + respgrpc.SetBody(resp.body.ToGRPCMessage().(*apemanager.ListChainsResponse_Body)) + resp.ResponseHeaders.ToMessage(respgrpc) + } + + return respgrpc +} + +func (resp *ListChainsResponse) FromGRPCMessage(m grpc.Message) error { + respgrpc, ok := m.(*apemanager.ListChainsResponse) + if !ok { + return message.NewUnexpectedMessageType(m, respgrpc) + } + + if respBodygrpc := respgrpc.GetBody(); respBodygrpc != nil { + resp.body = new(ListChainsResponseBody) + if err := resp.body.FromGRPCMessage(respBodygrpc); err != nil { + return err + } + } + + return resp.ResponseHeaders.FromMessage(respgrpc) +} diff --git a/api/apemanager/grpc/service.pb.go b/api/apemanager/grpc/service.pb.go new file mode 100644 index 00000000..7321ef1a --- /dev/null +++ b/api/apemanager/grpc/service.pb.go @@ -0,0 +1,1487 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/apemanager/grpc/service.proto + +//go:build !protoopaque + +package apemanager + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AddChainRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The request's body. + Body *AddChainRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddChainRequest) Reset() { + *x = AddChainRequest{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddChainRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainRequest) ProtoMessage() {} + +func (x *AddChainRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *AddChainRequest) GetBody() *AddChainRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AddChainRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *AddChainRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *AddChainRequest) SetBody(v *AddChainRequest_Body) { + x.Body = v +} + +func (x *AddChainRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *AddChainRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *AddChainRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *AddChainRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *AddChainRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *AddChainRequest) ClearBody() { + x.Body = nil +} + +func (x *AddChainRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *AddChainRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type AddChainRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The request's body. + Body *AddChainRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 AddChainRequest_builder) Build() *AddChainRequest { + m0 := &AddChainRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +type AddChainResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The response's body. + Body *AddChainResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddChainResponse) Reset() { + *x = AddChainResponse{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddChainResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainResponse) ProtoMessage() {} + +func (x *AddChainResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *AddChainResponse) GetBody() *AddChainResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *AddChainResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *AddChainResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *AddChainResponse) SetBody(v *AddChainResponse_Body) { + x.Body = v +} + +func (x *AddChainResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *AddChainResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *AddChainResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *AddChainResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *AddChainResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *AddChainResponse) ClearBody() { + x.Body = nil +} + +func (x *AddChainResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *AddChainResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type AddChainResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The response's body. + Body *AddChainResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 AddChainResponse_builder) Build() *AddChainResponse { + m0 := &AddChainResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +type RemoveChainRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The request's body. + Body *RemoveChainRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveChainRequest) Reset() { + *x = RemoveChainRequest{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveChainRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainRequest) ProtoMessage() {} + +func (x *RemoveChainRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RemoveChainRequest) GetBody() *RemoveChainRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *RemoveChainRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *RemoveChainRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *RemoveChainRequest) SetBody(v *RemoveChainRequest_Body) { + x.Body = v +} + +func (x *RemoveChainRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *RemoveChainRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *RemoveChainRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *RemoveChainRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *RemoveChainRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *RemoveChainRequest) ClearBody() { + x.Body = nil +} + +func (x *RemoveChainRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *RemoveChainRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type RemoveChainRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The request's body. + Body *RemoveChainRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 RemoveChainRequest_builder) Build() *RemoveChainRequest { + m0 := &RemoveChainRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +type RemoveChainResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The response's body. + Body *RemoveChainResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveChainResponse) Reset() { + *x = RemoveChainResponse{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveChainResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainResponse) ProtoMessage() {} + +func (x *RemoveChainResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RemoveChainResponse) GetBody() *RemoveChainResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *RemoveChainResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *RemoveChainResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *RemoveChainResponse) SetBody(v *RemoveChainResponse_Body) { + x.Body = v +} + +func (x *RemoveChainResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *RemoveChainResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *RemoveChainResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *RemoveChainResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *RemoveChainResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *RemoveChainResponse) ClearBody() { + x.Body = nil +} + +func (x *RemoveChainResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *RemoveChainResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type RemoveChainResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The response's body. + Body *RemoveChainResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 RemoveChainResponse_builder) Build() *RemoveChainResponse { + m0 := &RemoveChainResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +type ListChainsRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The request's body. + Body *ListChainsRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListChainsRequest) Reset() { + *x = ListChainsRequest{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListChainsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsRequest) ProtoMessage() {} + +func (x *ListChainsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListChainsRequest) GetBody() *ListChainsRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListChainsRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListChainsRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *ListChainsRequest) SetBody(v *ListChainsRequest_Body) { + x.Body = v +} + +func (x *ListChainsRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *ListChainsRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *ListChainsRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *ListChainsRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *ListChainsRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *ListChainsRequest) ClearBody() { + x.Body = nil +} + +func (x *ListChainsRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *ListChainsRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type ListChainsRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The request's body. + Body *ListChainsRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 ListChainsRequest_builder) Build() *ListChainsRequest { + m0 := &ListChainsRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +type ListChainsResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The response's body. + Body *ListChainsResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListChainsResponse) Reset() { + *x = ListChainsResponse{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListChainsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsResponse) ProtoMessage() {} + +func (x *ListChainsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListChainsResponse) GetBody() *ListChainsResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListChainsResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListChainsResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *ListChainsResponse) SetBody(v *ListChainsResponse_Body) { + x.Body = v +} + +func (x *ListChainsResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *ListChainsResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *ListChainsResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *ListChainsResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *ListChainsResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *ListChainsResponse) ClearBody() { + x.Body = nil +} + +func (x *ListChainsResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *ListChainsResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type ListChainsResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The response's body. + Body *ListChainsResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 ListChainsResponse_builder) Build() *ListChainsResponse { + m0 := &ListChainsResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +type AddChainRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // A target for which a rule chain is added. + Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + // The chain to set for the target. + Chain *grpc1.Chain `protobuf:"bytes,2,opt,name=chain" json:"chain,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddChainRequest_Body) Reset() { + *x = AddChainRequest_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddChainRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainRequest_Body) ProtoMessage() {} + +func (x *AddChainRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *AddChainRequest_Body) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.Target + } + return nil +} + +func (x *AddChainRequest_Body) GetChain() *grpc1.Chain { + if x != nil { + return x.Chain + } + return nil +} + +func (x *AddChainRequest_Body) SetTarget(v *grpc1.ChainTarget) { + x.Target = v +} + +func (x *AddChainRequest_Body) SetChain(v *grpc1.Chain) { + x.Chain = v +} + +func (x *AddChainRequest_Body) HasTarget() bool { + if x == nil { + return false + } + return x.Target != nil +} + +func (x *AddChainRequest_Body) HasChain() bool { + if x == nil { + return false + } + return x.Chain != nil +} + +func (x *AddChainRequest_Body) ClearTarget() { + x.Target = nil +} + +func (x *AddChainRequest_Body) ClearChain() { + x.Chain = nil +} + +type AddChainRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // A target for which a rule chain is added. + Target *grpc1.ChainTarget + // The chain to set for the target. + Chain *grpc1.Chain +} + +func (b0 AddChainRequest_Body_builder) Build() *AddChainRequest_Body { + m0 := &AddChainRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Target = b.Target + x.Chain = b.Chain + return m0 +} + +type AddChainResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Chain ID assigned for the added rule chain. + // If chain ID is left empty in the request, then + // it will be generated. + ChainId []byte `protobuf:"bytes,1,opt,name=chain_id,json=chainId" json:"chain_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddChainResponse_Body) Reset() { + *x = AddChainResponse_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddChainResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainResponse_Body) ProtoMessage() {} + +func (x *AddChainResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *AddChainResponse_Body) GetChainId() []byte { + if x != nil { + return x.ChainId + } + return nil +} + +func (x *AddChainResponse_Body) SetChainId(v []byte) { + if v == nil { + v = []byte{} + } + x.ChainId = v +} + +func (x *AddChainResponse_Body) HasChainId() bool { + if x == nil { + return false + } + return x.ChainId != nil +} + +func (x *AddChainResponse_Body) ClearChainId() { + x.ChainId = nil +} + +type AddChainResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Chain ID assigned for the added rule chain. + // If chain ID is left empty in the request, then + // it will be generated. + ChainId []byte +} + +func (b0 AddChainResponse_Body_builder) Build() *AddChainResponse_Body { + m0 := &AddChainResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ChainId = b.ChainId + return m0 +} + +type RemoveChainRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Target for which a rule chain is removed. + Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + // Chain ID assigned for the rule chain. + ChainId []byte `protobuf:"bytes,2,opt,name=chain_id,json=chainId" json:"chain_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveChainRequest_Body) Reset() { + *x = RemoveChainRequest_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveChainRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainRequest_Body) ProtoMessage() {} + +func (x *RemoveChainRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RemoveChainRequest_Body) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.Target + } + return nil +} + +func (x *RemoveChainRequest_Body) GetChainId() []byte { + if x != nil { + return x.ChainId + } + return nil +} + +func (x *RemoveChainRequest_Body) SetTarget(v *grpc1.ChainTarget) { + x.Target = v +} + +func (x *RemoveChainRequest_Body) SetChainId(v []byte) { + if v == nil { + v = []byte{} + } + x.ChainId = v +} + +func (x *RemoveChainRequest_Body) HasTarget() bool { + if x == nil { + return false + } + return x.Target != nil +} + +func (x *RemoveChainRequest_Body) HasChainId() bool { + if x == nil { + return false + } + return x.ChainId != nil +} + +func (x *RemoveChainRequest_Body) ClearTarget() { + x.Target = nil +} + +func (x *RemoveChainRequest_Body) ClearChainId() { + x.ChainId = nil +} + +type RemoveChainRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Target for which a rule chain is removed. + Target *grpc1.ChainTarget + // Chain ID assigned for the rule chain. + ChainId []byte +} + +func (b0 RemoveChainRequest_Body_builder) Build() *RemoveChainRequest_Body { + m0 := &RemoveChainRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Target = b.Target + x.ChainId = b.ChainId + return m0 +} + +// Since RemoveChain is an idempotent operation, then the only indicator that +// operation could not be performed is an error returning to a client. +type RemoveChainResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveChainResponse_Body) Reset() { + *x = RemoveChainResponse_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveChainResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainResponse_Body) ProtoMessage() {} + +func (x *RemoveChainResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type RemoveChainResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 RemoveChainResponse_Body_builder) Build() *RemoveChainResponse_Body { + m0 := &RemoveChainResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +type ListChainsRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Target for which rule chains are listed. + Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListChainsRequest_Body) Reset() { + *x = ListChainsRequest_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListChainsRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsRequest_Body) ProtoMessage() {} + +func (x *ListChainsRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListChainsRequest_Body) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.Target + } + return nil +} + +func (x *ListChainsRequest_Body) SetTarget(v *grpc1.ChainTarget) { + x.Target = v +} + +func (x *ListChainsRequest_Body) HasTarget() bool { + if x == nil { + return false + } + return x.Target != nil +} + +func (x *ListChainsRequest_Body) ClearTarget() { + x.Target = nil +} + +type ListChainsRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Target for which rule chains are listed. + Target *grpc1.ChainTarget +} + +func (b0 ListChainsRequest_Body_builder) Build() *ListChainsRequest_Body { + m0 := &ListChainsRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Target = b.Target + return m0 +} + +type ListChainsResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The list of chains defined for the reqeusted target. + Chains []*grpc1.Chain `protobuf:"bytes,1,rep,name=chains" json:"chains,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListChainsResponse_Body) Reset() { + *x = ListChainsResponse_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListChainsResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsResponse_Body) ProtoMessage() {} + +func (x *ListChainsResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListChainsResponse_Body) GetChains() []*grpc1.Chain { + if x != nil { + return x.Chains + } + return nil +} + +func (x *ListChainsResponse_Body) SetChains(v []*grpc1.Chain) { + x.Chains = v +} + +type ListChainsResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The list of chains defined for the reqeusted target. + Chains []*grpc1.Chain +} + +func (b0 ListChainsResponse_Body_builder) Build() *ListChainsResponse_Body { + m0 := &ListChainsResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Chains = b.Chains + return m0 +} + +var File_api_apemanager_grpc_service_proto protoreflect.FileDescriptor + +var file_api_apemanager_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x18, 0x61, 0x70, 0x69, 0x2f, + 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xd6, 0x02, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, + 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, + 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x1a, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, + 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2b, + 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x93, 0x02, 0x0a, 0x10, + 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x21, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, + 0x64, 0x22, 0xca, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x56, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, + 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xfe, + 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, + 0xad, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0x3b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, + 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, + 0xab, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x35, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2d, + 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x32, 0xb9, 0x02, + 0x0a, 0x11, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, + 0x26, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x64, 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, + 0x29, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x66, 0x72, 0x6f, + 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x73, 0x12, 0x28, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, + 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, + 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, + 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_apemanager_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_api_apemanager_grpc_service_proto_goTypes = []any{ + (*AddChainRequest)(nil), // 0: frostfs.v2.apemanager.AddChainRequest + (*AddChainResponse)(nil), // 1: frostfs.v2.apemanager.AddChainResponse + (*RemoveChainRequest)(nil), // 2: frostfs.v2.apemanager.RemoveChainRequest + (*RemoveChainResponse)(nil), // 3: frostfs.v2.apemanager.RemoveChainResponse + (*ListChainsRequest)(nil), // 4: frostfs.v2.apemanager.ListChainsRequest + (*ListChainsResponse)(nil), // 5: frostfs.v2.apemanager.ListChainsResponse + (*AddChainRequest_Body)(nil), // 6: frostfs.v2.apemanager.AddChainRequest.Body + (*AddChainResponse_Body)(nil), // 7: frostfs.v2.apemanager.AddChainResponse.Body + (*RemoveChainRequest_Body)(nil), // 8: frostfs.v2.apemanager.RemoveChainRequest.Body + (*RemoveChainResponse_Body)(nil), // 9: frostfs.v2.apemanager.RemoveChainResponse.Body + (*ListChainsRequest_Body)(nil), // 10: frostfs.v2.apemanager.ListChainsRequest.Body + (*ListChainsResponse_Body)(nil), // 11: frostfs.v2.apemanager.ListChainsResponse.Body + (*grpc.RequestMetaHeader)(nil), // 12: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader + (*grpc1.ChainTarget)(nil), // 16: frostfs.v2.ape.ChainTarget + (*grpc1.Chain)(nil), // 17: frostfs.v2.ape.Chain +} +var file_api_apemanager_grpc_service_proto_depIdxs = []int32{ + 6, // 0: frostfs.v2.apemanager.AddChainRequest.body:type_name -> frostfs.v2.apemanager.AddChainRequest.Body + 12, // 1: frostfs.v2.apemanager.AddChainRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 2: frostfs.v2.apemanager.AddChainRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 3: frostfs.v2.apemanager.AddChainResponse.body:type_name -> frostfs.v2.apemanager.AddChainResponse.Body + 14, // 4: frostfs.v2.apemanager.AddChainResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 5: frostfs.v2.apemanager.AddChainResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: frostfs.v2.apemanager.RemoveChainRequest.body:type_name -> frostfs.v2.apemanager.RemoveChainRequest.Body + 12, // 7: frostfs.v2.apemanager.RemoveChainRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 8: frostfs.v2.apemanager.RemoveChainRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 9, // 9: frostfs.v2.apemanager.RemoveChainResponse.body:type_name -> frostfs.v2.apemanager.RemoveChainResponse.Body + 14, // 10: frostfs.v2.apemanager.RemoveChainResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 11: frostfs.v2.apemanager.RemoveChainResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 10, // 12: frostfs.v2.apemanager.ListChainsRequest.body:type_name -> frostfs.v2.apemanager.ListChainsRequest.Body + 12, // 13: frostfs.v2.apemanager.ListChainsRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 14: frostfs.v2.apemanager.ListChainsRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 15: frostfs.v2.apemanager.ListChainsResponse.body:type_name -> frostfs.v2.apemanager.ListChainsResponse.Body + 14, // 16: frostfs.v2.apemanager.ListChainsResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 17: frostfs.v2.apemanager.ListChainsResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: frostfs.v2.apemanager.AddChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 17, // 19: frostfs.v2.apemanager.AddChainRequest.Body.chain:type_name -> frostfs.v2.ape.Chain + 16, // 20: frostfs.v2.apemanager.RemoveChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 16, // 21: frostfs.v2.apemanager.ListChainsRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 17, // 22: frostfs.v2.apemanager.ListChainsResponse.Body.chains:type_name -> frostfs.v2.ape.Chain + 0, // 23: frostfs.v2.apemanager.APEManagerService.AddChain:input_type -> frostfs.v2.apemanager.AddChainRequest + 2, // 24: frostfs.v2.apemanager.APEManagerService.RemoveChain:input_type -> frostfs.v2.apemanager.RemoveChainRequest + 4, // 25: frostfs.v2.apemanager.APEManagerService.ListChains:input_type -> frostfs.v2.apemanager.ListChainsRequest + 1, // 26: frostfs.v2.apemanager.APEManagerService.AddChain:output_type -> frostfs.v2.apemanager.AddChainResponse + 3, // 27: frostfs.v2.apemanager.APEManagerService.RemoveChain:output_type -> frostfs.v2.apemanager.RemoveChainResponse + 5, // 28: frostfs.v2.apemanager.APEManagerService.ListChains:output_type -> frostfs.v2.apemanager.ListChainsResponse + 26, // [26:29] is the sub-list for method output_type + 23, // [23:26] is the sub-list for method input_type + 23, // [23:23] is the sub-list for extension type_name + 23, // [23:23] is the sub-list for extension extendee + 0, // [0:23] is the sub-list for field type_name +} + +func init() { file_api_apemanager_grpc_service_proto_init() } +func file_api_apemanager_grpc_service_proto_init() { + if File_api_apemanager_grpc_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_apemanager_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_apemanager_grpc_service_proto_goTypes, + DependencyIndexes: file_api_apemanager_grpc_service_proto_depIdxs, + MessageInfos: file_api_apemanager_grpc_service_proto_msgTypes, + }.Build() + File_api_apemanager_grpc_service_proto = out.File + file_api_apemanager_grpc_service_proto_rawDesc = nil + file_api_apemanager_grpc_service_proto_goTypes = nil + file_api_apemanager_grpc_service_proto_depIdxs = nil +} diff --git a/api/apemanager/grpc/service_grpc.pb.go b/api/apemanager/grpc/service_grpc.pb.go new file mode 100644 index 00000000..8dd61e00 --- /dev/null +++ b/api/apemanager/grpc/service_grpc.pb.go @@ -0,0 +1,265 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.2 +// source: api/apemanager/grpc/service.proto + +package apemanager + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + APEManagerService_AddChain_FullMethodName = "/frostfs.v2.apemanager.APEManagerService/AddChain" + APEManagerService_RemoveChain_FullMethodName = "/frostfs.v2.apemanager.APEManagerService/RemoveChain" + APEManagerService_ListChains_FullMethodName = "/frostfs.v2.apemanager.APEManagerService/ListChains" +) + +// APEManagerServiceClient is the client API for APEManagerService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// `APEManagerService` provides API to manage rule chains within sidechain's +// `Policy` smart contract. +type APEManagerServiceClient interface { + // Add a rule chain for a specific target to `Policy` smart contract. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // the chain has been successfully added; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container (as target) not found; + // - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \ + // the operation is denied by the service. + AddChain(ctx context.Context, in *AddChainRequest, opts ...grpc.CallOption) (*AddChainResponse, error) + // Remove a rule chain for a specific target from `Policy` smart contract. + // RemoveChain is an idempotent operation: removal of non-existing rule chain + // also means success. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // the chain has been successfully removed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container (as target) not found; + // - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \ + // the operation is denied by the service. + RemoveChain(ctx context.Context, in *RemoveChainRequest, opts ...grpc.CallOption) (*RemoveChainResponse, error) + // List chains defined for a specific target from `Policy` smart contract. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // chains have been successfully listed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container (as target) not found; + // - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \ + // the operation is denied by the service. + ListChains(ctx context.Context, in *ListChainsRequest, opts ...grpc.CallOption) (*ListChainsResponse, error) +} + +type aPEManagerServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAPEManagerServiceClient(cc grpc.ClientConnInterface) APEManagerServiceClient { + return &aPEManagerServiceClient{cc} +} + +func (c *aPEManagerServiceClient) AddChain(ctx context.Context, in *AddChainRequest, opts ...grpc.CallOption) (*AddChainResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AddChainResponse) + err := c.cc.Invoke(ctx, APEManagerService_AddChain_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aPEManagerServiceClient) RemoveChain(ctx context.Context, in *RemoveChainRequest, opts ...grpc.CallOption) (*RemoveChainResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RemoveChainResponse) + err := c.cc.Invoke(ctx, APEManagerService_RemoveChain_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aPEManagerServiceClient) ListChains(ctx context.Context, in *ListChainsRequest, opts ...grpc.CallOption) (*ListChainsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListChainsResponse) + err := c.cc.Invoke(ctx, APEManagerService_ListChains_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// APEManagerServiceServer is the server API for APEManagerService service. +// All implementations should embed UnimplementedAPEManagerServiceServer +// for forward compatibility. +// +// `APEManagerService` provides API to manage rule chains within sidechain's +// `Policy` smart contract. +type APEManagerServiceServer interface { + // Add a rule chain for a specific target to `Policy` smart contract. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // the chain has been successfully added; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container (as target) not found; + // - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \ + // the operation is denied by the service. + AddChain(context.Context, *AddChainRequest) (*AddChainResponse, error) + // Remove a rule chain for a specific target from `Policy` smart contract. + // RemoveChain is an idempotent operation: removal of non-existing rule chain + // also means success. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // the chain has been successfully removed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container (as target) not found; + // - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \ + // the operation is denied by the service. + RemoveChain(context.Context, *RemoveChainRequest) (*RemoveChainResponse, error) + // List chains defined for a specific target from `Policy` smart contract. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // chains have been successfully listed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // container (as target) not found; + // - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \ + // the operation is denied by the service. + ListChains(context.Context, *ListChainsRequest) (*ListChainsResponse, error) +} + +// UnimplementedAPEManagerServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedAPEManagerServiceServer struct{} + +func (UnimplementedAPEManagerServiceServer) AddChain(context.Context, *AddChainRequest) (*AddChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddChain not implemented") +} +func (UnimplementedAPEManagerServiceServer) RemoveChain(context.Context, *RemoveChainRequest) (*RemoveChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveChain not implemented") +} +func (UnimplementedAPEManagerServiceServer) ListChains(context.Context, *ListChainsRequest) (*ListChainsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListChains not implemented") +} +func (UnimplementedAPEManagerServiceServer) testEmbeddedByValue() {} + +// UnsafeAPEManagerServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to APEManagerServiceServer will +// result in compilation errors. +type UnsafeAPEManagerServiceServer interface { + mustEmbedUnimplementedAPEManagerServiceServer() +} + +func RegisterAPEManagerServiceServer(s grpc.ServiceRegistrar, srv APEManagerServiceServer) { + // If the following call pancis, it indicates UnimplementedAPEManagerServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&APEManagerService_ServiceDesc, srv) +} + +func _APEManagerService_AddChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddChainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(APEManagerServiceServer).AddChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: APEManagerService_AddChain_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APEManagerServiceServer).AddChain(ctx, req.(*AddChainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _APEManagerService_RemoveChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveChainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(APEManagerServiceServer).RemoveChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: APEManagerService_RemoveChain_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APEManagerServiceServer).RemoveChain(ctx, req.(*RemoveChainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _APEManagerService_ListChains_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListChainsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(APEManagerServiceServer).ListChains(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: APEManagerService_ListChains_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(APEManagerServiceServer).ListChains(ctx, req.(*ListChainsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// APEManagerService_ServiceDesc is the grpc.ServiceDesc for APEManagerService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var APEManagerService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "frostfs.v2.apemanager.APEManagerService", + HandlerType: (*APEManagerServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddChain", + Handler: _APEManagerService_AddChain_Handler, + }, + { + MethodName: "RemoveChain", + Handler: _APEManagerService_RemoveChain_Handler, + }, + { + MethodName: "ListChains", + Handler: _APEManagerService_ListChains_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/apemanager/grpc/service.proto", +} diff --git a/api/apemanager/grpc/service_protoopaque.pb.go b/api/apemanager/grpc/service_protoopaque.pb.go new file mode 100644 index 00000000..5ccadc04 --- /dev/null +++ b/api/apemanager/grpc/service_protoopaque.pb.go @@ -0,0 +1,1458 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/apemanager/grpc/service.proto + +//go:build protoopaque + +package apemanager + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AddChainRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *AddChainRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddChainRequest) Reset() { + *x = AddChainRequest{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddChainRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainRequest) ProtoMessage() {} + +func (x *AddChainRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *AddChainRequest) GetBody() *AddChainRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *AddChainRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *AddChainRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *AddChainRequest) SetBody(v *AddChainRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *AddChainRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *AddChainRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *AddChainRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *AddChainRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *AddChainRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *AddChainRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *AddChainRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *AddChainRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type AddChainRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The request's body. + Body *AddChainRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 AddChainRequest_builder) Build() *AddChainRequest { + m0 := &AddChainRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +type AddChainResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *AddChainResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddChainResponse) Reset() { + *x = AddChainResponse{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddChainResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainResponse) ProtoMessage() {} + +func (x *AddChainResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *AddChainResponse) GetBody() *AddChainResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *AddChainResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *AddChainResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *AddChainResponse) SetBody(v *AddChainResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *AddChainResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *AddChainResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *AddChainResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *AddChainResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *AddChainResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *AddChainResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *AddChainResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *AddChainResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type AddChainResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The response's body. + Body *AddChainResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 AddChainResponse_builder) Build() *AddChainResponse { + m0 := &AddChainResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +type RemoveChainRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *RemoveChainRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveChainRequest) Reset() { + *x = RemoveChainRequest{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveChainRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainRequest) ProtoMessage() {} + +func (x *RemoveChainRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RemoveChainRequest) GetBody() *RemoveChainRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *RemoveChainRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *RemoveChainRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *RemoveChainRequest) SetBody(v *RemoveChainRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *RemoveChainRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *RemoveChainRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *RemoveChainRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *RemoveChainRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *RemoveChainRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *RemoveChainRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *RemoveChainRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *RemoveChainRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type RemoveChainRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The request's body. + Body *RemoveChainRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 RemoveChainRequest_builder) Build() *RemoveChainRequest { + m0 := &RemoveChainRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +type RemoveChainResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *RemoveChainResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveChainResponse) Reset() { + *x = RemoveChainResponse{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveChainResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainResponse) ProtoMessage() {} + +func (x *RemoveChainResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RemoveChainResponse) GetBody() *RemoveChainResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *RemoveChainResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *RemoveChainResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *RemoveChainResponse) SetBody(v *RemoveChainResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *RemoveChainResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *RemoveChainResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *RemoveChainResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *RemoveChainResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *RemoveChainResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *RemoveChainResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *RemoveChainResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *RemoveChainResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type RemoveChainResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The response's body. + Body *RemoveChainResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 RemoveChainResponse_builder) Build() *RemoveChainResponse { + m0 := &RemoveChainResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +type ListChainsRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *ListChainsRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListChainsRequest) Reset() { + *x = ListChainsRequest{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListChainsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsRequest) ProtoMessage() {} + +func (x *ListChainsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListChainsRequest) GetBody() *ListChainsRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *ListChainsRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *ListChainsRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *ListChainsRequest) SetBody(v *ListChainsRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *ListChainsRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *ListChainsRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *ListChainsRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *ListChainsRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *ListChainsRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *ListChainsRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *ListChainsRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *ListChainsRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type ListChainsRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The request's body. + Body *ListChainsRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 ListChainsRequest_builder) Build() *ListChainsRequest { + m0 := &ListChainsRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +type ListChainsResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *ListChainsResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListChainsResponse) Reset() { + *x = ListChainsResponse{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListChainsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsResponse) ProtoMessage() {} + +func (x *ListChainsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListChainsResponse) GetBody() *ListChainsResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *ListChainsResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *ListChainsResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *ListChainsResponse) SetBody(v *ListChainsResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *ListChainsResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *ListChainsResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *ListChainsResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *ListChainsResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *ListChainsResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *ListChainsResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *ListChainsResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *ListChainsResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type ListChainsResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The response's body. + Body *ListChainsResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 ListChainsResponse_builder) Build() *ListChainsResponse { + m0 := &ListChainsResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +type AddChainRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + xxx_hidden_Chain *grpc1.Chain `protobuf:"bytes,2,opt,name=chain" json:"chain,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddChainRequest_Body) Reset() { + *x = AddChainRequest_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddChainRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainRequest_Body) ProtoMessage() {} + +func (x *AddChainRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *AddChainRequest_Body) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.xxx_hidden_Target + } + return nil +} + +func (x *AddChainRequest_Body) GetChain() *grpc1.Chain { + if x != nil { + return x.xxx_hidden_Chain + } + return nil +} + +func (x *AddChainRequest_Body) SetTarget(v *grpc1.ChainTarget) { + x.xxx_hidden_Target = v +} + +func (x *AddChainRequest_Body) SetChain(v *grpc1.Chain) { + x.xxx_hidden_Chain = v +} + +func (x *AddChainRequest_Body) HasTarget() bool { + if x == nil { + return false + } + return x.xxx_hidden_Target != nil +} + +func (x *AddChainRequest_Body) HasChain() bool { + if x == nil { + return false + } + return x.xxx_hidden_Chain != nil +} + +func (x *AddChainRequest_Body) ClearTarget() { + x.xxx_hidden_Target = nil +} + +func (x *AddChainRequest_Body) ClearChain() { + x.xxx_hidden_Chain = nil +} + +type AddChainRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // A target for which a rule chain is added. + Target *grpc1.ChainTarget + // The chain to set for the target. + Chain *grpc1.Chain +} + +func (b0 AddChainRequest_Body_builder) Build() *AddChainRequest_Body { + m0 := &AddChainRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Target = b.Target + x.xxx_hidden_Chain = b.Chain + return m0 +} + +type AddChainResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ChainId []byte `protobuf:"bytes,1,opt,name=chain_id,json=chainId" json:"chain_id,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddChainResponse_Body) Reset() { + *x = AddChainResponse_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddChainResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddChainResponse_Body) ProtoMessage() {} + +func (x *AddChainResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *AddChainResponse_Body) GetChainId() []byte { + if x != nil { + return x.xxx_hidden_ChainId + } + return nil +} + +func (x *AddChainResponse_Body) SetChainId(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_ChainId = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *AddChainResponse_Body) HasChainId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *AddChainResponse_Body) ClearChainId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_ChainId = nil +} + +type AddChainResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Chain ID assigned for the added rule chain. + // If chain ID is left empty in the request, then + // it will be generated. + ChainId []byte +} + +func (b0 AddChainResponse_Body_builder) Build() *AddChainResponse_Body { + m0 := &AddChainResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.ChainId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_ChainId = b.ChainId + } + return m0 +} + +type RemoveChainRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + xxx_hidden_ChainId []byte `protobuf:"bytes,2,opt,name=chain_id,json=chainId" json:"chain_id,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveChainRequest_Body) Reset() { + *x = RemoveChainRequest_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveChainRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainRequest_Body) ProtoMessage() {} + +func (x *RemoveChainRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RemoveChainRequest_Body) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.xxx_hidden_Target + } + return nil +} + +func (x *RemoveChainRequest_Body) GetChainId() []byte { + if x != nil { + return x.xxx_hidden_ChainId + } + return nil +} + +func (x *RemoveChainRequest_Body) SetTarget(v *grpc1.ChainTarget) { + x.xxx_hidden_Target = v +} + +func (x *RemoveChainRequest_Body) SetChainId(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_ChainId = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *RemoveChainRequest_Body) HasTarget() bool { + if x == nil { + return false + } + return x.xxx_hidden_Target != nil +} + +func (x *RemoveChainRequest_Body) HasChainId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *RemoveChainRequest_Body) ClearTarget() { + x.xxx_hidden_Target = nil +} + +func (x *RemoveChainRequest_Body) ClearChainId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_ChainId = nil +} + +type RemoveChainRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Target for which a rule chain is removed. + Target *grpc1.ChainTarget + // Chain ID assigned for the rule chain. + ChainId []byte +} + +func (b0 RemoveChainRequest_Body_builder) Build() *RemoveChainRequest_Body { + m0 := &RemoveChainRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Target = b.Target + if b.ChainId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_ChainId = b.ChainId + } + return m0 +} + +// Since RemoveChain is an idempotent operation, then the only indicator that +// operation could not be performed is an error returning to a client. +type RemoveChainResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveChainResponse_Body) Reset() { + *x = RemoveChainResponse_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveChainResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveChainResponse_Body) ProtoMessage() {} + +func (x *RemoveChainResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type RemoveChainResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 RemoveChainResponse_Body_builder) Build() *RemoveChainResponse_Body { + m0 := &RemoveChainResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +type ListChainsRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target" json:"target,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListChainsRequest_Body) Reset() { + *x = ListChainsRequest_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListChainsRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsRequest_Body) ProtoMessage() {} + +func (x *ListChainsRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListChainsRequest_Body) GetTarget() *grpc1.ChainTarget { + if x != nil { + return x.xxx_hidden_Target + } + return nil +} + +func (x *ListChainsRequest_Body) SetTarget(v *grpc1.ChainTarget) { + x.xxx_hidden_Target = v +} + +func (x *ListChainsRequest_Body) HasTarget() bool { + if x == nil { + return false + } + return x.xxx_hidden_Target != nil +} + +func (x *ListChainsRequest_Body) ClearTarget() { + x.xxx_hidden_Target = nil +} + +type ListChainsRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Target for which rule chains are listed. + Target *grpc1.ChainTarget +} + +func (b0 ListChainsRequest_Body_builder) Build() *ListChainsRequest_Body { + m0 := &ListChainsRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Target = b.Target + return m0 +} + +type ListChainsResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Chains *[]*grpc1.Chain `protobuf:"bytes,1,rep,name=chains" json:"chains,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListChainsResponse_Body) Reset() { + *x = ListChainsResponse_Body{} + mi := &file_api_apemanager_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListChainsResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListChainsResponse_Body) ProtoMessage() {} + +func (x *ListChainsResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_apemanager_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListChainsResponse_Body) GetChains() []*grpc1.Chain { + if x != nil { + if x.xxx_hidden_Chains != nil { + return *x.xxx_hidden_Chains + } + } + return nil +} + +func (x *ListChainsResponse_Body) SetChains(v []*grpc1.Chain) { + x.xxx_hidden_Chains = &v +} + +type ListChainsResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The list of chains defined for the reqeusted target. + Chains []*grpc1.Chain +} + +func (b0 ListChainsResponse_Body_builder) Build() *ListChainsResponse_Body { + m0 := &ListChainsResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Chains = &b.Chains + return m0 +} + +var File_api_apemanager_grpc_service_proto protoreflect.FileDescriptor + +var file_api_apemanager_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x18, 0x61, 0x70, 0x69, 0x2f, + 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xd6, 0x02, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, + 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, + 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x1a, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, + 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2b, + 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, + 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x93, 0x02, 0x0a, 0x10, + 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x21, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, + 0x64, 0x22, 0xca, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x56, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, + 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xfe, + 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, + 0xad, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0x3b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, + 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, + 0xab, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x35, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2d, + 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x32, 0xb9, 0x02, + 0x0a, 0x11, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, + 0x26, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x64, 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, + 0x29, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x66, 0x72, 0x6f, + 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x73, 0x12, 0x28, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, + 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, + 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, + 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_apemanager_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_api_apemanager_grpc_service_proto_goTypes = []any{ + (*AddChainRequest)(nil), // 0: frostfs.v2.apemanager.AddChainRequest + (*AddChainResponse)(nil), // 1: frostfs.v2.apemanager.AddChainResponse + (*RemoveChainRequest)(nil), // 2: frostfs.v2.apemanager.RemoveChainRequest + (*RemoveChainResponse)(nil), // 3: frostfs.v2.apemanager.RemoveChainResponse + (*ListChainsRequest)(nil), // 4: frostfs.v2.apemanager.ListChainsRequest + (*ListChainsResponse)(nil), // 5: frostfs.v2.apemanager.ListChainsResponse + (*AddChainRequest_Body)(nil), // 6: frostfs.v2.apemanager.AddChainRequest.Body + (*AddChainResponse_Body)(nil), // 7: frostfs.v2.apemanager.AddChainResponse.Body + (*RemoveChainRequest_Body)(nil), // 8: frostfs.v2.apemanager.RemoveChainRequest.Body + (*RemoveChainResponse_Body)(nil), // 9: frostfs.v2.apemanager.RemoveChainResponse.Body + (*ListChainsRequest_Body)(nil), // 10: frostfs.v2.apemanager.ListChainsRequest.Body + (*ListChainsResponse_Body)(nil), // 11: frostfs.v2.apemanager.ListChainsResponse.Body + (*grpc.RequestMetaHeader)(nil), // 12: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader + (*grpc1.ChainTarget)(nil), // 16: frostfs.v2.ape.ChainTarget + (*grpc1.Chain)(nil), // 17: frostfs.v2.ape.Chain +} +var file_api_apemanager_grpc_service_proto_depIdxs = []int32{ + 6, // 0: frostfs.v2.apemanager.AddChainRequest.body:type_name -> frostfs.v2.apemanager.AddChainRequest.Body + 12, // 1: frostfs.v2.apemanager.AddChainRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 2: frostfs.v2.apemanager.AddChainRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 3: frostfs.v2.apemanager.AddChainResponse.body:type_name -> frostfs.v2.apemanager.AddChainResponse.Body + 14, // 4: frostfs.v2.apemanager.AddChainResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 5: frostfs.v2.apemanager.AddChainResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: frostfs.v2.apemanager.RemoveChainRequest.body:type_name -> frostfs.v2.apemanager.RemoveChainRequest.Body + 12, // 7: frostfs.v2.apemanager.RemoveChainRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 8: frostfs.v2.apemanager.RemoveChainRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 9, // 9: frostfs.v2.apemanager.RemoveChainResponse.body:type_name -> frostfs.v2.apemanager.RemoveChainResponse.Body + 14, // 10: frostfs.v2.apemanager.RemoveChainResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 11: frostfs.v2.apemanager.RemoveChainResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 10, // 12: frostfs.v2.apemanager.ListChainsRequest.body:type_name -> frostfs.v2.apemanager.ListChainsRequest.Body + 12, // 13: frostfs.v2.apemanager.ListChainsRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 14: frostfs.v2.apemanager.ListChainsRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 15: frostfs.v2.apemanager.ListChainsResponse.body:type_name -> frostfs.v2.apemanager.ListChainsResponse.Body + 14, // 16: frostfs.v2.apemanager.ListChainsResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 17: frostfs.v2.apemanager.ListChainsResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: frostfs.v2.apemanager.AddChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 17, // 19: frostfs.v2.apemanager.AddChainRequest.Body.chain:type_name -> frostfs.v2.ape.Chain + 16, // 20: frostfs.v2.apemanager.RemoveChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 16, // 21: frostfs.v2.apemanager.ListChainsRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget + 17, // 22: frostfs.v2.apemanager.ListChainsResponse.Body.chains:type_name -> frostfs.v2.ape.Chain + 0, // 23: frostfs.v2.apemanager.APEManagerService.AddChain:input_type -> frostfs.v2.apemanager.AddChainRequest + 2, // 24: frostfs.v2.apemanager.APEManagerService.RemoveChain:input_type -> frostfs.v2.apemanager.RemoveChainRequest + 4, // 25: frostfs.v2.apemanager.APEManagerService.ListChains:input_type -> frostfs.v2.apemanager.ListChainsRequest + 1, // 26: frostfs.v2.apemanager.APEManagerService.AddChain:output_type -> frostfs.v2.apemanager.AddChainResponse + 3, // 27: frostfs.v2.apemanager.APEManagerService.RemoveChain:output_type -> frostfs.v2.apemanager.RemoveChainResponse + 5, // 28: frostfs.v2.apemanager.APEManagerService.ListChains:output_type -> frostfs.v2.apemanager.ListChainsResponse + 26, // [26:29] is the sub-list for method output_type + 23, // [23:26] is the sub-list for method input_type + 23, // [23:23] is the sub-list for extension type_name + 23, // [23:23] is the sub-list for extension extendee + 0, // [0:23] is the sub-list for field type_name +} + +func init() { file_api_apemanager_grpc_service_proto_init() } +func file_api_apemanager_grpc_service_proto_init() { + if File_api_apemanager_grpc_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_apemanager_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_apemanager_grpc_service_proto_goTypes, + DependencyIndexes: file_api_apemanager_grpc_service_proto_depIdxs, + MessageInfos: file_api_apemanager_grpc_service_proto_msgTypes, + }.Build() + File_api_apemanager_grpc_service_proto = out.File + file_api_apemanager_grpc_service_proto_rawDesc = nil + file_api_apemanager_grpc_service_proto_goTypes = nil + file_api_apemanager_grpc_service_proto_depIdxs = nil +} diff --git a/api/apemanager/marshal.go b/api/apemanager/marshal.go new file mode 100644 index 00000000..ac6fdde6 --- /dev/null +++ b/api/apemanager/marshal.go @@ -0,0 +1,205 @@ +package apemanager + +import ( + apemanager "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + addChainReqBodyTargetField = 1 + addChainReqBodyChainField = 2 + + addChainRespBodyChainIDField = 1 + + removeChainReqBodyTargetField = 1 + removeChainReqBodyChainField = 2 + + /* + Fields for RemoveResponseBody are missed since RemoveResponseBody is empty. + */ + + listChainsReqBodyTargetField = 1 + + listChainsRespBodyChainsField = 1 +) + +func (rb *AddChainRequestBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + size += proto.NestedStructureSize(addChainReqBodyTargetField, rb.target) + size += proto.NestedStructureSize(addChainReqBodyChainField, rb.chain) + + return size +} + +func (rb *AddChainRequestBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(addChainReqBodyTargetField, buf[offset:], rb.target) + proto.NestedStructureMarshal(addChainReqBodyChainField, buf[offset:], rb.chain) + + return buf +} + +func (rb *AddChainRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.AddChainRequest_Body)) +} + +func (rb *AddChainResponseBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + size += proto.BytesSize(addChainRespBodyChainIDField, rb.chainID) + + return size +} + +func (rb *AddChainResponseBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + + proto.BytesMarshal(addChainRespBodyChainIDField, buf[offset:], rb.chainID) + + return buf +} + +func (rb *AddChainResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.AddChainResponse_Body)) +} + +func (rb *RemoveChainRequestBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + size += proto.NestedStructureSize(addChainReqBodyTargetField, rb.target) + size += proto.BytesSize(addChainReqBodyChainField, rb.chainID) + + return size +} + +func (rb *RemoveChainRequestBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(removeChainReqBodyTargetField, buf[offset:], rb.target) + proto.BytesMarshal(removeChainReqBodyChainField, buf[offset:], rb.chainID) + + return buf +} + +func (rb *RemoveChainRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.RemoveChainRequest_Body)) +} + +func (rb *RemoveChainResponseBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + return size +} + +func (rb *RemoveChainResponseBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + return buf +} + +func (rb *RemoveChainResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.RemoveChainResponse_Body)) +} + +func (rb *ListChainsRequestBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + size += proto.NestedStructureSize(listChainsReqBodyTargetField, rb.target) + + return size +} + +func (rb *ListChainsRequestBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + proto.NestedStructureMarshal(addChainReqBodyTargetField, buf[offset:], rb.target) + + return buf +} + +func (rb *ListChainsRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.ListChainsRequest_Body)) +} + +func (rb *ListChainsResponseBody) StableSize() (size int) { + if rb == nil { + return 0 + } + + for _, chain := range rb.GetChains() { + size += proto.NestedStructureSize(listChainsRespBodyChainsField, chain) + } + + return size +} + +func (rb *ListChainsResponseBody) StableMarshal(buf []byte) []byte { + if rb == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, rb.StableSize()) + } + + var offset int + for _, chain := range rb.GetChains() { + offset += proto.NestedStructureMarshal(listChainsRespBodyChainsField, buf[offset:], chain) + } + + return buf +} + +func (rb *ListChainsResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(rb, data, new(apemanager.ListChainsResponse_Body)) +} diff --git a/api/apemanager/message_test.go b/api/apemanager/message_test.go new file mode 100644 index 00000000..d64688c6 --- /dev/null +++ b/api/apemanager/message_test.go @@ -0,0 +1,26 @@ +package apemanager_test + +import ( + "testing" + + apemanagertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequestBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequest(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponseBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponse(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainRequestBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainRequest(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainResponseBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateRemoveChainResponse(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateListChainsRequestBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateListChainsRequest(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateListChainsResponseBody(empty) }, + func(empty bool) message.Message { return apemanagertest.GenerateListChainsResponse(empty) }, + ) +} diff --git a/api/apemanager/status.go b/api/apemanager/status.go new file mode 100644 index 00000000..3b7f4352 --- /dev/null +++ b/api/apemanager/status.go @@ -0,0 +1,76 @@ +package apemanager + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" + statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" +) + +// LocalizeFailStatus checks if passed global status.Code is related to ape manager failure and: +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must be non-nil. +func LocalizeFailStatus(c *status.Code) bool { + return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_APE_MANAGER)) +} + +// GlobalizeFail globalizes local code of ape manager failure. +// +// Arg must be non-nil. +func GlobalizeFail(c *status.Code) { + c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_APE_MANAGER)) +} + +const ( + // StatusAPEManagerAccessDenied is a local status.Code value for + // ACCESS_DENIED ape manager failure. + StatusAPEManagerAccessDenied status.Code = iota +) + +const ( + // detailAccessDeniedDesc is a StatusAccessDenied detail ID for + // human-readable description. + detailAccessDeniedDesc = iota +) + +// WriteAccessDeniedDesc writes human-readable description of StatusAccessDenied +// into status.Status as a detail. The status must not be nil. +// +// Existing details are expected to be ID-unique, otherwise undefined behavior. +func WriteAccessDeniedDesc(st *status.Status, desc string) { + var found bool + + st.IterateDetails(func(d *status.Detail) bool { + if d.ID() == detailAccessDeniedDesc { + found = true + d.SetValue([]byte(desc)) + } + + return found + }) + + if !found { + var d status.Detail + + d.SetID(detailAccessDeniedDesc) + d.SetValue([]byte(desc)) + + st.AppendDetails(d) + } +} + +// ReadAccessDeniedDesc looks up for status detail with human-readable description +// of StatusAccessDenied. Returns empty string if detail is missing. +func ReadAccessDeniedDesc(st status.Status) (desc string) { + st.IterateDetails(func(d *status.Detail) bool { + if d.ID() == detailAccessDeniedDesc { + desc = string(d.Value()) + return true + } + + return false + }) + + return +} diff --git a/api/apemanager/status_test.go b/api/apemanager/status_test.go new file mode 100644 index 00000000..af6cd665 --- /dev/null +++ b/api/apemanager/status_test.go @@ -0,0 +1,30 @@ +package apemanager_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" + statustest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/test" + "github.com/stretchr/testify/require" +) + +func TestStatusCodes(t *testing.T) { + statustest.TestCodes(t, apemanager.LocalizeFailStatus, apemanager.GlobalizeFail, + apemanager.StatusAPEManagerAccessDenied, 5120, + ) +} + +func TestAccessDeniedDesc(t *testing.T) { + var st status.Status + + require.Empty(t, apemanager.ReadAccessDeniedDesc(st)) + + const desc = "some description" + + apemanager.WriteAccessDeniedDesc(&st, desc) + require.Equal(t, desc, apemanager.ReadAccessDeniedDesc(st)) + + apemanager.WriteAccessDeniedDesc(&st, desc+"1") + require.Equal(t, desc+"1", apemanager.ReadAccessDeniedDesc(st)) +} diff --git a/api/apemanager/test/generate.go b/api/apemanager/test/generate.go new file mode 100644 index 00000000..47427d75 --- /dev/null +++ b/api/apemanager/test/generate.go @@ -0,0 +1,143 @@ +package apemanagertest + +import ( + apetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/test" +) + +func generateChainID(empty bool) []byte { + if empty { + return []byte{} + } + + return []byte("616c6c6f774f626a476574436e72") +} + +func GenerateAddChainRequestBody(empty bool) *apemanager.AddChainRequestBody { + m := new(apemanager.AddChainRequestBody) + + if !empty { + m.SetTarget(apetest.GenerateChainTarget(empty)) + m.SetChain(apetest.GenerateRawChain(empty)) + } + + return m +} + +func GenerateAddChainRequest(empty bool) *apemanager.AddChainRequest { + m := new(apemanager.AddChainRequest) + + if !empty { + m.SetBody(GenerateAddChainRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + } + + return m +} + +func GenerateAddChainResponseBody(empty bool) *apemanager.AddChainResponseBody { + m := new(apemanager.AddChainResponseBody) + + if !empty { + m.SetChainID(generateChainID(empty)) + } + + return m +} + +func GenerateAddChainResponse(empty bool) *apemanager.AddChainResponse { + m := new(apemanager.AddChainResponse) + + if !empty { + m.SetBody(GenerateAddChainResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + } + + return m +} + +func GenerateRemoveChainRequestBody(empty bool) *apemanager.RemoveChainRequestBody { + m := new(apemanager.RemoveChainRequestBody) + + if !empty { + m.SetChainID(generateChainID(empty)) + m.SetTarget(apetest.GenerateChainTarget(empty)) + } + + return m +} + +func GenerateRemoveChainRequest(empty bool) *apemanager.RemoveChainRequest { + m := new(apemanager.RemoveChainRequest) + + if !empty { + m.SetBody(GenerateRemoveChainRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + } + + return m +} + +func GenerateRemoveChainResponseBody(_ bool) *apemanager.RemoveChainResponseBody { + return new(apemanager.RemoveChainResponseBody) +} + +func GenerateRemoveChainResponse(empty bool) *apemanager.RemoveChainResponse { + m := new(apemanager.RemoveChainResponse) + + if !empty { + m.SetBody(GenerateRemoveChainResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + } + + return m +} + +func GenerateListChainsRequestBody(empty bool) *apemanager.ListChainsRequestBody { + m := new(apemanager.ListChainsRequestBody) + + if !empty { + m.SetTarget(apetest.GenerateChainTarget(empty)) + } + + return m +} + +func GenerateListChainsRequest(empty bool) *apemanager.ListChainsRequest { + m := new(apemanager.ListChainsRequest) + + if !empty { + m.SetBody(GenerateListChainsRequestBody(empty)) + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + } + + return m +} + +func GenerateListChainsResponseBody(empty bool) *apemanager.ListChainsResponseBody { + m := new(apemanager.ListChainsResponseBody) + + if !empty { + m.SetChains(apetest.GenerateRawChains(empty, 10)) + } + + return m +} + +func GenerateListChainsResponse(empty bool) *apemanager.ListChainsResponse { + m := new(apemanager.ListChainsResponse) + + if !empty { + m.SetBody(GenerateListChainsResponseBody(empty)) + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + } + + return m +} diff --git a/api/apemanager/types.go b/api/apemanager/types.go new file mode 100644 index 00000000..077488be --- /dev/null +++ b/api/apemanager/types.go @@ -0,0 +1,226 @@ +package apemanager + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" +) + +type AddChainRequest struct { + body *AddChainRequestBody + + session.RequestHeaders +} + +func (r *AddChainRequest) SetBody(body *AddChainRequestBody) { + r.body = body +} + +func (r *AddChainRequest) GetBody() *AddChainRequestBody { + if r == nil { + return nil + } + + return r.body +} + +type AddChainRequestBody struct { + target *ape.ChainTarget + + chain *ape.Chain +} + +func (rb *AddChainRequestBody) SetTarget(target *ape.ChainTarget) { + rb.target = target +} + +func (rb *AddChainRequestBody) GetTarget() *ape.ChainTarget { + if rb == nil { + return nil + } + + return rb.target +} + +func (rb *AddChainRequestBody) SetChain(chain *ape.Chain) { + rb.chain = chain +} + +func (rb *AddChainRequestBody) GetChain() *ape.Chain { + if rb == nil { + return nil + } + + return rb.chain +} + +type AddChainResponse struct { + body *AddChainResponseBody + + session.ResponseHeaders +} + +func (r *AddChainResponse) SetBody(body *AddChainResponseBody) { + r.body = body +} + +func (r *AddChainResponse) GetBody() *AddChainResponseBody { + if r == nil { + return nil + } + + return r.body +} + +type AddChainResponseBody struct { + chainID []byte +} + +func (rb *AddChainResponseBody) SetChainID(chainID []byte) { + rb.chainID = chainID +} + +func (rb *AddChainResponseBody) GetChainID() []byte { + if rb == nil { + return nil + } + + return rb.chainID +} + +type RemoveChainRequest struct { + body *RemoveChainRequestBody + + session.RequestHeaders +} + +func (r *RemoveChainRequest) SetBody(body *RemoveChainRequestBody) { + r.body = body +} + +func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody { + if r == nil { + return nil + } + + return r.body +} + +type RemoveChainRequestBody struct { + target *ape.ChainTarget + + chainID []byte +} + +func (rb *RemoveChainRequestBody) SetTarget(target *ape.ChainTarget) { + rb.target = target +} + +func (rb *RemoveChainRequestBody) GetTarget() *ape.ChainTarget { + if rb == nil { + return nil + } + + return rb.target +} + +func (rb *RemoveChainRequestBody) SetChainID(chainID []byte) { + rb.chainID = chainID +} + +func (rb *RemoveChainRequestBody) GetChainID() []byte { + if rb == nil { + return nil + } + + return rb.chainID +} + +type RemoveChainResponse struct { + body *RemoveChainResponseBody + + session.ResponseHeaders +} + +type RemoveChainResponseBody struct{} + +func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) { + r.body = body +} + +func (r *RemoveChainResponse) GetBody() *RemoveChainResponseBody { + if r == nil { + return nil + } + + return r.body +} + +type ListChainsRequest struct { + body *ListChainsRequestBody + + session.RequestHeaders +} + +func (r *ListChainsRequest) SetBody(body *ListChainsRequestBody) { + r.body = body +} + +func (r *ListChainsRequest) GetBody() *ListChainsRequestBody { + if r == nil { + return nil + } + + return r.body +} + +type ListChainsRequestBody struct { + target *ape.ChainTarget +} + +func (rb *ListChainsRequestBody) SetTarget(target *ape.ChainTarget) { + rb.target = target +} + +func (rb *ListChainsRequestBody) GetTarget() *ape.ChainTarget { + if rb == nil { + return nil + } + + return rb.target +} + +type ListChainsResponse struct { + body *ListChainsResponseBody + + session.ResponseHeaders +} + +func (r *ListChainsResponse) SetBody(body *ListChainsResponseBody) { + r.body = body +} + +func (r *ListChainsResponse) GetBody() *ListChainsResponseBody { + if r == nil { + return nil + } + + return r.body +} + +type ListChainsResponseBody struct { + chains []*ape.Chain + + session.RequestHeaders +} + +func (r *ListChainsResponseBody) SetChains(chains []*ape.Chain) { + r.chains = chains +} + +func (r *ListChainsResponseBody) GetChains() []*ape.Chain { + if r == nil { + return nil + } + + return r.chains +} diff --git a/api/container/attributes.go b/api/container/attributes.go new file mode 100644 index 00000000..288d0484 --- /dev/null +++ b/api/container/attributes.go @@ -0,0 +1,90 @@ +package container + +// SysAttributePrefix is a prefix of key to system attribute. +const SysAttributePrefix = "__SYSTEM__" + +const ( + // SysAttributeName is a string of human-friendly container name registered as the domain in NNS contract. + SysAttributeName = SysAttributePrefix + "NAME" + + // SysAttributeZone is a string of zone for container name. + SysAttributeZone = SysAttributePrefix + "ZONE" + + // SysAttributeHomomorphicHashing is a container's homomorphic hashing state. + SysAttributeHomomorphicHashing = SysAttributePrefix + "DISABLE_HOMOMORPHIC_HASHING" +) + +// SysAttributePrefixNeoFS is a prefix of key to system attribute. +// Deprecated: use SysAttributePrefix. +const SysAttributePrefixNeoFS = "__NEOFS__" + +const ( + // SysAttributeNameNeoFS is a string of human-friendly container name registered as the domain in NNS contract. + // Deprecated: use SysAttributeName. + SysAttributeNameNeoFS = SysAttributePrefixNeoFS + "NAME" + + // SysAttributeZoneNeoFS is a string of zone for container name. + // Deprecated: use SysAttributeZone. + SysAttributeZoneNeoFS = SysAttributePrefixNeoFS + "ZONE" + + // SysAttributeHomomorphicHashingNeoFS is a container's homomorphic hashing state. + // Deprecated: use SysAttributeHomomorphicHashing. + SysAttributeHomomorphicHashingNeoFS = SysAttributePrefixNeoFS + "DISABLE_HOMOMORPHIC_HASHING" +) + +// SysAttributeZoneDefault is a default value for SysAttributeZone attribute. +const SysAttributeZoneDefault = "container" + +const disabledHomomorphicHashingValue = "true" + +// HomomorphicHashingState returns container's homomorphic +// hashing state: +// - true if hashing is enabled; +// - false if hashing is disabled. +// +// All container's attributes must be unique, otherwise behavior +// is undefined. +// +// See also SetHomomorphicHashingState. +func (c Container) HomomorphicHashingState() bool { + for i := range c.attr { + if c.attr[i].GetKey() == SysAttributeHomomorphicHashing || c.attr[i].GetKey() == SysAttributeHomomorphicHashingNeoFS { + return c.attr[i].GetValue() != disabledHomomorphicHashingValue + } + } + + return true +} + +// SetHomomorphicHashingState sets homomorphic hashing state for +// container. +// +// All container's attributes must be unique, otherwise behavior +// is undefined. +// +// See also HomomorphicHashingState. +func (c *Container) SetHomomorphicHashingState(enable bool) { + for i := range c.attr { + if c.attr[i].GetKey() == SysAttributeHomomorphicHashing || c.attr[i].GetKey() == SysAttributeHomomorphicHashingNeoFS { + if enable { + // approach without allocation/waste + // coping works since the attributes + // order is not important + c.attr[i] = c.attr[len(c.attr)-1] + c.attr = c.attr[:len(c.attr)-1] + } else { + c.attr[i].SetValue(disabledHomomorphicHashingValue) + } + + return + } + } + + if !enable { + attr := Attribute{} + attr.SetKey(SysAttributeHomomorphicHashing) + attr.SetValue(disabledHomomorphicHashingValue) + + c.attr = append(c.attr, attr) + } +} diff --git a/api/container/attributes_test.go b/api/container/attributes_test.go new file mode 100644 index 00000000..2b00d332 --- /dev/null +++ b/api/container/attributes_test.go @@ -0,0 +1,59 @@ +package container_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + containertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container/test" + "github.com/stretchr/testify/require" +) + +func TestContainer_HomomorphicHashingDisabled(t *testing.T) { + cnr := containertest.GenerateContainer(false) + + t.Run("defaults", func(t *testing.T) { + require.True(t, cnr.HomomorphicHashingState()) + }) + + t.Run("disabled", func(t *testing.T) { + attr := container.Attribute{} + attr.SetKey(container.SysAttributeHomomorphicHashing) + attr.SetValue("NOT_true") + + cnr.SetAttributes(append(cnr.GetAttributes(), attr)) + require.True(t, cnr.HomomorphicHashingState()) + + attr.SetValue("true") + + cnr.SetAttributes([]container.Attribute{attr}) + require.False(t, cnr.HomomorphicHashingState()) + }) +} + +func TestContainer_SetHomomorphicHashingState(t *testing.T) { + cnr := containertest.GenerateContainer(false) + attrs := cnr.GetAttributes() + attrLen := len(attrs) + + cnr.SetHomomorphicHashingState(true) + + // enabling hashing should not add any new attributes + require.Equal(t, attrLen, len(cnr.GetAttributes())) + require.True(t, cnr.HomomorphicHashingState()) + + cnr.SetHomomorphicHashingState(false) + + // disabling hashing should add exactly one attribute + require.Equal(t, attrLen+1, len(cnr.GetAttributes())) + require.False(t, cnr.HomomorphicHashingState()) + + cnr.SetHomomorphicHashingState(true) + + // enabling hashing should remove 1 attribute if + // hashing was disabled before + require.Equal(t, attrLen, len(cnr.GetAttributes())) + require.True(t, cnr.HomomorphicHashingState()) + + // hashing operations should not change any other attributes + require.ElementsMatch(t, attrs, cnr.GetAttributes()) +} diff --git a/api/container/convert.go b/api/container/convert.go new file mode 100644 index 00000000..a7245d4c --- /dev/null +++ b/api/container/convert.go @@ -0,0 +1,899 @@ +package container + +import ( + container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + netmapGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" +) + +func (a *Attribute) ToGRPCMessage() grpc.Message { + var m *container.Container_Attribute + + if a != nil { + m = new(container.Container_Attribute) + + m.SetKey(a.key) + m.SetValue(a.val) + } + + return m +} + +func (a *Attribute) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.Container_Attribute) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + a.key = v.GetKey() + a.val = v.GetValue() + + return nil +} + +func AttributesToGRPC(xs []Attribute) (res []*container.Container_Attribute) { + if xs != nil { + res = make([]*container.Container_Attribute, 0, len(xs)) + + for i := range xs { + res = append(res, xs[i].ToGRPCMessage().(*container.Container_Attribute)) + } + } + + return +} + +func AttributesFromGRPC(xs []*container.Container_Attribute) (res []Attribute, err error) { + if xs != nil { + res = make([]Attribute, len(xs)) + + for i := range xs { + err = res[i].FromGRPCMessage(xs[i]) + if err != nil { + return + } + } + } + + return +} + +func (c *Container) ToGRPCMessage() grpc.Message { + var m *container.Container + + if c != nil { + m = new(container.Container) + + m.SetVersion(c.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetOwnerId(c.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetPlacementPolicy(c.policy.ToGRPCMessage().(*netmapGRPC.PlacementPolicy)) + m.SetAttributes(AttributesToGRPC(c.attr)) + m.SetBasicAcl(c.basicACL) + m.SetNonce(c.nonce) + } + + return m +} + +func (c *Container) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.Container) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + version := v.GetVersion() + if version == nil { + c.version = nil + } else { + if c.version == nil { + c.version = new(refs.Version) + } + + err = c.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + ownerID := v.GetOwnerId() + if ownerID == nil { + c.ownerID = nil + } else { + if c.ownerID == nil { + c.ownerID = new(refs.OwnerID) + } + + err = c.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + policy := v.GetPlacementPolicy() + if policy == nil { + c.policy = nil + } else { + if c.policy == nil { + c.policy = new(netmap.PlacementPolicy) + } + + err = c.policy.FromGRPCMessage(policy) + if err != nil { + return err + } + } + + c.attr, err = AttributesFromGRPC(v.GetAttributes()) + if err != nil { + return err + } + + c.basicACL = v.GetBasicAcl() + c.nonce = v.GetNonce() + + return nil +} + +func toSignatureRFC6979(s *refs.Signature) *refsGRPC.SignatureRFC6979 { + var res *refsGRPC.SignatureRFC6979 + + if s != nil { + res = new(refsGRPC.SignatureRFC6979) + res.SetKey(s.GetKey()) + res.SetSign(s.GetSign()) + } + + return res +} + +func (r *PutRequestBody) ToGRPCMessage() grpc.Message { + var m *container.PutRequest_Body + + if r != nil { + m = new(container.PutRequest_Body) + + m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container)) + m.SetSignature(toSignatureRFC6979(r.sig)) + } + + return m +} + +func (r *PutRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.PutRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cnr := v.GetContainer() + if cnr == nil { + r.cnr = nil + } else { + if r.cnr == nil { + r.cnr = new(Container) + } + + err = r.cnr.FromGRPCMessage(cnr) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + r.sig.SetKey(sig.GetKey()) + r.sig.SetSign(sig.GetSign()) + } + + return err +} + +func (r *PutRequest) ToGRPCMessage() grpc.Message { + var m *container.PutRequest + + if r != nil { + m = new(container.PutRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.PutRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *PutRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.PutRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *PutResponseBody) ToGRPCMessage() grpc.Message { + var m *container.PutResponse_Body + + if r != nil { + m = new(container.PutResponse_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + } + + return m +} + +func (r *PutResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.PutResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } + + err = r.cid.FromGRPCMessage(cid) + } + + return err +} + +func (r *PutResponse) ToGRPCMessage() grpc.Message { + var m *container.PutResponse + + if r != nil { + m = new(container.PutResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.PutResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *PutResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.PutResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *GetRequestBody) ToGRPCMessage() grpc.Message { + var m *container.GetRequest_Body + + if r != nil { + m = new(container.GetRequest_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + } + + return m +} + +func (r *GetRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } + + err = r.cid.FromGRPCMessage(cid) + } + + return err +} + +func (r *GetRequest) ToGRPCMessage() grpc.Message { + var m *container.GetRequest + + if r != nil { + m = new(container.GetRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.GetRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *GetRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *GetResponseBody) ToGRPCMessage() grpc.Message { + var m *container.GetResponse_Body + + if r != nil { + m = new(container.GetResponse_Body) + + m.SetContainer(r.cnr.ToGRPCMessage().(*container.Container)) + m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken)) + m.SetSignature(toSignatureRFC6979(r.sig)) + } + + return m +} + +func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cnr := v.GetContainer() + if cnr == nil { + r.cnr = nil + } else { + if r.cnr == nil { + r.cnr = new(Container) + } + + err = r.cnr.FromGRPCMessage(cnr) + } + + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + r.sig.SetKey(sig.GetKey()) + r.sig.SetSign(sig.GetSign()) + } + + token := v.GetSessionToken() + if token == nil { + r.token = nil + } else { + if r.token == nil { + r.token = new(session.Token) + } + + err = r.token.FromGRPCMessage(token) + } + + return err +} + +func (r *GetResponse) ToGRPCMessage() grpc.Message { + var m *container.GetResponse + + if r != nil { + m = new(container.GetResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.GetResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *GetResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.GetResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *DeleteRequestBody) ToGRPCMessage() grpc.Message { + var m *container.DeleteRequest_Body + + if r != nil { + m = new(container.DeleteRequest_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetSignature(toSignatureRFC6979(r.sig)) + } + + return m +} + +func (r *DeleteRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.DeleteRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } + + err = r.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + r.sig.SetKey(sig.GetKey()) + r.sig.SetSign(sig.GetSign()) + } + + return err +} + +func (r *DeleteRequest) ToGRPCMessage() grpc.Message { + var m *container.DeleteRequest + + if r != nil { + m = new(container.DeleteRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.DeleteRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *DeleteRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.DeleteRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(DeleteRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *DeleteResponseBody) ToGRPCMessage() grpc.Message { + var m *container.DeleteResponse_Body + + if r != nil { + m = new(container.DeleteResponse_Body) + } + + return m +} + +func (r *DeleteResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.DeleteResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +func (r *DeleteResponse) ToGRPCMessage() grpc.Message { + var m *container.DeleteResponse + + if r != nil { + m = new(container.DeleteResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.DeleteResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *DeleteResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.DeleteResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(DeleteResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *ListRequestBody) ToGRPCMessage() grpc.Message { + var m *container.ListRequest_Body + + if r != nil { + m = new(container.ListRequest_Body) + + m.SetOwnerId(r.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + } + + return m +} + +func (r *ListRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + ownerID := v.GetOwnerId() + if ownerID == nil { + r.ownerID = nil + } else { + if r.ownerID == nil { + r.ownerID = new(refs.OwnerID) + } + + err = r.ownerID.FromGRPCMessage(ownerID) + } + + return err +} + +func (r *ListRequest) ToGRPCMessage() grpc.Message { + var m *container.ListRequest + + if r != nil { + m = new(container.ListRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.ListRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *ListRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ListRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *ListResponseBody) ToGRPCMessage() grpc.Message { + var m *container.ListResponse_Body + + if r != nil { + m = new(container.ListResponse_Body) + + m.SetContainerIds(refs.ContainerIDsToGRPCMessage(r.cidList)) + } + + return m +} + +func (r *ListResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.cidList, err = refs.ContainerIDsFromGRPCMessage(v.GetContainerIds()) + + return err +} + +func (r *ListResponse) ToGRPCMessage() grpc.Message { + var m *container.ListResponse + + if r != nil { + m = new(container.ListResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.ListResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *ListResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ListResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *ListStreamRequestBody) ToGRPCMessage() grpc.Message { + var m *container.ListStreamRequest_Body + + if r != nil { + m = new(container.ListStreamRequest_Body) + + m.SetOwnerId(r.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + } + + return m +} + +func (r *ListStreamRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListStreamRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + ownerID := v.GetOwnerId() + if ownerID == nil { + r.ownerID = nil + } else { + if r.ownerID == nil { + r.ownerID = new(refs.OwnerID) + } + + err = r.ownerID.FromGRPCMessage(ownerID) + } + + return err +} + +func (r *ListStreamRequest) ToGRPCMessage() grpc.Message { + var m *container.ListStreamRequest + + if r != nil { + m = new(container.ListStreamRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.ListStreamRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *ListStreamRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListStreamRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ListStreamRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *ListStreamResponseBody) ToGRPCMessage() grpc.Message { + var m *container.ListStreamResponse_Body + + if r != nil { + m = new(container.ListStreamResponse_Body) + + m.SetContainerIds(refs.ContainerIDsToGRPCMessage(r.cidList)) + } + + return m +} + +func (r *ListStreamResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListStreamResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.cidList, err = refs.ContainerIDsFromGRPCMessage(v.GetContainerIds()) + + return err +} + +func (r *ListStreamResponse) ToGRPCMessage() grpc.Message { + var m *container.ListStreamResponse + + if r != nil { + m = new(container.ListStreamResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.ListStreamResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *ListStreamResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListStreamResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ListStreamResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} diff --git a/api/container/grpc/service.pb.go b/api/container/grpc/service.pb.go new file mode 100644 index 00000000..280aa207 --- /dev/null +++ b/api/container/grpc/service.pb.go @@ -0,0 +1,2487 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/container/grpc/service.proto + +//go:build !protoopaque + +package container + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// New FrostFS Container creation request +type PutRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of container put request message. + Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest) Reset() { + *x = PutRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest) ProtoMessage() {} + +func (x *PutRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest) GetBody() *PutRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *PutRequest) SetBody(v *PutRequest_Body) { + x.Body = v +} + +func (x *PutRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *PutRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *PutRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *PutRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *PutRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *PutRequest) ClearBody() { + x.Body = nil +} + +func (x *PutRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *PutRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type PutRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container put request message. + Body *PutRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 PutRequest_builder) Build() *PutRequest { + m0 := &PutRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// New FrostFS Container creation response +type PutResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of container put response message. + Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse) Reset() { + *x = PutResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutResponse) GetBody() *PutResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *PutResponse) SetBody(v *PutResponse_Body) { + x.Body = v +} + +func (x *PutResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *PutResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *PutResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *PutResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *PutResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *PutResponse) ClearBody() { + x.Body = nil +} + +func (x *PutResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *PutResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type PutResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container put response message. + Body *PutResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 PutResponse_builder) Build() *PutResponse { + m0 := &PutResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Container removal request +type DeleteRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of container delete request message. + Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteRequest) GetBody() *DeleteRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *DeleteRequest) SetBody(v *DeleteRequest_Body) { + x.Body = v +} + +func (x *DeleteRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *DeleteRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *DeleteRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *DeleteRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *DeleteRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *DeleteRequest) ClearBody() { + x.Body = nil +} + +func (x *DeleteRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *DeleteRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type DeleteRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container delete request message. + Body *DeleteRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 DeleteRequest_builder) Build() *DeleteRequest { + m0 := &DeleteRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// `DeleteResponse` has an empty body because delete operation is asynchronous +// and done via consensus in Inner Ring nodes. +type DeleteResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of container delete response message. + Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteResponse) GetBody() *DeleteResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *DeleteResponse) SetBody(v *DeleteResponse_Body) { + x.Body = v +} + +func (x *DeleteResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *DeleteResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *DeleteResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *DeleteResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *DeleteResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *DeleteResponse) ClearBody() { + x.Body = nil +} + +func (x *DeleteResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *DeleteResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type DeleteResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container delete response message. + Body *DeleteResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 DeleteResponse_builder) Build() *DeleteResponse { + m0 := &DeleteResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Get container structure +type GetRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of container get request message. + Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest) Reset() { + *x = GetRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRequest) GetBody() *GetRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *GetRequest) SetBody(v *GetRequest_Body) { + x.Body = v +} + +func (x *GetRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *GetRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *GetRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *GetRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *GetRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *GetRequest) ClearBody() { + x.Body = nil +} + +func (x *GetRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *GetRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type GetRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container get request message. + Body *GetRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 GetRequest_builder) Build() *GetRequest { + m0 := &GetRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Get container structure +type GetResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of container get response message. + Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse) Reset() { + *x = GetResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse) GetBody() *GetResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *GetResponse) SetBody(v *GetResponse_Body) { + x.Body = v +} + +func (x *GetResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *GetResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *GetResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *GetResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *GetResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *GetResponse) ClearBody() { + x.Body = nil +} + +func (x *GetResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *GetResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type GetResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container get response message. + Body *GetResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 GetResponse_builder) Build() *GetResponse { + m0 := &GetResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// List containers +type ListRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of list containers request message + Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListRequest) Reset() { + *x = ListRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRequest) ProtoMessage() {} + +func (x *ListRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListRequest) GetBody() *ListRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *ListRequest) SetBody(v *ListRequest_Body) { + x.Body = v +} + +func (x *ListRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *ListRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *ListRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *ListRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *ListRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *ListRequest) ClearBody() { + x.Body = nil +} + +func (x *ListRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *ListRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type ListRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of list containers request message + Body *ListRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 ListRequest_builder) Build() *ListRequest { + m0 := &ListRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// List containers +type ListResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of list containers response message. + Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListResponse) Reset() { + *x = ListResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponse) ProtoMessage() {} + +func (x *ListResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListResponse) GetBody() *ListResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *ListResponse) SetBody(v *ListResponse_Body) { + x.Body = v +} + +func (x *ListResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *ListResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *ListResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *ListResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *ListResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *ListResponse) ClearBody() { + x.Body = nil +} + +func (x *ListResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *ListResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type ListResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of list containers response message. + Body *ListResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 ListResponse_builder) Build() *ListResponse { + m0 := &ListResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// List containers stream +type ListStreamRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of list containers stream request message. + Body *ListStreamRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamRequest) Reset() { + *x = ListStreamRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamRequest) ProtoMessage() {} + +func (x *ListStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListStreamRequest) GetBody() *ListStreamRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListStreamRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListStreamRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *ListStreamRequest) SetBody(v *ListStreamRequest_Body) { + x.Body = v +} + +func (x *ListStreamRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *ListStreamRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *ListStreamRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *ListStreamRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *ListStreamRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *ListStreamRequest) ClearBody() { + x.Body = nil +} + +func (x *ListStreamRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *ListStreamRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type ListStreamRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of list containers stream request message. + Body *ListStreamRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 ListStreamRequest_builder) Build() *ListStreamRequest { + m0 := &ListStreamRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// List containers stream +type ListStreamResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of list containers stream response message. + Body *ListStreamResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamResponse) Reset() { + *x = ListStreamResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamResponse) ProtoMessage() {} + +func (x *ListStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListStreamResponse) GetBody() *ListStreamResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *ListStreamResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *ListStreamResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *ListStreamResponse) SetBody(v *ListStreamResponse_Body) { + x.Body = v +} + +func (x *ListStreamResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *ListStreamResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *ListStreamResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *ListStreamResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *ListStreamResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *ListStreamResponse) ClearBody() { + x.Body = nil +} + +func (x *ListStreamResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *ListStreamResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type ListStreamResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of list containers stream response message. + Body *ListStreamResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 ListStreamResponse_builder) Build() *ListStreamResponse { + m0 := &ListStreamResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Container creation request has container structure's signature as a +// separate field. It's not stored in sidechain, just verified on container +// creation by `Container` smart contract. `ContainerID` is a SHA256 hash of +// the stable-marshalled container strucutre, hence there is no need for +// additional signature checks. +type PutRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Container structure to register in FrostFS + Container *Container `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"` + // Signature of a stable-marshalled container according to RFC-6979. + Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest_Body) Reset() { + *x = PutRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body) ProtoMessage() {} + +func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest_Body) GetContainer() *Container { + if x != nil { + return x.Container + } + return nil +} + +func (x *PutRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { + if x != nil { + return x.Signature + } + return nil +} + +func (x *PutRequest_Body) SetContainer(v *Container) { + x.Container = v +} + +func (x *PutRequest_Body) SetSignature(v *grpc1.SignatureRFC6979) { + x.Signature = v +} + +func (x *PutRequest_Body) HasContainer() bool { + if x == nil { + return false + } + return x.Container != nil +} + +func (x *PutRequest_Body) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *PutRequest_Body) ClearContainer() { + x.Container = nil +} + +func (x *PutRequest_Body) ClearSignature() { + x.Signature = nil +} + +type PutRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container structure to register in FrostFS + Container *Container + // Signature of a stable-marshalled container according to RFC-6979. + Signature *grpc1.SignatureRFC6979 +} + +func (b0 PutRequest_Body_builder) Build() *PutRequest_Body { + m0 := &PutRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Container = b.Container + x.Signature = b.Signature + return m0 +} + +// Container put response body contains information about the newly registered +// container as seen by `Container` smart contract. `ContainerID` can be +// calculated beforehand from the container structure and compared to the one +// returned here to make sure everything has been done as expected. +type PutResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Unique identifier of the newly created container + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId" json:"container_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse_Body) Reset() { + *x = PutResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse_Body) ProtoMessage() {} + +func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutResponse_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *PutResponse_Body) SetContainerId(v *grpc1.ContainerID) { + x.ContainerId = v +} + +func (x *PutResponse_Body) HasContainerId() bool { + if x == nil { + return false + } + return x.ContainerId != nil +} + +func (x *PutResponse_Body) ClearContainerId() { + x.ContainerId = nil +} + +type PutResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Unique identifier of the newly created container + ContainerId *grpc1.ContainerID +} + +func (b0 PutResponse_Body_builder) Build() *PutResponse_Body { + m0 := &PutResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ContainerId = b.ContainerId + return m0 +} + +// Container removal request body has signed `ContainerID` as a proof of +// the container owner's intent. The signature will be verified by `Container` +// smart contract, so signing algorithm must be supported by NeoVM. +type DeleteRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of the container to delete from FrostFS + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId" json:"container_id,omitempty"` + // `ContainerID` signed with the container owner's key according to + // RFC-6979. + Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest_Body) Reset() { + *x = DeleteRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest_Body) ProtoMessage() {} + +func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *DeleteRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { + if x != nil { + return x.Signature + } + return nil +} + +func (x *DeleteRequest_Body) SetContainerId(v *grpc1.ContainerID) { + x.ContainerId = v +} + +func (x *DeleteRequest_Body) SetSignature(v *grpc1.SignatureRFC6979) { + x.Signature = v +} + +func (x *DeleteRequest_Body) HasContainerId() bool { + if x == nil { + return false + } + return x.ContainerId != nil +} + +func (x *DeleteRequest_Body) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *DeleteRequest_Body) ClearContainerId() { + x.ContainerId = nil +} + +func (x *DeleteRequest_Body) ClearSignature() { + x.Signature = nil +} + +type DeleteRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container to delete from FrostFS + ContainerId *grpc1.ContainerID + // `ContainerID` signed with the container owner's key according to + // RFC-6979. + Signature *grpc1.SignatureRFC6979 +} + +func (b0 DeleteRequest_Body_builder) Build() *DeleteRequest_Body { + m0 := &DeleteRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ContainerId = b.ContainerId + x.Signature = b.Signature + return m0 +} + +// `DeleteResponse` has an empty body because delete operation is asynchronous +// and done via consensus in Inner Ring nodes. +type DeleteResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse_Body) Reset() { + *x = DeleteResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse_Body) ProtoMessage() {} + +func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type DeleteResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 DeleteResponse_Body_builder) Build() *DeleteResponse_Body { + m0 := &DeleteResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// Get container structure request body. +type GetRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of the container to get + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId" json:"container_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest_Body) Reset() { + *x = GetRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest_Body) ProtoMessage() {} + +func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *GetRequest_Body) SetContainerId(v *grpc1.ContainerID) { + x.ContainerId = v +} + +func (x *GetRequest_Body) HasContainerId() bool { + if x == nil { + return false + } + return x.ContainerId != nil +} + +func (x *GetRequest_Body) ClearContainerId() { + x.ContainerId = nil +} + +type GetRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container to get + ContainerId *grpc1.ContainerID +} + +func (b0 GetRequest_Body_builder) Build() *GetRequest_Body { + m0 := &GetRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ContainerId = b.ContainerId + return m0 +} + +// Get container response body does not have container structure signature. It +// has been already verified upon container creation. +type GetResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Requested container structure + Container *Container `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"` + // Signature of a stable-marshalled container according to RFC-6979. + Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + // Session token if the container has been created within the session + SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken" json:"session_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse_Body) Reset() { + *x = GetResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body) ProtoMessage() {} + +func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse_Body) GetContainer() *Container { + if x != nil { + return x.Container + } + return nil +} + +func (x *GetResponse_Body) GetSignature() *grpc1.SignatureRFC6979 { + if x != nil { + return x.Signature + } + return nil +} + +func (x *GetResponse_Body) GetSessionToken() *grpc.SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} + +func (x *GetResponse_Body) SetContainer(v *Container) { + x.Container = v +} + +func (x *GetResponse_Body) SetSignature(v *grpc1.SignatureRFC6979) { + x.Signature = v +} + +func (x *GetResponse_Body) SetSessionToken(v *grpc.SessionToken) { + x.SessionToken = v +} + +func (x *GetResponse_Body) HasContainer() bool { + if x == nil { + return false + } + return x.Container != nil +} + +func (x *GetResponse_Body) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *GetResponse_Body) HasSessionToken() bool { + if x == nil { + return false + } + return x.SessionToken != nil +} + +func (x *GetResponse_Body) ClearContainer() { + x.Container = nil +} + +func (x *GetResponse_Body) ClearSignature() { + x.Signature = nil +} + +func (x *GetResponse_Body) ClearSessionToken() { + x.SessionToken = nil +} + +type GetResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Requested container structure + Container *Container + // Signature of a stable-marshalled container according to RFC-6979. + Signature *grpc1.SignatureRFC6979 + // Session token if the container has been created within the session + SessionToken *grpc.SessionToken +} + +func (b0 GetResponse_Body_builder) Build() *GetResponse_Body { + m0 := &GetResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Container = b.Container + x.Signature = b.Signature + x.SessionToken = b.SessionToken + return m0 +} + +// List containers request body. +type ListRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of the container owner + OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListRequest_Body) Reset() { + *x = ListRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRequest_Body) ProtoMessage() {} + +func (x *ListRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListRequest_Body) GetOwnerId() *grpc1.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *ListRequest_Body) SetOwnerId(v *grpc1.OwnerID) { + x.OwnerId = v +} + +func (x *ListRequest_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *ListRequest_Body) ClearOwnerId() { + x.OwnerId = nil +} + +type ListRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container owner + OwnerId *grpc1.OwnerID +} + +func (b0 ListRequest_Body_builder) Build() *ListRequest_Body { + m0 := &ListRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.OwnerId = b.OwnerId + return m0 +} + +// List containers response body. +type ListResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // List of `ContainerID`s belonging to the requested `OwnerID` + ContainerIds []*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds" json:"container_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListResponse_Body) Reset() { + *x = ListResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponse_Body) ProtoMessage() {} + +func (x *ListResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListResponse_Body) GetContainerIds() []*grpc1.ContainerID { + if x != nil { + return x.ContainerIds + } + return nil +} + +func (x *ListResponse_Body) SetContainerIds(v []*grpc1.ContainerID) { + x.ContainerIds = v +} + +type ListResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of `ContainerID`s belonging to the requested `OwnerID` + ContainerIds []*grpc1.ContainerID +} + +func (b0 ListResponse_Body_builder) Build() *ListResponse_Body { + m0 := &ListResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ContainerIds = b.ContainerIds + return m0 +} + +// List containers stream request body. +type ListStreamRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of the container owner. + OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamRequest_Body) Reset() { + *x = ListStreamRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamRequest_Body) ProtoMessage() {} + +func (x *ListStreamRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListStreamRequest_Body) GetOwnerId() *grpc1.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *ListStreamRequest_Body) SetOwnerId(v *grpc1.OwnerID) { + x.OwnerId = v +} + +func (x *ListStreamRequest_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *ListStreamRequest_Body) ClearOwnerId() { + x.OwnerId = nil +} + +type ListStreamRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container owner. + OwnerId *grpc1.OwnerID +} + +func (b0 ListStreamRequest_Body_builder) Build() *ListStreamRequest_Body { + m0 := &ListStreamRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.OwnerId = b.OwnerId + return m0 +} + +// List containers stream response body. +type ListStreamResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // List of `ContainerID`s belonging to the requested `OwnerID` + ContainerIds []*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds" json:"container_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamResponse_Body) Reset() { + *x = ListStreamResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamResponse_Body) ProtoMessage() {} + +func (x *ListStreamResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListStreamResponse_Body) GetContainerIds() []*grpc1.ContainerID { + if x != nil { + return x.ContainerIds + } + return nil +} + +func (x *ListStreamResponse_Body) SetContainerIds(v []*grpc1.ContainerID) { + x.ContainerIds = v +} + +type ListStreamResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of `ContainerID`s belonging to the requested `OwnerID` + ContainerIds []*grpc1.ContainerID +} + +func (b0 ListStreamResponse_Body_builder) Build() *ListStreamResponse_Body { + m0 := &ListStreamResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ContainerIds = b.ContainerIds + return m0 +} + +var File_api_container_grpc_service_proto protoreflect.FileDescriptor + +var file_api_container_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x13, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xe7, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x1a, 0x84, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x09, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, + 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, + 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x1a, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xef, 0x02, 0x0a, 0x0d, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0x86, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x3e, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xf2, 0x01, 0x0a, 0x0e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x22, 0xa8, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x1a, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xb1, 0x03, 0x0a, 0x0b, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, + 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, + 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0xca, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x09, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x9e, 0x02, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x39, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x22, 0xb0, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x40, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x64, 0x73, 0x22, 0xaa, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x22, 0xbc, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x40, 0x0a, + 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x32, + 0xa7, 0x03, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, + 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x6b, 0x5a, 0x49, 0x67, 0x69, 0x74, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, + 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x43, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x70, 0xe8, 0x07, +} + +var file_api_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_api_container_grpc_service_proto_goTypes = []any{ + (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest + (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse + (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest + (*DeleteResponse)(nil), // 3: neo.fs.v2.container.DeleteResponse + (*GetRequest)(nil), // 4: neo.fs.v2.container.GetRequest + (*GetResponse)(nil), // 5: neo.fs.v2.container.GetResponse + (*ListRequest)(nil), // 6: neo.fs.v2.container.ListRequest + (*ListResponse)(nil), // 7: neo.fs.v2.container.ListResponse + (*ListStreamRequest)(nil), // 8: neo.fs.v2.container.ListStreamRequest + (*ListStreamResponse)(nil), // 9: neo.fs.v2.container.ListStreamResponse + (*PutRequest_Body)(nil), // 10: neo.fs.v2.container.PutRequest.Body + (*PutResponse_Body)(nil), // 11: neo.fs.v2.container.PutResponse.Body + (*DeleteRequest_Body)(nil), // 12: neo.fs.v2.container.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 13: neo.fs.v2.container.DeleteResponse.Body + (*GetRequest_Body)(nil), // 14: neo.fs.v2.container.GetRequest.Body + (*GetResponse_Body)(nil), // 15: neo.fs.v2.container.GetResponse.Body + (*ListRequest_Body)(nil), // 16: neo.fs.v2.container.ListRequest.Body + (*ListResponse_Body)(nil), // 17: neo.fs.v2.container.ListResponse.Body + (*ListStreamRequest_Body)(nil), // 18: neo.fs.v2.container.ListStreamRequest.Body + (*ListStreamResponse_Body)(nil), // 19: neo.fs.v2.container.ListStreamResponse.Body + (*grpc.RequestMetaHeader)(nil), // 20: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 21: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 22: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 23: neo.fs.v2.session.ResponseVerificationHeader + (*Container)(nil), // 24: neo.fs.v2.container.Container + (*grpc1.SignatureRFC6979)(nil), // 25: neo.fs.v2.refs.SignatureRFC6979 + (*grpc1.ContainerID)(nil), // 26: neo.fs.v2.refs.ContainerID + (*grpc.SessionToken)(nil), // 27: neo.fs.v2.session.SessionToken + (*grpc1.OwnerID)(nil), // 28: neo.fs.v2.refs.OwnerID +} +var file_api_container_grpc_service_proto_depIdxs = []int32{ + 10, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body + 20, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 3: neo.fs.v2.container.PutResponse.body:type_name -> neo.fs.v2.container.PutResponse.Body + 22, // 4: neo.fs.v2.container.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 5: neo.fs.v2.container.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 12, // 6: neo.fs.v2.container.DeleteRequest.body:type_name -> neo.fs.v2.container.DeleteRequest.Body + 20, // 7: neo.fs.v2.container.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 8: neo.fs.v2.container.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 13, // 9: neo.fs.v2.container.DeleteResponse.body:type_name -> neo.fs.v2.container.DeleteResponse.Body + 22, // 10: neo.fs.v2.container.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 11: neo.fs.v2.container.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 14, // 12: neo.fs.v2.container.GetRequest.body:type_name -> neo.fs.v2.container.GetRequest.Body + 20, // 13: neo.fs.v2.container.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 14: neo.fs.v2.container.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 15, // 15: neo.fs.v2.container.GetResponse.body:type_name -> neo.fs.v2.container.GetResponse.Body + 22, // 16: neo.fs.v2.container.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 17: neo.fs.v2.container.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: neo.fs.v2.container.ListRequest.body:type_name -> neo.fs.v2.container.ListRequest.Body + 20, // 19: neo.fs.v2.container.ListRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 20: neo.fs.v2.container.ListRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 17, // 21: neo.fs.v2.container.ListResponse.body:type_name -> neo.fs.v2.container.ListResponse.Body + 22, // 22: neo.fs.v2.container.ListResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 23: neo.fs.v2.container.ListResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 18, // 24: neo.fs.v2.container.ListStreamRequest.body:type_name -> neo.fs.v2.container.ListStreamRequest.Body + 20, // 25: neo.fs.v2.container.ListStreamRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 26: neo.fs.v2.container.ListStreamRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 19, // 27: neo.fs.v2.container.ListStreamResponse.body:type_name -> neo.fs.v2.container.ListStreamResponse.Body + 22, // 28: neo.fs.v2.container.ListStreamResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 29: neo.fs.v2.container.ListStreamResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 24, // 30: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container + 25, // 31: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 26, // 32: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 26, // 33: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 25, // 34: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 26, // 35: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 24, // 36: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container + 25, // 37: neo.fs.v2.container.GetResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 27, // 38: neo.fs.v2.container.GetResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken + 28, // 39: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 26, // 40: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID + 28, // 41: neo.fs.v2.container.ListStreamRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 26, // 42: neo.fs.v2.container.ListStreamResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID + 0, // 43: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest + 2, // 44: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest + 4, // 45: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest + 6, // 46: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest + 8, // 47: neo.fs.v2.container.ContainerService.ListStream:input_type -> neo.fs.v2.container.ListStreamRequest + 1, // 48: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse + 3, // 49: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse + 5, // 50: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse + 7, // 51: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse + 9, // 52: neo.fs.v2.container.ContainerService.ListStream:output_type -> neo.fs.v2.container.ListStreamResponse + 48, // [48:53] is the sub-list for method output_type + 43, // [43:48] is the sub-list for method input_type + 43, // [43:43] is the sub-list for extension type_name + 43, // [43:43] is the sub-list for extension extendee + 0, // [0:43] is the sub-list for field type_name +} + +func init() { file_api_container_grpc_service_proto_init() } +func file_api_container_grpc_service_proto_init() { + if File_api_container_grpc_service_proto != nil { + return + } + file_api_container_grpc_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_container_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 20, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_container_grpc_service_proto_goTypes, + DependencyIndexes: file_api_container_grpc_service_proto_depIdxs, + MessageInfos: file_api_container_grpc_service_proto_msgTypes, + }.Build() + File_api_container_grpc_service_proto = out.File + file_api_container_grpc_service_proto_rawDesc = nil + file_api_container_grpc_service_proto_goTypes = nil + file_api_container_grpc_service_proto_depIdxs = nil +} diff --git a/api/container/grpc/service_grpc.pb.go b/api/container/grpc/service_grpc.pb.go new file mode 100644 index 00000000..d8182510 --- /dev/null +++ b/api/container/grpc/service_grpc.pb.go @@ -0,0 +1,383 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.2 +// source: api/container/grpc/service.proto + +package container + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + ContainerService_Put_FullMethodName = "/neo.fs.v2.container.ContainerService/Put" + ContainerService_Delete_FullMethodName = "/neo.fs.v2.container.ContainerService/Delete" + ContainerService_Get_FullMethodName = "/neo.fs.v2.container.ContainerService/Get" + ContainerService_List_FullMethodName = "/neo.fs.v2.container.ContainerService/List" + ContainerService_ListStream_FullMethodName = "/neo.fs.v2.container.ContainerService/ListStream" +) + +// ContainerServiceClient is the client API for ContainerService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// `ContainerService` provides API to interact with `Container` smart contract +// in FrostFS sidechain via other FrostFS nodes. All of those actions can be +// done equivalently by directly issuing transactions and RPC calls to sidechain +// nodes. +type ContainerServiceClient interface { + // `Put` invokes `Container` smart contract's `Put` method and returns + // response immediately. After a new block is issued in sidechain, request is + // verified by Inner Ring nodes. After one more block in sidechain, the + // container is added into smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container create access denied. + Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) + // `Delete` invokes `Container` smart contract's `Delete` method and returns + // response immediately. After a new block is issued in sidechain, request is + // verified by Inner Ring nodes. After one more block in sidechain, the + // container is added into smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container delete access denied. + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Returns container structure from `Container` smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied. + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + // Returns all owner's containers from `Container` smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container list access denied. + List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + // Returns all owner's containers from `Container` smart contract storage + // via stream. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container list access denied. + ListStream(ctx context.Context, in *ListStreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListStreamResponse], error) +} + +type containerServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewContainerServiceClient(cc grpc.ClientConnInterface) ContainerServiceClient { + return &containerServiceClient{cc} +} + +func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PutResponse) + err := c.cc.Invoke(ctx, ContainerService_Put_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, ContainerService_Delete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetResponse) + err := c.cc.Invoke(ctx, ContainerService_Get_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListResponse) + err := c.cc.Invoke(ctx, ContainerService_List_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerServiceClient) ListStream(ctx context.Context, in *ListStreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListStreamResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ContainerService_ServiceDesc.Streams[0], ContainerService_ListStream_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[ListStreamRequest, ListStreamResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ContainerService_ListStreamClient = grpc.ServerStreamingClient[ListStreamResponse] + +// ContainerServiceServer is the server API for ContainerService service. +// All implementations should embed UnimplementedContainerServiceServer +// for forward compatibility. +// +// `ContainerService` provides API to interact with `Container` smart contract +// in FrostFS sidechain via other FrostFS nodes. All of those actions can be +// done equivalently by directly issuing transactions and RPC calls to sidechain +// nodes. +type ContainerServiceServer interface { + // `Put` invokes `Container` smart contract's `Put` method and returns + // response immediately. After a new block is issued in sidechain, request is + // verified by Inner Ring nodes. After one more block in sidechain, the + // container is added into smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // request to save the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container create access denied. + Put(context.Context, *PutRequest) (*PutResponse, error) + // `Delete` invokes `Container` smart contract's `Delete` method and returns + // response immediately. After a new block is issued in sidechain, request is + // verified by Inner Ring nodes. After one more block in sidechain, the + // container is added into smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // request to remove the container has been sent to the sidechain; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container delete access denied. + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Returns container structure from `Container` smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // container has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // requested container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied. + Get(context.Context, *GetRequest) (*GetResponse, error) + // Returns all owner's containers from `Container` smart contract storage. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container list access denied. + List(context.Context, *ListRequest) (*ListResponse, error) + // Returns all owner's containers from `Container` smart contract storage + // via stream. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // container list has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // container list access denied. + ListStream(*ListStreamRequest, grpc.ServerStreamingServer[ListStreamResponse]) error +} + +// UnimplementedContainerServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedContainerServiceServer struct{} + +func (UnimplementedContainerServiceServer) Put(context.Context, *PutRequest) (*PutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (UnimplementedContainerServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedContainerServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedContainerServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (UnimplementedContainerServiceServer) ListStream(*ListStreamRequest, grpc.ServerStreamingServer[ListStreamResponse]) error { + return status.Errorf(codes.Unimplemented, "method ListStream not implemented") +} +func (UnimplementedContainerServiceServer) testEmbeddedByValue() {} + +// UnsafeContainerServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ContainerServiceServer will +// result in compilation errors. +type UnsafeContainerServiceServer interface { + mustEmbedUnimplementedContainerServiceServer() +} + +func RegisterContainerServiceServer(s grpc.ServiceRegistrar, srv ContainerServiceServer) { + // If the following call pancis, it indicates UnimplementedContainerServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ContainerService_ServiceDesc, srv) +} + +func _ContainerService_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ContainerService_Put_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Put(ctx, req.(*PutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ContainerService_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ContainerService_Get_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerServiceServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ContainerService_List_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerServiceServer).List(ctx, req.(*ListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ContainerService_ListStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListStreamRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ContainerServiceServer).ListStream(m, &grpc.GenericServerStream[ListStreamRequest, ListStreamResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ContainerService_ListStreamServer = grpc.ServerStreamingServer[ListStreamResponse] + +// ContainerService_ServiceDesc is the grpc.ServiceDesc for ContainerService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ContainerService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.container.ContainerService", + HandlerType: (*ContainerServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Put", + Handler: _ContainerService_Put_Handler, + }, + { + MethodName: "Delete", + Handler: _ContainerService_Delete_Handler, + }, + { + MethodName: "Get", + Handler: _ContainerService_Get_Handler, + }, + { + MethodName: "List", + Handler: _ContainerService_List_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListStream", + Handler: _ContainerService_ListStream_Handler, + ServerStreams: true, + }, + }, + Metadata: "api/container/grpc/service.proto", +} diff --git a/api/container/grpc/service_protoopaque.pb.go b/api/container/grpc/service_protoopaque.pb.go new file mode 100644 index 00000000..b54484c3 --- /dev/null +++ b/api/container/grpc/service_protoopaque.pb.go @@ -0,0 +1,2417 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/container/grpc/service.proto + +//go:build protoopaque + +package container + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// New FrostFS Container creation request +type PutRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest) Reset() { + *x = PutRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest) ProtoMessage() {} + +func (x *PutRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest) GetBody() *PutRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *PutRequest) SetBody(v *PutRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *PutRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *PutRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *PutRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *PutRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *PutRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *PutRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *PutRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *PutRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type PutRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container put request message. + Body *PutRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 PutRequest_builder) Build() *PutRequest { + m0 := &PutRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// New FrostFS Container creation response +type PutResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse) Reset() { + *x = PutResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutResponse) GetBody() *PutResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *PutResponse) SetBody(v *PutResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *PutResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *PutResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *PutResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *PutResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *PutResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *PutResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *PutResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *PutResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type PutResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container put response message. + Body *PutResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 PutResponse_builder) Build() *PutResponse { + m0 := &PutResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Container removal request +type DeleteRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteRequest) GetBody() *DeleteRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *DeleteRequest) SetBody(v *DeleteRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *DeleteRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *DeleteRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *DeleteRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *DeleteRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *DeleteRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *DeleteRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *DeleteRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *DeleteRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type DeleteRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container delete request message. + Body *DeleteRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 DeleteRequest_builder) Build() *DeleteRequest { + m0 := &DeleteRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// `DeleteResponse` has an empty body because delete operation is asynchronous +// and done via consensus in Inner Ring nodes. +type DeleteResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteResponse) GetBody() *DeleteResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *DeleteResponse) SetBody(v *DeleteResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *DeleteResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *DeleteResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *DeleteResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *DeleteResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *DeleteResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *DeleteResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *DeleteResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *DeleteResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type DeleteResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container delete response message. + Body *DeleteResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 DeleteResponse_builder) Build() *DeleteResponse { + m0 := &DeleteResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Get container structure +type GetRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest) Reset() { + *x = GetRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRequest) GetBody() *GetRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *GetRequest) SetBody(v *GetRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *GetRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *GetRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *GetRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *GetRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *GetRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *GetRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *GetRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *GetRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type GetRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container get request message. + Body *GetRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 GetRequest_builder) Build() *GetRequest { + m0 := &GetRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Get container structure +type GetResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse) Reset() { + *x = GetResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse) GetBody() *GetResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *GetResponse) SetBody(v *GetResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *GetResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *GetResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *GetResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *GetResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *GetResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *GetResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *GetResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *GetResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type GetResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of container get response message. + Body *GetResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 GetResponse_builder) Build() *GetResponse { + m0 := &GetResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// List containers +type ListRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *ListRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListRequest) Reset() { + *x = ListRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRequest) ProtoMessage() {} + +func (x *ListRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListRequest) GetBody() *ListRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *ListRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *ListRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *ListRequest) SetBody(v *ListRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *ListRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *ListRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *ListRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *ListRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *ListRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *ListRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *ListRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *ListRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type ListRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of list containers request message + Body *ListRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 ListRequest_builder) Build() *ListRequest { + m0 := &ListRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// List containers +type ListResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *ListResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListResponse) Reset() { + *x = ListResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponse) ProtoMessage() {} + +func (x *ListResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListResponse) GetBody() *ListResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *ListResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *ListResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *ListResponse) SetBody(v *ListResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *ListResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *ListResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *ListResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *ListResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *ListResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *ListResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *ListResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *ListResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type ListResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of list containers response message. + Body *ListResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 ListResponse_builder) Build() *ListResponse { + m0 := &ListResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// List containers stream +type ListStreamRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *ListStreamRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamRequest) Reset() { + *x = ListStreamRequest{} + mi := &file_api_container_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamRequest) ProtoMessage() {} + +func (x *ListStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListStreamRequest) GetBody() *ListStreamRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *ListStreamRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *ListStreamRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *ListStreamRequest) SetBody(v *ListStreamRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *ListStreamRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *ListStreamRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *ListStreamRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *ListStreamRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *ListStreamRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *ListStreamRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *ListStreamRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *ListStreamRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type ListStreamRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of list containers stream request message. + Body *ListStreamRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 ListStreamRequest_builder) Build() *ListStreamRequest { + m0 := &ListStreamRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// List containers stream +type ListStreamResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *ListStreamResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamResponse) Reset() { + *x = ListStreamResponse{} + mi := &file_api_container_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamResponse) ProtoMessage() {} + +func (x *ListStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListStreamResponse) GetBody() *ListStreamResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *ListStreamResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *ListStreamResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *ListStreamResponse) SetBody(v *ListStreamResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *ListStreamResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *ListStreamResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *ListStreamResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *ListStreamResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *ListStreamResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *ListStreamResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *ListStreamResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *ListStreamResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type ListStreamResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of list containers stream response message. + Body *ListStreamResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 ListStreamResponse_builder) Build() *ListStreamResponse { + m0 := &ListStreamResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Container creation request has container structure's signature as a +// separate field. It's not stored in sidechain, just verified on container +// creation by `Container` smart contract. `ContainerID` is a SHA256 hash of +// the stable-marshalled container strucutre, hence there is no need for +// additional signature checks. +type PutRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Container *Container `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"` + xxx_hidden_Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest_Body) Reset() { + *x = PutRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body) ProtoMessage() {} + +func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest_Body) GetContainer() *Container { + if x != nil { + return x.xxx_hidden_Container + } + return nil +} + +func (x *PutRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *PutRequest_Body) SetContainer(v *Container) { + x.xxx_hidden_Container = v +} + +func (x *PutRequest_Body) SetSignature(v *grpc1.SignatureRFC6979) { + x.xxx_hidden_Signature = v +} + +func (x *PutRequest_Body) HasContainer() bool { + if x == nil { + return false + } + return x.xxx_hidden_Container != nil +} + +func (x *PutRequest_Body) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *PutRequest_Body) ClearContainer() { + x.xxx_hidden_Container = nil +} + +func (x *PutRequest_Body) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +type PutRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container structure to register in FrostFS + Container *Container + // Signature of a stable-marshalled container according to RFC-6979. + Signature *grpc1.SignatureRFC6979 +} + +func (b0 PutRequest_Body_builder) Build() *PutRequest_Body { + m0 := &PutRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Container = b.Container + x.xxx_hidden_Signature = b.Signature + return m0 +} + +// Container put response body contains information about the newly registered +// container as seen by `Container` smart contract. `ContainerID` can be +// calculated beforehand from the container structure and compared to the one +// returned here to make sure everything has been done as expected. +type PutResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId" json:"container_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse_Body) Reset() { + *x = PutResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse_Body) ProtoMessage() {} + +func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutResponse_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.xxx_hidden_ContainerId + } + return nil +} + +func (x *PutResponse_Body) SetContainerId(v *grpc1.ContainerID) { + x.xxx_hidden_ContainerId = v +} + +func (x *PutResponse_Body) HasContainerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ContainerId != nil +} + +func (x *PutResponse_Body) ClearContainerId() { + x.xxx_hidden_ContainerId = nil +} + +type PutResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Unique identifier of the newly created container + ContainerId *grpc1.ContainerID +} + +func (b0 PutResponse_Body_builder) Build() *PutResponse_Body { + m0 := &PutResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ContainerId = b.ContainerId + return m0 +} + +// Container removal request body has signed `ContainerID` as a proof of +// the container owner's intent. The signature will be verified by `Container` +// smart contract, so signing algorithm must be supported by NeoVM. +type DeleteRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId" json:"container_id,omitempty"` + xxx_hidden_Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest_Body) Reset() { + *x = DeleteRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest_Body) ProtoMessage() {} + +func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.xxx_hidden_ContainerId + } + return nil +} + +func (x *DeleteRequest_Body) GetSignature() *grpc1.SignatureRFC6979 { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *DeleteRequest_Body) SetContainerId(v *grpc1.ContainerID) { + x.xxx_hidden_ContainerId = v +} + +func (x *DeleteRequest_Body) SetSignature(v *grpc1.SignatureRFC6979) { + x.xxx_hidden_Signature = v +} + +func (x *DeleteRequest_Body) HasContainerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ContainerId != nil +} + +func (x *DeleteRequest_Body) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *DeleteRequest_Body) ClearContainerId() { + x.xxx_hidden_ContainerId = nil +} + +func (x *DeleteRequest_Body) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +type DeleteRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container to delete from FrostFS + ContainerId *grpc1.ContainerID + // `ContainerID` signed with the container owner's key according to + // RFC-6979. + Signature *grpc1.SignatureRFC6979 +} + +func (b0 DeleteRequest_Body_builder) Build() *DeleteRequest_Body { + m0 := &DeleteRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ContainerId = b.ContainerId + x.xxx_hidden_Signature = b.Signature + return m0 +} + +// `DeleteResponse` has an empty body because delete operation is asynchronous +// and done via consensus in Inner Ring nodes. +type DeleteResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse_Body) Reset() { + *x = DeleteResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse_Body) ProtoMessage() {} + +func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type DeleteResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 DeleteResponse_Body_builder) Build() *DeleteResponse_Body { + m0 := &DeleteResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// Get container structure request body. +type GetRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId" json:"container_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest_Body) Reset() { + *x = GetRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest_Body) ProtoMessage() {} + +func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.xxx_hidden_ContainerId + } + return nil +} + +func (x *GetRequest_Body) SetContainerId(v *grpc1.ContainerID) { + x.xxx_hidden_ContainerId = v +} + +func (x *GetRequest_Body) HasContainerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ContainerId != nil +} + +func (x *GetRequest_Body) ClearContainerId() { + x.xxx_hidden_ContainerId = nil +} + +type GetRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container to get + ContainerId *grpc1.ContainerID +} + +func (b0 GetRequest_Body_builder) Build() *GetRequest_Body { + m0 := &GetRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ContainerId = b.ContainerId + return m0 +} + +// Get container response body does not have container structure signature. It +// has been already verified upon container creation. +type GetResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Container *Container `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"` + xxx_hidden_Signature *grpc1.SignatureRFC6979 `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + xxx_hidden_SessionToken *grpc.SessionToken `protobuf:"bytes,3,opt,name=session_token,json=sessionToken" json:"session_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse_Body) Reset() { + *x = GetResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body) ProtoMessage() {} + +func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse_Body) GetContainer() *Container { + if x != nil { + return x.xxx_hidden_Container + } + return nil +} + +func (x *GetResponse_Body) GetSignature() *grpc1.SignatureRFC6979 { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *GetResponse_Body) GetSessionToken() *grpc.SessionToken { + if x != nil { + return x.xxx_hidden_SessionToken + } + return nil +} + +func (x *GetResponse_Body) SetContainer(v *Container) { + x.xxx_hidden_Container = v +} + +func (x *GetResponse_Body) SetSignature(v *grpc1.SignatureRFC6979) { + x.xxx_hidden_Signature = v +} + +func (x *GetResponse_Body) SetSessionToken(v *grpc.SessionToken) { + x.xxx_hidden_SessionToken = v +} + +func (x *GetResponse_Body) HasContainer() bool { + if x == nil { + return false + } + return x.xxx_hidden_Container != nil +} + +func (x *GetResponse_Body) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *GetResponse_Body) HasSessionToken() bool { + if x == nil { + return false + } + return x.xxx_hidden_SessionToken != nil +} + +func (x *GetResponse_Body) ClearContainer() { + x.xxx_hidden_Container = nil +} + +func (x *GetResponse_Body) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +func (x *GetResponse_Body) ClearSessionToken() { + x.xxx_hidden_SessionToken = nil +} + +type GetResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Requested container structure + Container *Container + // Signature of a stable-marshalled container according to RFC-6979. + Signature *grpc1.SignatureRFC6979 + // Session token if the container has been created within the session + SessionToken *grpc.SessionToken +} + +func (b0 GetResponse_Body_builder) Build() *GetResponse_Body { + m0 := &GetResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Container = b.Container + x.xxx_hidden_Signature = b.Signature + x.xxx_hidden_SessionToken = b.SessionToken + return m0 +} + +// List containers request body. +type ListRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListRequest_Body) Reset() { + *x = ListRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRequest_Body) ProtoMessage() {} + +func (x *ListRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListRequest_Body) GetOwnerId() *grpc1.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *ListRequest_Body) SetOwnerId(v *grpc1.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *ListRequest_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *ListRequest_Body) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +type ListRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container owner + OwnerId *grpc1.OwnerID +} + +func (b0 ListRequest_Body_builder) Build() *ListRequest_Body { + m0 := &ListRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_OwnerId = b.OwnerId + return m0 +} + +// List containers response body. +type ListResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ContainerIds *[]*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds" json:"container_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListResponse_Body) Reset() { + *x = ListResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponse_Body) ProtoMessage() {} + +func (x *ListResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListResponse_Body) GetContainerIds() []*grpc1.ContainerID { + if x != nil { + if x.xxx_hidden_ContainerIds != nil { + return *x.xxx_hidden_ContainerIds + } + } + return nil +} + +func (x *ListResponse_Body) SetContainerIds(v []*grpc1.ContainerID) { + x.xxx_hidden_ContainerIds = &v +} + +type ListResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of `ContainerID`s belonging to the requested `OwnerID` + ContainerIds []*grpc1.ContainerID +} + +func (b0 ListResponse_Body_builder) Build() *ListResponse_Body { + m0 := &ListResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ContainerIds = &b.ContainerIds + return m0 +} + +// List containers stream request body. +type ListStreamRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamRequest_Body) Reset() { + *x = ListStreamRequest_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamRequest_Body) ProtoMessage() {} + +func (x *ListStreamRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListStreamRequest_Body) GetOwnerId() *grpc1.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *ListStreamRequest_Body) SetOwnerId(v *grpc1.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *ListStreamRequest_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *ListStreamRequest_Body) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +type ListStreamRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container owner. + OwnerId *grpc1.OwnerID +} + +func (b0 ListStreamRequest_Body_builder) Build() *ListStreamRequest_Body { + m0 := &ListStreamRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_OwnerId = b.OwnerId + return m0 +} + +// List containers stream response body. +type ListStreamResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ContainerIds *[]*grpc1.ContainerID `protobuf:"bytes,1,rep,name=container_ids,json=containerIds" json:"container_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamResponse_Body) Reset() { + *x = ListStreamResponse_Body{} + mi := &file_api_container_grpc_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamResponse_Body) ProtoMessage() {} + +func (x *ListStreamResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ListStreamResponse_Body) GetContainerIds() []*grpc1.ContainerID { + if x != nil { + if x.xxx_hidden_ContainerIds != nil { + return *x.xxx_hidden_ContainerIds + } + } + return nil +} + +func (x *ListStreamResponse_Body) SetContainerIds(v []*grpc1.ContainerID) { + x.xxx_hidden_ContainerIds = &v +} + +type ListStreamResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of `ContainerID`s belonging to the requested `OwnerID` + ContainerIds []*grpc1.ContainerID +} + +func (b0 ListStreamResponse_Body_builder) Build() *ListStreamResponse_Body { + m0 := &ListStreamResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ContainerIds = &b.ContainerIds + return m0 +} + +var File_api_container_grpc_service_proto protoreflect.FileDescriptor + +var file_api_container_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x13, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xe7, 0x02, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x1a, 0x84, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x09, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, + 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, + 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x1a, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xef, 0x02, 0x0a, 0x0d, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0x86, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x3e, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xf2, 0x01, 0x0a, 0x0e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x22, 0xa8, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x1a, 0x46, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xb1, 0x03, 0x0a, 0x0b, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, + 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, + 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0xca, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, 0x0a, 0x09, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x09, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x52, 0x09, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x9e, 0x02, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x39, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x22, 0xb0, 0x02, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x40, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x64, 0x73, 0x22, 0xaa, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x22, 0xbc, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x48, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x40, 0x0a, + 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, + 0x44, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x32, + 0xa7, 0x03, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, + 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x48, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x6b, 0x5a, 0x49, 0x67, 0x69, 0x74, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, + 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x43, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x70, 0xe8, 0x07, +} + +var file_api_container_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_api_container_grpc_service_proto_goTypes = []any{ + (*PutRequest)(nil), // 0: neo.fs.v2.container.PutRequest + (*PutResponse)(nil), // 1: neo.fs.v2.container.PutResponse + (*DeleteRequest)(nil), // 2: neo.fs.v2.container.DeleteRequest + (*DeleteResponse)(nil), // 3: neo.fs.v2.container.DeleteResponse + (*GetRequest)(nil), // 4: neo.fs.v2.container.GetRequest + (*GetResponse)(nil), // 5: neo.fs.v2.container.GetResponse + (*ListRequest)(nil), // 6: neo.fs.v2.container.ListRequest + (*ListResponse)(nil), // 7: neo.fs.v2.container.ListResponse + (*ListStreamRequest)(nil), // 8: neo.fs.v2.container.ListStreamRequest + (*ListStreamResponse)(nil), // 9: neo.fs.v2.container.ListStreamResponse + (*PutRequest_Body)(nil), // 10: neo.fs.v2.container.PutRequest.Body + (*PutResponse_Body)(nil), // 11: neo.fs.v2.container.PutResponse.Body + (*DeleteRequest_Body)(nil), // 12: neo.fs.v2.container.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 13: neo.fs.v2.container.DeleteResponse.Body + (*GetRequest_Body)(nil), // 14: neo.fs.v2.container.GetRequest.Body + (*GetResponse_Body)(nil), // 15: neo.fs.v2.container.GetResponse.Body + (*ListRequest_Body)(nil), // 16: neo.fs.v2.container.ListRequest.Body + (*ListResponse_Body)(nil), // 17: neo.fs.v2.container.ListResponse.Body + (*ListStreamRequest_Body)(nil), // 18: neo.fs.v2.container.ListStreamRequest.Body + (*ListStreamResponse_Body)(nil), // 19: neo.fs.v2.container.ListStreamResponse.Body + (*grpc.RequestMetaHeader)(nil), // 20: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 21: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 22: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 23: neo.fs.v2.session.ResponseVerificationHeader + (*Container)(nil), // 24: neo.fs.v2.container.Container + (*grpc1.SignatureRFC6979)(nil), // 25: neo.fs.v2.refs.SignatureRFC6979 + (*grpc1.ContainerID)(nil), // 26: neo.fs.v2.refs.ContainerID + (*grpc.SessionToken)(nil), // 27: neo.fs.v2.session.SessionToken + (*grpc1.OwnerID)(nil), // 28: neo.fs.v2.refs.OwnerID +} +var file_api_container_grpc_service_proto_depIdxs = []int32{ + 10, // 0: neo.fs.v2.container.PutRequest.body:type_name -> neo.fs.v2.container.PutRequest.Body + 20, // 1: neo.fs.v2.container.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 2: neo.fs.v2.container.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 3: neo.fs.v2.container.PutResponse.body:type_name -> neo.fs.v2.container.PutResponse.Body + 22, // 4: neo.fs.v2.container.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 5: neo.fs.v2.container.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 12, // 6: neo.fs.v2.container.DeleteRequest.body:type_name -> neo.fs.v2.container.DeleteRequest.Body + 20, // 7: neo.fs.v2.container.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 8: neo.fs.v2.container.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 13, // 9: neo.fs.v2.container.DeleteResponse.body:type_name -> neo.fs.v2.container.DeleteResponse.Body + 22, // 10: neo.fs.v2.container.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 11: neo.fs.v2.container.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 14, // 12: neo.fs.v2.container.GetRequest.body:type_name -> neo.fs.v2.container.GetRequest.Body + 20, // 13: neo.fs.v2.container.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 14: neo.fs.v2.container.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 15, // 15: neo.fs.v2.container.GetResponse.body:type_name -> neo.fs.v2.container.GetResponse.Body + 22, // 16: neo.fs.v2.container.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 17: neo.fs.v2.container.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: neo.fs.v2.container.ListRequest.body:type_name -> neo.fs.v2.container.ListRequest.Body + 20, // 19: neo.fs.v2.container.ListRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 20: neo.fs.v2.container.ListRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 17, // 21: neo.fs.v2.container.ListResponse.body:type_name -> neo.fs.v2.container.ListResponse.Body + 22, // 22: neo.fs.v2.container.ListResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 23: neo.fs.v2.container.ListResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 18, // 24: neo.fs.v2.container.ListStreamRequest.body:type_name -> neo.fs.v2.container.ListStreamRequest.Body + 20, // 25: neo.fs.v2.container.ListStreamRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 21, // 26: neo.fs.v2.container.ListStreamRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 19, // 27: neo.fs.v2.container.ListStreamResponse.body:type_name -> neo.fs.v2.container.ListStreamResponse.Body + 22, // 28: neo.fs.v2.container.ListStreamResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 23, // 29: neo.fs.v2.container.ListStreamResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 24, // 30: neo.fs.v2.container.PutRequest.Body.container:type_name -> neo.fs.v2.container.Container + 25, // 31: neo.fs.v2.container.PutRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 26, // 32: neo.fs.v2.container.PutResponse.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 26, // 33: neo.fs.v2.container.DeleteRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 25, // 34: neo.fs.v2.container.DeleteRequest.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 26, // 35: neo.fs.v2.container.GetRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 24, // 36: neo.fs.v2.container.GetResponse.Body.container:type_name -> neo.fs.v2.container.Container + 25, // 37: neo.fs.v2.container.GetResponse.Body.signature:type_name -> neo.fs.v2.refs.SignatureRFC6979 + 27, // 38: neo.fs.v2.container.GetResponse.Body.session_token:type_name -> neo.fs.v2.session.SessionToken + 28, // 39: neo.fs.v2.container.ListRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 26, // 40: neo.fs.v2.container.ListResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID + 28, // 41: neo.fs.v2.container.ListStreamRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 26, // 42: neo.fs.v2.container.ListStreamResponse.Body.container_ids:type_name -> neo.fs.v2.refs.ContainerID + 0, // 43: neo.fs.v2.container.ContainerService.Put:input_type -> neo.fs.v2.container.PutRequest + 2, // 44: neo.fs.v2.container.ContainerService.Delete:input_type -> neo.fs.v2.container.DeleteRequest + 4, // 45: neo.fs.v2.container.ContainerService.Get:input_type -> neo.fs.v2.container.GetRequest + 6, // 46: neo.fs.v2.container.ContainerService.List:input_type -> neo.fs.v2.container.ListRequest + 8, // 47: neo.fs.v2.container.ContainerService.ListStream:input_type -> neo.fs.v2.container.ListStreamRequest + 1, // 48: neo.fs.v2.container.ContainerService.Put:output_type -> neo.fs.v2.container.PutResponse + 3, // 49: neo.fs.v2.container.ContainerService.Delete:output_type -> neo.fs.v2.container.DeleteResponse + 5, // 50: neo.fs.v2.container.ContainerService.Get:output_type -> neo.fs.v2.container.GetResponse + 7, // 51: neo.fs.v2.container.ContainerService.List:output_type -> neo.fs.v2.container.ListResponse + 9, // 52: neo.fs.v2.container.ContainerService.ListStream:output_type -> neo.fs.v2.container.ListStreamResponse + 48, // [48:53] is the sub-list for method output_type + 43, // [43:48] is the sub-list for method input_type + 43, // [43:43] is the sub-list for extension type_name + 43, // [43:43] is the sub-list for extension extendee + 0, // [0:43] is the sub-list for field type_name +} + +func init() { file_api_container_grpc_service_proto_init() } +func file_api_container_grpc_service_proto_init() { + if File_api_container_grpc_service_proto != nil { + return + } + file_api_container_grpc_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_container_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 20, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_container_grpc_service_proto_goTypes, + DependencyIndexes: file_api_container_grpc_service_proto_depIdxs, + MessageInfos: file_api_container_grpc_service_proto_msgTypes, + }.Build() + File_api_container_grpc_service_proto = out.File + file_api_container_grpc_service_proto_rawDesc = nil + file_api_container_grpc_service_proto_goTypes = nil + file_api_container_grpc_service_proto_depIdxs = nil +} diff --git a/api/container/grpc/types.pb.go b/api/container/grpc/types.pb.go new file mode 100644 index 00000000..b815e150 --- /dev/null +++ b/api/container/grpc/types.pb.go @@ -0,0 +1,447 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/container/grpc/types.proto + +//go:build !protoopaque + +package container + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Container is a structure that defines object placement behaviour. Objects can +// be stored only within containers. They define placement rule, attributes and +// access control information. An ID of a container is a 32 byte long SHA256 +// hash of stable-marshalled container message. +type Container struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Container format version. Effectively, the version of API library used to + // create the container. + Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + // Identifier of the container owner + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + // Nonce is a 16 byte UUIDv4, used to avoid collisions of `ContainerID`s + Nonce []byte `protobuf:"bytes,3,opt,name=nonce" json:"nonce,omitempty"` + // `BasicACL` contains access control rules for the owner, system and others + // groups, as well as permission bits for `BearerToken` and `Extended ACL` + BasicAcl *uint32 `protobuf:"varint,4,opt,name=basic_acl,json=basicACL" json:"basic_acl,omitempty"` + // Attributes represent immutable container's meta data + Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes" json:"attributes,omitempty"` + // Placement policy for the object inside the container + PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy" json:"placement_policy,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Container) Reset() { + *x = Container{} + mi := &file_api_container_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Container) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Container) ProtoMessage() {} + +func (x *Container) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Container) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} + +func (x *Container) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *Container) GetNonce() []byte { + if x != nil { + return x.Nonce + } + return nil +} + +func (x *Container) GetBasicAcl() uint32 { + if x != nil && x.BasicAcl != nil { + return *x.BasicAcl + } + return 0 +} + +func (x *Container) GetAttributes() []*Container_Attribute { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { + if x != nil { + return x.PlacementPolicy + } + return nil +} + +func (x *Container) SetVersion(v *grpc.Version) { + x.Version = v +} + +func (x *Container) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} + +func (x *Container) SetNonce(v []byte) { + if v == nil { + v = []byte{} + } + x.Nonce = v +} + +func (x *Container) SetBasicAcl(v uint32) { + x.BasicAcl = &v +} + +func (x *Container) SetAttributes(v []*Container_Attribute) { + x.Attributes = v +} + +func (x *Container) SetPlacementPolicy(v *grpc1.PlacementPolicy) { + x.PlacementPolicy = v +} + +func (x *Container) HasVersion() bool { + if x == nil { + return false + } + return x.Version != nil +} + +func (x *Container) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *Container) HasNonce() bool { + if x == nil { + return false + } + return x.Nonce != nil +} + +func (x *Container) HasBasicAcl() bool { + if x == nil { + return false + } + return x.BasicAcl != nil +} + +func (x *Container) HasPlacementPolicy() bool { + if x == nil { + return false + } + return x.PlacementPolicy != nil +} + +func (x *Container) ClearVersion() { + x.Version = nil +} + +func (x *Container) ClearOwnerId() { + x.OwnerId = nil +} + +func (x *Container) ClearNonce() { + x.Nonce = nil +} + +func (x *Container) ClearBasicAcl() { + x.BasicAcl = nil +} + +func (x *Container) ClearPlacementPolicy() { + x.PlacementPolicy = nil +} + +type Container_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container format version. Effectively, the version of API library used to + // create the container. + Version *grpc.Version + // Identifier of the container owner + OwnerId *grpc.OwnerID + // Nonce is a 16 byte UUIDv4, used to avoid collisions of `ContainerID`s + Nonce []byte + // `BasicACL` contains access control rules for the owner, system and others + // groups, as well as permission bits for `BearerToken` and `Extended ACL` + BasicAcl *uint32 + // Attributes represent immutable container's meta data + Attributes []*Container_Attribute + // Placement policy for the object inside the container + PlacementPolicy *grpc1.PlacementPolicy +} + +func (b0 Container_builder) Build() *Container { + m0 := &Container{} + b, x := &b0, m0 + _, _ = b, x + x.Version = b.Version + x.OwnerId = b.OwnerId + x.Nonce = b.Nonce + x.BasicAcl = b.BasicAcl + x.Attributes = b.Attributes + x.PlacementPolicy = b.PlacementPolicy + return m0 +} + +// `Attribute` is a user-defined Key-Value metadata pair attached to the +// container. Container attributes are immutable. They are set at the moment +// of container creation and can never be added or updated. +// +// Key name must be a container-unique valid UTF-8 string. Value can't be +// empty. Containers with duplicated attribute names or attributes with empty +// values will be considered invalid. +// +// There are some "well-known" attributes affecting system behaviour: +// +// - [ __SYSTEM__NAME ] \ +// (`__NEOFS__NAME` is deprecated) \ +// String of a human-friendly container name registered as a domain in +// NNS contract. +// - [ __SYSTEM__ZONE ] \ +// (`__NEOFS__ZONE` is deprecated) \ +// String of a zone for `__SYSTEM__NAME` (`__NEOFS__NAME` is deprecated). +// Used as a TLD of a domain name in NNS contract. If no zone is specified, +// use default zone: `container`. +// - [ __SYSTEM__DISABLE_HOMOMORPHIC_HASHING ] \ +// (`__NEOFS__DISABLE_HOMOMORPHIC_HASHING` is deprecated) \ +// Disables homomorphic hashing for the container if the value equals "true" +// string. Any other values are interpreted as missing attribute. Container +// could be accepted in a FrostFS network only if the global network hashing +// configuration value corresponds with that attribute's value. After +// container inclusion, network setting is ignored. +// +// And some well-known attributes used by applications only: +// +// - Name \ +// Human-friendly name +// - Timestamp \ +// User-defined local time of container creation in Unix Timestamp format +type Container_Attribute struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Attribute name key + Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + // Attribute value + Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Container_Attribute) Reset() { + *x = Container_Attribute{} + mi := &file_api_container_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Container_Attribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Container_Attribute) ProtoMessage() {} + +func (x *Container_Attribute) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Container_Attribute) GetKey() string { + if x != nil && x.Key != nil { + return *x.Key + } + return "" +} + +func (x *Container_Attribute) GetValue() string { + if x != nil && x.Value != nil { + return *x.Value + } + return "" +} + +func (x *Container_Attribute) SetKey(v string) { + x.Key = &v +} + +func (x *Container_Attribute) SetValue(v string) { + x.Value = &v +} + +func (x *Container_Attribute) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *Container_Attribute) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *Container_Attribute) ClearKey() { + x.Key = nil +} + +func (x *Container_Attribute) ClearValue() { + x.Value = nil +} + +type Container_Attribute_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Attribute name key + Key *string + // Attribute value + Value *string +} + +func (b0 Container_Attribute_builder) Build() *Container_Attribute { + m0 := &Container_Attribute{} + b, x := &b0, m0 + _, _ = b, x + x.Key = b.Key + x.Value = b.Value + return m0 +} + +var File_api_container_grpc_types_proto protoreflect.FileDescriptor + +var file_api_container_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x13, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x02, + 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x32, + 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, + 0x63, 0x5f, 0x61, 0x63, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x62, 0x61, 0x73, + 0x69, 0x63, 0x41, 0x43, 0x4c, 0x12, 0x48, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x4c, 0x0a, 0x10, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x50, 0x6c, 0x61, + 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0f, 0x70, 0x6c, + 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x1a, 0x33, 0x0a, + 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x42, 0x6b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, + 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0xaa, + 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62, + 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_container_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_container_grpc_types_proto_goTypes = []any{ + (*Container)(nil), // 0: neo.fs.v2.container.Container + (*Container_Attribute)(nil), // 1: neo.fs.v2.container.Container.Attribute + (*grpc.Version)(nil), // 2: neo.fs.v2.refs.Version + (*grpc.OwnerID)(nil), // 3: neo.fs.v2.refs.OwnerID + (*grpc1.PlacementPolicy)(nil), // 4: neo.fs.v2.netmap.PlacementPolicy +} +var file_api_container_grpc_types_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.container.Container.version:type_name -> neo.fs.v2.refs.Version + 3, // 1: neo.fs.v2.container.Container.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 1, // 2: neo.fs.v2.container.Container.attributes:type_name -> neo.fs.v2.container.Container.Attribute + 4, // 3: neo.fs.v2.container.Container.placement_policy:type_name -> neo.fs.v2.netmap.PlacementPolicy + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_api_container_grpc_types_proto_init() } +func file_api_container_grpc_types_proto_init() { + if File_api_container_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_container_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_container_grpc_types_proto_goTypes, + DependencyIndexes: file_api_container_grpc_types_proto_depIdxs, + MessageInfos: file_api_container_grpc_types_proto_msgTypes, + }.Build() + File_api_container_grpc_types_proto = out.File + file_api_container_grpc_types_proto_rawDesc = nil + file_api_container_grpc_types_proto_goTypes = nil + file_api_container_grpc_types_proto_depIdxs = nil +} diff --git a/api/container/grpc/types_protoopaque.pb.go b/api/container/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..78ce6e61 --- /dev/null +++ b/api/container/grpc/types_protoopaque.pb.go @@ -0,0 +1,469 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/container/grpc/types.proto + +//go:build protoopaque + +package container + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Container is a structure that defines object placement behaviour. Objects can +// be stored only within containers. They define placement rule, attributes and +// access control information. An ID of a container is a 32 byte long SHA256 +// hash of stable-marshalled container message. +type Container struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + xxx_hidden_OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + xxx_hidden_Nonce []byte `protobuf:"bytes,3,opt,name=nonce" json:"nonce,omitempty"` + xxx_hidden_BasicAcl uint32 `protobuf:"varint,4,opt,name=basic_acl,json=basicACL" json:"basic_acl,omitempty"` + xxx_hidden_Attributes *[]*Container_Attribute `protobuf:"bytes,5,rep,name=attributes" json:"attributes,omitempty"` + xxx_hidden_PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy" json:"placement_policy,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Container) Reset() { + *x = Container{} + mi := &file_api_container_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Container) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Container) ProtoMessage() {} + +func (x *Container) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Container) GetVersion() *grpc.Version { + if x != nil { + return x.xxx_hidden_Version + } + return nil +} + +func (x *Container) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *Container) GetNonce() []byte { + if x != nil { + return x.xxx_hidden_Nonce + } + return nil +} + +func (x *Container) GetBasicAcl() uint32 { + if x != nil { + return x.xxx_hidden_BasicAcl + } + return 0 +} + +func (x *Container) GetAttributes() []*Container_Attribute { + if x != nil { + if x.xxx_hidden_Attributes != nil { + return *x.xxx_hidden_Attributes + } + } + return nil +} + +func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy { + if x != nil { + return x.xxx_hidden_PlacementPolicy + } + return nil +} + +func (x *Container) SetVersion(v *grpc.Version) { + x.xxx_hidden_Version = v +} + +func (x *Container) SetOwnerId(v *grpc.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *Container) SetNonce(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Nonce = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 6) +} + +func (x *Container) SetBasicAcl(v uint32) { + x.xxx_hidden_BasicAcl = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 6) +} + +func (x *Container) SetAttributes(v []*Container_Attribute) { + x.xxx_hidden_Attributes = &v +} + +func (x *Container) SetPlacementPolicy(v *grpc1.PlacementPolicy) { + x.xxx_hidden_PlacementPolicy = v +} + +func (x *Container) HasVersion() bool { + if x == nil { + return false + } + return x.xxx_hidden_Version != nil +} + +func (x *Container) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *Container) HasNonce() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *Container) HasBasicAcl() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Container) HasPlacementPolicy() bool { + if x == nil { + return false + } + return x.xxx_hidden_PlacementPolicy != nil +} + +func (x *Container) ClearVersion() { + x.xxx_hidden_Version = nil +} + +func (x *Container) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +func (x *Container) ClearNonce() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Nonce = nil +} + +func (x *Container) ClearBasicAcl() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_BasicAcl = 0 +} + +func (x *Container) ClearPlacementPolicy() { + x.xxx_hidden_PlacementPolicy = nil +} + +type Container_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container format version. Effectively, the version of API library used to + // create the container. + Version *grpc.Version + // Identifier of the container owner + OwnerId *grpc.OwnerID + // Nonce is a 16 byte UUIDv4, used to avoid collisions of `ContainerID`s + Nonce []byte + // `BasicACL` contains access control rules for the owner, system and others + // groups, as well as permission bits for `BearerToken` and `Extended ACL` + BasicAcl *uint32 + // Attributes represent immutable container's meta data + Attributes []*Container_Attribute + // Placement policy for the object inside the container + PlacementPolicy *grpc1.PlacementPolicy +} + +func (b0 Container_builder) Build() *Container { + m0 := &Container{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Version = b.Version + x.xxx_hidden_OwnerId = b.OwnerId + if b.Nonce != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 6) + x.xxx_hidden_Nonce = b.Nonce + } + if b.BasicAcl != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 6) + x.xxx_hidden_BasicAcl = *b.BasicAcl + } + x.xxx_hidden_Attributes = &b.Attributes + x.xxx_hidden_PlacementPolicy = b.PlacementPolicy + return m0 +} + +// `Attribute` is a user-defined Key-Value metadata pair attached to the +// container. Container attributes are immutable. They are set at the moment +// of container creation and can never be added or updated. +// +// Key name must be a container-unique valid UTF-8 string. Value can't be +// empty. Containers with duplicated attribute names or attributes with empty +// values will be considered invalid. +// +// There are some "well-known" attributes affecting system behaviour: +// +// - [ __SYSTEM__NAME ] \ +// (`__NEOFS__NAME` is deprecated) \ +// String of a human-friendly container name registered as a domain in +// NNS contract. +// - [ __SYSTEM__ZONE ] \ +// (`__NEOFS__ZONE` is deprecated) \ +// String of a zone for `__SYSTEM__NAME` (`__NEOFS__NAME` is deprecated). +// Used as a TLD of a domain name in NNS contract. If no zone is specified, +// use default zone: `container`. +// - [ __SYSTEM__DISABLE_HOMOMORPHIC_HASHING ] \ +// (`__NEOFS__DISABLE_HOMOMORPHIC_HASHING` is deprecated) \ +// Disables homomorphic hashing for the container if the value equals "true" +// string. Any other values are interpreted as missing attribute. Container +// could be accepted in a FrostFS network only if the global network hashing +// configuration value corresponds with that attribute's value. After +// container inclusion, network setting is ignored. +// +// And some well-known attributes used by applications only: +// +// - Name \ +// Human-friendly name +// - Timestamp \ +// User-defined local time of container creation in Unix Timestamp format +type Container_Attribute struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + xxx_hidden_Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Container_Attribute) Reset() { + *x = Container_Attribute{} + mi := &file_api_container_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Container_Attribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Container_Attribute) ProtoMessage() {} + +func (x *Container_Attribute) ProtoReflect() protoreflect.Message { + mi := &file_api_container_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Container_Attribute) GetKey() string { + if x != nil { + if x.xxx_hidden_Key != nil { + return *x.xxx_hidden_Key + } + return "" + } + return "" +} + +func (x *Container_Attribute) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *Container_Attribute) SetKey(v string) { + x.xxx_hidden_Key = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *Container_Attribute) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *Container_Attribute) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Container_Attribute) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Container_Attribute) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Key = nil +} + +func (x *Container_Attribute) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Value = nil +} + +type Container_Attribute_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Attribute name key + Key *string + // Attribute value + Value *string +} + +func (b0 Container_Attribute_builder) Build() *Container_Attribute { + m0 := &Container_Attribute{} + b, x := &b0, m0 + _, _ = b, x + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Key = b.Key + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +var File_api_container_grpc_types_proto protoreflect.FileDescriptor + +var file_api_container_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x13, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x02, + 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x32, + 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, + 0x63, 0x5f, 0x61, 0x63, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x62, 0x61, 0x73, + 0x69, 0x63, 0x41, 0x43, 0x4c, 0x12, 0x48, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x4c, 0x0a, 0x10, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x50, 0x6c, 0x61, + 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0f, 0x70, 0x6c, + 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x1a, 0x33, 0x0a, + 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x42, 0x6b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, + 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0xaa, + 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62, + 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_container_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_container_grpc_types_proto_goTypes = []any{ + (*Container)(nil), // 0: neo.fs.v2.container.Container + (*Container_Attribute)(nil), // 1: neo.fs.v2.container.Container.Attribute + (*grpc.Version)(nil), // 2: neo.fs.v2.refs.Version + (*grpc.OwnerID)(nil), // 3: neo.fs.v2.refs.OwnerID + (*grpc1.PlacementPolicy)(nil), // 4: neo.fs.v2.netmap.PlacementPolicy +} +var file_api_container_grpc_types_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.container.Container.version:type_name -> neo.fs.v2.refs.Version + 3, // 1: neo.fs.v2.container.Container.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 1, // 2: neo.fs.v2.container.Container.attributes:type_name -> neo.fs.v2.container.Container.Attribute + 4, // 3: neo.fs.v2.container.Container.placement_policy:type_name -> neo.fs.v2.netmap.PlacementPolicy + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_api_container_grpc_types_proto_init() } +func file_api_container_grpc_types_proto_init() { + if File_api_container_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_container_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_container_grpc_types_proto_goTypes, + DependencyIndexes: file_api_container_grpc_types_proto_depIdxs, + MessageInfos: file_api_container_grpc_types_proto_msgTypes, + }.Build() + File_api_container_grpc_types_proto = out.File + file_api_container_grpc_types_proto_rawDesc = nil + file_api_container_grpc_types_proto_goTypes = nil + file_api_container_grpc_types_proto_depIdxs = nil +} diff --git a/api/container/json.go b/api/container/json.go new file mode 100644 index 00000000..838fb8df --- /dev/null +++ b/api/container/json.go @@ -0,0 +1,22 @@ +package container + +import ( + container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (a *Attribute) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(a) +} + +func (a *Attribute) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(a, data, new(container.Container_Attribute)) +} + +func (c *Container) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(c) +} + +func (c *Container) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(c, data, new(container.Container)) +} diff --git a/api/container/marshal.go b/api/container/marshal.go new file mode 100644 index 00000000..89a6661d --- /dev/null +++ b/api/container/marshal.go @@ -0,0 +1,407 @@ +package container + +import ( + container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + attributeKeyField = 1 + attributeValueField = 2 + + containerVersionField = 1 + containerOwnerField = 2 + containerNonceField = 3 + containerBasicACLField = 4 + containerAttributesField = 5 + containerPlacementField = 6 + + putReqBodyContainerField = 1 + putReqBodySignatureField = 2 + + putRespBodyIDField = 1 + + deleteReqBodyIDField = 1 + deleteReqBodySignatureField = 2 + + getReqBodyIDField = 1 + + getRespBodyContainerField = 1 + getRespBodySignatureField = 2 + getRespBodyTokenField = 3 + + listReqBodyOwnerField = 1 + + listRespBodyIDsField = 1 +) + +func (a *Attribute) StableMarshal(buf []byte) []byte { + if a == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var offset int + + offset += protoutil.StringMarshal(attributeKeyField, buf[offset:], a.key) + protoutil.StringMarshal(attributeValueField, buf[offset:], a.val) + + return buf +} + +func (a *Attribute) StableSize() (size int) { + if a == nil { + return 0 + } + + size += protoutil.StringSize(attributeKeyField, a.key) + size += protoutil.StringSize(attributeValueField, a.val) + + return size +} + +func (a *Attribute) Unmarshal(data []byte) error { + return message.Unmarshal(a, data, new(container.Container_Attribute)) +} + +func (c *Container) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(containerVersionField, buf[offset:], c.version) + offset += protoutil.NestedStructureMarshal(containerOwnerField, buf[offset:], c.ownerID) + offset += protoutil.BytesMarshal(containerNonceField, buf[offset:], c.nonce) + offset += protoutil.UInt32Marshal(containerBasicACLField, buf[offset:], c.basicACL) + + for i := range c.attr { + offset += protoutil.NestedStructureMarshal(containerAttributesField, buf[offset:], &c.attr[i]) + } + + protoutil.NestedStructureMarshal(containerPlacementField, buf[offset:], c.policy) + + return buf +} + +func (c *Container) StableSize() (size int) { + if c == nil { + return 0 + } + + size += protoutil.NestedStructureSize(containerVersionField, c.version) + size += protoutil.NestedStructureSize(containerOwnerField, c.ownerID) + size += protoutil.BytesSize(containerNonceField, c.nonce) + size += protoutil.UInt32Size(containerBasicACLField, c.basicACL) + + for i := range c.attr { + size += protoutil.NestedStructureSize(containerAttributesField, &c.attr[i]) + } + + size += protoutil.NestedStructureSize(containerPlacementField, c.policy) + + return size +} + +func (c *Container) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(container.Container)) +} + +func (r *PutRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(putReqBodyContainerField, buf[offset:], r.cnr) + protoutil.NestedStructureMarshal(putReqBodySignatureField, buf[offset:], r.sig) + + return buf +} + +func (r *PutRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.NestedStructureSize(putReqBodyContainerField, r.cnr) + size += protoutil.NestedStructureSize(putReqBodySignatureField, r.sig) + + return size +} + +func (r *PutRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.PutRequest_Body)) +} + +func (r *PutResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + protoutil.NestedStructureMarshal(putRespBodyIDField, buf, r.cid) + + return buf +} + +func (r *PutResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.NestedStructureSize(putRespBodyIDField, r.cid) + + return size +} + +func (r *PutResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.PutResponse_Body)) +} + +func (r *DeleteRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(deleteReqBodyIDField, buf[offset:], r.cid) + protoutil.NestedStructureMarshal(deleteReqBodySignatureField, buf[offset:], r.sig) + + return buf +} + +func (r *DeleteRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.NestedStructureSize(deleteReqBodyIDField, r.cid) + size += protoutil.NestedStructureSize(deleteReqBodySignatureField, r.sig) + + return size +} + +func (r *DeleteRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.DeleteRequest_Body)) +} + +func (r *DeleteResponseBody) StableMarshal(_ []byte) []byte { + return nil +} + +func (r *DeleteResponseBody) StableSize() (size int) { + return 0 +} + +func (r *DeleteResponseBody) Unmarshal([]byte) error { + return nil +} + +func (r *GetRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + protoutil.NestedStructureMarshal(getReqBodyIDField, buf, r.cid) + + return buf +} + +func (r *GetRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.NestedStructureSize(getReqBodyIDField, r.cid) + + return size +} + +func (r *GetRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.GetRequest_Body)) +} + +func (r *GetResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(getRespBodyContainerField, buf, r.cnr) + offset += protoutil.NestedStructureMarshal(getRespBodySignatureField, buf[offset:], r.sig) + protoutil.NestedStructureMarshal(getRespBodyTokenField, buf[offset:], r.token) + + return buf +} + +func (r *GetResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.NestedStructureSize(getRespBodyContainerField, r.cnr) + size += protoutil.NestedStructureSize(getRespBodySignatureField, r.sig) + size += protoutil.NestedStructureSize(getRespBodyTokenField, r.token) + + return size +} + +func (r *GetResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.GetResponse_Body)) +} + +func (r *ListRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + protoutil.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID) + + return buf +} + +func (r *ListRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.NestedStructureSize(listReqBodyOwnerField, r.ownerID) + + return size +} + +func (r *ListRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.ListRequest_Body)) +} + +func (r *ListResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + for i := range r.cidList { + offset += protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], &r.cidList[i]) + } + + return buf +} + +func (r *ListResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + for i := range r.cidList { + size += protoutil.NestedStructureSize(listRespBodyIDsField, &r.cidList[i]) + } + + return size +} + +func (r *ListResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.ListResponse_Body)) +} + +func (r *ListStreamRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + protoutil.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID) + + return buf +} + +func (r *ListStreamRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.NestedStructureSize(listReqBodyOwnerField, r.ownerID) + + return size +} + +func (r *ListStreamRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.ListStreamRequest_Body)) +} + +func (r *ListStreamResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + for i := range r.cidList { + offset += protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], &r.cidList[i]) + } + + return buf +} + +func (r *ListStreamResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + for i := range r.cidList { + size += protoutil.NestedStructureSize(listRespBodyIDsField, &r.cidList[i]) + } + + return size +} + +func (r *ListStreamResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.ListStreamResponse_Body)) +} diff --git a/api/container/message_test.go b/api/container/message_test.go new file mode 100644 index 00000000..b32475de --- /dev/null +++ b/api/container/message_test.go @@ -0,0 +1,36 @@ +package container_test + +import ( + "testing" + + containertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return containertest.GenerateAttribute(empty) }, + func(empty bool) message.Message { return containertest.GenerateContainer(empty) }, + func(empty bool) message.Message { return containertest.GeneratePutRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GeneratePutRequest(empty) }, + func(empty bool) message.Message { return containertest.GeneratePutResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GeneratePutResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateDeleteRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateDeleteRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateDeleteResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateDeleteResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateListRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateListRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateListResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateListResponse(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetRequestBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) }, + func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) }, + ) +} diff --git a/api/container/status.go b/api/container/status.go new file mode 100644 index 00000000..93b29839 --- /dev/null +++ b/api/container/status.go @@ -0,0 +1,33 @@ +package container + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" + statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" +) + +// LocalizeFailStatus checks if passed global status.Code is related to container failure and: +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must not be nil. +func LocalizeFailStatus(c *status.Code) bool { + return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_CONTAINER)) +} + +// GlobalizeFail globalizes local code of container failure. +// +// Arg must not be nil. +func GlobalizeFail(c *status.Code) { + c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_CONTAINER)) +} + +const ( + // StatusNotFound is a local status.Code value for + // CONTAINER_NOT_FOUND container failure. + StatusNotFound status.Code = iota + + // StatusEACLNotFound is a local status.Code value for + // EACL_NOT_FOUND failure. + StatusEACLNotFound +) diff --git a/api/container/status_test.go b/api/container/status_test.go new file mode 100644 index 00000000..92c738dd --- /dev/null +++ b/api/container/status_test.go @@ -0,0 +1,15 @@ +package container_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + statustest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/test" +) + +func TestStatusCodes(t *testing.T) { + statustest.TestCodes(t, container.LocalizeFailStatus, container.GlobalizeFail, + container.StatusNotFound, 3072, + container.StatusEACLNotFound, 3073, + ) +} diff --git a/api/container/test/generate.go b/api/container/test/generate.go new file mode 100644 index 00000000..f804da57 --- /dev/null +++ b/api/container/test/generate.go @@ -0,0 +1,240 @@ +package containertest + +import ( + "crypto/rand" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + netmaptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/test" + refstest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/test" +) + +func GenerateAttribute(empty bool) *container.Attribute { + m := new(container.Attribute) + + if !empty { + m.SetKey("key") + m.SetValue("val") + } + + return m +} + +func GenerateAttributes(empty bool) []container.Attribute { + var res []container.Attribute + + if !empty { + res = append(res, + *GenerateAttribute(false), + *GenerateAttribute(false), + ) + } + + return res +} + +func GenerateContainer(empty bool) *container.Container { + m := new(container.Container) + + if !empty { + nonce := make([]byte, 16) + _, _ = rand.Read(nonce) + + m.SetBasicACL(12) + m.SetNonce(nonce) + m.SetOwnerID(refstest.GenerateOwnerID(false)) + m.SetAttributes(GenerateAttributes(false)) + m.SetPlacementPolicy(netmaptest.GeneratePlacementPolicy(false)) + } + + m.SetVersion(refstest.GenerateVersion(empty)) + + return m +} + +func GeneratePutRequestBody(empty bool) *container.PutRequestBody { + m := new(container.PutRequestBody) + + if !empty { + m.SetContainer(GenerateContainer(false)) + } + + m.SetSignature(refstest.GenerateSignature(empty)) + + return m +} + +func GeneratePutRequest(empty bool) *container.PutRequest { + m := new(container.PutRequest) + + if !empty { + m.SetBody(GeneratePutRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GeneratePutResponseBody(empty bool) *container.PutResponseBody { + m := new(container.PutResponseBody) + + if !empty { + m.SetContainerID(refstest.GenerateContainerID(false)) + } + + return m +} + +func GeneratePutResponse(empty bool) *container.PutResponse { + m := new(container.PutResponse) + + if !empty { + m.SetBody(GeneratePutResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateGetRequestBody(empty bool) *container.GetRequestBody { + m := new(container.GetRequestBody) + + if !empty { + m.SetContainerID(refstest.GenerateContainerID(false)) + } + + return m +} + +func GenerateGetRequest(empty bool) *container.GetRequest { + m := new(container.GetRequest) + + if !empty { + m.SetBody(GenerateGetRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetResponseBody(empty bool) *container.GetResponseBody { + m := new(container.GetResponseBody) + + if !empty { + m.SetContainer(GenerateContainer(false)) + } + + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) + + return m +} + +func GenerateGetResponse(empty bool) *container.GetResponse { + m := new(container.GetResponse) + + if !empty { + m.SetBody(GenerateGetResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateDeleteRequestBody(empty bool) *container.DeleteRequestBody { + m := new(container.DeleteRequestBody) + + if !empty { + m.SetContainerID(refstest.GenerateContainerID(false)) + } + + m.SetSignature(refstest.GenerateSignature(empty)) + + return m +} + +func GenerateDeleteRequest(empty bool) *container.DeleteRequest { + m := new(container.DeleteRequest) + + if !empty { + m.SetBody(GenerateDeleteRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateDeleteResponseBody(_ bool) *container.DeleteResponseBody { + m := new(container.DeleteResponseBody) + + return m +} + +func GenerateDeleteResponse(empty bool) *container.DeleteResponse { + m := new(container.DeleteResponse) + + if !empty { + m.SetBody(GenerateDeleteResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateListRequestBody(empty bool) *container.ListRequestBody { + m := new(container.ListRequestBody) + + if !empty { + m.SetOwnerID(refstest.GenerateOwnerID(false)) + } + + return m +} + +func GenerateListRequest(empty bool) *container.ListRequest { + m := new(container.ListRequest) + + if !empty { + m.SetBody(GenerateListRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateListResponseBody(empty bool) *container.ListResponseBody { + m := new(container.ListResponseBody) + + if !empty { + m.SetContainerIDs(refstest.GenerateContainerIDs(false)) + } + + return m +} + +func GenerateListResponse(empty bool) *container.ListResponse { + m := new(container.ListResponse) + + if !empty { + m.SetBody(GenerateListResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} diff --git a/api/container/types.go b/api/container/types.go new file mode 100644 index 00000000..4da3f870 --- /dev/null +++ b/api/container/types.go @@ -0,0 +1,514 @@ +package container + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" +) + +type Attribute struct { + key, val string +} + +type Container struct { + version *refs.Version + + ownerID *refs.OwnerID + + nonce []byte + + basicACL uint32 + + attr []Attribute + + policy *netmap.PlacementPolicy +} + +type PutRequestBody struct { + cnr *Container + + sig *refs.Signature +} +type PutRequest struct { + body *PutRequestBody + + session.RequestHeaders +} + +type PutResponseBody struct { + cid *refs.ContainerID +} + +type PutResponse struct { + body *PutResponseBody + + session.ResponseHeaders +} + +type GetRequestBody struct { + cid *refs.ContainerID +} + +type GetRequest struct { + body *GetRequestBody + + session.RequestHeaders +} + +type GetResponseBody struct { + cnr *Container + + token *session.Token + + sig *refs.Signature +} + +type GetResponse struct { + body *GetResponseBody + + session.ResponseHeaders +} + +type DeleteRequestBody struct { + cid *refs.ContainerID + + sig *refs.Signature +} + +type DeleteRequest struct { + body *DeleteRequestBody + + session.RequestHeaders +} + +type DeleteResponseBody struct{} + +type DeleteResponse struct { + body *DeleteResponseBody + + session.ResponseHeaders +} + +type ListRequestBody struct { + ownerID *refs.OwnerID +} + +type ListRequest struct { + body *ListRequestBody + + session.RequestHeaders +} + +type ListResponseBody struct { + cidList []refs.ContainerID +} + +type ListResponse struct { + body *ListResponseBody + + session.ResponseHeaders +} + +type ListStreamRequestBody struct { + ownerID *refs.OwnerID +} + +type ListStreamRequest struct { + body *ListStreamRequestBody + + session.RequestHeaders +} + +type ListStreamResponseBody struct { + cidList []refs.ContainerID +} + +type ListStreamResponse struct { + body *ListStreamResponseBody + + session.ResponseHeaders +} + +func (a *Attribute) GetKey() string { + if a != nil { + return a.key + } + + return "" +} + +func (a *Attribute) SetKey(v string) { + a.key = v +} + +func (a *Attribute) GetValue() string { + if a != nil { + return a.val + } + + return "" +} + +func (a *Attribute) SetValue(v string) { + a.val = v +} + +func (c *Container) GetVersion() *refs.Version { + if c != nil { + return c.version + } + + return nil +} + +func (c *Container) SetVersion(v *refs.Version) { + c.version = v +} + +func (c *Container) GetOwnerID() *refs.OwnerID { + if c != nil { + return c.ownerID + } + + return nil +} + +func (c *Container) SetOwnerID(v *refs.OwnerID) { + c.ownerID = v +} + +func (c *Container) GetNonce() []byte { + if c != nil { + return c.nonce + } + + return nil +} + +func (c *Container) SetNonce(v []byte) { + c.nonce = v +} + +func (c *Container) GetBasicACL() uint32 { + if c != nil { + return c.basicACL + } + + return 0 +} + +func (c *Container) SetBasicACL(v uint32) { + c.basicACL = v +} + +func (c *Container) GetAttributes() []Attribute { + if c != nil { + return c.attr + } + + return nil +} + +func (c *Container) SetAttributes(v []Attribute) { + c.attr = v +} + +func (c *Container) GetPlacementPolicy() *netmap.PlacementPolicy { + if c != nil { + return c.policy + } + + return nil +} + +func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) { + c.policy = v +} + +func (r *PutRequestBody) GetContainer() *Container { + if r != nil { + return r.cnr + } + + return nil +} + +func (r *PutRequestBody) SetContainer(v *Container) { + r.cnr = v +} + +func (r *PutRequestBody) GetSignature() *refs.Signature { + if r != nil { + return r.sig + } + + return nil +} + +func (r *PutRequestBody) SetSignature(v *refs.Signature) { + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) + r.sig = v +} + +func (r *PutRequest) GetBody() *PutRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutRequest) SetBody(v *PutRequestBody) { + r.body = v +} + +func (r *PutResponseBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *PutResponseBody) SetContainerID(v *refs.ContainerID) { + r.cid = v +} + +func (r *PutResponse) GetBody() *PutResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutResponse) SetBody(v *PutResponseBody) { + r.body = v +} + +func (r *GetRequestBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *GetRequestBody) SetContainerID(v *refs.ContainerID) { + r.cid = v +} + +func (r *GetRequest) GetBody() *GetRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRequest) SetBody(v *GetRequestBody) { + r.body = v +} + +func (r *GetResponseBody) GetContainer() *Container { + if r != nil { + return r.cnr + } + + return nil +} + +func (r *GetResponseBody) SetContainer(v *Container) { + r.cnr = v +} + +// GetSessionToken returns token of the session within which requested +// container was created. +func (r *GetResponseBody) GetSessionToken() *session.Token { + if r != nil { + return r.token + } + + return nil +} + +// SetSessionToken sets token of the session within which requested +// container was created. +func (r *GetResponseBody) SetSessionToken(v *session.Token) { + r.token = v +} + +// GetSignature returns signature of the requested container. +func (r *GetResponseBody) GetSignature() *refs.Signature { + if r != nil { + return r.sig + } + + return nil +} + +// SetSignature sets signature of the requested container. +func (r *GetResponseBody) SetSignature(v *refs.Signature) { + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) + r.sig = v +} + +func (r *GetResponse) GetBody() *GetResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetResponse) SetBody(v *GetResponseBody) { + r.body = v +} + +func (r *DeleteRequestBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *DeleteRequestBody) SetContainerID(v *refs.ContainerID) { + r.cid = v +} + +func (r *DeleteRequestBody) GetSignature() *refs.Signature { + if r != nil { + return r.sig + } + + return nil +} + +func (r *DeleteRequestBody) SetSignature(v *refs.Signature) { + // TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type) + v.SetScheme(0) + r.sig = v +} + +func (r *DeleteRequest) GetBody() *DeleteRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { + r.body = v +} + +func (r *DeleteResponse) GetBody() *DeleteResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { + r.body = v +} + +func (r *ListRequestBody) GetOwnerID() *refs.OwnerID { + if r != nil { + return r.ownerID + } + + return nil +} + +func (r *ListRequestBody) SetOwnerID(v *refs.OwnerID) { + r.ownerID = v +} + +func (r *ListRequest) GetBody() *ListRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *ListRequest) SetBody(v *ListRequestBody) { + r.body = v +} + +func (r *ListResponseBody) GetContainerIDs() []refs.ContainerID { + if r != nil { + return r.cidList + } + + return nil +} + +func (r *ListResponseBody) SetContainerIDs(v []refs.ContainerID) { + r.cidList = v +} + +func (r *ListResponse) GetBody() *ListResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *ListResponse) SetBody(v *ListResponseBody) { + r.body = v +} + +func (r *ListStreamRequestBody) GetOwnerID() *refs.OwnerID { + if r != nil { + return r.ownerID + } + + return nil +} + +func (r *ListStreamRequestBody) SetOwnerID(v *refs.OwnerID) { + r.ownerID = v +} + +func (r *ListStreamRequest) GetBody() *ListStreamRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *ListStreamRequest) SetBody(v *ListStreamRequestBody) { + r.body = v +} + +func (r *ListStreamResponseBody) GetContainerIDs() []refs.ContainerID { + if r != nil { + return r.cidList + } + + return nil +} + +func (r *ListStreamResponseBody) SetContainerIDs(v []refs.ContainerID) { + r.cidList = v +} + +func (r *ListStreamResponse) GetBody() *ListStreamResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *ListStreamResponse) SetBody(v *ListStreamResponseBody) { + r.body = v +} diff --git a/api/lock/grpc/types.pb.go b/api/lock/grpc/types.pb.go new file mode 100644 index 00000000..77055221 --- /dev/null +++ b/api/lock/grpc/types.pb.go @@ -0,0 +1,148 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/lock/grpc/types.proto + +//go:build !protoopaque + +package lock + +import ( + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Lock objects protects a list of objects from being deleted. The lifetime of a +// lock object is limited similar to regular objects in +// `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) +// attribute. Lock object MUST have expiration epoch. It is impossible to delete +// a lock object via ObjectService.Delete RPC call. +type Lock struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // List of objects to lock. Must not be empty or carry empty IDs. + // All members must be of the `REGULAR` type. + Members []*grpc.ObjectID `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Lock) Reset() { + *x = Lock{} + mi := &file_api_lock_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Lock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Lock) ProtoMessage() {} + +func (x *Lock) ProtoReflect() protoreflect.Message { + mi := &file_api_lock_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Lock) GetMembers() []*grpc.ObjectID { + if x != nil { + return x.Members + } + return nil +} + +func (x *Lock) SetMembers(v []*grpc.ObjectID) { + x.Members = v +} + +type Lock_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of objects to lock. Must not be empty or carry empty IDs. + // All members must be of the `REGULAR` type. + Members []*grpc.ObjectID +} + +func (b0 Lock_builder) Build() *Lock { + m0 := &Lock{} + b, x := &b0, m0 + _, _ = b, x + x.Members = b.Members + return m0 +} + +var File_api_lock_grpc_types_proto protoreflect.FileDescriptor + +var file_api_lock_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6c, 0x6f, 0x63, 0x6b, 0x1a, 0x19, 0x61, 0x70, 0x69, + 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3a, 0x0a, 0x04, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x32, + 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x73, 0x42, 0x5c, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, + 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6c, 0x6f, 0x63, 0x6b, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, + 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_lock_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_api_lock_grpc_types_proto_goTypes = []any{ + (*Lock)(nil), // 0: neo.fs.v2.lock.Lock + (*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID +} +var file_api_lock_grpc_types_proto_depIdxs = []int32{ + 1, // 0: neo.fs.v2.lock.Lock.members:type_name -> neo.fs.v2.refs.ObjectID + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_lock_grpc_types_proto_init() } +func file_api_lock_grpc_types_proto_init() { + if File_api_lock_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_lock_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_lock_grpc_types_proto_goTypes, + DependencyIndexes: file_api_lock_grpc_types_proto_depIdxs, + MessageInfos: file_api_lock_grpc_types_proto_msgTypes, + }.Build() + File_api_lock_grpc_types_proto = out.File + file_api_lock_grpc_types_proto_rawDesc = nil + file_api_lock_grpc_types_proto_goTypes = nil + file_api_lock_grpc_types_proto_depIdxs = nil +} diff --git a/api/lock/grpc/types_protoopaque.pb.go b/api/lock/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..dd9664d8 --- /dev/null +++ b/api/lock/grpc/types_protoopaque.pb.go @@ -0,0 +1,148 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/lock/grpc/types.proto + +//go:build protoopaque + +package lock + +import ( + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Lock objects protects a list of objects from being deleted. The lifetime of a +// lock object is limited similar to regular objects in +// `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) +// attribute. Lock object MUST have expiration epoch. It is impossible to delete +// a lock object via ObjectService.Delete RPC call. +type Lock struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Members *[]*grpc.ObjectID `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Lock) Reset() { + *x = Lock{} + mi := &file_api_lock_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Lock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Lock) ProtoMessage() {} + +func (x *Lock) ProtoReflect() protoreflect.Message { + mi := &file_api_lock_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Lock) GetMembers() []*grpc.ObjectID { + if x != nil { + if x.xxx_hidden_Members != nil { + return *x.xxx_hidden_Members + } + } + return nil +} + +func (x *Lock) SetMembers(v []*grpc.ObjectID) { + x.xxx_hidden_Members = &v +} + +type Lock_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of objects to lock. Must not be empty or carry empty IDs. + // All members must be of the `REGULAR` type. + Members []*grpc.ObjectID +} + +func (b0 Lock_builder) Build() *Lock { + m0 := &Lock{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Members = &b.Members + return m0 +} + +var File_api_lock_grpc_types_proto protoreflect.FileDescriptor + +var file_api_lock_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6c, 0x6f, 0x63, 0x6b, 0x1a, 0x19, 0x61, 0x70, 0x69, + 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3a, 0x0a, 0x04, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x32, + 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x73, 0x42, 0x5c, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, + 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6c, 0x6f, 0x63, 0x6b, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, + 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_lock_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_api_lock_grpc_types_proto_goTypes = []any{ + (*Lock)(nil), // 0: neo.fs.v2.lock.Lock + (*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID +} +var file_api_lock_grpc_types_proto_depIdxs = []int32{ + 1, // 0: neo.fs.v2.lock.Lock.members:type_name -> neo.fs.v2.refs.ObjectID + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_lock_grpc_types_proto_init() } +func file_api_lock_grpc_types_proto_init() { + if File_api_lock_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_lock_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_lock_grpc_types_proto_goTypes, + DependencyIndexes: file_api_lock_grpc_types_proto_depIdxs, + MessageInfos: file_api_lock_grpc_types_proto_msgTypes, + }.Build() + File_api_lock_grpc_types_proto = out.File + file_api_lock_grpc_types_proto_rawDesc = nil + file_api_lock_grpc_types_proto_goTypes = nil + file_api_lock_grpc_types_proto_depIdxs = nil +} diff --git a/api/netmap/convert.go b/api/netmap/convert.go new file mode 100644 index 00000000..9bbb3035 --- /dev/null +++ b/api/netmap/convert.go @@ -0,0 +1,916 @@ +package netmap + +import ( + netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (f *Filter) ToGRPCMessage() grpc.Message { + var m *netmap.Filter + + if f != nil { + m = new(netmap.Filter) + + m.SetKey(f.key) + m.SetValue(f.value) + m.SetName(f.name) + m.SetOp(OperationToGRPCMessage(f.op)) + m.SetFilters(FiltersToGRPC(f.filters)) + } + + return m +} + +func (f *Filter) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.Filter) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + f.filters, err = FiltersFromGRPC(v.GetFilters()) + if err != nil { + return err + } + + f.key = v.GetKey() + f.value = v.GetValue() + f.name = v.GetName() + f.op = OperationFromGRPCMessage(v.GetOp()) + + return nil +} + +func FiltersToGRPC(fs []Filter) (res []*netmap.Filter) { + if fs != nil { + res = make([]*netmap.Filter, 0, len(fs)) + + for i := range fs { + res = append(res, fs[i].ToGRPCMessage().(*netmap.Filter)) + } + } + + return +} + +func FiltersFromGRPC(fs []*netmap.Filter) (res []Filter, err error) { + if fs != nil { + res = make([]Filter, len(fs)) + + for i := range fs { + err = res[i].FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + } + + return +} + +func (s *Selector) ToGRPCMessage() grpc.Message { + var m *netmap.Selector + + if s != nil { + m = new(netmap.Selector) + + m.SetName(s.name) + m.SetAttribute(s.attribute) + m.SetFilter(s.filter) + m.SetCount(s.count) + m.SetClause(ClauseToGRPCMessage(s.clause)) + } + + return m +} + +func (s *Selector) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.Selector) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + s.name = v.GetName() + s.attribute = v.GetAttribute() + s.filter = v.GetFilter() + s.count = v.GetCount() + s.clause = ClauseFromGRPCMessage(v.GetClause()) + + return nil +} + +func SelectorsToGRPC(ss []Selector) (res []*netmap.Selector) { + if ss != nil { + res = make([]*netmap.Selector, 0, len(ss)) + + for i := range ss { + res = append(res, ss[i].ToGRPCMessage().(*netmap.Selector)) + } + } + + return +} + +func SelectorsFromGRPC(ss []*netmap.Selector) (res []Selector, err error) { + if ss != nil { + res = make([]Selector, len(ss)) + + for i := range ss { + err = res[i].FromGRPCMessage(ss[i]) + if err != nil { + return + } + } + } + + return +} + +func (r *Replica) ToGRPCMessage() grpc.Message { + var m *netmap.Replica + + if r != nil { + m = new(netmap.Replica) + + m.SetSelector(r.selector) + m.SetCount(r.count) + m.SetEcDataCount(r.ecDataCount) + m.SetEcParityCount(r.ecParityCount) + } + + return m +} + +func (r *Replica) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.Replica) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.selector = v.GetSelector() + r.count = v.GetCount() + r.ecDataCount = v.GetEcDataCount() + r.ecParityCount = v.GetEcParityCount() + + return nil +} + +func ReplicasToGRPC(rs []Replica) (res []*netmap.Replica) { + if rs != nil { + res = make([]*netmap.Replica, 0, len(rs)) + + for i := range rs { + res = append(res, rs[i].ToGRPCMessage().(*netmap.Replica)) + } + } + + return +} + +func ReplicasFromGRPC(rs []*netmap.Replica) (res []Replica, err error) { + if rs != nil { + res = make([]Replica, len(rs)) + + for i := range rs { + err = res[i].FromGRPCMessage(rs[i]) + if err != nil { + return + } + } + } + + return +} + +func (p *PlacementPolicy) ToGRPCMessage() grpc.Message { + var m *netmap.PlacementPolicy + + if p != nil { + m = new(netmap.PlacementPolicy) + + m.SetFilters(FiltersToGRPC(p.filters)) + m.SetSelectors(SelectorsToGRPC(p.selectors)) + m.SetReplicas(ReplicasToGRPC(p.replicas)) + m.SetContainerBackupFactor(p.backupFactor) + m.SetUnique(p.unique) + } + + return m +} + +func (p *PlacementPolicy) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.PlacementPolicy) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + p.filters, err = FiltersFromGRPC(v.GetFilters()) + if err != nil { + return err + } + + p.selectors, err = SelectorsFromGRPC(v.GetSelectors()) + if err != nil { + return err + } + + p.replicas, err = ReplicasFromGRPC(v.GetReplicas()) + if err != nil { + return err + } + + p.backupFactor = v.GetContainerBackupFactor() + + p.unique = v.GetUnique() + + return nil +} + +func ClauseToGRPCMessage(n Clause) netmap.Clause { + return netmap.Clause(n) +} + +func ClauseFromGRPCMessage(n netmap.Clause) Clause { + return Clause(n) +} + +func OperationToGRPCMessage(n Operation) netmap.Operation { + return netmap.Operation(n) +} + +func OperationFromGRPCMessage(n netmap.Operation) Operation { + return Operation(n) +} + +func NodeStateToGRPCMessage(n NodeState) netmap.NodeInfo_State { + return netmap.NodeInfo_State(n) +} + +func NodeStateFromRPCMessage(n netmap.NodeInfo_State) NodeState { + return NodeState(n) +} + +func (a *Attribute) ToGRPCMessage() grpc.Message { + var m *netmap.NodeInfo_Attribute + + if a != nil { + m = new(netmap.NodeInfo_Attribute) + + m.SetKey(a.key) + m.SetValue(a.value) + m.SetParents(a.parents) + } + + return m +} + +func (a *Attribute) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NodeInfo_Attribute) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + a.key = v.GetKey() + a.value = v.GetValue() + a.parents = v.GetParents() + + return nil +} + +func AttributesToGRPC(as []Attribute) (res []*netmap.NodeInfo_Attribute) { + if as != nil { + res = make([]*netmap.NodeInfo_Attribute, 0, len(as)) + + for i := range as { + res = append(res, as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute)) + } + } + + return +} + +func AttributesFromGRPC(as []*netmap.NodeInfo_Attribute) (res []Attribute, err error) { + if as != nil { + res = make([]Attribute, len(as)) + + for i := range as { + err = res[i].FromGRPCMessage(as[i]) + if err != nil { + return + } + } + } + + return +} + +func (ni *NodeInfo) ToGRPCMessage() grpc.Message { + var m *netmap.NodeInfo + + if ni != nil { + m = new(netmap.NodeInfo) + + m.SetPublicKey(ni.publicKey) + m.SetAddresses(ni.addresses) + m.SetState(NodeStateToGRPCMessage(ni.state)) + m.SetAttributes(AttributesToGRPC(ni.attributes)) + } + + return m +} + +func (ni *NodeInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NodeInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + ni.attributes, err = AttributesFromGRPC(v.GetAttributes()) + if err != nil { + return err + } + + ni.publicKey = v.GetPublicKey() + ni.addresses = v.GetAddresses() + ni.state = NodeStateFromRPCMessage(v.GetState()) + + return nil +} + +func (l *LocalNodeInfoRequestBody) ToGRPCMessage() grpc.Message { + var m *netmap.LocalNodeInfoRequest_Body + + if l != nil { + m = new(netmap.LocalNodeInfoRequest_Body) + } + + return m +} + +func (l *LocalNodeInfoRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.LocalNodeInfoRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +func (l *LocalNodeInfoRequest) ToGRPCMessage() grpc.Message { + var m *netmap.LocalNodeInfoRequest + + if l != nil { + m = new(netmap.LocalNodeInfoRequest) + + m.SetBody(l.body.ToGRPCMessage().(*netmap.LocalNodeInfoRequest_Body)) + l.RequestHeaders.ToMessage(m) + } + + return m +} + +func (l *LocalNodeInfoRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.LocalNodeInfoRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + l.body = nil + } else { + if l.body == nil { + l.body = new(LocalNodeInfoRequestBody) + } + + err = l.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return l.RequestHeaders.FromMessage(v) +} + +func (l *LocalNodeInfoResponseBody) ToGRPCMessage() grpc.Message { + var m *netmap.LocalNodeInfoResponse_Body + + if l != nil { + m = new(netmap.LocalNodeInfoResponse_Body) + + m.SetVersion(l.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetNodeInfo(l.nodeInfo.ToGRPCMessage().(*netmap.NodeInfo)) + } + + return m +} + +func (l *LocalNodeInfoResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.LocalNodeInfoResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + version := v.GetVersion() + if version == nil { + l.version = nil + } else { + if l.version == nil { + l.version = new(refs.Version) + } + + err = l.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + nodeInfo := v.GetNodeInfo() + if nodeInfo == nil { + l.nodeInfo = nil + } else { + if l.nodeInfo == nil { + l.nodeInfo = new(NodeInfo) + } + + err = l.nodeInfo.FromGRPCMessage(nodeInfo) + } + + return err +} + +func (l *LocalNodeInfoResponse) ToGRPCMessage() grpc.Message { + var m *netmap.LocalNodeInfoResponse + + if l != nil { + m = new(netmap.LocalNodeInfoResponse) + + m.SetBody(l.body.ToGRPCMessage().(*netmap.LocalNodeInfoResponse_Body)) + l.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (l *LocalNodeInfoResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.LocalNodeInfoResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + l.body = nil + } else { + if l.body == nil { + l.body = new(LocalNodeInfoResponseBody) + } + + err = l.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return l.ResponseHeaders.FromMessage(v) +} + +func (x *NetworkParameter) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkConfig_Parameter + + if x != nil { + m = new(netmap.NetworkConfig_Parameter) + + m.SetKey(x.k) + m.SetValue(x.v) + } + + return m +} + +func (x *NetworkParameter) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkConfig_Parameter) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + x.k = v.GetKey() + x.v = v.GetValue() + + return nil +} + +func (x *NetworkConfig) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkConfig + + if x != nil { + m = new(netmap.NetworkConfig) + + var ps []*netmap.NetworkConfig_Parameter + + if ln := len(x.ps); ln > 0 { + ps = make([]*netmap.NetworkConfig_Parameter, 0, ln) + + for i := range ln { + ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter)) + } + } + + m.SetParameters(ps) + } + + return m +} + +func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkConfig) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var ( + ps []NetworkParameter + psV2 = v.GetParameters() + ) + + if psV2 != nil { + ln := len(psV2) + + ps = make([]NetworkParameter, ln) + + for i := range ln { + if err := ps[i].FromGRPCMessage(psV2[i]); err != nil { + return err + } + } + } + + x.ps = ps + + return nil +} + +func (i *NetworkInfo) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfo + + if i != nil { + m = new(netmap.NetworkInfo) + + m.SetMagicNumber(i.magicNum) + m.SetCurrentEpoch(i.curEpoch) + m.SetMsPerBlock(i.msPerBlock) + m.SetNetworkConfig(i.netCfg.ToGRPCMessage().(*netmap.NetworkConfig)) + } + + return m +} + +func (i *NetworkInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + netCfg := v.GetNetworkConfig() + if netCfg == nil { + i.netCfg = nil + } else { + if i.netCfg == nil { + i.netCfg = new(NetworkConfig) + } + + err = i.netCfg.FromGRPCMessage(netCfg) + if err != nil { + return err + } + } + + i.magicNum = v.GetMagicNumber() + i.curEpoch = v.GetCurrentEpoch() + i.msPerBlock = v.GetMsPerBlock() + + return nil +} + +func (l *NetworkInfoRequestBody) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfoRequest_Body + + if l != nil { + m = new(netmap.NetworkInfoRequest_Body) + } + + return m +} + +func (l *NetworkInfoRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfoRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +func (l *NetworkInfoRequest) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfoRequest + + if l != nil { + m = new(netmap.NetworkInfoRequest) + + m.SetBody(l.body.ToGRPCMessage().(*netmap.NetworkInfoRequest_Body)) + l.RequestHeaders.ToMessage(m) + } + + return m +} + +func (l *NetworkInfoRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfoRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + l.body = nil + } else { + if l.body == nil { + l.body = new(NetworkInfoRequestBody) + } + + err = l.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return l.RequestHeaders.FromMessage(v) +} + +func (i *NetworkInfoResponseBody) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfoResponse_Body + + if i != nil { + m = new(netmap.NetworkInfoResponse_Body) + + m.SetNetworkInfo(i.netInfo.ToGRPCMessage().(*netmap.NetworkInfo)) + } + + return m +} + +func (i *NetworkInfoResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfoResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + netInfo := v.GetNetworkInfo() + if netInfo == nil { + i.netInfo = nil + } else { + if i.netInfo == nil { + i.netInfo = new(NetworkInfo) + } + + err = i.netInfo.FromGRPCMessage(netInfo) + } + + return err +} + +func (l *NetworkInfoResponse) ToGRPCMessage() grpc.Message { + var m *netmap.NetworkInfoResponse + + if l != nil { + m = new(netmap.NetworkInfoResponse) + + m.SetBody(l.body.ToGRPCMessage().(*netmap.NetworkInfoResponse_Body)) + l.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (l *NetworkInfoResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetworkInfoResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + l.body = nil + } else { + if l.body == nil { + l.body = new(NetworkInfoResponseBody) + } + + err = l.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return l.ResponseHeaders.FromMessage(v) +} + +func (x *NetMap) ToGRPCMessage() grpc.Message { + var m *netmap.Netmap + + if x != nil { + m = new(netmap.Netmap) + + m.SetEpoch(x.epoch) + + if x.nodes != nil { + nodes := make([]*netmap.NodeInfo, len(x.nodes)) + + for i := range x.nodes { + nodes[i] = x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo) + } + + m.SetNodes(nodes) + } + } + + return m +} + +func (x *NetMap) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.Netmap) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + nodes := v.GetNodes() + if nodes == nil { + x.nodes = nil + } else { + x.nodes = make([]NodeInfo, len(nodes)) + + for i := range nodes { + err = x.nodes[i].FromGRPCMessage(nodes[i]) + if err != nil { + return err + } + } + } + + x.epoch = v.GetEpoch() + + return nil +} + +func (x *SnapshotRequestBody) ToGRPCMessage() grpc.Message { + var m *netmap.NetmapSnapshotRequest_Body + + if x != nil { + m = new(netmap.NetmapSnapshotRequest_Body) + } + + return m +} + +func (x *SnapshotRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetmapSnapshotRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +func (x *SnapshotRequest) ToGRPCMessage() grpc.Message { + var m *netmap.NetmapSnapshotRequest + + if x != nil { + m = new(netmap.NetmapSnapshotRequest) + + m.SetBody(x.body.ToGRPCMessage().(*netmap.NetmapSnapshotRequest_Body)) + x.RequestHeaders.ToMessage(m) + } + + return m +} + +func (x *SnapshotRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetmapSnapshotRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(SnapshotRequestBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return x.RequestHeaders.FromMessage(v) +} + +func (x *SnapshotResponseBody) ToGRPCMessage() grpc.Message { + var m *netmap.NetmapSnapshotResponse_Body + + if x != nil { + m = new(netmap.NetmapSnapshotResponse_Body) + + m.SetNetmap(x.netMap.ToGRPCMessage().(*netmap.Netmap)) + } + + return m +} + +func (x *SnapshotResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetmapSnapshotResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + netMap := v.GetNetmap() + if netMap == nil { + x.netMap = nil + } else { + if x.netMap == nil { + x.netMap = new(NetMap) + } + + err = x.netMap.FromGRPCMessage(netMap) + } + + return err +} + +func (x *SnapshotResponse) ToGRPCMessage() grpc.Message { + var m *netmap.NetmapSnapshotResponse + + if x != nil { + m = new(netmap.NetmapSnapshotResponse) + + m.SetBody(x.body.ToGRPCMessage().(*netmap.NetmapSnapshotResponse_Body)) + x.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (x *SnapshotResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*netmap.NetmapSnapshotResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + x.body = nil + } else { + if x.body == nil { + x.body = new(SnapshotResponseBody) + } + + err = x.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return x.ResponseHeaders.FromMessage(v) +} diff --git a/api/netmap/grpc/service.pb.go b/api/netmap/grpc/service.pb.go new file mode 100644 index 00000000..b3fd8d1b --- /dev/null +++ b/api/netmap/grpc/service.pb.go @@ -0,0 +1,1417 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/netmap/grpc/service.proto + +//go:build !protoopaque + +package netmap + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Get NodeInfo structure directly from a particular node +type LocalNodeInfoRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of the LocalNodeInfo request message + Body *LocalNodeInfoRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalNodeInfoRequest) Reset() { + *x = LocalNodeInfoRequest{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalNodeInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoRequest) ProtoMessage() {} + +func (x *LocalNodeInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *LocalNodeInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) { + x.Body = v +} + +func (x *LocalNodeInfoRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *LocalNodeInfoRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *LocalNodeInfoRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *LocalNodeInfoRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *LocalNodeInfoRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *LocalNodeInfoRequest) ClearBody() { + x.Body = nil +} + +func (x *LocalNodeInfoRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *LocalNodeInfoRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type LocalNodeInfoRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the LocalNodeInfo request message + Body *LocalNodeInfoRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 LocalNodeInfoRequest_builder) Build() *LocalNodeInfoRequest { + m0 := &LocalNodeInfoRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Local Node Info, including API Version in use +type LocalNodeInfoResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of the balance response message. + Body *LocalNodeInfoResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalNodeInfoResponse) Reset() { + *x = LocalNodeInfoResponse{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalNodeInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoResponse) ProtoMessage() {} + +func (x *LocalNodeInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *LocalNodeInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) { + x.Body = v +} + +func (x *LocalNodeInfoResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *LocalNodeInfoResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *LocalNodeInfoResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *LocalNodeInfoResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *LocalNodeInfoResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *LocalNodeInfoResponse) ClearBody() { + x.Body = nil +} + +func (x *LocalNodeInfoResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *LocalNodeInfoResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type LocalNodeInfoResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the balance response message. + Body *LocalNodeInfoResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 LocalNodeInfoResponse_builder) Build() *LocalNodeInfoResponse { + m0 := &LocalNodeInfoResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Get NetworkInfo structure with the network view from a particular node. +type NetworkInfoRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of the NetworkInfo request message + Body *NetworkInfoRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfoRequest) Reset() { + *x = NetworkInfoRequest{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoRequest) ProtoMessage() {} + +func (x *NetworkInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkInfoRequest) GetBody() *NetworkInfoRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *NetworkInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *NetworkInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) { + x.Body = v +} + +func (x *NetworkInfoRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *NetworkInfoRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *NetworkInfoRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *NetworkInfoRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *NetworkInfoRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *NetworkInfoRequest) ClearBody() { + x.Body = nil +} + +func (x *NetworkInfoRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *NetworkInfoRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type NetworkInfoRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the NetworkInfo request message + Body *NetworkInfoRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 NetworkInfoRequest_builder) Build() *NetworkInfoRequest { + m0 := &NetworkInfoRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Response with NetworkInfo structure including current epoch and +// sidechain magic number. +type NetworkInfoResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of the NetworkInfo response message. + Body *NetworkInfoResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfoResponse) Reset() { + *x = NetworkInfoResponse{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoResponse) ProtoMessage() {} + +func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkInfoResponse) GetBody() *NetworkInfoResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *NetworkInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *NetworkInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) { + x.Body = v +} + +func (x *NetworkInfoResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *NetworkInfoResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *NetworkInfoResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *NetworkInfoResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *NetworkInfoResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *NetworkInfoResponse) ClearBody() { + x.Body = nil +} + +func (x *NetworkInfoResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *NetworkInfoResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type NetworkInfoResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the NetworkInfo response message. + Body *NetworkInfoResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 NetworkInfoResponse_builder) Build() *NetworkInfoResponse { + m0 := &NetworkInfoResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Get netmap snapshot request +type NetmapSnapshotRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of get netmap snapshot request message. + Body *NetmapSnapshotRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetmapSnapshotRequest) Reset() { + *x = NetmapSnapshotRequest{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetmapSnapshotRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotRequest) ProtoMessage() {} + +func (x *NetmapSnapshotRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetmapSnapshotRequest) GetBody() *NetmapSnapshotRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *NetmapSnapshotRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *NetmapSnapshotRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) { + x.Body = v +} + +func (x *NetmapSnapshotRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *NetmapSnapshotRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *NetmapSnapshotRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *NetmapSnapshotRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *NetmapSnapshotRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *NetmapSnapshotRequest) ClearBody() { + x.Body = nil +} + +func (x *NetmapSnapshotRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *NetmapSnapshotRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type NetmapSnapshotRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get netmap snapshot request message. + Body *NetmapSnapshotRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 NetmapSnapshotRequest_builder) Build() *NetmapSnapshotRequest { + m0 := &NetmapSnapshotRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Response with current netmap snapshot +type NetmapSnapshotResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of get netmap snapshot response message. + Body *NetmapSnapshotResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetmapSnapshotResponse) Reset() { + *x = NetmapSnapshotResponse{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetmapSnapshotResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotResponse) ProtoMessage() {} + +func (x *NetmapSnapshotResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetmapSnapshotResponse) GetBody() *NetmapSnapshotResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *NetmapSnapshotResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *NetmapSnapshotResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) { + x.Body = v +} + +func (x *NetmapSnapshotResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *NetmapSnapshotResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *NetmapSnapshotResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *NetmapSnapshotResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *NetmapSnapshotResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *NetmapSnapshotResponse) ClearBody() { + x.Body = nil +} + +func (x *NetmapSnapshotResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *NetmapSnapshotResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type NetmapSnapshotResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get netmap snapshot response message. + Body *NetmapSnapshotResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 NetmapSnapshotResponse_builder) Build() *NetmapSnapshotResponse { + m0 := &NetmapSnapshotResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// LocalNodeInfo request body is empty. +type LocalNodeInfoRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalNodeInfoRequest_Body) Reset() { + *x = LocalNodeInfoRequest_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalNodeInfoRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoRequest_Body) ProtoMessage() {} + +func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type LocalNodeInfoRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 LocalNodeInfoRequest_Body_builder) Build() *LocalNodeInfoRequest_Body { + m0 := &LocalNodeInfoRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// Local Node Info, including API Version in use. +type LocalNodeInfoResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Latest FrostFS API version in use + Version *grpc1.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + // NodeInfo structure with recent information from node itself + NodeInfo *NodeInfo `protobuf:"bytes,2,opt,name=node_info,json=nodeInfo" json:"node_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalNodeInfoResponse_Body) Reset() { + *x = LocalNodeInfoResponse_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalNodeInfoResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoResponse_Body) ProtoMessage() {} + +func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version { + if x != nil { + return x.Version + } + return nil +} + +func (x *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo { + if x != nil { + return x.NodeInfo + } + return nil +} + +func (x *LocalNodeInfoResponse_Body) SetVersion(v *grpc1.Version) { + x.Version = v +} + +func (x *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) { + x.NodeInfo = v +} + +func (x *LocalNodeInfoResponse_Body) HasVersion() bool { + if x == nil { + return false + } + return x.Version != nil +} + +func (x *LocalNodeInfoResponse_Body) HasNodeInfo() bool { + if x == nil { + return false + } + return x.NodeInfo != nil +} + +func (x *LocalNodeInfoResponse_Body) ClearVersion() { + x.Version = nil +} + +func (x *LocalNodeInfoResponse_Body) ClearNodeInfo() { + x.NodeInfo = nil +} + +type LocalNodeInfoResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Latest FrostFS API version in use + Version *grpc1.Version + // NodeInfo structure with recent information from node itself + NodeInfo *NodeInfo +} + +func (b0 LocalNodeInfoResponse_Body_builder) Build() *LocalNodeInfoResponse_Body { + m0 := &LocalNodeInfoResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Version = b.Version + x.NodeInfo = b.NodeInfo + return m0 +} + +// NetworkInfo request body is empty. +type NetworkInfoRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfoRequest_Body) Reset() { + *x = NetworkInfoRequest_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfoRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoRequest_Body) ProtoMessage() {} + +func (x *NetworkInfoRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type NetworkInfoRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 NetworkInfoRequest_Body_builder) Build() *NetworkInfoRequest_Body { + m0 := &NetworkInfoRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// Information about the network. +type NetworkInfoResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // NetworkInfo structure with recent information. + NetworkInfo *NetworkInfo `protobuf:"bytes,1,opt,name=network_info,json=networkInfo" json:"network_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfoResponse_Body) Reset() { + *x = NetworkInfoResponse_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfoResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoResponse_Body) ProtoMessage() {} + +func (x *NetworkInfoResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo { + if x != nil { + return x.NetworkInfo + } + return nil +} + +func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) { + x.NetworkInfo = v +} + +func (x *NetworkInfoResponse_Body) HasNetworkInfo() bool { + if x == nil { + return false + } + return x.NetworkInfo != nil +} + +func (x *NetworkInfoResponse_Body) ClearNetworkInfo() { + x.NetworkInfo = nil +} + +type NetworkInfoResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // NetworkInfo structure with recent information. + NetworkInfo *NetworkInfo +} + +func (b0 NetworkInfoResponse_Body_builder) Build() *NetworkInfoResponse_Body { + m0 := &NetworkInfoResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.NetworkInfo = b.NetworkInfo + return m0 +} + +// Get netmap snapshot request body. +type NetmapSnapshotRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetmapSnapshotRequest_Body) Reset() { + *x = NetmapSnapshotRequest_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetmapSnapshotRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotRequest_Body) ProtoMessage() {} + +func (x *NetmapSnapshotRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type NetmapSnapshotRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 NetmapSnapshotRequest_Body_builder) Build() *NetmapSnapshotRequest_Body { + m0 := &NetmapSnapshotRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// Get netmap snapshot response body +type NetmapSnapshotResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Structure of the requested network map. + Netmap *Netmap `protobuf:"bytes,1,opt,name=netmap" json:"netmap,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetmapSnapshotResponse_Body) Reset() { + *x = NetmapSnapshotResponse_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetmapSnapshotResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotResponse_Body) ProtoMessage() {} + +func (x *NetmapSnapshotResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetmapSnapshotResponse_Body) GetNetmap() *Netmap { + if x != nil { + return x.Netmap + } + return nil +} + +func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) { + x.Netmap = v +} + +func (x *NetmapSnapshotResponse_Body) HasNetmap() bool { + if x == nil { + return false + } + return x.Netmap != nil +} + +func (x *NetmapSnapshotResponse_Body) ClearNetmap() { + x.Netmap = nil +} + +type NetmapSnapshotResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Structure of the requested network map. + Netmap *Netmap +} + +func (b0 NetmapSnapshotResponse_Body_builder) Build() *NetmapSnapshotResponse_Body { + m0 := &NetmapSnapshotResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Netmap = b.Netmap + return m0 +} + +var File_api_netmap_grpc_service_proto protoreflect.FileDescriptor + +var file_api_netmap_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf9, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x22, 0xe9, 0x02, 0x0a, 0x15, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x72, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, + 0xf5, 0x01, 0x0a, 0x12, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, + 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xbb, 0x02, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x48, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x40, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x15, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x22, 0xb1, 0x02, 0x0a, 0x16, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, + 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x38, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x52, + 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x32, 0xb2, 0x02, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0e, 0x4e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, + 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x43, + 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, + 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, + 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_api_netmap_grpc_service_proto_goTypes = []any{ + (*LocalNodeInfoRequest)(nil), // 0: neo.fs.v2.netmap.LocalNodeInfoRequest + (*LocalNodeInfoResponse)(nil), // 1: neo.fs.v2.netmap.LocalNodeInfoResponse + (*NetworkInfoRequest)(nil), // 2: neo.fs.v2.netmap.NetworkInfoRequest + (*NetworkInfoResponse)(nil), // 3: neo.fs.v2.netmap.NetworkInfoResponse + (*NetmapSnapshotRequest)(nil), // 4: neo.fs.v2.netmap.NetmapSnapshotRequest + (*NetmapSnapshotResponse)(nil), // 5: neo.fs.v2.netmap.NetmapSnapshotResponse + (*LocalNodeInfoRequest_Body)(nil), // 6: neo.fs.v2.netmap.LocalNodeInfoRequest.Body + (*LocalNodeInfoResponse_Body)(nil), // 7: neo.fs.v2.netmap.LocalNodeInfoResponse.Body + (*NetworkInfoRequest_Body)(nil), // 8: neo.fs.v2.netmap.NetworkInfoRequest.Body + (*NetworkInfoResponse_Body)(nil), // 9: neo.fs.v2.netmap.NetworkInfoResponse.Body + (*NetmapSnapshotRequest_Body)(nil), // 10: neo.fs.v2.netmap.NetmapSnapshotRequest.Body + (*NetmapSnapshotResponse_Body)(nil), // 11: neo.fs.v2.netmap.NetmapSnapshotResponse.Body + (*grpc.RequestMetaHeader)(nil), // 12: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader + (*grpc1.Version)(nil), // 16: neo.fs.v2.refs.Version + (*NodeInfo)(nil), // 17: neo.fs.v2.netmap.NodeInfo + (*NetworkInfo)(nil), // 18: neo.fs.v2.netmap.NetworkInfo + (*Netmap)(nil), // 19: neo.fs.v2.netmap.Netmap +} +var file_api_netmap_grpc_service_proto_depIdxs = []int32{ + 6, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body + 12, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body + 14, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.netmap.NetworkInfoRequest.body:type_name -> neo.fs.v2.netmap.NetworkInfoRequest.Body + 12, // 7: neo.fs.v2.netmap.NetworkInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 8: neo.fs.v2.netmap.NetworkInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 9, // 9: neo.fs.v2.netmap.NetworkInfoResponse.body:type_name -> neo.fs.v2.netmap.NetworkInfoResponse.Body + 14, // 10: neo.fs.v2.netmap.NetworkInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 11: neo.fs.v2.netmap.NetworkInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 10, // 12: neo.fs.v2.netmap.NetmapSnapshotRequest.body:type_name -> neo.fs.v2.netmap.NetmapSnapshotRequest.Body + 12, // 13: neo.fs.v2.netmap.NetmapSnapshotRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 14: neo.fs.v2.netmap.NetmapSnapshotRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 15: neo.fs.v2.netmap.NetmapSnapshotResponse.body:type_name -> neo.fs.v2.netmap.NetmapSnapshotResponse.Body + 14, // 16: neo.fs.v2.netmap.NetmapSnapshotResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 17: neo.fs.v2.netmap.NetmapSnapshotResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version + 17, // 19: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo + 18, // 20: neo.fs.v2.netmap.NetworkInfoResponse.Body.network_info:type_name -> neo.fs.v2.netmap.NetworkInfo + 19, // 21: neo.fs.v2.netmap.NetmapSnapshotResponse.Body.netmap:type_name -> neo.fs.v2.netmap.Netmap + 0, // 22: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest + 2, // 23: neo.fs.v2.netmap.NetmapService.NetworkInfo:input_type -> neo.fs.v2.netmap.NetworkInfoRequest + 4, // 24: neo.fs.v2.netmap.NetmapService.NetmapSnapshot:input_type -> neo.fs.v2.netmap.NetmapSnapshotRequest + 1, // 25: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse + 3, // 26: neo.fs.v2.netmap.NetmapService.NetworkInfo:output_type -> neo.fs.v2.netmap.NetworkInfoResponse + 5, // 27: neo.fs.v2.netmap.NetmapService.NetmapSnapshot:output_type -> neo.fs.v2.netmap.NetmapSnapshotResponse + 25, // [25:28] is the sub-list for method output_type + 22, // [22:25] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_api_netmap_grpc_service_proto_init() } +func file_api_netmap_grpc_service_proto_init() { + if File_api_netmap_grpc_service_proto != nil { + return + } + file_api_netmap_grpc_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_netmap_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_netmap_grpc_service_proto_goTypes, + DependencyIndexes: file_api_netmap_grpc_service_proto_depIdxs, + MessageInfos: file_api_netmap_grpc_service_proto_msgTypes, + }.Build() + File_api_netmap_grpc_service_proto = out.File + file_api_netmap_grpc_service_proto_rawDesc = nil + file_api_netmap_grpc_service_proto_goTypes = nil + file_api_netmap_grpc_service_proto_depIdxs = nil +} diff --git a/api/netmap/grpc/service_grpc.pb.go b/api/netmap/grpc/service_grpc.pb.go new file mode 100644 index 00000000..4bdc977f --- /dev/null +++ b/api/netmap/grpc/service_grpc.pb.go @@ -0,0 +1,251 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.2 +// source: api/netmap/grpc/service.proto + +package netmap + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + NetmapService_LocalNodeInfo_FullMethodName = "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo" + NetmapService_NetworkInfo_FullMethodName = "/neo.fs.v2.netmap.NetmapService/NetworkInfo" + NetmapService_NetmapSnapshot_FullMethodName = "/neo.fs.v2.netmap.NetmapService/NetmapSnapshot" +) + +// NetmapServiceClient is the client API for NetmapService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// `NetmapService` provides methods to work with `Network Map` and the +// information required to build it. The resulting `Network Map` is stored in +// sidechain `Netmap` smart contract, while related information can be obtained +// from other FrostFS nodes. +type NetmapServiceClient interface { + // Get NodeInfo structure from the particular node directly. + // Node information can be taken from `Netmap` smart contract. In some cases, + // though, one may want to get recent information directly or to talk to the + // node not yet present in the `Network Map` to find out what API version can + // be used for further communication. This can be also used to check if a node + // is up and running. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the server has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) + // Read recent information about the FrostFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the current network state has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) + // Returns network map snapshot of the current FrostFS epoch. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the current network map has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) +} + +type netmapServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNetmapServiceClient(cc grpc.ClientConnInterface) NetmapServiceClient { + return &netmapServiceClient{cc} +} + +func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LocalNodeInfoResponse) + err := c.cc.Invoke(ctx, NetmapService_LocalNodeInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(NetworkInfoResponse) + err := c.cc.Invoke(ctx, NetmapService_NetworkInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *netmapServiceClient) NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(NetmapSnapshotResponse) + err := c.cc.Invoke(ctx, NetmapService_NetmapSnapshot_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NetmapServiceServer is the server API for NetmapService service. +// All implementations should embed UnimplementedNetmapServiceServer +// for forward compatibility. +// +// `NetmapService` provides methods to work with `Network Map` and the +// information required to build it. The resulting `Network Map` is stored in +// sidechain `Netmap` smart contract, while related information can be obtained +// from other FrostFS nodes. +type NetmapServiceServer interface { + // Get NodeInfo structure from the particular node directly. + // Node information can be taken from `Netmap` smart contract. In some cases, + // though, one may want to get recent information directly or to talk to the + // node not yet present in the `Network Map` to find out what API version can + // be used for further communication. This can be also used to check if a node + // is up and running. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the server has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) + // Read recent information about the FrostFS network. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the current network state has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) + // Returns network map snapshot of the current FrostFS epoch. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // information about the current network map has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON). + NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error) +} + +// UnimplementedNetmapServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedNetmapServiceServer struct{} + +func (UnimplementedNetmapServiceServer) LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LocalNodeInfo not implemented") +} +func (UnimplementedNetmapServiceServer) NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NetworkInfo not implemented") +} +func (UnimplementedNetmapServiceServer) NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NetmapSnapshot not implemented") +} +func (UnimplementedNetmapServiceServer) testEmbeddedByValue() {} + +// UnsafeNetmapServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to NetmapServiceServer will +// result in compilation errors. +type UnsafeNetmapServiceServer interface { + mustEmbedUnimplementedNetmapServiceServer() +} + +func RegisterNetmapServiceServer(s grpc.ServiceRegistrar, srv NetmapServiceServer) { + // If the following call pancis, it indicates UnimplementedNetmapServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&NetmapService_ServiceDesc, srv) +} + +func _NetmapService_LocalNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LocalNodeInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetmapServiceServer).LocalNodeInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NetmapService_LocalNodeInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetmapServiceServer).LocalNodeInfo(ctx, req.(*LocalNodeInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetmapService_NetworkInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NetworkInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetmapServiceServer).NetworkInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NetmapService_NetworkInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetmapServiceServer).NetworkInfo(ctx, req.(*NetworkInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NetmapService_NetmapSnapshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NetmapSnapshotRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetmapServiceServer).NetmapSnapshot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NetmapService_NetmapSnapshot_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetmapServiceServer).NetmapSnapshot(ctx, req.(*NetmapSnapshotRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// NetmapService_ServiceDesc is the grpc.ServiceDesc for NetmapService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var NetmapService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.netmap.NetmapService", + HandlerType: (*NetmapServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "LocalNodeInfo", + Handler: _NetmapService_LocalNodeInfo_Handler, + }, + { + MethodName: "NetworkInfo", + Handler: _NetmapService_NetworkInfo_Handler, + }, + { + MethodName: "NetmapSnapshot", + Handler: _NetmapService_NetmapSnapshot_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/netmap/grpc/service.proto", +} diff --git a/api/netmap/grpc/service_protoopaque.pb.go b/api/netmap/grpc/service_protoopaque.pb.go new file mode 100644 index 00000000..681ed704 --- /dev/null +++ b/api/netmap/grpc/service_protoopaque.pb.go @@ -0,0 +1,1377 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/netmap/grpc/service.proto + +//go:build protoopaque + +package netmap + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Get NodeInfo structure directly from a particular node +type LocalNodeInfoRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *LocalNodeInfoRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalNodeInfoRequest) Reset() { + *x = LocalNodeInfoRequest{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalNodeInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoRequest) ProtoMessage() {} + +func (x *LocalNodeInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *LocalNodeInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *LocalNodeInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *LocalNodeInfoRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *LocalNodeInfoRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *LocalNodeInfoRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *LocalNodeInfoRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *LocalNodeInfoRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *LocalNodeInfoRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *LocalNodeInfoRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *LocalNodeInfoRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type LocalNodeInfoRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the LocalNodeInfo request message + Body *LocalNodeInfoRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 LocalNodeInfoRequest_builder) Build() *LocalNodeInfoRequest { + m0 := &LocalNodeInfoRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Local Node Info, including API Version in use +type LocalNodeInfoResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *LocalNodeInfoResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalNodeInfoResponse) Reset() { + *x = LocalNodeInfoResponse{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalNodeInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoResponse) ProtoMessage() {} + +func (x *LocalNodeInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *LocalNodeInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *LocalNodeInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *LocalNodeInfoResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *LocalNodeInfoResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *LocalNodeInfoResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *LocalNodeInfoResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *LocalNodeInfoResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *LocalNodeInfoResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *LocalNodeInfoResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *LocalNodeInfoResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type LocalNodeInfoResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the balance response message. + Body *LocalNodeInfoResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 LocalNodeInfoResponse_builder) Build() *LocalNodeInfoResponse { + m0 := &LocalNodeInfoResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Get NetworkInfo structure with the network view from a particular node. +type NetworkInfoRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *NetworkInfoRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfoRequest) Reset() { + *x = NetworkInfoRequest{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoRequest) ProtoMessage() {} + +func (x *NetworkInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkInfoRequest) GetBody() *NetworkInfoRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *NetworkInfoRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *NetworkInfoRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *NetworkInfoRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *NetworkInfoRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *NetworkInfoRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *NetworkInfoRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *NetworkInfoRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *NetworkInfoRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *NetworkInfoRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *NetworkInfoRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type NetworkInfoRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the NetworkInfo request message + Body *NetworkInfoRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 NetworkInfoRequest_builder) Build() *NetworkInfoRequest { + m0 := &NetworkInfoRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Response with NetworkInfo structure including current epoch and +// sidechain magic number. +type NetworkInfoResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *NetworkInfoResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfoResponse) Reset() { + *x = NetworkInfoResponse{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoResponse) ProtoMessage() {} + +func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkInfoResponse) GetBody() *NetworkInfoResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *NetworkInfoResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *NetworkInfoResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *NetworkInfoResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *NetworkInfoResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *NetworkInfoResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *NetworkInfoResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *NetworkInfoResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *NetworkInfoResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *NetworkInfoResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *NetworkInfoResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type NetworkInfoResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of the NetworkInfo response message. + Body *NetworkInfoResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 NetworkInfoResponse_builder) Build() *NetworkInfoResponse { + m0 := &NetworkInfoResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Get netmap snapshot request +type NetmapSnapshotRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *NetmapSnapshotRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetmapSnapshotRequest) Reset() { + *x = NetmapSnapshotRequest{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetmapSnapshotRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotRequest) ProtoMessage() {} + +func (x *NetmapSnapshotRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetmapSnapshotRequest) GetBody() *NetmapSnapshotRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *NetmapSnapshotRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *NetmapSnapshotRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *NetmapSnapshotRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *NetmapSnapshotRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *NetmapSnapshotRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *NetmapSnapshotRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *NetmapSnapshotRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *NetmapSnapshotRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *NetmapSnapshotRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *NetmapSnapshotRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type NetmapSnapshotRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get netmap snapshot request message. + Body *NetmapSnapshotRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 NetmapSnapshotRequest_builder) Build() *NetmapSnapshotRequest { + m0 := &NetmapSnapshotRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Response with current netmap snapshot +type NetmapSnapshotResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *NetmapSnapshotResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetmapSnapshotResponse) Reset() { + *x = NetmapSnapshotResponse{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetmapSnapshotResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotResponse) ProtoMessage() {} + +func (x *NetmapSnapshotResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetmapSnapshotResponse) GetBody() *NetmapSnapshotResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *NetmapSnapshotResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *NetmapSnapshotResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *NetmapSnapshotResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *NetmapSnapshotResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *NetmapSnapshotResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *NetmapSnapshotResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *NetmapSnapshotResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *NetmapSnapshotResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *NetmapSnapshotResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *NetmapSnapshotResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type NetmapSnapshotResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get netmap snapshot response message. + Body *NetmapSnapshotResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect response execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 NetmapSnapshotResponse_builder) Build() *NetmapSnapshotResponse { + m0 := &NetmapSnapshotResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// LocalNodeInfo request body is empty. +type LocalNodeInfoRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalNodeInfoRequest_Body) Reset() { + *x = LocalNodeInfoRequest_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalNodeInfoRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoRequest_Body) ProtoMessage() {} + +func (x *LocalNodeInfoRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type LocalNodeInfoRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 LocalNodeInfoRequest_Body_builder) Build() *LocalNodeInfoRequest_Body { + m0 := &LocalNodeInfoRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// Local Node Info, including API Version in use. +type LocalNodeInfoResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Version *grpc1.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + xxx_hidden_NodeInfo *NodeInfo `protobuf:"bytes,2,opt,name=node_info,json=nodeInfo" json:"node_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LocalNodeInfoResponse_Body) Reset() { + *x = LocalNodeInfoResponse_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LocalNodeInfoResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNodeInfoResponse_Body) ProtoMessage() {} + +func (x *LocalNodeInfoResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *LocalNodeInfoResponse_Body) GetVersion() *grpc1.Version { + if x != nil { + return x.xxx_hidden_Version + } + return nil +} + +func (x *LocalNodeInfoResponse_Body) GetNodeInfo() *NodeInfo { + if x != nil { + return x.xxx_hidden_NodeInfo + } + return nil +} + +func (x *LocalNodeInfoResponse_Body) SetVersion(v *grpc1.Version) { + x.xxx_hidden_Version = v +} + +func (x *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) { + x.xxx_hidden_NodeInfo = v +} + +func (x *LocalNodeInfoResponse_Body) HasVersion() bool { + if x == nil { + return false + } + return x.xxx_hidden_Version != nil +} + +func (x *LocalNodeInfoResponse_Body) HasNodeInfo() bool { + if x == nil { + return false + } + return x.xxx_hidden_NodeInfo != nil +} + +func (x *LocalNodeInfoResponse_Body) ClearVersion() { + x.xxx_hidden_Version = nil +} + +func (x *LocalNodeInfoResponse_Body) ClearNodeInfo() { + x.xxx_hidden_NodeInfo = nil +} + +type LocalNodeInfoResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Latest FrostFS API version in use + Version *grpc1.Version + // NodeInfo structure with recent information from node itself + NodeInfo *NodeInfo +} + +func (b0 LocalNodeInfoResponse_Body_builder) Build() *LocalNodeInfoResponse_Body { + m0 := &LocalNodeInfoResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Version = b.Version + x.xxx_hidden_NodeInfo = b.NodeInfo + return m0 +} + +// NetworkInfo request body is empty. +type NetworkInfoRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfoRequest_Body) Reset() { + *x = NetworkInfoRequest_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfoRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoRequest_Body) ProtoMessage() {} + +func (x *NetworkInfoRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type NetworkInfoRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 NetworkInfoRequest_Body_builder) Build() *NetworkInfoRequest_Body { + m0 := &NetworkInfoRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// Information about the network. +type NetworkInfoResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_NetworkInfo *NetworkInfo `protobuf:"bytes,1,opt,name=network_info,json=networkInfo" json:"network_info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfoResponse_Body) Reset() { + *x = NetworkInfoResponse_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfoResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfoResponse_Body) ProtoMessage() {} + +func (x *NetworkInfoResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkInfoResponse_Body) GetNetworkInfo() *NetworkInfo { + if x != nil { + return x.xxx_hidden_NetworkInfo + } + return nil +} + +func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) { + x.xxx_hidden_NetworkInfo = v +} + +func (x *NetworkInfoResponse_Body) HasNetworkInfo() bool { + if x == nil { + return false + } + return x.xxx_hidden_NetworkInfo != nil +} + +func (x *NetworkInfoResponse_Body) ClearNetworkInfo() { + x.xxx_hidden_NetworkInfo = nil +} + +type NetworkInfoResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // NetworkInfo structure with recent information. + NetworkInfo *NetworkInfo +} + +func (b0 NetworkInfoResponse_Body_builder) Build() *NetworkInfoResponse_Body { + m0 := &NetworkInfoResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_NetworkInfo = b.NetworkInfo + return m0 +} + +// Get netmap snapshot request body. +type NetmapSnapshotRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetmapSnapshotRequest_Body) Reset() { + *x = NetmapSnapshotRequest_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetmapSnapshotRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotRequest_Body) ProtoMessage() {} + +func (x *NetmapSnapshotRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type NetmapSnapshotRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 NetmapSnapshotRequest_Body_builder) Build() *NetmapSnapshotRequest_Body { + m0 := &NetmapSnapshotRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// Get netmap snapshot response body +type NetmapSnapshotResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Netmap *Netmap `protobuf:"bytes,1,opt,name=netmap" json:"netmap,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetmapSnapshotResponse_Body) Reset() { + *x = NetmapSnapshotResponse_Body{} + mi := &file_api_netmap_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetmapSnapshotResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetmapSnapshotResponse_Body) ProtoMessage() {} + +func (x *NetmapSnapshotResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetmapSnapshotResponse_Body) GetNetmap() *Netmap { + if x != nil { + return x.xxx_hidden_Netmap + } + return nil +} + +func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) { + x.xxx_hidden_Netmap = v +} + +func (x *NetmapSnapshotResponse_Body) HasNetmap() bool { + if x == nil { + return false + } + return x.xxx_hidden_Netmap != nil +} + +func (x *NetmapSnapshotResponse_Body) ClearNetmap() { + x.xxx_hidden_Netmap = nil +} + +type NetmapSnapshotResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Structure of the requested network map. + Netmap *Netmap +} + +func (b0 NetmapSnapshotResponse_Body_builder) Build() *NetmapSnapshotResponse_Body { + m0 := &NetmapSnapshotResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Netmap = b.Netmap + return m0 +} + +var File_api_netmap_grpc_service_proto protoreflect.FileDescriptor + +var file_api_netmap_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf9, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x22, 0xe9, 0x02, 0x0a, 0x15, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x72, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, + 0xf5, 0x01, 0x0a, 0x12, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, + 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xbb, 0x02, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x48, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x40, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x15, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x22, 0xb1, 0x02, 0x0a, 0x16, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, + 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x38, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x52, + 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x32, 0xb2, 0x02, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x0d, 0x4c, 0x6f, 0x63, + 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0e, 0x4e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, + 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x43, + 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, + 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, + 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6e, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_netmap_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_api_netmap_grpc_service_proto_goTypes = []any{ + (*LocalNodeInfoRequest)(nil), // 0: neo.fs.v2.netmap.LocalNodeInfoRequest + (*LocalNodeInfoResponse)(nil), // 1: neo.fs.v2.netmap.LocalNodeInfoResponse + (*NetworkInfoRequest)(nil), // 2: neo.fs.v2.netmap.NetworkInfoRequest + (*NetworkInfoResponse)(nil), // 3: neo.fs.v2.netmap.NetworkInfoResponse + (*NetmapSnapshotRequest)(nil), // 4: neo.fs.v2.netmap.NetmapSnapshotRequest + (*NetmapSnapshotResponse)(nil), // 5: neo.fs.v2.netmap.NetmapSnapshotResponse + (*LocalNodeInfoRequest_Body)(nil), // 6: neo.fs.v2.netmap.LocalNodeInfoRequest.Body + (*LocalNodeInfoResponse_Body)(nil), // 7: neo.fs.v2.netmap.LocalNodeInfoResponse.Body + (*NetworkInfoRequest_Body)(nil), // 8: neo.fs.v2.netmap.NetworkInfoRequest.Body + (*NetworkInfoResponse_Body)(nil), // 9: neo.fs.v2.netmap.NetworkInfoResponse.Body + (*NetmapSnapshotRequest_Body)(nil), // 10: neo.fs.v2.netmap.NetmapSnapshotRequest.Body + (*NetmapSnapshotResponse_Body)(nil), // 11: neo.fs.v2.netmap.NetmapSnapshotResponse.Body + (*grpc.RequestMetaHeader)(nil), // 12: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader + (*grpc1.Version)(nil), // 16: neo.fs.v2.refs.Version + (*NodeInfo)(nil), // 17: neo.fs.v2.netmap.NodeInfo + (*NetworkInfo)(nil), // 18: neo.fs.v2.netmap.NetworkInfo + (*Netmap)(nil), // 19: neo.fs.v2.netmap.Netmap +} +var file_api_netmap_grpc_service_proto_depIdxs = []int32{ + 6, // 0: neo.fs.v2.netmap.LocalNodeInfoRequest.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoRequest.Body + 12, // 1: neo.fs.v2.netmap.LocalNodeInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 2: neo.fs.v2.netmap.LocalNodeInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 7, // 3: neo.fs.v2.netmap.LocalNodeInfoResponse.body:type_name -> neo.fs.v2.netmap.LocalNodeInfoResponse.Body + 14, // 4: neo.fs.v2.netmap.LocalNodeInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 5: neo.fs.v2.netmap.LocalNodeInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.netmap.NetworkInfoRequest.body:type_name -> neo.fs.v2.netmap.NetworkInfoRequest.Body + 12, // 7: neo.fs.v2.netmap.NetworkInfoRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 8: neo.fs.v2.netmap.NetworkInfoRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 9, // 9: neo.fs.v2.netmap.NetworkInfoResponse.body:type_name -> neo.fs.v2.netmap.NetworkInfoResponse.Body + 14, // 10: neo.fs.v2.netmap.NetworkInfoResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 11: neo.fs.v2.netmap.NetworkInfoResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 10, // 12: neo.fs.v2.netmap.NetmapSnapshotRequest.body:type_name -> neo.fs.v2.netmap.NetmapSnapshotRequest.Body + 12, // 13: neo.fs.v2.netmap.NetmapSnapshotRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 13, // 14: neo.fs.v2.netmap.NetmapSnapshotRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 11, // 15: neo.fs.v2.netmap.NetmapSnapshotResponse.body:type_name -> neo.fs.v2.netmap.NetmapSnapshotResponse.Body + 14, // 16: neo.fs.v2.netmap.NetmapSnapshotResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 15, // 17: neo.fs.v2.netmap.NetmapSnapshotResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 16, // 18: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.version:type_name -> neo.fs.v2.refs.Version + 17, // 19: neo.fs.v2.netmap.LocalNodeInfoResponse.Body.node_info:type_name -> neo.fs.v2.netmap.NodeInfo + 18, // 20: neo.fs.v2.netmap.NetworkInfoResponse.Body.network_info:type_name -> neo.fs.v2.netmap.NetworkInfo + 19, // 21: neo.fs.v2.netmap.NetmapSnapshotResponse.Body.netmap:type_name -> neo.fs.v2.netmap.Netmap + 0, // 22: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:input_type -> neo.fs.v2.netmap.LocalNodeInfoRequest + 2, // 23: neo.fs.v2.netmap.NetmapService.NetworkInfo:input_type -> neo.fs.v2.netmap.NetworkInfoRequest + 4, // 24: neo.fs.v2.netmap.NetmapService.NetmapSnapshot:input_type -> neo.fs.v2.netmap.NetmapSnapshotRequest + 1, // 25: neo.fs.v2.netmap.NetmapService.LocalNodeInfo:output_type -> neo.fs.v2.netmap.LocalNodeInfoResponse + 3, // 26: neo.fs.v2.netmap.NetmapService.NetworkInfo:output_type -> neo.fs.v2.netmap.NetworkInfoResponse + 5, // 27: neo.fs.v2.netmap.NetmapService.NetmapSnapshot:output_type -> neo.fs.v2.netmap.NetmapSnapshotResponse + 25, // [25:28] is the sub-list for method output_type + 22, // [22:25] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_api_netmap_grpc_service_proto_init() } +func file_api_netmap_grpc_service_proto_init() { + if File_api_netmap_grpc_service_proto != nil { + return + } + file_api_netmap_grpc_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_netmap_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_netmap_grpc_service_proto_goTypes, + DependencyIndexes: file_api_netmap_grpc_service_proto_depIdxs, + MessageInfos: file_api_netmap_grpc_service_proto_msgTypes, + }.Build() + File_api_netmap_grpc_service_proto = out.File + file_api_netmap_grpc_service_proto_rawDesc = nil + file_api_netmap_grpc_service_proto_goTypes = nil + file_api_netmap_grpc_service_proto_depIdxs = nil +} diff --git a/api/netmap/grpc/types.pb.go b/api/netmap/grpc/types.pb.go new file mode 100644 index 00000000..b8a8b3e6 --- /dev/null +++ b/api/netmap/grpc/types.pb.go @@ -0,0 +1,1857 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/netmap/grpc/types.proto + +//go:build !protoopaque + +package netmap + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Operations on filters +type Operation int32 + +const ( + // No Operation defined + Operation_OPERATION_UNSPECIFIED Operation = 0 + // Equal + Operation_EQ Operation = 1 + // Not Equal + Operation_NE Operation = 2 + // Greater then + Operation_GT Operation = 3 + // Greater or equal + Operation_GE Operation = 4 + // Less then + Operation_LT Operation = 5 + // Less or equal + Operation_LE Operation = 6 + // Logical OR + Operation_OR Operation = 7 + // Logical AND + Operation_AND Operation = 8 + // Logical negation + Operation_NOT Operation = 9 + // Matches pattern + Operation_LIKE Operation = 10 +) + +// Enum value maps for Operation. +var ( + Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", + 1: "EQ", + 2: "NE", + 3: "GT", + 4: "GE", + 5: "LT", + 6: "LE", + 7: "OR", + 8: "AND", + 9: "NOT", + 10: "LIKE", + } + Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "EQ": 1, + "NE": 2, + "GT": 3, + "GE": 4, + "LT": 5, + "LE": 6, + "OR": 7, + "AND": 8, + "NOT": 9, + "LIKE": 10, + } +) + +func (x Operation) Enum() *Operation { + p := new(Operation) + *p = x + return p +} + +func (x Operation) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Operation) Descriptor() protoreflect.EnumDescriptor { + return file_api_netmap_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Operation) Type() protoreflect.EnumType { + return &file_api_netmap_grpc_types_proto_enumTypes[0] +} + +func (x Operation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Selector modifier shows how the node set will be formed. By default selector +// just groups nodes into a bucket by attribute, selecting nodes only by their +// hash distance. +type Clause int32 + +const ( + // No modifier defined. Nodes will be selected from the bucket randomly + Clause_CLAUSE_UNSPECIFIED Clause = 0 + // SAME will select only nodes having the same value of bucket attribute + Clause_SAME Clause = 1 + // DISTINCT will select nodes having different values of bucket attribute + Clause_DISTINCT Clause = 2 +) + +// Enum value maps for Clause. +var ( + Clause_name = map[int32]string{ + 0: "CLAUSE_UNSPECIFIED", + 1: "SAME", + 2: "DISTINCT", + } + Clause_value = map[string]int32{ + "CLAUSE_UNSPECIFIED": 0, + "SAME": 1, + "DISTINCT": 2, + } +) + +func (x Clause) Enum() *Clause { + p := new(Clause) + *p = x + return p +} + +func (x Clause) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Clause) Descriptor() protoreflect.EnumDescriptor { + return file_api_netmap_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (Clause) Type() protoreflect.EnumType { + return &file_api_netmap_grpc_types_proto_enumTypes[1] +} + +func (x Clause) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Represents the enumeration of various states of the FrostFS node. +type NodeInfo_State int32 + +const ( + // Unknown state + NodeInfo_UNSPECIFIED NodeInfo_State = 0 + // Active state in the network + NodeInfo_ONLINE NodeInfo_State = 1 + // Network unavailable state + NodeInfo_OFFLINE NodeInfo_State = 2 + // Maintenance state + NodeInfo_MAINTENANCE NodeInfo_State = 3 +) + +// Enum value maps for NodeInfo_State. +var ( + NodeInfo_State_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "ONLINE", + 2: "OFFLINE", + 3: "MAINTENANCE", + } + NodeInfo_State_value = map[string]int32{ + "UNSPECIFIED": 0, + "ONLINE": 1, + "OFFLINE": 2, + "MAINTENANCE": 3, + } +) + +func (x NodeInfo_State) Enum() *NodeInfo_State { + p := new(NodeInfo_State) + *p = x + return p +} + +func (x NodeInfo_State) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NodeInfo_State) Descriptor() protoreflect.EnumDescriptor { + return file_api_netmap_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (NodeInfo_State) Type() protoreflect.EnumType { + return &file_api_netmap_grpc_types_proto_enumTypes[2] +} + +func (x NodeInfo_State) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// This filter will return the subset of nodes from `NetworkMap` or another +// filter's results that will satisfy filter's conditions. +type Filter struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Name of the filter or a reference to a named filter. '*' means + // application to the whole unfiltered NetworkMap. At top level it's used as a + // filter name. At lower levels it's considered to be a reference to another + // named filter + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Key to filter + Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + // Filtering operation + Op *Operation `protobuf:"varint,3,opt,name=op,enum=neo.fs.v2.netmap.Operation" json:"op,omitempty"` + // Value to match + Value *string `protobuf:"bytes,4,opt,name=value" json:"value,omitempty"` + // List of inner filters. Top level operation will be applied to the whole + // list. + Filters []*Filter `protobuf:"bytes,5,rep,name=filters" json:"filters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Filter) Reset() { + *x = Filter{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Filter) ProtoMessage() {} + +func (x *Filter) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Filter) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *Filter) GetKey() string { + if x != nil && x.Key != nil { + return *x.Key + } + return "" +} + +func (x *Filter) GetOp() Operation { + if x != nil && x.Op != nil { + return *x.Op + } + return Operation_OPERATION_UNSPECIFIED +} + +func (x *Filter) GetValue() string { + if x != nil && x.Value != nil { + return *x.Value + } + return "" +} + +func (x *Filter) GetFilters() []*Filter { + if x != nil { + return x.Filters + } + return nil +} + +func (x *Filter) SetName(v string) { + x.Name = &v +} + +func (x *Filter) SetKey(v string) { + x.Key = &v +} + +func (x *Filter) SetOp(v Operation) { + x.Op = &v +} + +func (x *Filter) SetValue(v string) { + x.Value = &v +} + +func (x *Filter) SetFilters(v []*Filter) { + x.Filters = v +} + +func (x *Filter) HasName() bool { + if x == nil { + return false + } + return x.Name != nil +} + +func (x *Filter) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *Filter) HasOp() bool { + if x == nil { + return false + } + return x.Op != nil +} + +func (x *Filter) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *Filter) ClearName() { + x.Name = nil +} + +func (x *Filter) ClearKey() { + x.Key = nil +} + +func (x *Filter) ClearOp() { + x.Op = nil +} + +func (x *Filter) ClearValue() { + x.Value = nil +} + +type Filter_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Name of the filter or a reference to a named filter. '*' means + // application to the whole unfiltered NetworkMap. At top level it's used as a + // filter name. At lower levels it's considered to be a reference to another + // named filter + Name *string + // Key to filter + Key *string + // Filtering operation + Op *Operation + // Value to match + Value *string + // List of inner filters. Top level operation will be applied to the whole + // list. + Filters []*Filter +} + +func (b0 Filter_builder) Build() *Filter { + m0 := &Filter{} + b, x := &b0, m0 + _, _ = b, x + x.Name = b.Name + x.Key = b.Key + x.Op = b.Op + x.Value = b.Value + x.Filters = b.Filters + return m0 +} + +// Selector chooses a number of nodes from the bucket taking the nearest nodes +// to the provided `ContainerID` by hash distance. +type Selector struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Selector name to reference in object placement section + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // How many nodes to select from the bucket + Count *uint32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` + // Selector modifier showing how to form a bucket + Clause *Clause `protobuf:"varint,3,opt,name=clause,enum=neo.fs.v2.netmap.Clause" json:"clause,omitempty"` + // Bucket attribute to select from + Attribute *string `protobuf:"bytes,4,opt,name=attribute" json:"attribute,omitempty"` + // Filter reference to select from + Filter *string `protobuf:"bytes,5,opt,name=filter" json:"filter,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Selector) Reset() { + *x = Selector{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Selector) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Selector) ProtoMessage() {} + +func (x *Selector) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Selector) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *Selector) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + +func (x *Selector) GetClause() Clause { + if x != nil && x.Clause != nil { + return *x.Clause + } + return Clause_CLAUSE_UNSPECIFIED +} + +func (x *Selector) GetAttribute() string { + if x != nil && x.Attribute != nil { + return *x.Attribute + } + return "" +} + +func (x *Selector) GetFilter() string { + if x != nil && x.Filter != nil { + return *x.Filter + } + return "" +} + +func (x *Selector) SetName(v string) { + x.Name = &v +} + +func (x *Selector) SetCount(v uint32) { + x.Count = &v +} + +func (x *Selector) SetClause(v Clause) { + x.Clause = &v +} + +func (x *Selector) SetAttribute(v string) { + x.Attribute = &v +} + +func (x *Selector) SetFilter(v string) { + x.Filter = &v +} + +func (x *Selector) HasName() bool { + if x == nil { + return false + } + return x.Name != nil +} + +func (x *Selector) HasCount() bool { + if x == nil { + return false + } + return x.Count != nil +} + +func (x *Selector) HasClause() bool { + if x == nil { + return false + } + return x.Clause != nil +} + +func (x *Selector) HasAttribute() bool { + if x == nil { + return false + } + return x.Attribute != nil +} + +func (x *Selector) HasFilter() bool { + if x == nil { + return false + } + return x.Filter != nil +} + +func (x *Selector) ClearName() { + x.Name = nil +} + +func (x *Selector) ClearCount() { + x.Count = nil +} + +func (x *Selector) ClearClause() { + x.Clause = nil +} + +func (x *Selector) ClearAttribute() { + x.Attribute = nil +} + +func (x *Selector) ClearFilter() { + x.Filter = nil +} + +type Selector_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Selector name to reference in object placement section + Name *string + // How many nodes to select from the bucket + Count *uint32 + // Selector modifier showing how to form a bucket + Clause *Clause + // Bucket attribute to select from + Attribute *string + // Filter reference to select from + Filter *string +} + +func (b0 Selector_builder) Build() *Selector { + m0 := &Selector{} + b, x := &b0, m0 + _, _ = b, x + x.Name = b.Name + x.Count = b.Count + x.Clause = b.Clause + x.Attribute = b.Attribute + x.Filter = b.Filter + return m0 +} + +// Number of object replicas in a set of nodes from the defined selector. If no +// selector set, the root bucket containing all possible nodes will be used by +// default. +type Replica struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // How many object replicas to put + Count *uint32 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"` + // Named selector bucket to put replicas + Selector *string `protobuf:"bytes,2,opt,name=selector" json:"selector,omitempty"` + // Data shards count + EcDataCount *uint32 `protobuf:"varint,3,opt,name=ec_data_count,json=ecDataCount" json:"ec_data_count,omitempty"` + // Parity shards count + EcParityCount *uint32 `protobuf:"varint,4,opt,name=ec_parity_count,json=ecParityCount" json:"ec_parity_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Replica) Reset() { + *x = Replica{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Replica) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Replica) ProtoMessage() {} + +func (x *Replica) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Replica) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + +func (x *Replica) GetSelector() string { + if x != nil && x.Selector != nil { + return *x.Selector + } + return "" +} + +func (x *Replica) GetEcDataCount() uint32 { + if x != nil && x.EcDataCount != nil { + return *x.EcDataCount + } + return 0 +} + +func (x *Replica) GetEcParityCount() uint32 { + if x != nil && x.EcParityCount != nil { + return *x.EcParityCount + } + return 0 +} + +func (x *Replica) SetCount(v uint32) { + x.Count = &v +} + +func (x *Replica) SetSelector(v string) { + x.Selector = &v +} + +func (x *Replica) SetEcDataCount(v uint32) { + x.EcDataCount = &v +} + +func (x *Replica) SetEcParityCount(v uint32) { + x.EcParityCount = &v +} + +func (x *Replica) HasCount() bool { + if x == nil { + return false + } + return x.Count != nil +} + +func (x *Replica) HasSelector() bool { + if x == nil { + return false + } + return x.Selector != nil +} + +func (x *Replica) HasEcDataCount() bool { + if x == nil { + return false + } + return x.EcDataCount != nil +} + +func (x *Replica) HasEcParityCount() bool { + if x == nil { + return false + } + return x.EcParityCount != nil +} + +func (x *Replica) ClearCount() { + x.Count = nil +} + +func (x *Replica) ClearSelector() { + x.Selector = nil +} + +func (x *Replica) ClearEcDataCount() { + x.EcDataCount = nil +} + +func (x *Replica) ClearEcParityCount() { + x.EcParityCount = nil +} + +type Replica_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // How many object replicas to put + Count *uint32 + // Named selector bucket to put replicas + Selector *string + // Data shards count + EcDataCount *uint32 + // Parity shards count + EcParityCount *uint32 +} + +func (b0 Replica_builder) Build() *Replica { + m0 := &Replica{} + b, x := &b0, m0 + _, _ = b, x + x.Count = b.Count + x.Selector = b.Selector + x.EcDataCount = b.EcDataCount + x.EcParityCount = b.EcParityCount + return m0 +} + +// Set of rules to select a subset of nodes from `NetworkMap` able to store +// container's objects. The format is simple enough to transpile from different +// storage policy definition languages. +type PlacementPolicy struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Rules to set number of object replicas and place each one into a named + // bucket + Replicas []*Replica `protobuf:"bytes,1,rep,name=replicas" json:"replicas,omitempty"` + // Container backup factor controls how deep FrostFS will search for nodes + // alternatives to include into container's nodes subset + ContainerBackupFactor *uint32 `protobuf:"varint,2,opt,name=container_backup_factor,json=containerBackupFactor" json:"container_backup_factor,omitempty"` + // Set of Selectors to form the container's nodes subset + Selectors []*Selector `protobuf:"bytes,3,rep,name=selectors" json:"selectors,omitempty"` + // List of named filters to reference in selectors + Filters []*Filter `protobuf:"bytes,4,rep,name=filters" json:"filters,omitempty"` + // Unique flag defines non-overlapping application for replicas + Unique *bool `protobuf:"varint,5,opt,name=unique" json:"unique,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PlacementPolicy) Reset() { + *x = PlacementPolicy{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PlacementPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlacementPolicy) ProtoMessage() {} + +func (x *PlacementPolicy) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PlacementPolicy) GetReplicas() []*Replica { + if x != nil { + return x.Replicas + } + return nil +} + +func (x *PlacementPolicy) GetContainerBackupFactor() uint32 { + if x != nil && x.ContainerBackupFactor != nil { + return *x.ContainerBackupFactor + } + return 0 +} + +func (x *PlacementPolicy) GetSelectors() []*Selector { + if x != nil { + return x.Selectors + } + return nil +} + +func (x *PlacementPolicy) GetFilters() []*Filter { + if x != nil { + return x.Filters + } + return nil +} + +func (x *PlacementPolicy) GetUnique() bool { + if x != nil && x.Unique != nil { + return *x.Unique + } + return false +} + +func (x *PlacementPolicy) SetReplicas(v []*Replica) { + x.Replicas = v +} + +func (x *PlacementPolicy) SetContainerBackupFactor(v uint32) { + x.ContainerBackupFactor = &v +} + +func (x *PlacementPolicy) SetSelectors(v []*Selector) { + x.Selectors = v +} + +func (x *PlacementPolicy) SetFilters(v []*Filter) { + x.Filters = v +} + +func (x *PlacementPolicy) SetUnique(v bool) { + x.Unique = &v +} + +func (x *PlacementPolicy) HasContainerBackupFactor() bool { + if x == nil { + return false + } + return x.ContainerBackupFactor != nil +} + +func (x *PlacementPolicy) HasUnique() bool { + if x == nil { + return false + } + return x.Unique != nil +} + +func (x *PlacementPolicy) ClearContainerBackupFactor() { + x.ContainerBackupFactor = nil +} + +func (x *PlacementPolicy) ClearUnique() { + x.Unique = nil +} + +type PlacementPolicy_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Rules to set number of object replicas and place each one into a named + // bucket + Replicas []*Replica + // Container backup factor controls how deep FrostFS will search for nodes + // alternatives to include into container's nodes subset + ContainerBackupFactor *uint32 + // Set of Selectors to form the container's nodes subset + Selectors []*Selector + // List of named filters to reference in selectors + Filters []*Filter + // Unique flag defines non-overlapping application for replicas + Unique *bool +} + +func (b0 PlacementPolicy_builder) Build() *PlacementPolicy { + m0 := &PlacementPolicy{} + b, x := &b0, m0 + _, _ = b, x + x.Replicas = b.Replicas + x.ContainerBackupFactor = b.ContainerBackupFactor + x.Selectors = b.Selectors + x.Filters = b.Filters + x.Unique = b.Unique + return m0 +} + +// FrostFS node description +type NodeInfo struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Public key of the FrostFS node in a binary format + PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey" json:"public_key,omitempty"` + // Ways to connect to a node + Addresses []string `protobuf:"bytes,2,rep,name=addresses" json:"addresses,omitempty"` + // Carries list of the FrostFS node attributes in a key-value form. Key name + // must be a node-unique valid UTF-8 string. Value can't be empty. NodeInfo + // structures with duplicated attribute names or attributes with empty values + // will be considered invalid. + Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes" json:"attributes,omitempty"` + // Carries state of the FrostFS node + State *NodeInfo_State `protobuf:"varint,4,opt,name=state,enum=neo.fs.v2.netmap.NodeInfo_State" json:"state,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeInfo) Reset() { + *x = NodeInfo{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeInfo) ProtoMessage() {} + +func (x *NodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NodeInfo) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *NodeInfo) GetAddresses() []string { + if x != nil { + return x.Addresses + } + return nil +} + +func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *NodeInfo) GetState() NodeInfo_State { + if x != nil && x.State != nil { + return *x.State + } + return NodeInfo_UNSPECIFIED +} + +func (x *NodeInfo) SetPublicKey(v []byte) { + if v == nil { + v = []byte{} + } + x.PublicKey = v +} + +func (x *NodeInfo) SetAddresses(v []string) { + x.Addresses = v +} + +func (x *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { + x.Attributes = v +} + +func (x *NodeInfo) SetState(v NodeInfo_State) { + x.State = &v +} + +func (x *NodeInfo) HasPublicKey() bool { + if x == nil { + return false + } + return x.PublicKey != nil +} + +func (x *NodeInfo) HasState() bool { + if x == nil { + return false + } + return x.State != nil +} + +func (x *NodeInfo) ClearPublicKey() { + x.PublicKey = nil +} + +func (x *NodeInfo) ClearState() { + x.State = nil +} + +type NodeInfo_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Public key of the FrostFS node in a binary format + PublicKey []byte + // Ways to connect to a node + Addresses []string + // Carries list of the FrostFS node attributes in a key-value form. Key name + // must be a node-unique valid UTF-8 string. Value can't be empty. NodeInfo + // structures with duplicated attribute names or attributes with empty values + // will be considered invalid. + Attributes []*NodeInfo_Attribute + // Carries state of the FrostFS node + State *NodeInfo_State +} + +func (b0 NodeInfo_builder) Build() *NodeInfo { + m0 := &NodeInfo{} + b, x := &b0, m0 + _, _ = b, x + x.PublicKey = b.PublicKey + x.Addresses = b.Addresses + x.Attributes = b.Attributes + x.State = b.State + return m0 +} + +// Network map structure +type Netmap struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Network map revision number. + Epoch *uint64 `protobuf:"varint,1,opt,name=epoch" json:"epoch,omitempty"` + // Nodes presented in network. + Nodes []*NodeInfo `protobuf:"bytes,2,rep,name=nodes" json:"nodes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Netmap) Reset() { + *x = Netmap{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Netmap) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Netmap) ProtoMessage() {} + +func (x *Netmap) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Netmap) GetEpoch() uint64 { + if x != nil && x.Epoch != nil { + return *x.Epoch + } + return 0 +} + +func (x *Netmap) GetNodes() []*NodeInfo { + if x != nil { + return x.Nodes + } + return nil +} + +func (x *Netmap) SetEpoch(v uint64) { + x.Epoch = &v +} + +func (x *Netmap) SetNodes(v []*NodeInfo) { + x.Nodes = v +} + +func (x *Netmap) HasEpoch() bool { + if x == nil { + return false + } + return x.Epoch != nil +} + +func (x *Netmap) ClearEpoch() { + x.Epoch = nil +} + +type Netmap_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Network map revision number. + Epoch *uint64 + // Nodes presented in network. + Nodes []*NodeInfo +} + +func (b0 Netmap_builder) Build() *Netmap { + m0 := &Netmap{} + b, x := &b0, m0 + _, _ = b, x + x.Epoch = b.Epoch + x.Nodes = b.Nodes + return m0 +} + +// FrostFS network configuration +type NetworkConfig struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // List of parameter values + Parameters []*NetworkConfig_Parameter `protobuf:"bytes,1,rep,name=parameters" json:"parameters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkConfig) Reset() { + *x = NetworkConfig{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkConfig) ProtoMessage() {} + +func (x *NetworkConfig) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { + x.Parameters = v +} + +type NetworkConfig_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of parameter values + Parameters []*NetworkConfig_Parameter +} + +func (b0 NetworkConfig_builder) Build() *NetworkConfig { + m0 := &NetworkConfig{} + b, x := &b0, m0 + _, _ = b, x + x.Parameters = b.Parameters + return m0 +} + +// Information about FrostFS network +type NetworkInfo struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Number of the current epoch in the FrostFS network + CurrentEpoch *uint64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch" json:"current_epoch,omitempty"` + // Magic number of the sidechain of the FrostFS network + MagicNumber *uint64 `protobuf:"varint,2,opt,name=magic_number,json=magicNumber" json:"magic_number,omitempty"` + // MillisecondsPerBlock network parameter of the sidechain of the FrostFS + // network + MsPerBlock *int64 `protobuf:"varint,3,opt,name=ms_per_block,json=msPerBlock" json:"ms_per_block,omitempty"` + // FrostFS network configuration + NetworkConfig *NetworkConfig `protobuf:"bytes,4,opt,name=network_config,json=networkConfig" json:"network_config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfo) Reset() { + *x = NetworkInfo{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfo) ProtoMessage() {} + +func (x *NetworkInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkInfo) GetCurrentEpoch() uint64 { + if x != nil && x.CurrentEpoch != nil { + return *x.CurrentEpoch + } + return 0 +} + +func (x *NetworkInfo) GetMagicNumber() uint64 { + if x != nil && x.MagicNumber != nil { + return *x.MagicNumber + } + return 0 +} + +func (x *NetworkInfo) GetMsPerBlock() int64 { + if x != nil && x.MsPerBlock != nil { + return *x.MsPerBlock + } + return 0 +} + +func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { + if x != nil { + return x.NetworkConfig + } + return nil +} + +func (x *NetworkInfo) SetCurrentEpoch(v uint64) { + x.CurrentEpoch = &v +} + +func (x *NetworkInfo) SetMagicNumber(v uint64) { + x.MagicNumber = &v +} + +func (x *NetworkInfo) SetMsPerBlock(v int64) { + x.MsPerBlock = &v +} + +func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { + x.NetworkConfig = v +} + +func (x *NetworkInfo) HasCurrentEpoch() bool { + if x == nil { + return false + } + return x.CurrentEpoch != nil +} + +func (x *NetworkInfo) HasMagicNumber() bool { + if x == nil { + return false + } + return x.MagicNumber != nil +} + +func (x *NetworkInfo) HasMsPerBlock() bool { + if x == nil { + return false + } + return x.MsPerBlock != nil +} + +func (x *NetworkInfo) HasNetworkConfig() bool { + if x == nil { + return false + } + return x.NetworkConfig != nil +} + +func (x *NetworkInfo) ClearCurrentEpoch() { + x.CurrentEpoch = nil +} + +func (x *NetworkInfo) ClearMagicNumber() { + x.MagicNumber = nil +} + +func (x *NetworkInfo) ClearMsPerBlock() { + x.MsPerBlock = nil +} + +func (x *NetworkInfo) ClearNetworkConfig() { + x.NetworkConfig = nil +} + +type NetworkInfo_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Number of the current epoch in the FrostFS network + CurrentEpoch *uint64 + // Magic number of the sidechain of the FrostFS network + MagicNumber *uint64 + // MillisecondsPerBlock network parameter of the sidechain of the FrostFS + // network + MsPerBlock *int64 + // FrostFS network configuration + NetworkConfig *NetworkConfig +} + +func (b0 NetworkInfo_builder) Build() *NetworkInfo { + m0 := &NetworkInfo{} + b, x := &b0, m0 + _, _ = b, x + x.CurrentEpoch = b.CurrentEpoch + x.MagicNumber = b.MagicNumber + x.MsPerBlock = b.MsPerBlock + x.NetworkConfig = b.NetworkConfig + return m0 +} + +// Administrator-defined Attributes of the FrostFS Storage Node. +// +// `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 +// string. Value can't be empty. +// +// Attributes can be constructed into a chain of attributes: any attribute can +// have a parent attribute and a child attribute (except the first and the +// last one). A string representation of the chain of attributes in FrostFS +// Storage Node configuration uses ":" and "/" symbols, e.g.: +// +// `FrostFS_NODE_ATTRIBUTE_1=key1:val1/key2:val2` +// +// Therefore the string attribute representation in the Node configuration +// must use "\:", "\/" and "\\" escaped symbols if any of them appears in an +// attribute's key or value. +// +// Node's attributes are mostly used during Storage Policy evaluation to +// calculate object's placement and find a set of nodes satisfying policy +// requirements. There are some "well-known" node attributes common to all the +// Storage Nodes in the network and used implicitly with default values if not +// explicitly set: +// +// - Capacity \ +// Total available disk space in Gigabytes. +// - Price \ +// Price in GAS tokens for storing one GB of data during one Epoch. In node +// attributes it's a string presenting floating point number with comma or +// point delimiter for decimal part. In the Network Map it will be saved as +// 64-bit unsigned integer representing number of minimal token fractions. +// - UN-LOCODE \ +// Node's geographic location in +// [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) +// format approximated to the nearest point defined in the standard. +// - CountryCode \ +// Country code in +// [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +// format. Calculated automatically from `UN-LOCODE` attribute. +// - Country \ +// Country short name in English, as defined in +// [ISO-3166](https://www.iso.org/obp/ui/#search). Calculated automatically +// from `UN-LOCODE` attribute. +// - Location \ +// Place names are given, whenever possible, in their national language +// versions as expressed in the Roman alphabet using the 26 characters of +// the character set adopted for international trade data interchange, +// written without diacritics . Calculated automatically from `UN-LOCODE` +// attribute. +// - SubDivCode \ +// Country's administrative subdivision where node is located. Calculated +// automatically from `UN-LOCODE` attribute based on `SubDiv` field. +// Presented in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) +// format. +// - SubDiv \ +// Country's administrative subdivision name, as defined in +// [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). Calculated +// automatically from `UN-LOCODE` attribute. +// - Continent \ +// Node's continent name according to the [Seven-Continent +// model](https://en.wikipedia.org/wiki/Continent#Number). Calculated +// automatically from `UN-LOCODE` attribute. +// - ExternalAddr +// Node's preferred way for communications with external clients. +// Clients SHOULD use these addresses if possible. +// Must contain a comma-separated list of multi-addresses. +// +// For detailed description of each well-known attribute please see the +// corresponding section in FrostFS Technical Specification. +type NodeInfo_Attribute struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Key of the node attribute + Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + // Value of the node attribute + Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + // Parent keys, if any. For example for `City` it could be `Region` and + // `Country`. + Parents []string `protobuf:"bytes,3,rep,name=parents" json:"parents,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeInfo_Attribute) Reset() { + *x = NodeInfo_Attribute{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeInfo_Attribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeInfo_Attribute) ProtoMessage() {} + +func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NodeInfo_Attribute) GetKey() string { + if x != nil && x.Key != nil { + return *x.Key + } + return "" +} + +func (x *NodeInfo_Attribute) GetValue() string { + if x != nil && x.Value != nil { + return *x.Value + } + return "" +} + +func (x *NodeInfo_Attribute) GetParents() []string { + if x != nil { + return x.Parents + } + return nil +} + +func (x *NodeInfo_Attribute) SetKey(v string) { + x.Key = &v +} + +func (x *NodeInfo_Attribute) SetValue(v string) { + x.Value = &v +} + +func (x *NodeInfo_Attribute) SetParents(v []string) { + x.Parents = v +} + +func (x *NodeInfo_Attribute) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *NodeInfo_Attribute) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *NodeInfo_Attribute) ClearKey() { + x.Key = nil +} + +func (x *NodeInfo_Attribute) ClearValue() { + x.Value = nil +} + +type NodeInfo_Attribute_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Key of the node attribute + Key *string + // Value of the node attribute + Value *string + // Parent keys, if any. For example for `City` it could be `Region` and + // `Country`. + Parents []string +} + +func (b0 NodeInfo_Attribute_builder) Build() *NodeInfo_Attribute { + m0 := &NodeInfo_Attribute{} + b, x := &b0, m0 + _, _ = b, x + x.Key = b.Key + x.Value = b.Value + x.Parents = b.Parents + return m0 +} + +// Single configuration parameter. Key MUST be network-unique. +// +// System parameters: +// +// - **AuditFee** \ +// Fee paid by the storage group owner to the Inner Ring member. +// Value: little-endian integer. Default: 0. +// +// - **BasicIncomeRate** \ +// Cost of storing one gigabyte of data for a period of one epoch. Paid by +// container owner to container nodes. +// Value: little-endian integer. Default: 0. +// +// - **ContainerAliasFee** \ +// Fee paid for named container's creation by the container owner. +// Value: little-endian integer. Default: 0. +// +// - **ContainerFee** \ +// Fee paid for container creation by the container owner. +// Value: little-endian integer. Default: 0. +// +// - **EpochDuration** \ +// FrostFS epoch duration measured in Sidechain blocks. +// Value: little-endian integer. Default: 0. +// +// - **HomomorphicHashingDisabled** \ +// Flag of disabling the homomorphic hashing of objects' payload. +// Value: true if any byte != 0. Default: false. +// +// - **InnerRingCandidateFee** \ +// Fee for entrance to the Inner Ring paid by the candidate. +// Value: little-endian integer. Default: 0. +// +// - **MaintenanceModeAllowed** \ +// Flag allowing setting the MAINTENANCE state to storage nodes. +// Value: true if any byte != 0. Default: false. +// +// - **MaxObjectSize** \ +// Maximum size of physically stored FrostFS object measured in bytes. +// Value: little-endian integer. Default: 0. +// +// This value refers to the maximum size of a **physically** stored object +// in FrostFS. However, from a user's perspective, the **logical** size of a +// stored object can be significantly larger. The relationship between the +// physical and logical object sizes is governed by the following formula +// +// ```math +// \mathrm{Stored\ Object\ Size} \le +// \frac{ +// \left(\mathrm{Max\ Object\ Size}\right)^2 +// }{ +// \mathrm{Object\ ID\ Size} +// } +// ``` +// +// This arises from the fact that a tombstone, also being an object, stores +// the IDs of inhumed objects and cannot be divided into smaller objects, +// thus having an upper limit for its size. +// +// For example, if: +// +// - Max Object Size Size = 64 MiB; +// +// - Object ID Size = 32 B; +// +// then: +// ```math +// \mathrm{Stored\ Object\ Size} \le +// \frac{\left(64\ \mathrm{MiB}\right)^2}{32\ \mathrm{B}} = +// \frac{2^{52}}{2^5}\ \mathrm{B} = +// 2^{47}\ \mathrm{B} = +// 128\ \mathrm{TiB} +// ``` +// - **WithdrawFee** \ +// Fee paid for withdrawal of funds paid by the account owner. +// Value: little-endian integer. Default: 0. +// - **MaxECDataCount** \ +// Maximum number of data shards for EC placement policy. +// Value: little-endian integer. Default: 0. +// - **MaxECParityCount** \ +// Maximum number of parity shards for EC placement policy. +// Value: little-endian integer. Default: 0. +type NetworkConfig_Parameter struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Parameter key. UTF-8 encoded string + Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + // Parameter value + Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkConfig_Parameter) Reset() { + *x = NetworkConfig_Parameter{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkConfig_Parameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkConfig_Parameter) ProtoMessage() {} + +func (x *NetworkConfig_Parameter) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkConfig_Parameter) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *NetworkConfig_Parameter) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *NetworkConfig_Parameter) SetKey(v []byte) { + if v == nil { + v = []byte{} + } + x.Key = v +} + +func (x *NetworkConfig_Parameter) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.Value = v +} + +func (x *NetworkConfig_Parameter) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *NetworkConfig_Parameter) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *NetworkConfig_Parameter) ClearKey() { + x.Key = nil +} + +func (x *NetworkConfig_Parameter) ClearValue() { + x.Value = nil +} + +type NetworkConfig_Parameter_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Parameter key. UTF-8 encoded string + Key []byte + // Parameter value + Value []byte +} + +func (b0 NetworkConfig_Parameter_builder) Build() *NetworkConfig_Parameter { + m0 := &NetworkConfig_Parameter{} + b, x := &b0, m0 + _, _ = b, x + x.Key = b.Key + x.Value = b.Value + return m0 +} + +var File_api_netmap_grpc_types_proto protoreflect.FileDescriptor + +var file_api_netmap_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x22, + 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x2b, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, + 0x0a, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x87, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x65, 0x63, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x65, 0x63, 0x44, + 0x61, 0x74, 0x61, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x65, 0x63, 0x5f, 0x70, + 0x61, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0d, 0x65, 0x63, 0x50, 0x61, 0x72, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x86, 0x02, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, + 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, + 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, + 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, + 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x1a, 0x4d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, + 0x22, 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, + 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, + 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, + 0x43, 0x45, 0x10, 0x03, 0x22, 0x50, 0x0a, 0x06, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, + 0x70, 0x6f, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, + 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, + 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, + 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, + 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, + 0x44, 0x10, 0x08, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x4f, 0x54, 0x10, 0x09, 0x12, 0x08, 0x0a, 0x04, + 0x4c, 0x49, 0x4b, 0x45, 0x10, 0x0a, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, + 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, + 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, + 0x42, 0x62, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, + 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, + 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, + 0x07, +} + +var file_api_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_api_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_api_netmap_grpc_types_proto_goTypes = []any{ + (Operation)(0), // 0: neo.fs.v2.netmap.Operation + (Clause)(0), // 1: neo.fs.v2.netmap.Clause + (NodeInfo_State)(0), // 2: neo.fs.v2.netmap.NodeInfo.State + (*Filter)(nil), // 3: neo.fs.v2.netmap.Filter + (*Selector)(nil), // 4: neo.fs.v2.netmap.Selector + (*Replica)(nil), // 5: neo.fs.v2.netmap.Replica + (*PlacementPolicy)(nil), // 6: neo.fs.v2.netmap.PlacementPolicy + (*NodeInfo)(nil), // 7: neo.fs.v2.netmap.NodeInfo + (*Netmap)(nil), // 8: neo.fs.v2.netmap.Netmap + (*NetworkConfig)(nil), // 9: neo.fs.v2.netmap.NetworkConfig + (*NetworkInfo)(nil), // 10: neo.fs.v2.netmap.NetworkInfo + (*NodeInfo_Attribute)(nil), // 11: neo.fs.v2.netmap.NodeInfo.Attribute + (*NetworkConfig_Parameter)(nil), // 12: neo.fs.v2.netmap.NetworkConfig.Parameter +} +var file_api_netmap_grpc_types_proto_depIdxs = []int32{ + 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation + 3, // 1: neo.fs.v2.netmap.Filter.filters:type_name -> neo.fs.v2.netmap.Filter + 1, // 2: neo.fs.v2.netmap.Selector.clause:type_name -> neo.fs.v2.netmap.Clause + 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica + 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector + 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter + 11, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute + 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State + 7, // 8: neo.fs.v2.netmap.Netmap.nodes:type_name -> neo.fs.v2.netmap.NodeInfo + 12, // 9: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter + 9, // 10: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_api_netmap_grpc_types_proto_init() } +func file_api_netmap_grpc_types_proto_init() { + if File_api_netmap_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_netmap_grpc_types_proto_rawDesc, + NumEnums: 3, + NumMessages: 10, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_netmap_grpc_types_proto_goTypes, + DependencyIndexes: file_api_netmap_grpc_types_proto_depIdxs, + EnumInfos: file_api_netmap_grpc_types_proto_enumTypes, + MessageInfos: file_api_netmap_grpc_types_proto_msgTypes, + }.Build() + File_api_netmap_grpc_types_proto = out.File + file_api_netmap_grpc_types_proto_rawDesc = nil + file_api_netmap_grpc_types_proto_goTypes = nil + file_api_netmap_grpc_types_proto_depIdxs = nil +} diff --git a/api/netmap/grpc/types_protoopaque.pb.go b/api/netmap/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..23225258 --- /dev/null +++ b/api/netmap/grpc/types_protoopaque.pb.go @@ -0,0 +1,2001 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/netmap/grpc/types.proto + +//go:build protoopaque + +package netmap + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Operations on filters +type Operation int32 + +const ( + // No Operation defined + Operation_OPERATION_UNSPECIFIED Operation = 0 + // Equal + Operation_EQ Operation = 1 + // Not Equal + Operation_NE Operation = 2 + // Greater then + Operation_GT Operation = 3 + // Greater or equal + Operation_GE Operation = 4 + // Less then + Operation_LT Operation = 5 + // Less or equal + Operation_LE Operation = 6 + // Logical OR + Operation_OR Operation = 7 + // Logical AND + Operation_AND Operation = 8 + // Logical negation + Operation_NOT Operation = 9 + // Matches pattern + Operation_LIKE Operation = 10 +) + +// Enum value maps for Operation. +var ( + Operation_name = map[int32]string{ + 0: "OPERATION_UNSPECIFIED", + 1: "EQ", + 2: "NE", + 3: "GT", + 4: "GE", + 5: "LT", + 6: "LE", + 7: "OR", + 8: "AND", + 9: "NOT", + 10: "LIKE", + } + Operation_value = map[string]int32{ + "OPERATION_UNSPECIFIED": 0, + "EQ": 1, + "NE": 2, + "GT": 3, + "GE": 4, + "LT": 5, + "LE": 6, + "OR": 7, + "AND": 8, + "NOT": 9, + "LIKE": 10, + } +) + +func (x Operation) Enum() *Operation { + p := new(Operation) + *p = x + return p +} + +func (x Operation) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Operation) Descriptor() protoreflect.EnumDescriptor { + return file_api_netmap_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Operation) Type() protoreflect.EnumType { + return &file_api_netmap_grpc_types_proto_enumTypes[0] +} + +func (x Operation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Selector modifier shows how the node set will be formed. By default selector +// just groups nodes into a bucket by attribute, selecting nodes only by their +// hash distance. +type Clause int32 + +const ( + // No modifier defined. Nodes will be selected from the bucket randomly + Clause_CLAUSE_UNSPECIFIED Clause = 0 + // SAME will select only nodes having the same value of bucket attribute + Clause_SAME Clause = 1 + // DISTINCT will select nodes having different values of bucket attribute + Clause_DISTINCT Clause = 2 +) + +// Enum value maps for Clause. +var ( + Clause_name = map[int32]string{ + 0: "CLAUSE_UNSPECIFIED", + 1: "SAME", + 2: "DISTINCT", + } + Clause_value = map[string]int32{ + "CLAUSE_UNSPECIFIED": 0, + "SAME": 1, + "DISTINCT": 2, + } +) + +func (x Clause) Enum() *Clause { + p := new(Clause) + *p = x + return p +} + +func (x Clause) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Clause) Descriptor() protoreflect.EnumDescriptor { + return file_api_netmap_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (Clause) Type() protoreflect.EnumType { + return &file_api_netmap_grpc_types_proto_enumTypes[1] +} + +func (x Clause) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Represents the enumeration of various states of the FrostFS node. +type NodeInfo_State int32 + +const ( + // Unknown state + NodeInfo_UNSPECIFIED NodeInfo_State = 0 + // Active state in the network + NodeInfo_ONLINE NodeInfo_State = 1 + // Network unavailable state + NodeInfo_OFFLINE NodeInfo_State = 2 + // Maintenance state + NodeInfo_MAINTENANCE NodeInfo_State = 3 +) + +// Enum value maps for NodeInfo_State. +var ( + NodeInfo_State_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "ONLINE", + 2: "OFFLINE", + 3: "MAINTENANCE", + } + NodeInfo_State_value = map[string]int32{ + "UNSPECIFIED": 0, + "ONLINE": 1, + "OFFLINE": 2, + "MAINTENANCE": 3, + } +) + +func (x NodeInfo_State) Enum() *NodeInfo_State { + p := new(NodeInfo_State) + *p = x + return p +} + +func (x NodeInfo_State) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NodeInfo_State) Descriptor() protoreflect.EnumDescriptor { + return file_api_netmap_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (NodeInfo_State) Type() protoreflect.EnumType { + return &file_api_netmap_grpc_types_proto_enumTypes[2] +} + +func (x NodeInfo_State) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// This filter will return the subset of nodes from `NetworkMap` or another +// filter's results that will satisfy filter's conditions. +type Filter struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + xxx_hidden_Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + xxx_hidden_Op Operation `protobuf:"varint,3,opt,name=op,enum=neo.fs.v2.netmap.Operation" json:"op,omitempty"` + xxx_hidden_Value *string `protobuf:"bytes,4,opt,name=value" json:"value,omitempty"` + xxx_hidden_Filters *[]*Filter `protobuf:"bytes,5,rep,name=filters" json:"filters,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Filter) Reset() { + *x = Filter{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Filter) ProtoMessage() {} + +func (x *Filter) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Filter) GetName() string { + if x != nil { + if x.xxx_hidden_Name != nil { + return *x.xxx_hidden_Name + } + return "" + } + return "" +} + +func (x *Filter) GetKey() string { + if x != nil { + if x.xxx_hidden_Key != nil { + return *x.xxx_hidden_Key + } + return "" + } + return "" +} + +func (x *Filter) GetOp() Operation { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 2) { + return x.xxx_hidden_Op + } + } + return Operation_OPERATION_UNSPECIFIED +} + +func (x *Filter) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *Filter) GetFilters() []*Filter { + if x != nil { + if x.xxx_hidden_Filters != nil { + return *x.xxx_hidden_Filters + } + } + return nil +} + +func (x *Filter) SetName(v string) { + x.xxx_hidden_Name = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 5) +} + +func (x *Filter) SetKey(v string) { + x.xxx_hidden_Key = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 5) +} + +func (x *Filter) SetOp(v Operation) { + x.xxx_hidden_Op = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 5) +} + +func (x *Filter) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 5) +} + +func (x *Filter) SetFilters(v []*Filter) { + x.xxx_hidden_Filters = &v +} + +func (x *Filter) HasName() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Filter) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Filter) HasOp() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *Filter) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Filter) ClearName() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Name = nil +} + +func (x *Filter) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Key = nil +} + +func (x *Filter) ClearOp() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Op = Operation_OPERATION_UNSPECIFIED +} + +func (x *Filter) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Value = nil +} + +type Filter_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Name of the filter or a reference to a named filter. '*' means + // application to the whole unfiltered NetworkMap. At top level it's used as a + // filter name. At lower levels it's considered to be a reference to another + // named filter + Name *string + // Key to filter + Key *string + // Filtering operation + Op *Operation + // Value to match + Value *string + // List of inner filters. Top level operation will be applied to the whole + // list. + Filters []*Filter +} + +func (b0 Filter_builder) Build() *Filter { + m0 := &Filter{} + b, x := &b0, m0 + _, _ = b, x + if b.Name != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 5) + x.xxx_hidden_Name = b.Name + } + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 5) + x.xxx_hidden_Key = b.Key + } + if b.Op != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 5) + x.xxx_hidden_Op = *b.Op + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 5) + x.xxx_hidden_Value = b.Value + } + x.xxx_hidden_Filters = &b.Filters + return m0 +} + +// Selector chooses a number of nodes from the bucket taking the nearest nodes +// to the provided `ContainerID` by hash distance. +type Selector struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + xxx_hidden_Count uint32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` + xxx_hidden_Clause Clause `protobuf:"varint,3,opt,name=clause,enum=neo.fs.v2.netmap.Clause" json:"clause,omitempty"` + xxx_hidden_Attribute *string `protobuf:"bytes,4,opt,name=attribute" json:"attribute,omitempty"` + xxx_hidden_Filter *string `protobuf:"bytes,5,opt,name=filter" json:"filter,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Selector) Reset() { + *x = Selector{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Selector) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Selector) ProtoMessage() {} + +func (x *Selector) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Selector) GetName() string { + if x != nil { + if x.xxx_hidden_Name != nil { + return *x.xxx_hidden_Name + } + return "" + } + return "" +} + +func (x *Selector) GetCount() uint32 { + if x != nil { + return x.xxx_hidden_Count + } + return 0 +} + +func (x *Selector) GetClause() Clause { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 2) { + return x.xxx_hidden_Clause + } + } + return Clause_CLAUSE_UNSPECIFIED +} + +func (x *Selector) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *Selector) GetFilter() string { + if x != nil { + if x.xxx_hidden_Filter != nil { + return *x.xxx_hidden_Filter + } + return "" + } + return "" +} + +func (x *Selector) SetName(v string) { + x.xxx_hidden_Name = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 5) +} + +func (x *Selector) SetCount(v uint32) { + x.xxx_hidden_Count = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 5) +} + +func (x *Selector) SetClause(v Clause) { + x.xxx_hidden_Clause = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 5) +} + +func (x *Selector) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 5) +} + +func (x *Selector) SetFilter(v string) { + x.xxx_hidden_Filter = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 5) +} + +func (x *Selector) HasName() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Selector) HasCount() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Selector) HasClause() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *Selector) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Selector) HasFilter() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *Selector) ClearName() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Name = nil +} + +func (x *Selector) ClearCount() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Count = 0 +} + +func (x *Selector) ClearClause() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Clause = Clause_CLAUSE_UNSPECIFIED +} + +func (x *Selector) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Attribute = nil +} + +func (x *Selector) ClearFilter() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Filter = nil +} + +type Selector_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Selector name to reference in object placement section + Name *string + // How many nodes to select from the bucket + Count *uint32 + // Selector modifier showing how to form a bucket + Clause *Clause + // Bucket attribute to select from + Attribute *string + // Filter reference to select from + Filter *string +} + +func (b0 Selector_builder) Build() *Selector { + m0 := &Selector{} + b, x := &b0, m0 + _, _ = b, x + if b.Name != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 5) + x.xxx_hidden_Name = b.Name + } + if b.Count != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 5) + x.xxx_hidden_Count = *b.Count + } + if b.Clause != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 5) + x.xxx_hidden_Clause = *b.Clause + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 5) + x.xxx_hidden_Attribute = b.Attribute + } + if b.Filter != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 5) + x.xxx_hidden_Filter = b.Filter + } + return m0 +} + +// Number of object replicas in a set of nodes from the defined selector. If no +// selector set, the root bucket containing all possible nodes will be used by +// default. +type Replica struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Count uint32 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"` + xxx_hidden_Selector *string `protobuf:"bytes,2,opt,name=selector" json:"selector,omitempty"` + xxx_hidden_EcDataCount uint32 `protobuf:"varint,3,opt,name=ec_data_count,json=ecDataCount" json:"ec_data_count,omitempty"` + xxx_hidden_EcParityCount uint32 `protobuf:"varint,4,opt,name=ec_parity_count,json=ecParityCount" json:"ec_parity_count,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Replica) Reset() { + *x = Replica{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Replica) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Replica) ProtoMessage() {} + +func (x *Replica) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Replica) GetCount() uint32 { + if x != nil { + return x.xxx_hidden_Count + } + return 0 +} + +func (x *Replica) GetSelector() string { + if x != nil { + if x.xxx_hidden_Selector != nil { + return *x.xxx_hidden_Selector + } + return "" + } + return "" +} + +func (x *Replica) GetEcDataCount() uint32 { + if x != nil { + return x.xxx_hidden_EcDataCount + } + return 0 +} + +func (x *Replica) GetEcParityCount() uint32 { + if x != nil { + return x.xxx_hidden_EcParityCount + } + return 0 +} + +func (x *Replica) SetCount(v uint32) { + x.xxx_hidden_Count = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *Replica) SetSelector(v string) { + x.xxx_hidden_Selector = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *Replica) SetEcDataCount(v uint32) { + x.xxx_hidden_EcDataCount = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *Replica) SetEcParityCount(v uint32) { + x.xxx_hidden_EcParityCount = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *Replica) HasCount() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Replica) HasSelector() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Replica) HasEcDataCount() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *Replica) HasEcParityCount() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Replica) ClearCount() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Count = 0 +} + +func (x *Replica) ClearSelector() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Selector = nil +} + +func (x *Replica) ClearEcDataCount() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_EcDataCount = 0 +} + +func (x *Replica) ClearEcParityCount() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_EcParityCount = 0 +} + +type Replica_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // How many object replicas to put + Count *uint32 + // Named selector bucket to put replicas + Selector *string + // Data shards count + EcDataCount *uint32 + // Parity shards count + EcParityCount *uint32 +} + +func (b0 Replica_builder) Build() *Replica { + m0 := &Replica{} + b, x := &b0, m0 + _, _ = b, x + if b.Count != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_Count = *b.Count + } + if b.Selector != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_Selector = b.Selector + } + if b.EcDataCount != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_EcDataCount = *b.EcDataCount + } + if b.EcParityCount != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_EcParityCount = *b.EcParityCount + } + return m0 +} + +// Set of rules to select a subset of nodes from `NetworkMap` able to store +// container's objects. The format is simple enough to transpile from different +// storage policy definition languages. +type PlacementPolicy struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Replicas *[]*Replica `protobuf:"bytes,1,rep,name=replicas" json:"replicas,omitempty"` + xxx_hidden_ContainerBackupFactor uint32 `protobuf:"varint,2,opt,name=container_backup_factor,json=containerBackupFactor" json:"container_backup_factor,omitempty"` + xxx_hidden_Selectors *[]*Selector `protobuf:"bytes,3,rep,name=selectors" json:"selectors,omitempty"` + xxx_hidden_Filters *[]*Filter `protobuf:"bytes,4,rep,name=filters" json:"filters,omitempty"` + xxx_hidden_Unique bool `protobuf:"varint,5,opt,name=unique" json:"unique,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PlacementPolicy) Reset() { + *x = PlacementPolicy{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PlacementPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PlacementPolicy) ProtoMessage() {} + +func (x *PlacementPolicy) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PlacementPolicy) GetReplicas() []*Replica { + if x != nil { + if x.xxx_hidden_Replicas != nil { + return *x.xxx_hidden_Replicas + } + } + return nil +} + +func (x *PlacementPolicy) GetContainerBackupFactor() uint32 { + if x != nil { + return x.xxx_hidden_ContainerBackupFactor + } + return 0 +} + +func (x *PlacementPolicy) GetSelectors() []*Selector { + if x != nil { + if x.xxx_hidden_Selectors != nil { + return *x.xxx_hidden_Selectors + } + } + return nil +} + +func (x *PlacementPolicy) GetFilters() []*Filter { + if x != nil { + if x.xxx_hidden_Filters != nil { + return *x.xxx_hidden_Filters + } + } + return nil +} + +func (x *PlacementPolicy) GetUnique() bool { + if x != nil { + return x.xxx_hidden_Unique + } + return false +} + +func (x *PlacementPolicy) SetReplicas(v []*Replica) { + x.xxx_hidden_Replicas = &v +} + +func (x *PlacementPolicy) SetContainerBackupFactor(v uint32) { + x.xxx_hidden_ContainerBackupFactor = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 5) +} + +func (x *PlacementPolicy) SetSelectors(v []*Selector) { + x.xxx_hidden_Selectors = &v +} + +func (x *PlacementPolicy) SetFilters(v []*Filter) { + x.xxx_hidden_Filters = &v +} + +func (x *PlacementPolicy) SetUnique(v bool) { + x.xxx_hidden_Unique = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 5) +} + +func (x *PlacementPolicy) HasContainerBackupFactor() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *PlacementPolicy) HasUnique() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *PlacementPolicy) ClearContainerBackupFactor() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_ContainerBackupFactor = 0 +} + +func (x *PlacementPolicy) ClearUnique() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Unique = false +} + +type PlacementPolicy_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Rules to set number of object replicas and place each one into a named + // bucket + Replicas []*Replica + // Container backup factor controls how deep FrostFS will search for nodes + // alternatives to include into container's nodes subset + ContainerBackupFactor *uint32 + // Set of Selectors to form the container's nodes subset + Selectors []*Selector + // List of named filters to reference in selectors + Filters []*Filter + // Unique flag defines non-overlapping application for replicas + Unique *bool +} + +func (b0 PlacementPolicy_builder) Build() *PlacementPolicy { + m0 := &PlacementPolicy{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Replicas = &b.Replicas + if b.ContainerBackupFactor != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 5) + x.xxx_hidden_ContainerBackupFactor = *b.ContainerBackupFactor + } + x.xxx_hidden_Selectors = &b.Selectors + x.xxx_hidden_Filters = &b.Filters + if b.Unique != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 5) + x.xxx_hidden_Unique = *b.Unique + } + return m0 +} + +// FrostFS node description +type NodeInfo struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey" json:"public_key,omitempty"` + xxx_hidden_Addresses []string `protobuf:"bytes,2,rep,name=addresses" json:"addresses,omitempty"` + xxx_hidden_Attributes *[]*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes" json:"attributes,omitempty"` + xxx_hidden_State NodeInfo_State `protobuf:"varint,4,opt,name=state,enum=neo.fs.v2.netmap.NodeInfo_State" json:"state,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeInfo) Reset() { + *x = NodeInfo{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeInfo) ProtoMessage() {} + +func (x *NodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NodeInfo) GetPublicKey() []byte { + if x != nil { + return x.xxx_hidden_PublicKey + } + return nil +} + +func (x *NodeInfo) GetAddresses() []string { + if x != nil { + return x.xxx_hidden_Addresses + } + return nil +} + +func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { + if x != nil { + if x.xxx_hidden_Attributes != nil { + return *x.xxx_hidden_Attributes + } + } + return nil +} + +func (x *NodeInfo) GetState() NodeInfo_State { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 3) { + return x.xxx_hidden_State + } + } + return NodeInfo_UNSPECIFIED +} + +func (x *NodeInfo) SetPublicKey(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_PublicKey = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *NodeInfo) SetAddresses(v []string) { + x.xxx_hidden_Addresses = v +} + +func (x *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { + x.xxx_hidden_Attributes = &v +} + +func (x *NodeInfo) SetState(v NodeInfo_State) { + x.xxx_hidden_State = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *NodeInfo) HasPublicKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *NodeInfo) HasState() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *NodeInfo) ClearPublicKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_PublicKey = nil +} + +func (x *NodeInfo) ClearState() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_State = NodeInfo_UNSPECIFIED +} + +type NodeInfo_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Public key of the FrostFS node in a binary format + PublicKey []byte + // Ways to connect to a node + Addresses []string + // Carries list of the FrostFS node attributes in a key-value form. Key name + // must be a node-unique valid UTF-8 string. Value can't be empty. NodeInfo + // structures with duplicated attribute names or attributes with empty values + // will be considered invalid. + Attributes []*NodeInfo_Attribute + // Carries state of the FrostFS node + State *NodeInfo_State +} + +func (b0 NodeInfo_builder) Build() *NodeInfo { + m0 := &NodeInfo{} + b, x := &b0, m0 + _, _ = b, x + if b.PublicKey != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_PublicKey = b.PublicKey + } + x.xxx_hidden_Addresses = b.Addresses + x.xxx_hidden_Attributes = &b.Attributes + if b.State != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_State = *b.State + } + return m0 +} + +// Network map structure +type Netmap struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Epoch uint64 `protobuf:"varint,1,opt,name=epoch" json:"epoch,omitempty"` + xxx_hidden_Nodes *[]*NodeInfo `protobuf:"bytes,2,rep,name=nodes" json:"nodes,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Netmap) Reset() { + *x = Netmap{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Netmap) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Netmap) ProtoMessage() {} + +func (x *Netmap) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Netmap) GetEpoch() uint64 { + if x != nil { + return x.xxx_hidden_Epoch + } + return 0 +} + +func (x *Netmap) GetNodes() []*NodeInfo { + if x != nil { + if x.xxx_hidden_Nodes != nil { + return *x.xxx_hidden_Nodes + } + } + return nil +} + +func (x *Netmap) SetEpoch(v uint64) { + x.xxx_hidden_Epoch = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *Netmap) SetNodes(v []*NodeInfo) { + x.xxx_hidden_Nodes = &v +} + +func (x *Netmap) HasEpoch() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Netmap) ClearEpoch() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Epoch = 0 +} + +type Netmap_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Network map revision number. + Epoch *uint64 + // Nodes presented in network. + Nodes []*NodeInfo +} + +func (b0 Netmap_builder) Build() *Netmap { + m0 := &Netmap{} + b, x := &b0, m0 + _, _ = b, x + if b.Epoch != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Epoch = *b.Epoch + } + x.xxx_hidden_Nodes = &b.Nodes + return m0 +} + +// FrostFS network configuration +type NetworkConfig struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Parameters *[]*NetworkConfig_Parameter `protobuf:"bytes,1,rep,name=parameters" json:"parameters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkConfig) Reset() { + *x = NetworkConfig{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkConfig) ProtoMessage() {} + +func (x *NetworkConfig) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkConfig) GetParameters() []*NetworkConfig_Parameter { + if x != nil { + if x.xxx_hidden_Parameters != nil { + return *x.xxx_hidden_Parameters + } + } + return nil +} + +func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) { + x.xxx_hidden_Parameters = &v +} + +type NetworkConfig_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of parameter values + Parameters []*NetworkConfig_Parameter +} + +func (b0 NetworkConfig_builder) Build() *NetworkConfig { + m0 := &NetworkConfig{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Parameters = &b.Parameters + return m0 +} + +// Information about FrostFS network +type NetworkInfo struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_CurrentEpoch uint64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch" json:"current_epoch,omitempty"` + xxx_hidden_MagicNumber uint64 `protobuf:"varint,2,opt,name=magic_number,json=magicNumber" json:"magic_number,omitempty"` + xxx_hidden_MsPerBlock int64 `protobuf:"varint,3,opt,name=ms_per_block,json=msPerBlock" json:"ms_per_block,omitempty"` + xxx_hidden_NetworkConfig *NetworkConfig `protobuf:"bytes,4,opt,name=network_config,json=networkConfig" json:"network_config,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkInfo) Reset() { + *x = NetworkInfo{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkInfo) ProtoMessage() {} + +func (x *NetworkInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkInfo) GetCurrentEpoch() uint64 { + if x != nil { + return x.xxx_hidden_CurrentEpoch + } + return 0 +} + +func (x *NetworkInfo) GetMagicNumber() uint64 { + if x != nil { + return x.xxx_hidden_MagicNumber + } + return 0 +} + +func (x *NetworkInfo) GetMsPerBlock() int64 { + if x != nil { + return x.xxx_hidden_MsPerBlock + } + return 0 +} + +func (x *NetworkInfo) GetNetworkConfig() *NetworkConfig { + if x != nil { + return x.xxx_hidden_NetworkConfig + } + return nil +} + +func (x *NetworkInfo) SetCurrentEpoch(v uint64) { + x.xxx_hidden_CurrentEpoch = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 4) +} + +func (x *NetworkInfo) SetMagicNumber(v uint64) { + x.xxx_hidden_MagicNumber = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *NetworkInfo) SetMsPerBlock(v int64) { + x.xxx_hidden_MsPerBlock = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { + x.xxx_hidden_NetworkConfig = v +} + +func (x *NetworkInfo) HasCurrentEpoch() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *NetworkInfo) HasMagicNumber() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *NetworkInfo) HasMsPerBlock() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *NetworkInfo) HasNetworkConfig() bool { + if x == nil { + return false + } + return x.xxx_hidden_NetworkConfig != nil +} + +func (x *NetworkInfo) ClearCurrentEpoch() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_CurrentEpoch = 0 +} + +func (x *NetworkInfo) ClearMagicNumber() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_MagicNumber = 0 +} + +func (x *NetworkInfo) ClearMsPerBlock() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_MsPerBlock = 0 +} + +func (x *NetworkInfo) ClearNetworkConfig() { + x.xxx_hidden_NetworkConfig = nil +} + +type NetworkInfo_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Number of the current epoch in the FrostFS network + CurrentEpoch *uint64 + // Magic number of the sidechain of the FrostFS network + MagicNumber *uint64 + // MillisecondsPerBlock network parameter of the sidechain of the FrostFS + // network + MsPerBlock *int64 + // FrostFS network configuration + NetworkConfig *NetworkConfig +} + +func (b0 NetworkInfo_builder) Build() *NetworkInfo { + m0 := &NetworkInfo{} + b, x := &b0, m0 + _, _ = b, x + if b.CurrentEpoch != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 4) + x.xxx_hidden_CurrentEpoch = *b.CurrentEpoch + } + if b.MagicNumber != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_MagicNumber = *b.MagicNumber + } + if b.MsPerBlock != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_MsPerBlock = *b.MsPerBlock + } + x.xxx_hidden_NetworkConfig = b.NetworkConfig + return m0 +} + +// Administrator-defined Attributes of the FrostFS Storage Node. +// +// `Attribute` is a Key-Value metadata pair. Key name must be a valid UTF-8 +// string. Value can't be empty. +// +// Attributes can be constructed into a chain of attributes: any attribute can +// have a parent attribute and a child attribute (except the first and the +// last one). A string representation of the chain of attributes in FrostFS +// Storage Node configuration uses ":" and "/" symbols, e.g.: +// +// `FrostFS_NODE_ATTRIBUTE_1=key1:val1/key2:val2` +// +// Therefore the string attribute representation in the Node configuration +// must use "\:", "\/" and "\\" escaped symbols if any of them appears in an +// attribute's key or value. +// +// Node's attributes are mostly used during Storage Policy evaluation to +// calculate object's placement and find a set of nodes satisfying policy +// requirements. There are some "well-known" node attributes common to all the +// Storage Nodes in the network and used implicitly with default values if not +// explicitly set: +// +// - Capacity \ +// Total available disk space in Gigabytes. +// - Price \ +// Price in GAS tokens for storing one GB of data during one Epoch. In node +// attributes it's a string presenting floating point number with comma or +// point delimiter for decimal part. In the Network Map it will be saved as +// 64-bit unsigned integer representing number of minimal token fractions. +// - UN-LOCODE \ +// Node's geographic location in +// [UN/LOCODE](https://www.unece.org/cefact/codesfortrade/codes_index.html) +// format approximated to the nearest point defined in the standard. +// - CountryCode \ +// Country code in +// [ISO 3166-1_alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +// format. Calculated automatically from `UN-LOCODE` attribute. +// - Country \ +// Country short name in English, as defined in +// [ISO-3166](https://www.iso.org/obp/ui/#search). Calculated automatically +// from `UN-LOCODE` attribute. +// - Location \ +// Place names are given, whenever possible, in their national language +// versions as expressed in the Roman alphabet using the 26 characters of +// the character set adopted for international trade data interchange, +// written without diacritics . Calculated automatically from `UN-LOCODE` +// attribute. +// - SubDivCode \ +// Country's administrative subdivision where node is located. Calculated +// automatically from `UN-LOCODE` attribute based on `SubDiv` field. +// Presented in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) +// format. +// - SubDiv \ +// Country's administrative subdivision name, as defined in +// [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). Calculated +// automatically from `UN-LOCODE` attribute. +// - Continent \ +// Node's continent name according to the [Seven-Continent +// model](https://en.wikipedia.org/wiki/Continent#Number). Calculated +// automatically from `UN-LOCODE` attribute. +// - ExternalAddr +// Node's preferred way for communications with external clients. +// Clients SHOULD use these addresses if possible. +// Must contain a comma-separated list of multi-addresses. +// +// For detailed description of each well-known attribute please see the +// corresponding section in FrostFS Technical Specification. +type NodeInfo_Attribute struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + xxx_hidden_Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + xxx_hidden_Parents []string `protobuf:"bytes,3,rep,name=parents" json:"parents,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NodeInfo_Attribute) Reset() { + *x = NodeInfo_Attribute{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NodeInfo_Attribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeInfo_Attribute) ProtoMessage() {} + +func (x *NodeInfo_Attribute) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NodeInfo_Attribute) GetKey() string { + if x != nil { + if x.xxx_hidden_Key != nil { + return *x.xxx_hidden_Key + } + return "" + } + return "" +} + +func (x *NodeInfo_Attribute) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *NodeInfo_Attribute) GetParents() []string { + if x != nil { + return x.xxx_hidden_Parents + } + return nil +} + +func (x *NodeInfo_Attribute) SetKey(v string) { + x.xxx_hidden_Key = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *NodeInfo_Attribute) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *NodeInfo_Attribute) SetParents(v []string) { + x.xxx_hidden_Parents = v +} + +func (x *NodeInfo_Attribute) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *NodeInfo_Attribute) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *NodeInfo_Attribute) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Key = nil +} + +func (x *NodeInfo_Attribute) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Value = nil +} + +type NodeInfo_Attribute_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Key of the node attribute + Key *string + // Value of the node attribute + Value *string + // Parent keys, if any. For example for `City` it could be `Region` and + // `Country`. + Parents []string +} + +func (b0 NodeInfo_Attribute_builder) Build() *NodeInfo_Attribute { + m0 := &NodeInfo_Attribute{} + b, x := &b0, m0 + _, _ = b, x + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_Key = b.Key + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Value = b.Value + } + x.xxx_hidden_Parents = b.Parents + return m0 +} + +// Single configuration parameter. Key MUST be network-unique. +// +// System parameters: +// +// - **AuditFee** \ +// Fee paid by the storage group owner to the Inner Ring member. +// Value: little-endian integer. Default: 0. +// +// - **BasicIncomeRate** \ +// Cost of storing one gigabyte of data for a period of one epoch. Paid by +// container owner to container nodes. +// Value: little-endian integer. Default: 0. +// +// - **ContainerAliasFee** \ +// Fee paid for named container's creation by the container owner. +// Value: little-endian integer. Default: 0. +// +// - **ContainerFee** \ +// Fee paid for container creation by the container owner. +// Value: little-endian integer. Default: 0. +// +// - **EpochDuration** \ +// FrostFS epoch duration measured in Sidechain blocks. +// Value: little-endian integer. Default: 0. +// +// - **HomomorphicHashingDisabled** \ +// Flag of disabling the homomorphic hashing of objects' payload. +// Value: true if any byte != 0. Default: false. +// +// - **InnerRingCandidateFee** \ +// Fee for entrance to the Inner Ring paid by the candidate. +// Value: little-endian integer. Default: 0. +// +// - **MaintenanceModeAllowed** \ +// Flag allowing setting the MAINTENANCE state to storage nodes. +// Value: true if any byte != 0. Default: false. +// +// - **MaxObjectSize** \ +// Maximum size of physically stored FrostFS object measured in bytes. +// Value: little-endian integer. Default: 0. +// +// This value refers to the maximum size of a **physically** stored object +// in FrostFS. However, from a user's perspective, the **logical** size of a +// stored object can be significantly larger. The relationship between the +// physical and logical object sizes is governed by the following formula +// +// ```math +// \mathrm{Stored\ Object\ Size} \le +// \frac{ +// \left(\mathrm{Max\ Object\ Size}\right)^2 +// }{ +// \mathrm{Object\ ID\ Size} +// } +// ``` +// +// This arises from the fact that a tombstone, also being an object, stores +// the IDs of inhumed objects and cannot be divided into smaller objects, +// thus having an upper limit for its size. +// +// For example, if: +// +// - Max Object Size Size = 64 MiB; +// +// - Object ID Size = 32 B; +// +// then: +// ```math +// \mathrm{Stored\ Object\ Size} \le +// \frac{\left(64\ \mathrm{MiB}\right)^2}{32\ \mathrm{B}} = +// \frac{2^{52}}{2^5}\ \mathrm{B} = +// 2^{47}\ \mathrm{B} = +// 128\ \mathrm{TiB} +// ``` +// - **WithdrawFee** \ +// Fee paid for withdrawal of funds paid by the account owner. +// Value: little-endian integer. Default: 0. +// - **MaxECDataCount** \ +// Maximum number of data shards for EC placement policy. +// Value: little-endian integer. Default: 0. +// - **MaxECParityCount** \ +// Maximum number of parity shards for EC placement policy. +// Value: little-endian integer. Default: 0. +type NetworkConfig_Parameter struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + xxx_hidden_Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NetworkConfig_Parameter) Reset() { + *x = NetworkConfig_Parameter{} + mi := &file_api_netmap_grpc_types_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NetworkConfig_Parameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NetworkConfig_Parameter) ProtoMessage() {} + +func (x *NetworkConfig_Parameter) ProtoReflect() protoreflect.Message { + mi := &file_api_netmap_grpc_types_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *NetworkConfig_Parameter) GetKey() []byte { + if x != nil { + return x.xxx_hidden_Key + } + return nil +} + +func (x *NetworkConfig_Parameter) GetValue() []byte { + if x != nil { + return x.xxx_hidden_Value + } + return nil +} + +func (x *NetworkConfig_Parameter) SetKey(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Key = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *NetworkConfig_Parameter) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Value = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *NetworkConfig_Parameter) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *NetworkConfig_Parameter) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *NetworkConfig_Parameter) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Key = nil +} + +func (x *NetworkConfig_Parameter) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Value = nil +} + +type NetworkConfig_Parameter_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Parameter key. UTF-8 encoded string + Key []byte + // Parameter value + Value []byte +} + +func (b0 NetworkConfig_Parameter_builder) Build() *NetworkConfig_Parameter { + m0 := &NetworkConfig_Parameter{} + b, x := &b0, m0 + _, _ = b, x + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Key = b.Key + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +var File_api_netmap_grpc_types_proto protoreflect.FileDescriptor + +var file_api_netmap_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x22, + 0xa5, 0x01, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x2b, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, + 0x0a, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x75, 0x73, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x87, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x65, 0x63, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x65, 0x63, 0x44, + 0x61, 0x74, 0x61, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x65, 0x63, 0x5f, 0x70, + 0x61, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0d, 0x65, 0x63, 0x50, 0x61, 0x72, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x86, 0x02, 0x0a, 0x0f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, + 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x46, 0x61, 0x63, + 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x52, 0x09, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x32, 0x0a, + 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x22, 0xd8, 0x02, 0x0a, 0x08, 0x4e, 0x6f, + 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x1a, 0x4d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, + 0x22, 0x42, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, + 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, + 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, + 0x43, 0x45, 0x10, 0x03, 0x22, 0x50, 0x0a, 0x06, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, + 0x70, 0x6f, 0x63, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x4e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x49, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x21, 0x0a, + 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x0e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2a, 0x7a, 0x0a, 0x09, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x45, + 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x45, + 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x54, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x45, + 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, + 0x44, 0x10, 0x08, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x4f, 0x54, 0x10, 0x09, 0x12, 0x08, 0x0a, 0x04, + 0x4c, 0x49, 0x4b, 0x45, 0x10, 0x0a, 0x2a, 0x38, 0x0a, 0x06, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, + 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4c, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, + 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x53, 0x54, 0x49, 0x4e, 0x43, 0x54, 0x10, 0x02, + 0x42, 0x62, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, + 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, + 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x3b, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4e, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, + 0x07, +} + +var file_api_netmap_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_api_netmap_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_api_netmap_grpc_types_proto_goTypes = []any{ + (Operation)(0), // 0: neo.fs.v2.netmap.Operation + (Clause)(0), // 1: neo.fs.v2.netmap.Clause + (NodeInfo_State)(0), // 2: neo.fs.v2.netmap.NodeInfo.State + (*Filter)(nil), // 3: neo.fs.v2.netmap.Filter + (*Selector)(nil), // 4: neo.fs.v2.netmap.Selector + (*Replica)(nil), // 5: neo.fs.v2.netmap.Replica + (*PlacementPolicy)(nil), // 6: neo.fs.v2.netmap.PlacementPolicy + (*NodeInfo)(nil), // 7: neo.fs.v2.netmap.NodeInfo + (*Netmap)(nil), // 8: neo.fs.v2.netmap.Netmap + (*NetworkConfig)(nil), // 9: neo.fs.v2.netmap.NetworkConfig + (*NetworkInfo)(nil), // 10: neo.fs.v2.netmap.NetworkInfo + (*NodeInfo_Attribute)(nil), // 11: neo.fs.v2.netmap.NodeInfo.Attribute + (*NetworkConfig_Parameter)(nil), // 12: neo.fs.v2.netmap.NetworkConfig.Parameter +} +var file_api_netmap_grpc_types_proto_depIdxs = []int32{ + 0, // 0: neo.fs.v2.netmap.Filter.op:type_name -> neo.fs.v2.netmap.Operation + 3, // 1: neo.fs.v2.netmap.Filter.filters:type_name -> neo.fs.v2.netmap.Filter + 1, // 2: neo.fs.v2.netmap.Selector.clause:type_name -> neo.fs.v2.netmap.Clause + 5, // 3: neo.fs.v2.netmap.PlacementPolicy.replicas:type_name -> neo.fs.v2.netmap.Replica + 4, // 4: neo.fs.v2.netmap.PlacementPolicy.selectors:type_name -> neo.fs.v2.netmap.Selector + 3, // 5: neo.fs.v2.netmap.PlacementPolicy.filters:type_name -> neo.fs.v2.netmap.Filter + 11, // 6: neo.fs.v2.netmap.NodeInfo.attributes:type_name -> neo.fs.v2.netmap.NodeInfo.Attribute + 2, // 7: neo.fs.v2.netmap.NodeInfo.state:type_name -> neo.fs.v2.netmap.NodeInfo.State + 7, // 8: neo.fs.v2.netmap.Netmap.nodes:type_name -> neo.fs.v2.netmap.NodeInfo + 12, // 9: neo.fs.v2.netmap.NetworkConfig.parameters:type_name -> neo.fs.v2.netmap.NetworkConfig.Parameter + 9, // 10: neo.fs.v2.netmap.NetworkInfo.network_config:type_name -> neo.fs.v2.netmap.NetworkConfig + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_api_netmap_grpc_types_proto_init() } +func file_api_netmap_grpc_types_proto_init() { + if File_api_netmap_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_netmap_grpc_types_proto_rawDesc, + NumEnums: 3, + NumMessages: 10, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_netmap_grpc_types_proto_goTypes, + DependencyIndexes: file_api_netmap_grpc_types_proto_depIdxs, + EnumInfos: file_api_netmap_grpc_types_proto_enumTypes, + MessageInfos: file_api_netmap_grpc_types_proto_msgTypes, + }.Build() + File_api_netmap_grpc_types_proto = out.File + file_api_netmap_grpc_types_proto_rawDesc = nil + file_api_netmap_grpc_types_proto_goTypes = nil + file_api_netmap_grpc_types_proto_depIdxs = nil +} diff --git a/api/netmap/json.go b/api/netmap/json.go new file mode 100644 index 00000000..6a1c2571 --- /dev/null +++ b/api/netmap/json.go @@ -0,0 +1,62 @@ +package netmap + +import ( + netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (p *PlacementPolicy) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(p) +} + +func (p *PlacementPolicy) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(p, data, new(netmap.PlacementPolicy)) +} + +func (f *Filter) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(f) +} + +func (f *Filter) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(f, data, new(netmap.Filter)) +} + +func (s *Selector) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(s) +} + +func (s *Selector) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(s, data, new(netmap.Selector)) +} + +func (r *Replica) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(r) +} + +func (r *Replica) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(r, data, new(netmap.Replica)) +} + +func (a *Attribute) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(a) +} + +func (a *Attribute) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(a, data, new(netmap.NodeInfo_Attribute)) +} + +func (ni *NodeInfo) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(ni) +} + +func (ni *NodeInfo) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(ni, data, new(netmap.NodeInfo)) +} + +func (i *NetworkInfo) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(i) +} + +func (i *NetworkInfo) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(i, data, new(netmap.NetworkInfo)) +} diff --git a/api/netmap/marshal.go b/api/netmap/marshal.go new file mode 100644 index 00000000..4d5e4f18 --- /dev/null +++ b/api/netmap/marshal.go @@ -0,0 +1,576 @@ +package netmap + +import ( + netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + nameFilterField = 1 + keyFilterField = 2 + opFilterField = 3 + valueFilterField = 4 + filtersFilterField = 5 + + nameSelectorField = 1 + countSelectorField = 2 + clauseSelectorField = 3 + attributeSelectorField = 4 + filterSelectorField = 5 + + countReplicaField = 1 + selectorReplicaField = 2 + ecDataCountReplicaField = 3 + ecParityCountReplicaField = 4 + + replicasPolicyField = 1 + backupPolicyField = 2 + selectorsPolicyField = 3 + filtersPolicyField = 4 + uniquePolicyField = 5 + + keyAttributeField = 1 + valueAttributeField = 2 + parentsAttributeField = 3 + + keyNodeInfoField = 1 + addressNodeInfoField = 2 + attributesNodeInfoField = 3 + stateNodeInfoField = 4 + + versionInfoResponseBodyField = 1 + nodeInfoResponseBodyField = 2 +) + +func (f *Filter) StableMarshal(buf []byte) []byte { + if f == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, f.StableSize()) + } + + var offset int + + offset += protoutil.StringMarshal(nameFilterField, buf[offset:], f.name) + offset += protoutil.StringMarshal(keyFilterField, buf[offset:], f.key) + offset += protoutil.EnumMarshal(opFilterField, buf[offset:], int32(f.op)) + offset += protoutil.StringMarshal(valueFilterField, buf[offset:], f.value) + + for i := range f.filters { + offset += protoutil.NestedStructureMarshal(filtersFilterField, buf[offset:], &f.filters[i]) + } + + return buf +} + +func (f *Filter) StableSize() (size int) { + if f == nil { + return 0 + } + + size += protoutil.StringSize(nameFilterField, f.name) + size += protoutil.StringSize(keyFilterField, f.key) + size += protoutil.EnumSize(opFilterField, int32(f.op)) + size += protoutil.StringSize(valueFilterField, f.value) + for i := range f.filters { + size += protoutil.NestedStructureSize(filtersFilterField, &f.filters[i]) + } + + return size +} + +func (f *Filter) Unmarshal(data []byte) error { + return message.Unmarshal(f, data, new(netmap.Filter)) +} + +func (s *Selector) StableMarshal(buf []byte) []byte { + if s == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var offset int + + offset += protoutil.StringMarshal(nameSelectorField, buf[offset:], s.name) + offset += protoutil.UInt32Marshal(countSelectorField, buf[offset:], s.count) + offset += protoutil.EnumMarshal(clauseSelectorField, buf[offset:], int32(s.clause)) + offset += protoutil.StringMarshal(attributeSelectorField, buf[offset:], s.attribute) + protoutil.StringMarshal(filterSelectorField, buf[offset:], s.filter) + + return buf +} + +func (s *Selector) StableSize() (size int) { + if s == nil { + return 0 + } + + size += protoutil.StringSize(nameSelectorField, s.name) + size += protoutil.UInt32Size(countSelectorField, s.count) + size += protoutil.EnumSize(countSelectorField, int32(s.clause)) + size += protoutil.StringSize(attributeSelectorField, s.attribute) + size += protoutil.StringSize(filterSelectorField, s.filter) + + return size +} + +func (s *Selector) Unmarshal(data []byte) error { + return message.Unmarshal(s, data, new(netmap.Selector)) +} + +func (r *Replica) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += protoutil.UInt32Marshal(countReplicaField, buf[offset:], r.count) + offset += protoutil.StringMarshal(selectorReplicaField, buf[offset:], r.selector) + offset += protoutil.UInt32Marshal(ecDataCountReplicaField, buf[offset:], r.ecDataCount) + protoutil.UInt32Marshal(ecParityCountReplicaField, buf[offset:], r.ecParityCount) + + return buf +} + +func (r *Replica) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.UInt32Size(countReplicaField, r.count) + size += protoutil.StringSize(selectorReplicaField, r.selector) + size += protoutil.UInt32Size(ecDataCountReplicaField, r.ecDataCount) + size += protoutil.UInt32Size(ecParityCountReplicaField, r.ecParityCount) + + return size +} + +func (r *Replica) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(netmap.Replica)) +} + +func (p *PlacementPolicy) StableMarshal(buf []byte) []byte { + if p == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, p.StableSize()) + } + + var offset int + + for i := range p.replicas { + offset += protoutil.NestedStructureMarshal(replicasPolicyField, buf[offset:], &p.replicas[i]) + } + + offset += protoutil.UInt32Marshal(backupPolicyField, buf[offset:], p.backupFactor) + + for i := range p.selectors { + offset += protoutil.NestedStructureMarshal(selectorsPolicyField, buf[offset:], &p.selectors[i]) + } + + for i := range p.filters { + offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i]) + } + + protoutil.BoolMarshal(uniquePolicyField, buf[offset:], p.unique) + + return buf +} + +func (p *PlacementPolicy) StableSize() (size int) { + if p == nil { + return 0 + } + + for i := range p.replicas { + size += protoutil.NestedStructureSize(replicasPolicyField, &p.replicas[i]) + } + + size += protoutil.UInt32Size(backupPolicyField, p.backupFactor) + + for i := range p.selectors { + size += protoutil.NestedStructureSize(selectorsPolicyField, &p.selectors[i]) + } + + for i := range p.filters { + size += protoutil.NestedStructureSize(filtersPolicyField, &p.filters[i]) + } + + size += protoutil.BoolSize(uniquePolicyField, p.unique) + + return size +} + +func (p *PlacementPolicy) Unmarshal(data []byte) error { + return message.Unmarshal(p, data, new(netmap.PlacementPolicy)) +} + +func (a *Attribute) StableMarshal(buf []byte) []byte { + if a == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var offset int + + offset += protoutil.StringMarshal(keyAttributeField, buf[offset:], a.key) + offset += protoutil.StringMarshal(valueAttributeField, buf[offset:], a.value) + + for i := range a.parents { + offset += protoutil.StringMarshal(parentsAttributeField, buf[offset:], a.parents[i]) + } + + return buf +} + +func (a *Attribute) StableSize() (size int) { + if a == nil { + return 0 + } + + size += protoutil.StringSize(keyAttributeField, a.key) + size += protoutil.StringSize(valueAttributeField, a.value) + + for i := range a.parents { + size += protoutil.StringSize(parentsAttributeField, a.parents[i]) + } + + return size +} + +func (a *Attribute) Unmarshal(data []byte) error { + return message.Unmarshal(a, data, new(netmap.NodeInfo_Attribute)) +} + +func (ni *NodeInfo) StableMarshal(buf []byte) []byte { + if ni == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, ni.StableSize()) + } + + var offset int + + offset += protoutil.BytesMarshal(keyNodeInfoField, buf[offset:], ni.publicKey) + offset += protoutil.RepeatedStringMarshal(addressNodeInfoField, buf[offset:], ni.addresses) + + for i := range ni.attributes { + offset += protoutil.NestedStructureMarshal(attributesNodeInfoField, buf[offset:], &ni.attributes[i]) + } + + protoutil.EnumMarshal(stateNodeInfoField, buf[offset:], int32(ni.state)) + + return buf +} + +func (ni *NodeInfo) StableSize() (size int) { + if ni == nil { + return 0 + } + + size += protoutil.BytesSize(keyNodeInfoField, ni.publicKey) + size += protoutil.RepeatedStringSize(addressNodeInfoField, ni.addresses) + + for i := range ni.attributes { + size += protoutil.NestedStructureSize(attributesNodeInfoField, &ni.attributes[i]) + } + + size += protoutil.EnumSize(stateNodeInfoField, int32(ni.state)) + + return size +} + +func (ni *NodeInfo) Unmarshal(data []byte) error { + return message.Unmarshal(ni, data, new(netmap.NodeInfo)) +} + +func (l *LocalNodeInfoRequestBody) StableMarshal(_ []byte) []byte { + return nil +} + +func (l *LocalNodeInfoRequestBody) StableSize() (size int) { + return 0 +} + +func (l *LocalNodeInfoRequestBody) Unmarshal([]byte) error { + return nil +} + +func (l *LocalNodeInfoResponseBody) StableMarshal(buf []byte) []byte { + if l == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, l.StableSize()) + } + + var offset int + + offset += protoutil.NestedStructureMarshal(versionInfoResponseBodyField, buf[offset:], l.version) + protoutil.NestedStructureMarshal(nodeInfoResponseBodyField, buf[offset:], l.nodeInfo) + + return buf +} + +func (l *LocalNodeInfoResponseBody) StableSize() (size int) { + if l == nil { + return 0 + } + + size += protoutil.NestedStructureSize(versionInfoResponseBodyField, l.version) + size += protoutil.NestedStructureSize(nodeInfoResponseBodyField, l.nodeInfo) + + return size +} + +func (l *LocalNodeInfoResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(l, data, new(netmap.LocalNodeInfoResponse_Body)) +} + +const ( + _ = iota + netPrmKeyFNum + netPrmValFNum +) + +func (x *NetworkParameter) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var offset int + + offset += protoutil.BytesMarshal(netPrmKeyFNum, buf[offset:], x.k) + protoutil.BytesMarshal(netPrmValFNum, buf[offset:], x.v) + + return buf +} + +func (x *NetworkParameter) StableSize() (size int) { + if x == nil { + return 0 + } + + size += protoutil.BytesSize(netPrmKeyFNum, x.k) + size += protoutil.BytesSize(netPrmValFNum, x.v) + + return size +} + +const ( + _ = iota + netCfgPrmsFNum +) + +func (x *NetworkConfig) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var offset int + + for i := range x.ps { + offset += protoutil.NestedStructureMarshal(netCfgPrmsFNum, buf[offset:], &x.ps[i]) + } + + return buf +} + +func (x *NetworkConfig) StableSize() (size int) { + if x == nil { + return 0 + } + + for i := range x.ps { + size += protoutil.NestedStructureSize(netCfgPrmsFNum, &x.ps[i]) + } + + return size +} + +const ( + _ = iota + netInfoCurEpochFNum + netInfoMagicNumFNum + netInfoMSPerBlockFNum + netInfoCfgFNum +) + +func (i *NetworkInfo) StableMarshal(buf []byte) []byte { + if i == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, i.StableSize()) + } + + var offset int + + offset += protoutil.UInt64Marshal(netInfoCurEpochFNum, buf[offset:], i.curEpoch) + offset += protoutil.UInt64Marshal(netInfoMagicNumFNum, buf[offset:], i.magicNum) + offset += protoutil.Int64Marshal(netInfoMSPerBlockFNum, buf[offset:], i.msPerBlock) + protoutil.NestedStructureMarshal(netInfoCfgFNum, buf[offset:], i.netCfg) + + return buf +} + +func (i *NetworkInfo) StableSize() (size int) { + if i == nil { + return 0 + } + + size += protoutil.UInt64Size(netInfoCurEpochFNum, i.curEpoch) + size += protoutil.UInt64Size(netInfoMagicNumFNum, i.magicNum) + size += protoutil.Int64Size(netInfoMSPerBlockFNum, i.msPerBlock) + size += protoutil.NestedStructureSize(netInfoCfgFNum, i.netCfg) + + return size +} + +func (i *NetworkInfo) Unmarshal(data []byte) error { + return message.Unmarshal(i, data, new(netmap.NetworkInfo)) +} + +func (l *NetworkInfoRequestBody) StableMarshal(_ []byte) []byte { + return nil +} + +func (l *NetworkInfoRequestBody) StableSize() (size int) { + return 0 +} + +func (l *NetworkInfoRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(l, data, new(netmap.NetworkInfoRequest_Body)) +} + +const ( + _ = iota + netInfoRespBodyNetInfoFNum +) + +func (i *NetworkInfoResponseBody) StableMarshal(buf []byte) []byte { + if i == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, i.StableSize()) + } + + protoutil.NestedStructureMarshal(netInfoRespBodyNetInfoFNum, buf, i.netInfo) + + return buf +} + +func (i *NetworkInfoResponseBody) StableSize() (size int) { + if i == nil { + return 0 + } + + size += protoutil.NestedStructureSize(netInfoRespBodyNetInfoFNum, i.netInfo) + + return size +} + +func (i *NetworkInfoResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(i, data, new(netmap.NetworkInfoResponse_Body)) +} + +const ( + _ = iota + fNumNetMapEpoch + fNumNetMapNodes +) + +func (x *NetMap) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + offset := protoutil.UInt64Marshal(fNumNetMapEpoch, buf, x.epoch) + + for i := range x.nodes { + offset += protoutil.NestedStructureMarshal(fNumNetMapNodes, buf[offset:], &x.nodes[i]) + } + + return buf +} + +func (x *NetMap) StableSize() (size int) { + if x != nil { + size = protoutil.UInt64Size(fNumNetMapEpoch, x.epoch) + + for i := range x.nodes { + size += protoutil.NestedStructureSize(fNumNetMapNodes, &x.nodes[i]) + } + } + + return +} + +func (x *SnapshotRequestBody) StableMarshal([]byte) []byte { + return nil +} + +func (x *SnapshotRequestBody) StableSize() int { + return 0 +} + +const ( + _ = iota + fNumSnapshotResponseBodyNetMap +) + +func (x *SnapshotResponseBody) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + protoutil.NestedStructureMarshal(fNumSnapshotResponseBodyNetMap, buf, x.netMap) + + return buf +} + +func (x *SnapshotResponseBody) StableSize() (size int) { + if x != nil { + size = protoutil.NestedStructureSize(fNumSnapshotResponseBodyNetMap, x.netMap) + } + + return +} diff --git a/api/netmap/message_test.go b/api/netmap/message_test.go new file mode 100644 index 00000000..2406ece3 --- /dev/null +++ b/api/netmap/message_test.go @@ -0,0 +1,32 @@ +package netmap_test + +import ( + "testing" + + netmaptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return netmaptest.GenerateFilter(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSelector(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateReplica(empty) }, + func(empty bool) message.Message { return netmaptest.GeneratePlacementPolicy(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateAttribute(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNodeInfo(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateLocalNodeInfoRequest(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateLocalNodeInfoResponseBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkParameter(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkConfig(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkInfo(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoRequest(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetworkInfoResponseBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateNetMap(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSnapshotRequestBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSnapshotRequest(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSnapshotResponseBody(empty) }, + func(empty bool) message.Message { return netmaptest.GenerateSnapshotResponse(empty) }, + ) +} diff --git a/api/netmap/string.go b/api/netmap/string.go new file mode 100644 index 00000000..7b9c1467 --- /dev/null +++ b/api/netmap/string.go @@ -0,0 +1,62 @@ +package netmap + +import ( + netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc" +) + +// String returns string representation of Clause. +func (x Clause) String() string { + return ClauseToGRPCMessage(x).String() +} + +// FromString parses Clause from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Clause) FromString(s string) bool { + g, ok := netmap.Clause_value[s] + + if ok { + *x = ClauseFromGRPCMessage(netmap.Clause(g)) + } + + return ok +} + +// String returns string representation of Operation. +func (x Operation) String() string { + return OperationToGRPCMessage(x).String() +} + +// FromString parses Operation from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *Operation) FromString(s string) bool { + g, ok := netmap.Operation_value[s] + + if ok { + *x = OperationFromGRPCMessage(netmap.Operation(g)) + } + + return ok +} + +// String returns string representation of NodeState. +func (x NodeState) String() string { + return NodeStateToGRPCMessage(x).String() +} + +// FromString parses NodeState from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *NodeState) FromString(s string) bool { + g, ok := netmap.NodeInfo_State_value[s] + + if ok { + *x = NodeStateFromRPCMessage(netmap.NodeInfo_State(g)) + } + + return ok +} diff --git a/api/netmap/test/generate.go b/api/netmap/test/generate.go new file mode 100644 index 00000000..4ac9254f --- /dev/null +++ b/api/netmap/test/generate.go @@ -0,0 +1,335 @@ +package netmaptest + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + refstest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/test" +) + +func GenerateFilter(empty bool) *netmap.Filter { + return generateFilter(empty, true) +} + +func generateFilter(empty, withSub bool) *netmap.Filter { + m := new(netmap.Filter) + + if !empty { + m.SetKey("filter key") + m.SetValue("filter value") + m.SetName("filter name") + m.SetOp(1) + + if withSub { + m.SetFilters([]netmap.Filter{ + *generateFilter(empty, false), + *generateFilter(empty, false), + }) + } + } + + return m +} + +func GenerateFilters(empty bool) []netmap.Filter { + var res []netmap.Filter + + if !empty { + res = append(res, + *GenerateFilter(false), + *GenerateFilter(false), + ) + } + + return res +} + +func GenerateSelector(empty bool) *netmap.Selector { + m := new(netmap.Selector) + + if !empty { + m.SetCount(66) + m.SetAttribute("selector attribute") + m.SetFilter("select filter") + m.SetName("select name") + m.SetClause(1) + } + + return m +} + +func GenerateSelectors(empty bool) []netmap.Selector { + var res []netmap.Selector + + if !empty { + res = append(res, + *GenerateSelector(false), + *GenerateSelector(false), + ) + } + + return res +} + +func GenerateReplica(empty bool) *netmap.Replica { + m := new(netmap.Replica) + + if !empty { + m.SetCount(42) + m.SetSelector("replica selector") + } + + return m +} + +func GenerateEC(empty bool) *netmap.Replica { + m := new(netmap.Replica) + + if !empty { + m.SetECDataCount(4) + m.SetECParityCount(2) + } + + return m +} + +func GenerateReplicas(empty bool) []netmap.Replica { + var res []netmap.Replica + + if !empty { + res = append(res, + *GenerateReplica(false), + *GenerateReplica(false), + *GenerateEC(false), + ) + } + + return res +} + +func GeneratePlacementPolicy(empty bool) *netmap.PlacementPolicy { + m := new(netmap.PlacementPolicy) + + if !empty { + m.SetContainerBackupFactor(322) + m.SetFilters(GenerateFilters(false)) + m.SetSelectors(GenerateSelectors(false)) + m.SetReplicas(GenerateReplicas(false)) + m.SetUnique(true) + } + + return m +} + +func GenerateAttribute(empty bool) *netmap.Attribute { + m := new(netmap.Attribute) + + if !empty { + m.SetKey("attribute key") + m.SetValue("attribute val") + } + + return m +} + +func GenerateAttributes(empty bool) []netmap.Attribute { + var res []netmap.Attribute + + if !empty { + res = append(res, + *GenerateAttribute(false), + *GenerateAttribute(false), + ) + } + + return res +} + +func GenerateNodeInfo(empty bool) *netmap.NodeInfo { + m := new(netmap.NodeInfo) + + if !empty { + m.SetAddresses("node address", "node address 2") + m.SetPublicKey([]byte{1, 2, 3}) + m.SetState(33) + m.SetAttributes(GenerateAttributes(empty)) + } + + return m +} + +func GenerateLocalNodeInfoRequestBody(_ bool) *netmap.LocalNodeInfoRequestBody { + m := new(netmap.LocalNodeInfoRequestBody) + + return m +} + +func GenerateLocalNodeInfoRequest(empty bool) *netmap.LocalNodeInfoRequest { + m := new(netmap.LocalNodeInfoRequest) + + if !empty { + m.SetBody(GenerateLocalNodeInfoRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateLocalNodeInfoResponseBody(empty bool) *netmap.LocalNodeInfoResponseBody { + m := new(netmap.LocalNodeInfoResponseBody) + + if !empty { + m.SetNodeInfo(GenerateNodeInfo(false)) + } + + m.SetVersion(refstest.GenerateVersion(empty)) + + return m +} + +func GenerateLocalNodeInfoResponse(empty bool) *netmap.LocalNodeInfoResponse { + m := new(netmap.LocalNodeInfoResponse) + + if !empty { + m.SetBody(GenerateLocalNodeInfoResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateNetworkParameter(empty bool) *netmap.NetworkParameter { + m := new(netmap.NetworkParameter) + + if !empty { + m.SetKey([]byte("key")) + m.SetValue([]byte("value")) + } + + return m +} + +func GenerateNetworkConfig(empty bool) *netmap.NetworkConfig { + m := new(netmap.NetworkConfig) + + if !empty { + m.SetParameters( + *GenerateNetworkParameter(empty), + *GenerateNetworkParameter(empty), + ) + } + + return m +} + +func GenerateNetworkInfo(empty bool) *netmap.NetworkInfo { + m := new(netmap.NetworkInfo) + + if !empty { + m.SetMagicNumber(228) + m.SetCurrentEpoch(666) + m.SetMsPerBlock(5678) + m.SetNetworkConfig(GenerateNetworkConfig(empty)) + } + + return m +} + +func GenerateNetworkInfoRequestBody(_ bool) *netmap.NetworkInfoRequestBody { + m := new(netmap.NetworkInfoRequestBody) + + return m +} + +func GenerateNetworkInfoRequest(empty bool) *netmap.NetworkInfoRequest { + m := new(netmap.NetworkInfoRequest) + + if !empty { + m.SetBody(GenerateNetworkInfoRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateNetworkInfoResponseBody(empty bool) *netmap.NetworkInfoResponseBody { + m := new(netmap.NetworkInfoResponseBody) + + if !empty { + m.SetNetworkInfo(GenerateNetworkInfo(false)) + } + + return m +} + +func GenerateNetworkInfoResponse(empty bool) *netmap.NetworkInfoResponse { + m := new(netmap.NetworkInfoResponse) + + if !empty { + m.SetBody(GenerateNetworkInfoResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateNetMap(empty bool) *netmap.NetMap { + m := new(netmap.NetMap) + + if !empty { + m.SetEpoch(987) + m.SetNodes([]netmap.NodeInfo{ + *GenerateNodeInfo(false), + *GenerateNodeInfo(false), + }) + } + + return m +} + +func GenerateSnapshotRequestBody(_ bool) *netmap.SnapshotRequestBody { + return new(netmap.SnapshotRequestBody) +} + +func GenerateSnapshotRequest(empty bool) *netmap.SnapshotRequest { + m := new(netmap.SnapshotRequest) + + if !empty { + m.SetBody(GenerateSnapshotRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateSnapshotResponseBody(empty bool) *netmap.SnapshotResponseBody { + m := new(netmap.SnapshotResponseBody) + + if !empty { + m.SetNetMap(GenerateNetMap(false)) + } + + return m +} + +func GenerateSnapshotResponse(empty bool) *netmap.SnapshotResponse { + m := new(netmap.SnapshotResponse) + + if !empty { + m.SetBody(GenerateSnapshotResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} diff --git a/api/netmap/types.go b/api/netmap/types.go new file mode 100644 index 00000000..b5559724 --- /dev/null +++ b/api/netmap/types.go @@ -0,0 +1,822 @@ +package netmap + +import ( + "bytes" + "iter" + "slices" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" +) + +type LocalNodeInfoRequest struct { + body *LocalNodeInfoRequestBody + + session.RequestHeaders +} + +type LocalNodeInfoResponse struct { + body *LocalNodeInfoResponseBody + + session.ResponseHeaders +} + +// NetworkInfoRequest is a structure of NetworkInfo request. +type NetworkInfoRequest struct { + body *NetworkInfoRequestBody + + session.RequestHeaders +} + +// NetworkInfoResponse is a structure of NetworkInfo response. +type NetworkInfoResponse struct { + body *NetworkInfoResponseBody + + session.ResponseHeaders +} + +type Filter struct { + name string + key string + op Operation + value string + filters []Filter +} + +type Selector struct { + name string + count uint32 + clause Clause + attribute string + filter string +} + +type Replica struct { + count uint32 + selector string + + ecDataCount uint32 + ecParityCount uint32 +} + +type Operation uint32 + +type PlacementPolicy struct { + replicas []Replica + backupFactor uint32 + selectors []Selector + filters []Filter + unique bool +} + +// Attribute of storage node. +type Attribute struct { + key string + value string + parents []string +} + +// NodeInfo of storage node. +type NodeInfo struct { + publicKey []byte + addresses []string + attributes []Attribute + state NodeState +} + +// NodeState of storage node. +type NodeState uint32 + +// Clause of placement selector. +type Clause uint32 + +type LocalNodeInfoRequestBody struct{} + +type LocalNodeInfoResponseBody struct { + version *refs.Version + nodeInfo *NodeInfo +} + +const ( + UnspecifiedState NodeState = iota + Online + Offline + Maintenance +) + +const ( + UnspecifiedOperation Operation = iota + EQ + NE + GT + GE + LT + LE + OR + AND + NOT + LIKE +) + +const ( + UnspecifiedClause Clause = iota + Same + Distinct +) + +func (f *Filter) GetFilters() []Filter { + if f != nil { + return f.filters + } + + return nil +} + +func (f *Filter) SetFilters(filters []Filter) { + f.filters = filters +} + +func (f *Filter) GetValue() string { + if f != nil { + return f.value + } + + return "" +} + +func (f *Filter) SetValue(value string) { + f.value = value +} + +func (f *Filter) GetOp() Operation { + if f != nil { + return f.op + } + return UnspecifiedOperation +} + +func (f *Filter) SetOp(op Operation) { + f.op = op +} + +func (f *Filter) GetKey() string { + if f != nil { + return f.key + } + + return "" +} + +func (f *Filter) SetKey(key string) { + f.key = key +} + +func (f *Filter) GetName() string { + if f != nil { + return f.name + } + + return "" +} + +func (f *Filter) SetName(name string) { + f.name = name +} + +func (s *Selector) GetFilter() string { + if s != nil { + return s.filter + } + + return "" +} + +func (s *Selector) SetFilter(filter string) { + s.filter = filter +} + +func (s *Selector) GetAttribute() string { + if s != nil { + return s.attribute + } + + return "" +} + +func (s *Selector) SetAttribute(attribute string) { + s.attribute = attribute +} + +func (s *Selector) GetClause() Clause { + if s != nil { + return s.clause + } + + return UnspecifiedClause +} + +func (s *Selector) SetClause(clause Clause) { + s.clause = clause +} + +func (s *Selector) GetCount() uint32 { + if s != nil { + return s.count + } + + return 0 +} + +func (s *Selector) SetCount(count uint32) { + s.count = count +} + +func (s *Selector) GetName() string { + if s != nil { + return s.name + } + + return "" +} + +func (s *Selector) SetName(name string) { + s.name = name +} + +func (r *Replica) GetSelector() string { + if r != nil { + return r.selector + } + + return "" +} + +func (r *Replica) SetSelector(selector string) { + r.selector = selector +} + +func (r *Replica) GetCount() uint32 { + if r != nil { + return r.count + } + + return 0 +} + +func (r *Replica) SetCount(count uint32) { + r.count = count +} + +func (r *Replica) GetECDataCount() uint32 { + if r != nil { + return r.ecDataCount + } + + return 0 +} + +func (r *Replica) SetECDataCount(count uint32) { + r.ecDataCount = count +} + +func (r *Replica) GetECParityCount() uint32 { + if r != nil { + return r.ecParityCount + } + + return 0 +} + +func (r *Replica) SetECParityCount(count uint32) { + r.ecParityCount = count +} + +func (p *PlacementPolicy) GetUnique() bool { + if p != nil { + return p.unique + } + return false +} + +func (p *PlacementPolicy) SetUnique(unique bool) { + p.unique = unique +} + +func (p *PlacementPolicy) GetFilters() []Filter { + if p != nil { + return p.filters + } + + return nil +} + +func (p *PlacementPolicy) SetFilters(filters []Filter) { + p.filters = filters +} + +func (p *PlacementPolicy) GetSelectors() []Selector { + if p != nil { + return p.selectors + } + + return nil +} + +func (p *PlacementPolicy) SetSelectors(selectors []Selector) { + p.selectors = selectors +} + +func (p *PlacementPolicy) GetContainerBackupFactor() uint32 { + if p != nil { + return p.backupFactor + } + + return 0 +} + +func (p *PlacementPolicy) SetContainerBackupFactor(backupFactor uint32) { + p.backupFactor = backupFactor +} + +func (p *PlacementPolicy) GetReplicas() []Replica { + if p == nil { + return nil + } + + return p.replicas +} + +func (p *PlacementPolicy) SetReplicas(replicas []Replica) { + p.replicas = replicas +} + +func (a *Attribute) GetKey() string { + if a != nil { + return a.key + } + + return "" +} + +func (a *Attribute) SetKey(v string) { + a.key = v +} + +func (a *Attribute) GetValue() string { + if a != nil { + return a.value + } + + return "" +} + +func (a *Attribute) SetValue(v string) { + a.value = v +} + +func (a *Attribute) GetParents() []string { + if a != nil { + return a.parents + } + + return nil +} + +func (a *Attribute) SetParents(parent []string) { + a.parents = parent +} + +// Clone returns a copy of Attribute. +func (a *Attribute) Clone() *Attribute { + if a == nil { + return nil + } + return &Attribute{ + parents: slices.Clone(a.parents), + value: a.value, + key: a.key, + } +} + +func (ni *NodeInfo) GetPublicKey() []byte { + if ni != nil { + return ni.publicKey + } + + return nil +} + +func (ni *NodeInfo) SetPublicKey(v []byte) { + ni.publicKey = v +} + +// SetAddresses sets list of network addresses of the node. +func (ni *NodeInfo) SetAddresses(v ...string) { + ni.addresses = v +} + +// NumberOfAddresses returns number of network addresses of the node. +func (ni *NodeInfo) NumberOfAddresses() int { + if ni != nil { + return len(ni.addresses) + } + + return 0 +} + +// Addresses returns an iterator over network addresses of the node. +func (ni NodeInfo) Addresses() iter.Seq[string] { + return func(yield func(string) bool) { + for i := range ni.addresses { + if !yield(ni.addresses[i]) { + break + } + } + } +} + +// IterateAddresses iterates over network addresses of the node. +// Breaks iteration on f's true return. +// +// Handler should not be nil. +// +// Deprecated: use [NodeInfo.Addresses] instead. +func (ni *NodeInfo) IterateAddresses(f func(string) bool) { + if ni != nil { + for i := range ni.addresses { + if f(ni.addresses[i]) { + break + } + } + } +} + +func (ni *NodeInfo) GetAttributes() []Attribute { + if ni != nil { + return ni.attributes + } + + return nil +} + +func (ni *NodeInfo) SetAttributes(v []Attribute) { + ni.attributes = v +} + +func (ni *NodeInfo) GetState() NodeState { + if ni != nil { + return ni.state + } + + return UnspecifiedState +} + +func (ni *NodeInfo) SetState(state NodeState) { + ni.state = state +} + +// Clone returns a copy of NodeInfo. +func (ni *NodeInfo) Clone() *NodeInfo { + if ni == nil { + return nil + } + dst := NodeInfo{ + addresses: slices.Clone(ni.addresses), + publicKey: bytes.Clone(ni.publicKey), + state: ni.state, + attributes: make([]Attribute, len(ni.attributes)), + } + for i, v := range ni.attributes { + dst.attributes[i] = *v.Clone() + } + return &dst +} + +func (l *LocalNodeInfoResponseBody) GetVersion() *refs.Version { + if l != nil { + return l.version + } + + return nil +} + +func (l *LocalNodeInfoResponseBody) SetVersion(version *refs.Version) { + l.version = version +} + +func (l *LocalNodeInfoResponseBody) GetNodeInfo() *NodeInfo { + if l != nil { + return l.nodeInfo + } + + return nil +} + +func (l *LocalNodeInfoResponseBody) SetNodeInfo(nodeInfo *NodeInfo) { + l.nodeInfo = nodeInfo +} + +func (l *LocalNodeInfoRequest) GetBody() *LocalNodeInfoRequestBody { + if l != nil { + return l.body + } + return nil +} + +func (l *LocalNodeInfoRequest) SetBody(body *LocalNodeInfoRequestBody) { + l.body = body +} + +func (l *LocalNodeInfoResponse) GetBody() *LocalNodeInfoResponseBody { + if l != nil { + return l.body + } + return nil +} + +func (l *LocalNodeInfoResponse) SetBody(body *LocalNodeInfoResponseBody) { + l.body = body +} + +// NetworkParameter represents NeoFS network parameter. +type NetworkParameter struct { + k, v []byte +} + +// GetKey returns parameter key. +func (x *NetworkParameter) GetKey() []byte { + if x != nil { + return x.k + } + + return nil +} + +// SetKey sets parameter key. +func (x *NetworkParameter) SetKey(k []byte) { + x.k = k +} + +// GetValue returns parameter value. +func (x *NetworkParameter) GetValue() []byte { + if x != nil { + return x.v + } + + return nil +} + +// SetValue sets parameter value. +func (x *NetworkParameter) SetValue(v []byte) { + x.v = v +} + +// NetworkConfig represents NeoFS network configuration. +type NetworkConfig struct { + ps []NetworkParameter +} + +// NumberOfParameters returns number of network parameters. +// +// Deprecated: use [NetworkConfig.Parameters] instead. +func (x *NetworkConfig) NumberOfParameters() int { + if x != nil { + return len(x.ps) + } + + return 0 +} + +// Parameters returns an iterator over network parameters. +func (x *NetworkConfig) Parameters() []NetworkParameter { + if x != nil { + return x.ps + } + return nil +} + +// IterateParameters iterates over network parameters. +// Breaks iteration on f's true return. +// +// Handler must not be nil. +// +// Deprecated: use [NetworkConfig.Parameters] instead. +func (x *NetworkConfig) IterateParameters(f func(*NetworkParameter) bool) { + if x != nil { + for i := range x.ps { + if f(&x.ps[i]) { + break + } + } + } +} + +// SetParameters sets list of network parameters. +func (x *NetworkConfig) SetParameters(v ...NetworkParameter) { + x.ps = v +} + +// NetworkInfo groups information about +// NeoFS network. +type NetworkInfo struct { + curEpoch, magicNum uint64 + + msPerBlock int64 + + netCfg *NetworkConfig +} + +// GetCurrentEpoch returns number of the current epoch. +func (i *NetworkInfo) GetCurrentEpoch() uint64 { + if i != nil { + return i.curEpoch + } + + return 0 +} + +// SetCurrentEpoch sets number of the current epoch. +func (i *NetworkInfo) SetCurrentEpoch(epoch uint64) { + i.curEpoch = epoch +} + +// GetMagicNumber returns magic number of the sidechain. +func (i *NetworkInfo) GetMagicNumber() uint64 { + if i != nil { + return i.magicNum + } + + return 0 +} + +// SetMagicNumber sets magic number of the sidechain. +func (i *NetworkInfo) SetMagicNumber(magic uint64) { + i.magicNum = magic +} + +// GetMsPerBlock returns MillisecondsPerBlock network parameter. +func (i *NetworkInfo) GetMsPerBlock() int64 { + if i != nil { + return i.msPerBlock + } + + return 0 +} + +// SetMsPerBlock sets MillisecondsPerBlock network parameter. +func (i *NetworkInfo) SetMsPerBlock(v int64) { + i.msPerBlock = v +} + +// GetNetworkConfig returns NeoFS network configuration. +func (i *NetworkInfo) GetNetworkConfig() *NetworkConfig { + if i != nil { + return i.netCfg + } + + return nil +} + +// SetNetworkConfig sets NeoFS network configuration. +func (i *NetworkInfo) SetNetworkConfig(v *NetworkConfig) { + i.netCfg = v +} + +// NetworkInfoRequestBody is a structure of NetworkInfo request body. +type NetworkInfoRequestBody struct{} + +// NetworkInfoResponseBody is a structure of NetworkInfo response body. +type NetworkInfoResponseBody struct { + netInfo *NetworkInfo +} + +// GetNetworkInfo returns information about the NeoFS network. +func (i *NetworkInfoResponseBody) GetNetworkInfo() *NetworkInfo { + if i != nil { + return i.netInfo + } + + return nil +} + +// SetNetworkInfo sets information about the NeoFS network. +func (i *NetworkInfoResponseBody) SetNetworkInfo(netInfo *NetworkInfo) { + i.netInfo = netInfo +} + +func (l *NetworkInfoRequest) GetBody() *NetworkInfoRequestBody { + if l != nil { + return l.body + } + return nil +} + +func (l *NetworkInfoRequest) SetBody(body *NetworkInfoRequestBody) { + l.body = body +} + +func (l *NetworkInfoResponse) GetBody() *NetworkInfoResponseBody { + if l != nil { + return l.body + } + return nil +} + +func (l *NetworkInfoResponse) SetBody(body *NetworkInfoResponseBody) { + l.body = body +} + +// NetMap represents structure of NeoFS network map. +type NetMap struct { + epoch uint64 + + nodes []NodeInfo +} + +// Epoch returns revision number of the NetMap. +func (x *NetMap) Epoch() uint64 { + if x != nil { + return x.epoch + } + + return 0 +} + +// SetEpoch sets revision number of the NetMap. +func (x *NetMap) SetEpoch(v uint64) { + x.epoch = v +} + +// Nodes returns nodes presented in the NetMap. +func (x *NetMap) Nodes() []NodeInfo { + if x != nil { + return x.nodes + } + + return nil +} + +// SetNodes sets nodes presented in the NetMap. +func (x *NetMap) SetNodes(v []NodeInfo) { + x.nodes = v +} + +// SnapshotRequestBody represents structure of Snapshot request body. +type SnapshotRequestBody struct{} + +// SnapshotRequest represents structure of Snapshot request. +type SnapshotRequest struct { + body *SnapshotRequestBody + + session.RequestHeaders +} + +func (x *SnapshotRequest) GetBody() *SnapshotRequestBody { + if x != nil { + return x.body + } + + return nil +} + +func (x *SnapshotRequest) SetBody(body *SnapshotRequestBody) { + x.body = body +} + +// SnapshotResponseBody represents structure of Snapshot response body. +type SnapshotResponseBody struct { + netMap *NetMap +} + +// NetMap returns current NetMap. +func (x *SnapshotResponseBody) NetMap() *NetMap { + if x != nil { + return x.netMap + } + + return nil +} + +// SetNetMap sets current NetMap. +func (x *SnapshotResponseBody) SetNetMap(netMap *NetMap) { + x.netMap = netMap +} + +// SnapshotResponse represents structure of Snapshot response. +type SnapshotResponse struct { + body *SnapshotResponseBody + + session.ResponseHeaders +} + +func (x *SnapshotResponse) GetBody() *SnapshotResponseBody { + if x != nil { + return x.body + } + + return nil +} + +func (x *SnapshotResponse) SetBody(body *SnapshotResponseBody) { + x.body = body +} diff --git a/api/netmap/types_test.go b/api/netmap/types_test.go new file mode 100644 index 00000000..47d9d7b2 --- /dev/null +++ b/api/netmap/types_test.go @@ -0,0 +1,48 @@ +package netmap + +import ( + "bytes" + "slices" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNodeInfo_Clone(t *testing.T) { + var ni NodeInfo + ni.publicKey = []byte{2} + attr := Attribute{ + key: "key", + value: "value", + parents: []string{"parent", "parent2"}, + } + ni.attributes = []Attribute{attr} + ni.addresses = []string{"5", "6"} + + c := ni.Clone() + + require.True(t, c != &ni) + require.True(t, bytes.Equal(c.publicKey, ni.publicKey)) + require.True(t, &(c.publicKey[0]) != &(ni.publicKey[0])) + require.True(t, &(c.attributes[0]) != &(ni.attributes[0])) + require.True(t, slices.Compare(c.addresses, ni.addresses) == 0) + require.True(t, &(c.addresses[0]) != &(ni.addresses[0])) +} + +func TestAttribute_Clone(t *testing.T) { + attr := Attribute{ + key: "key", + value: "value", + parents: []string{"parent1", "parent2"}, + } + + c := attr.Clone() + + require.True(t, c != &attr) + require.True(t, c.key == attr.key) + require.True(t, &(c.key) != &(attr.key)) + require.True(t, &(c.value) != &(attr.value)) + require.True(t, c.value == attr.value) + require.True(t, &(c.parents[0]) != &(attr.parents[0])) + require.True(t, slices.Compare(c.parents, attr.parents) == 0) +} diff --git a/api/object/attributes.go b/api/object/attributes.go new file mode 100644 index 00000000..7f4fca02 --- /dev/null +++ b/api/object/attributes.go @@ -0,0 +1,187 @@ +package object + +import ( + "errors" + "fmt" + "strconv" +) + +// SysAttributePrefix is a prefix of key to system attribute. +const SysAttributePrefix = "__SYSTEM__" + +const ( + // SysAttributeUploadID marks smaller parts of a split bigger object. + SysAttributeUploadID = SysAttributePrefix + "UPLOAD_ID" + + // SysAttributeExpEpoch tells GC to delete object after that epoch. + SysAttributeExpEpoch = SysAttributePrefix + "EXPIRATION_EPOCH" + + // SysAttributeTickEpoch defines what epoch must produce object + // notification. + SysAttributeTickEpoch = SysAttributePrefix + "TICK_EPOCH" + + // SysAttributeTickTopic defines what topic object notification + // must be sent to. + SysAttributeTickTopic = SysAttributePrefix + "TICK_TOPIC" +) + +// SysAttributePrefixNeoFS is a prefix of key to system attribute. +// Deprecated: use SysAttributePrefix. +const SysAttributePrefixNeoFS = "__NEOFS__" + +const ( + // SysAttributeUploadIDNeoFS marks smaller parts of a split bigger object. + // Deprecated: use SysAttributeUploadID. + SysAttributeUploadIDNeoFS = SysAttributePrefixNeoFS + "UPLOAD_ID" + + // SysAttributeExpEpochNeoFS tells GC to delete object after that epoch. + // Deprecated: use SysAttributeExpEpoch. + SysAttributeExpEpochNeoFS = SysAttributePrefixNeoFS + "EXPIRATION_EPOCH" + + // SysAttributeTickEpochNeoFS defines what epoch must produce object + // notification. + // Deprecated: use SysAttributeTickEpoch. + SysAttributeTickEpochNeoFS = SysAttributePrefixNeoFS + "TICK_EPOCH" + + // SysAttributeTickTopicNeoFS defines what topic object notification + // must be sent to. + // Deprecated: use SysAttributeTickTopic. + SysAttributeTickTopicNeoFS = SysAttributePrefixNeoFS + "TICK_TOPIC" +) + +// NotificationInfo groups information about object notification +// that can be written to object. +// +// Topic is an optional field. +type NotificationInfo struct { + epoch uint64 + topic string +} + +// Epoch returns object notification tick +// epoch. +func (n NotificationInfo) Epoch() uint64 { + return n.epoch +} + +// SetEpoch sets object notification tick +// epoch. +func (n *NotificationInfo) SetEpoch(epoch uint64) { + n.epoch = epoch +} + +// Topic return optional object notification +// topic. +func (n NotificationInfo) Topic() string { + return n.topic +} + +// SetTopic sets optional object notification +// topic. +func (n *NotificationInfo) SetTopic(topic string) { + n.topic = topic +} + +// WriteNotificationInfo writes NotificationInfo to the Object via attributes. Object must not be nil. +// +// Existing notification attributes are expected to be key-unique, otherwise undefined behavior. +func WriteNotificationInfo(o *Object, ni NotificationInfo) { + h := o.GetHeader() + if h == nil { + h = new(Header) + o.SetHeader(h) + } + + var ( + attrs = h.GetAttributes() + + epoch = strconv.FormatUint(ni.Epoch(), 10) + topic = ni.Topic() + + changedEpoch bool + changedTopic bool + deleteIndex = -1 + ) + + for i := range attrs { + switch attrs[i].GetKey() { + case SysAttributeTickEpoch, SysAttributeTickEpochNeoFS: + attrs[i].SetValue(epoch) + changedEpoch = true + case SysAttributeTickTopic, SysAttributeTickTopicNeoFS: + changedTopic = true + + if topic == "" { + deleteIndex = i + break + } + + attrs[i].SetValue(topic) + } + + if changedEpoch && changedTopic { + break + } + } + + if deleteIndex != -1 { + // approach without allocation/waste + // coping works since the attributes + // order is not important + attrs[deleteIndex] = attrs[len(attrs)-1] + attrs = attrs[:len(attrs)-1] + } + + if !changedEpoch { + index := len(attrs) + attrs = append(attrs, Attribute{}) + attrs[index].SetKey(SysAttributeTickEpoch) + attrs[index].SetValue(epoch) + } + + if !changedTopic && topic != "" { + index := len(attrs) + attrs = append(attrs, Attribute{}) + attrs[index].SetKey(SysAttributeTickTopic) + attrs[index].SetValue(topic) + } + + h.SetAttributes(attrs) +} + +// ErrNotificationNotSet means that object does not have notification. +var ErrNotificationNotSet = errors.New("notification for object is not set") + +// GetNotificationInfo looks for object notification attributes. Object must not be nil. +// Returns ErrNotificationNotSet if no corresponding attributes +// were found. +// +// Existing notification attributes are expected to be key-unique, otherwise undefined behavior. +func GetNotificationInfo(o *Object) (*NotificationInfo, error) { + var ( + foundEpoch bool + ni = new(NotificationInfo) + ) + + for _, attr := range o.GetHeader().GetAttributes() { + switch key := attr.GetKey(); key { + case SysAttributeTickEpoch, SysAttributeTickEpochNeoFS: + epoch, err := strconv.ParseUint(attr.GetValue(), 10, 64) + if err != nil { + return nil, fmt.Errorf("could not parse epoch: %w", err) + } + + ni.SetEpoch(epoch) + + foundEpoch = true + case SysAttributeTickTopic, SysAttributeTickTopicNeoFS: + ni.SetTopic(attr.GetValue()) + } + } + + if !foundEpoch { + return nil, ErrNotificationNotSet + } + + return ni, nil +} diff --git a/api/object/attributes_test.go b/api/object/attributes_test.go new file mode 100644 index 00000000..85635da7 --- /dev/null +++ b/api/object/attributes_test.go @@ -0,0 +1,89 @@ +package object + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestSetNotification(t *testing.T) { + o := new(Object) + + ni := NotificationInfo{ + epoch: 10, + topic: "test", + } + + WriteNotificationInfo(o, ni) + + var foundEpoch, foundTopic bool + + for _, attr := range o.GetHeader().GetAttributes() { + switch key := attr.GetKey(); key { + case SysAttributeTickEpoch: + require.Equal(t, false, foundEpoch) + + uEpoch, err := strconv.ParseUint(attr.GetValue(), 10, 64) + require.NoError(t, err) + + require.Equal(t, ni.Epoch(), uEpoch) + foundEpoch = true + case SysAttributeTickTopic: + require.Equal(t, false, foundTopic) + require.Equal(t, ni.Topic(), attr.GetValue()) + foundTopic = true + } + } + + require.Equal(t, true, foundEpoch && foundTopic) +} + +func TestGetNotification(t *testing.T) { + o := new(Object) + + attr := []Attribute{ + {SysAttributeTickEpoch, "10"}, + {SysAttributeTickTopic, "test"}, + } + + h := new(Header) + h.SetAttributes(attr) + + o.SetHeader(h) + + t.Run("No error", func(t *testing.T) { + ni, err := GetNotificationInfo(o) + require.NoError(t, err) + + require.Equal(t, uint64(10), ni.Epoch()) + require.Equal(t, "test", ni.Topic()) + }) +} + +func TestIntegration(t *testing.T) { + o := new(Object) + + var ( + ni1 = NotificationInfo{ + epoch: 10, + topic: "", + } + ni2 = NotificationInfo{ + epoch: 11, + topic: "test", + } + ) + + WriteNotificationInfo(o, ni1) + WriteNotificationInfo(o, ni2) + + t.Run("double set", func(t *testing.T) { + ni, err := GetNotificationInfo(o) + require.NoError(t, err) + + require.Equal(t, ni2.epoch, ni.Epoch()) + require.Equal(t, ni2.topic, ni.Topic()) + require.Equal(t, 2, len(o.GetHeader().GetAttributes())) + }) +} diff --git a/api/object/bench_test.go b/api/object/bench_test.go new file mode 100644 index 00000000..b29b1d1d --- /dev/null +++ b/api/object/bench_test.go @@ -0,0 +1,45 @@ +package object + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/require" +) + +func randString(n int) string { + x := make([]byte, n) + for i := range x { + x[i] = byte('a' + rand.Intn('z'-'a')) + } + return string(x) +} + +func BenchmarkAttributesMarshal(b *testing.B) { + attrs := make([]Attribute, 50) + for i := range attrs { + attrs[i].key = SysAttributePrefix + randString(10) + attrs[i].val = randString(10) + } + raw := AttributesToGRPC(attrs) + require.Equal(b, len(raw), len(attrs)) + + b.Run("marshal", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + res := AttributesToGRPC(attrs) + if len(res) != len(raw) { + b.FailNow() + } + } + }) + b.Run("unmarshal", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + res, err := AttributesFromGRPC(raw) + if err != nil || len(res) != len(raw) { + b.FailNow() + } + } + }) +} diff --git a/api/object/convert.go b/api/object/convert.go new file mode 100644 index 00000000..90e40dc3 --- /dev/null +++ b/api/object/convert.go @@ -0,0 +1,2569 @@ +package object + +import ( + "fmt" + + object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" +) + +func TypeToGRPCField(t Type) object.ObjectType { + return object.ObjectType(t) +} + +func TypeFromGRPCField(t object.ObjectType) Type { + return Type(t) +} + +func MatchTypeToGRPCField(t MatchType) object.MatchType { + return object.MatchType(t) +} + +func MatchTypeFromGRPCField(t object.MatchType) MatchType { + return MatchType(t) +} + +func (h *ShortHeader) ToGRPCMessage() grpc.Message { + var m *object.ShortHeader + + if h != nil { + m = new(object.ShortHeader) + + m.SetVersion(h.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetOwnerId(h.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetHomomorphicHash(h.homoHash.ToGRPCMessage().(*refsGRPC.Checksum)) + m.SetPayloadHash(h.payloadHash.ToGRPCMessage().(*refsGRPC.Checksum)) + m.SetObjectType(TypeToGRPCField(h.typ)) + m.SetCreationEpoch(h.creatEpoch) + m.SetPayloadLength(h.payloadLen) + } + + return m +} + +func (h *ShortHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.ShortHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + version := v.GetVersion() + if version == nil { + h.version = nil + } else { + if h.version == nil { + h.version = new(refs.Version) + } + + err = h.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + ownerID := v.GetOwnerId() + if ownerID == nil { + h.ownerID = nil + } else { + if h.ownerID == nil { + h.ownerID = new(refs.OwnerID) + } + + err = h.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + homoHash := v.GetHomomorphicHash() + if homoHash == nil { + h.homoHash = nil + } else { + if h.homoHash == nil { + h.homoHash = new(refs.Checksum) + } + + err = h.homoHash.FromGRPCMessage(homoHash) + if err != nil { + return err + } + } + + payloadHash := v.GetPayloadHash() + if payloadHash == nil { + h.payloadHash = nil + } else { + if h.payloadHash == nil { + h.payloadHash = new(refs.Checksum) + } + + err = h.payloadHash.FromGRPCMessage(payloadHash) + if err != nil { + return err + } + } + + h.typ = TypeFromGRPCField(v.GetObjectType()) + h.creatEpoch = v.GetCreationEpoch() + h.payloadLen = v.GetPayloadLength() + + return nil +} + +func (a *Attribute) ToGRPCMessage() grpc.Message { + var m *object.Header_Attribute + + if a != nil { + m = new(object.Header_Attribute) + + m.SetKey(a.key) + m.SetValue(a.val) + } + + return m +} + +func (a *Attribute) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Header_Attribute) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + a.key = v.GetKey() + a.val = v.GetValue() + + return nil +} + +func AttributesToGRPC(xs []Attribute) (res []*object.Header_Attribute) { + if xs != nil { + res = make([]*object.Header_Attribute, 0, len(xs)) + + for i := range xs { + res = append(res, xs[i].ToGRPCMessage().(*object.Header_Attribute)) + } + } + + return +} + +func AttributesFromGRPC(xs []*object.Header_Attribute) (res []Attribute, err error) { + if xs != nil { + res = make([]Attribute, len(xs)) + + for i := range xs { + err = res[i].FromGRPCMessage(xs[i]) + if err != nil { + return + } + } + } + + return +} + +func (h *SplitHeader) ToGRPCMessage() grpc.Message { + var m *object.Header_Split + + if h != nil { + m = new(object.Header_Split) + + m.SetParent(h.par.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetPrevious(h.prev.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetParentHeader(h.parHdr.ToGRPCMessage().(*object.Header)) + m.SetParentSignature(h.parSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetChildren(refs.ObjectIDListToGRPCMessage(h.children)) + m.SetSplitId(h.splitID) + } + + return m +} + +func (h *SplitHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Header_Split) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + par := v.GetParent() + if par == nil { + h.par = nil + } else { + if h.par == nil { + h.par = new(refs.ObjectID) + } + + err = h.par.FromGRPCMessage(par) + if err != nil { + return err + } + } + + prev := v.GetPrevious() + if prev == nil { + h.prev = nil + } else { + if h.prev == nil { + h.prev = new(refs.ObjectID) + } + + err = h.prev.FromGRPCMessage(prev) + if err != nil { + return err + } + } + + parHdr := v.GetParentHeader() + if parHdr == nil { + h.parHdr = nil + } else { + if h.parHdr == nil { + h.parHdr = new(Header) + } + + err = h.parHdr.FromGRPCMessage(parHdr) + if err != nil { + return err + } + } + + parSig := v.GetParentSignature() + if parSig == nil { + h.parSig = nil + } else { + if h.parSig == nil { + h.parSig = new(refs.Signature) + } + + err = h.parSig.FromGRPCMessage(parSig) + if err != nil { + return err + } + } + + h.children, err = refs.ObjectIDListFromGRPCMessage(v.GetChildren()) + if err != nil { + return err + } + + h.splitID = v.GetSplitId() + + return nil +} + +func (h *ECHeader) ToGRPCMessage() grpc.Message { + var m *object.Header_EC + + if h != nil { + m = new(object.Header_EC) + + m.SetParent(h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetParentSplitId(h.ParentSplitID) + m.SetParentSplitParentId(h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetParentAttributes(AttributesToGRPC(h.ParentAttributes)) + m.SetIndex(h.Index) + m.SetTotal(h.Total) + m.SetHeader(h.Header) + m.SetHeaderLength(h.HeaderLength) + } + + return m +} + +func (h *ECHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Header_EC) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + par := v.GetParent() + if par == nil { + h.Parent = nil + } else { + if h.Parent == nil { + h.Parent = new(refs.ObjectID) + } + + err = h.Parent.FromGRPCMessage(par) + if err != nil { + return err + } + } + + h.ParentSplitID = v.GetParentSplitId() + + parSplitParentID := v.GetParentSplitParentId() + if parSplitParentID == nil { + h.ParentSplitParentID = nil + } else { + if h.ParentSplitParentID == nil { + h.ParentSplitParentID = new(refs.ObjectID) + } + + err = h.ParentSplitParentID.FromGRPCMessage(parSplitParentID) + if err != nil { + return err + } + } + + if h.ParentAttributes, err = AttributesFromGRPC(v.GetParentAttributes()); err != nil { + return err + } + + h.Index = v.GetIndex() + h.Total = v.GetTotal() + h.Header = v.GetHeader() + h.HeaderLength = v.GetHeaderLength() + return nil +} + +func (h *Header) ToGRPCMessage() grpc.Message { + var m *object.Header + + if h != nil { + m = new(object.Header) + + m.SetVersion(h.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetPayloadHash(h.payloadHash.ToGRPCMessage().(*refsGRPC.Checksum)) + m.SetOwnerId(h.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetHomomorphicHash(h.homoHash.ToGRPCMessage().(*refsGRPC.Checksum)) + m.SetContainerId(h.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetSessionToken(h.sessionToken.ToGRPCMessage().(*sessionGRPC.SessionToken)) + m.SetSplit(h.split.ToGRPCMessage().(*object.Header_Split)) + m.Ec = h.ec.ToGRPCMessage().(*object.Header_EC) + m.SetAttributes(AttributesToGRPC(h.attr)) + m.SetPayloadLength(h.payloadLen) + m.SetCreationEpoch(h.creatEpoch) + m.SetObjectType(TypeToGRPCField(h.typ)) + } + + return m +} + +func (h *Header) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Header) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + if err := h.fillVersion(v); err != nil { + return err + } + if err := h.fillPayloadHash(v); err != nil { + return err + } + if err := h.fillOwnerID(v); err != nil { + return err + } + if err := h.fillHomomorphicHash(v); err != nil { + return err + } + if err := h.fillContainerID(v); err != nil { + return err + } + if err := h.fillSessionToken(v); err != nil { + return err + } + if err := h.fillSplitHeader(v); err != nil { + return err + } + if err := h.fillECHeader(v); err != nil { + return err + } + + h.attr, err = AttributesFromGRPC(v.GetAttributes()) + if err != nil { + return err + } + + h.payloadLen = v.GetPayloadLength() + h.creatEpoch = v.GetCreationEpoch() + h.typ = TypeFromGRPCField(v.GetObjectType()) + + return nil +} + +func (h *Header) fillVersion(v *object.Header) error { + version := v.GetVersion() + if version == nil { + h.version = nil + return nil + } + + if h.version == nil { + h.version = new(refs.Version) + } + return h.version.FromGRPCMessage(version) +} + +func (h *Header) fillPayloadHash(v *object.Header) error { + payloadHash := v.GetPayloadHash() + if payloadHash == nil { + h.payloadHash = nil + return nil + } + + if h.payloadHash == nil { + h.payloadHash = new(refs.Checksum) + } + return h.payloadHash.FromGRPCMessage(payloadHash) +} + +func (h *Header) fillOwnerID(v *object.Header) error { + ownerID := v.GetOwnerId() + if ownerID == nil { + h.ownerID = nil + return nil + } + + if h.ownerID == nil { + h.ownerID = new(refs.OwnerID) + } + return h.ownerID.FromGRPCMessage(ownerID) +} + +func (h *Header) fillHomomorphicHash(v *object.Header) error { + homoHash := v.GetHomomorphicHash() + if homoHash == nil { + h.homoHash = nil + return nil + } + + if h.homoHash == nil { + h.homoHash = new(refs.Checksum) + } + return h.homoHash.FromGRPCMessage(homoHash) +} + +func (h *Header) fillContainerID(v *object.Header) error { + cid := v.GetContainerId() + if cid == nil { + h.cid = nil + return nil + } + + if h.cid == nil { + h.cid = new(refs.ContainerID) + } + return h.cid.FromGRPCMessage(cid) +} + +func (h *Header) fillSessionToken(v *object.Header) error { + sessionToken := v.GetSessionToken() + if sessionToken == nil { + h.sessionToken = nil + return nil + } + + if h.sessionToken == nil { + h.sessionToken = new(session.Token) + } + return h.sessionToken.FromGRPCMessage(sessionToken) +} + +func (h *Header) fillSplitHeader(v *object.Header) error { + split := v.GetSplit() + if split == nil { + h.split = nil + return nil + } + + if h.split == nil { + h.split = new(SplitHeader) + } + return h.split.FromGRPCMessage(split) +} + +func (h *Header) fillECHeader(v *object.Header) error { + ec := v.GetEc() + if ec == nil { + h.ec = nil + return nil + } + + if h.ec == nil { + h.ec = new(ECHeader) + } + return h.ec.FromGRPCMessage(ec) +} + +func (h *HeaderWithSignature) ToGRPCMessage() grpc.Message { + var m *object.HeaderWithSignature + + if h != nil { + m = new(object.HeaderWithSignature) + + m.SetSignature(h.signature.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetHeader(h.header.ToGRPCMessage().(*object.Header)) + } + + return m +} + +func (h *HeaderWithSignature) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeaderWithSignature) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + signature := v.GetSignature() + if signature == nil { + h.signature = nil + } else { + if h.signature == nil { + h.signature = new(refs.Signature) + } + + err = h.signature.FromGRPCMessage(signature) + if err != nil { + return err + } + } + + header := v.GetHeader() + if header == nil { + h.header = nil + } else { + if h.header == nil { + h.header = new(Header) + } + + err = h.header.FromGRPCMessage(header) + } + + return err +} + +func (o *Object) ToGRPCMessage() grpc.Message { + var m *object.Object + + if o != nil { + m = new(object.Object) + + m.SetObjectId(o.objectID.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetSignature(o.idSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetHeader(o.header.ToGRPCMessage().(*object.Header)) + m.SetPayload(o.payload) + } + + return m +} + +func (o *Object) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Object) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + objectID := v.GetObjectId() + if objectID == nil { + o.objectID = nil + } else { + if o.objectID == nil { + o.objectID = new(refs.ObjectID) + } + + err = o.objectID.FromGRPCMessage(objectID) + if err != nil { + return err + } + } + + idSig := v.GetSignature() + if idSig == nil { + o.idSig = nil + } else { + if o.idSig == nil { + o.idSig = new(refs.Signature) + } + + err = o.idSig.FromGRPCMessage(idSig) + if err != nil { + return err + } + } + + header := v.GetHeader() + if header == nil { + o.header = nil + } else { + if o.header == nil { + o.header = new(Header) + } + + err = o.header.FromGRPCMessage(header) + if err != nil { + return err + } + } + + o.payload = v.GetPayload() + + return nil +} + +func (s *SplitInfo) ToGRPCMessage() grpc.Message { + var m *object.SplitInfo + + if s != nil { + m = new(object.SplitInfo) + + m.SetLastPart(s.lastPart.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetLink(s.link.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetSplitId(s.splitID) + } + + return m +} + +func (s *SplitInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SplitInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + lastPart := v.GetLastPart() + if lastPart == nil { + s.lastPart = nil + } else { + if s.lastPart == nil { + s.lastPart = new(refs.ObjectID) + } + + err = s.lastPart.FromGRPCMessage(lastPart) + if err != nil { + return err + } + } + + link := v.GetLink() + if link == nil { + s.link = nil + } else { + if s.link == nil { + s.link = new(refs.ObjectID) + } + + err = s.link.FromGRPCMessage(link) + if err != nil { + return err + } + } + + s.splitID = v.GetSplitId() + + return nil +} + +func (s *ECInfo) ToGRPCMessage() grpc.Message { + var m *object.ECInfo + + if s != nil { + m = new(object.ECInfo) + + if s.Chunks != nil { + chunks := make([]*object.ECInfo_Chunk, len(s.Chunks)) + for i := range chunks { + chunks[i] = s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk) + } + m.Chunks = chunks + } + } + + return m +} + +func (s *ECInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.ECInfo) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + chunks := v.GetChunks() + if chunks == nil { + s.Chunks = nil + } else { + s.Chunks = make([]ECChunk, len(chunks)) + for i := range chunks { + if err := s.Chunks[i].FromGRPCMessage(chunks[i]); err != nil { + return err + } + } + } + return nil +} + +func (c *ECChunk) ToGRPCMessage() grpc.Message { + var m *object.ECInfo_Chunk + + if c != nil { + m = new(object.ECInfo_Chunk) + + m.SetTotal(c.Total) + m.SetIndex(c.Index) + m.SetId(c.ID.ToGRPCMessage().(*refsGRPC.ObjectID)) + } + + return m +} + +func (c *ECChunk) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.ECInfo_Chunk) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + if err := c.ID.FromGRPCMessage(v.GetId()); err != nil { + return err + } + c.Index = v.GetIndex() + c.Total = v.GetTotal() + + return nil +} + +func (r *GetRequestBody) ToGRPCMessage() grpc.Message { + var m *object.GetRequest_Body + + if r != nil { + m = new(object.GetRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetRaw(r.raw) + } + + return m +} + +func (r *GetRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + r.raw = v.GetRaw() + + return nil +} + +func (r *GetRequest) ToGRPCMessage() grpc.Message { + var m *object.GetRequest + + if r != nil { + m = new(object.GetRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *GetRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *GetObjectPartInit) ToGRPCMessage() grpc.Message { + var m *object.GetResponse_Body_Init + + if r != nil { + m = new(object.GetResponse_Body_Init) + + m.SetObjectId(r.id.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetHeader(r.hdr.ToGRPCMessage().(*object.Header)) + } + + return m +} + +func (r *GetObjectPartInit) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetResponse_Body_Init) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + id := v.GetObjectId() + if id == nil { + r.id = nil + } else { + if r.id == nil { + r.id = new(refs.ObjectID) + } + + err = r.id.FromGRPCMessage(id) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + if err != nil { + return err + } + } + + hdr := v.GetHeader() + if hdr == nil { + r.hdr = nil + } else { + if r.hdr == nil { + r.hdr = new(Header) + } + + err = r.hdr.FromGRPCMessage(hdr) + } + + return err +} + +func (r *GetObjectPartChunk) ToGRPCMessage() grpc.Message { + var m *object.GetResponse_Body_Chunk + + if r != nil { + m = new(object.GetResponse_Body_Chunk) + m.Chunk = r.chunk + } + + return m +} + +func (r *GetObjectPartChunk) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetResponse_Body_Chunk) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.chunk = v.Chunk + + return nil +} + +func (r *GetResponseBody) ToGRPCMessage() grpc.Message { + var m *object.GetResponse_Body + + if r != nil { + m = new(object.GetResponse_Body) + + switch v := r.GetObjectPart(); t := v.(type) { + case nil: + m.ObjectPart = nil + case *GetObjectPartInit: + m.SetInit(t.ToGRPCMessage().(*object.GetResponse_Body_Init)) + case *GetObjectPartChunk: + m.SetChunk(t.ToGRPCMessage().(*object.GetResponse_Body_Chunk).Chunk) + case *SplitInfo: + m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo)) + case *ECInfo: + m.SetEcInfo(t.ToGRPCMessage().(*object.ECInfo)) + default: + panic(fmt.Sprintf("unknown get object part %T", t)) + } + } + + return m +} + +func (r *GetResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.objPart = nil + + switch pt := v.GetObjectPart().(type) { + case nil: + case *object.GetResponse_Body_Init_: + if pt != nil { + partInit := new(GetObjectPartInit) + r.objPart = partInit + err = partInit.FromGRPCMessage(pt.Init) + } + case *object.GetResponse_Body_Chunk: + if pt != nil { + partChunk := new(GetObjectPartChunk) + r.objPart = partChunk + err = partChunk.FromGRPCMessage(pt) + } + case *object.GetResponse_Body_SplitInfo: + if pt != nil { + partSplit := new(SplitInfo) + r.objPart = partSplit + err = partSplit.FromGRPCMessage(pt.SplitInfo) + } + case *object.GetResponse_Body_EcInfo: + if pt != nil { + partEC := new(ECInfo) + r.objPart = partEC + err = partEC.FromGRPCMessage(pt.EcInfo) + } + default: + err = fmt.Errorf("unknown get object part %T", pt) + } + + return err +} + +func (r *GetResponse) ToGRPCMessage() grpc.Message { + var m *object.GetResponse + + if r != nil { + m = new(object.GetResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *GetResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *PutObjectPartInit) ToGRPCMessage() grpc.Message { + var m *object.PutRequest_Body_Init + + if r != nil { + m = new(object.PutRequest_Body_Init) + + m.SetObjectId(r.id.ToGRPCMessage().(*refsGRPC.ObjectID)) + m.SetSignature(r.sig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetHeader(r.hdr.ToGRPCMessage().(*object.Header)) + m.SetCopiesNumber(r.copyNum) + } + + return m +} + +func (r *PutObjectPartInit) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutRequest_Body_Init) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + id := v.GetObjectId() + if id == nil { + r.id = nil + } else { + if r.id == nil { + r.id = new(refs.ObjectID) + } + + err = r.id.FromGRPCMessage(id) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.sig = nil + } else { + if r.sig == nil { + r.sig = new(refs.Signature) + } + + err = r.sig.FromGRPCMessage(sig) + if err != nil { + return err + } + } + + hdr := v.GetHeader() + if hdr == nil { + r.hdr = nil + } else { + if r.hdr == nil { + r.hdr = new(Header) + } + + err = r.hdr.FromGRPCMessage(hdr) + if err != nil { + return err + } + } + + r.copyNum = v.GetCopiesNumber() + + return nil +} + +func (r *PutObjectPartChunk) ToGRPCMessage() grpc.Message { + var m *object.PutRequest_Body_Chunk + + if r != nil { + m = new(object.PutRequest_Body_Chunk) + + m.Chunk = r.chunk + } + + return m +} + +func (r *PutObjectPartChunk) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutRequest_Body_Chunk) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.chunk = v.Chunk + + return nil +} + +func (r *PutRequestBody) ToGRPCMessage() grpc.Message { + var m *object.PutRequest_Body + + if r != nil { + m = new(object.PutRequest_Body) + + switch v := r.GetObjectPart(); t := v.(type) { + case nil: + m.ObjectPart = nil + case *PutObjectPartInit: + m.SetInit(t.ToGRPCMessage().(*object.PutRequest_Body_Init)) + case *PutObjectPartChunk: + m.SetChunk(t.ToGRPCMessage().(*object.PutRequest_Body_Chunk).Chunk) + default: + panic(fmt.Sprintf("unknown put object part %T", t)) + } + } + + return m +} + +func (r *PutRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.objPart = nil + + switch pt := v.GetObjectPart().(type) { + case nil: + case *object.PutRequest_Body_Init_: + if pt != nil { + partInit := new(PutObjectPartInit) + r.objPart = partInit + err = partInit.FromGRPCMessage(pt.Init) + } + case *object.PutRequest_Body_Chunk: + if pt != nil { + partChunk := new(PutObjectPartChunk) + r.objPart = partChunk + err = partChunk.FromGRPCMessage(pt) + } + default: + err = fmt.Errorf("unknown put object part %T", pt) + } + + return err +} + +func (r *PutRequest) ToGRPCMessage() grpc.Message { + var m *object.PutRequest + + if r != nil { + m = new(object.PutRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.PutRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *PutRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *PutResponseBody) ToGRPCMessage() grpc.Message { + var m *object.PutResponse_Body + + if r != nil { + m = new(object.PutResponse_Body) + + m.SetObjectId(r.id.ToGRPCMessage().(*refsGRPC.ObjectID)) + } + + return m +} + +func (r *PutResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + id := v.GetObjectId() + if id == nil { + r.id = nil + } else { + if r.id == nil { + r.id = new(refs.ObjectID) + } + + err = r.id.FromGRPCMessage(id) + } + + return err +} + +func (r *PutResponse) ToGRPCMessage() grpc.Message { + var m *object.PutResponse + + if r != nil { + m = new(object.PutResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.PutResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *PutResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *DeleteRequestBody) ToGRPCMessage() grpc.Message { + var m *object.DeleteRequest_Body + + if r != nil { + m = new(object.DeleteRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + } + + return m +} + +func (r *DeleteRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.DeleteRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + } + + return err +} + +func (r *DeleteRequest) ToGRPCMessage() grpc.Message { + var m *object.DeleteRequest + + if r != nil { + m = new(object.DeleteRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.DeleteRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *DeleteRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.DeleteRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(DeleteRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *DeleteResponseBody) ToGRPCMessage() grpc.Message { + var m *object.DeleteResponse_Body + + if r != nil { + m = new(object.DeleteResponse_Body) + + m.SetTombstone(r.tombstone.ToGRPCMessage().(*refsGRPC.Address)) + } + + return m +} + +func (r *DeleteResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.DeleteResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + tombstone := v.GetTombstone() + if tombstone == nil { + r.tombstone = nil + } else { + if r.tombstone == nil { + r.tombstone = new(refs.Address) + } + + err = r.tombstone.FromGRPCMessage(tombstone) + } + + return err +} + +func (r *DeleteResponse) ToGRPCMessage() grpc.Message { + var m *object.DeleteResponse + + if r != nil { + m = new(object.DeleteResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.DeleteResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *DeleteResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.DeleteResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(DeleteResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *HeadRequestBody) ToGRPCMessage() grpc.Message { + var m *object.HeadRequest_Body + + if r != nil { + m = new(object.HeadRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetRaw(r.raw) + m.SetMainOnly(r.mainOnly) + } + + return m +} + +func (r *HeadRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeadRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + r.raw = v.GetRaw() + r.mainOnly = v.GetMainOnly() + + return nil +} + +func (r *HeadRequest) ToGRPCMessage() grpc.Message { + var m *object.HeadRequest + + if r != nil { + m = new(object.HeadRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.HeadRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *HeadRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeadRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(HeadRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *HeadResponseBody) ToGRPCMessage() grpc.Message { + var m *object.HeadResponse_Body + + if r != nil { + m = new(object.HeadResponse_Body) + + switch v := r.hdrPart.(type) { + case nil: + m.Head = nil + case *HeaderWithSignature: + m.SetHeader(v.ToGRPCMessage().(*object.HeaderWithSignature)) + case *ShortHeader: + m.SetShortHeader(v.ToGRPCMessage().(*object.ShortHeader)) + case *SplitInfo: + m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) + case *ECInfo: + m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo)) + default: + panic(fmt.Sprintf("unknown head part %T", v)) + } + } + + return m +} + +func (r *HeadResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeadResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.hdrPart = nil + + switch pt := v.GetHead().(type) { + case nil: + case *object.HeadResponse_Body_Header: + if pt != nil { + partHdr := new(HeaderWithSignature) + r.hdrPart = partHdr + err = partHdr.FromGRPCMessage(pt.Header) + } + case *object.HeadResponse_Body_ShortHeader: + if pt != nil { + partShort := new(ShortHeader) + r.hdrPart = partShort + err = partShort.FromGRPCMessage(pt.ShortHeader) + } + case *object.HeadResponse_Body_SplitInfo: + if pt != nil { + partSplit := new(SplitInfo) + r.hdrPart = partSplit + err = partSplit.FromGRPCMessage(pt.SplitInfo) + } + case *object.HeadResponse_Body_EcInfo: + if pt != nil { + partEC := new(ECInfo) + r.hdrPart = partEC + err = partEC.FromGRPCMessage(pt.EcInfo) + } + default: + err = fmt.Errorf("unknown head part %T", pt) + } + + return err +} + +func (r *HeadResponse) ToGRPCMessage() grpc.Message { + var m *object.HeadResponse + + if r != nil { + m = new(object.HeadResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.HeadResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *HeadResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.HeadResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(HeadResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (f *SearchFilter) ToGRPCMessage() grpc.Message { + var m *object.SearchRequest_Body_Filter + + if f != nil { + m = new(object.SearchRequest_Body_Filter) + + m.SetKey(f.key) + m.SetValue(f.val) + m.SetMatchType(MatchTypeToGRPCField(f.matchType)) + } + + return m +} + +func (f *SearchFilter) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchRequest_Body_Filter) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + f.key = v.GetKey() + f.val = v.GetValue() + f.matchType = MatchTypeFromGRPCField(v.GetMatchType()) + + return nil +} + +func SearchFiltersToGRPC(fs []SearchFilter) (res []*object.SearchRequest_Body_Filter) { + if fs != nil { + res = make([]*object.SearchRequest_Body_Filter, 0, len(fs)) + + for i := range fs { + res = append(res, fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter)) + } + } + + return +} + +func SearchFiltersFromGRPC(fs []*object.SearchRequest_Body_Filter) (res []SearchFilter, err error) { + if fs != nil { + res = make([]SearchFilter, len(fs)) + + for i := range fs { + err = res[i].FromGRPCMessage(fs[i]) + if err != nil { + return + } + } + } + + return +} + +func (r *SearchRequestBody) ToGRPCMessage() grpc.Message { + var m *object.SearchRequest_Body + + if r != nil { + m = new(object.SearchRequest_Body) + + m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + m.SetFilters(SearchFiltersToGRPC(r.filters)) + m.SetVersion(r.version) + } + + return m +} + +func (r *SearchRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + r.cid = nil + } else { + if r.cid == nil { + r.cid = new(refs.ContainerID) + } + + err = r.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } + + r.filters, err = SearchFiltersFromGRPC(v.GetFilters()) + if err != nil { + return err + } + + r.version = v.GetVersion() + + return nil +} + +func (r *SearchRequest) ToGRPCMessage() grpc.Message { + var m *object.SearchRequest + + if r != nil { + m = new(object.SearchRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.SearchRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *SearchRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(SearchRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *SearchResponseBody) ToGRPCMessage() grpc.Message { + var m *object.SearchResponse_Body + + if r != nil { + m = new(object.SearchResponse_Body) + + m.SetIdList(refs.ObjectIDListToGRPCMessage(r.idList)) + } + + return m +} + +func (r *SearchResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.idList, err = refs.ObjectIDListFromGRPCMessage(v.GetIdList()) + + return err +} + +func (r *SearchResponse) ToGRPCMessage() grpc.Message { + var m *object.SearchResponse + + if r != nil { + m = new(object.SearchResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.SearchResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *SearchResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.SearchResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(SearchResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *Range) ToGRPCMessage() grpc.Message { + var m *object.Range + + if r != nil { + m = new(object.Range) + + m.SetLength(r.len) + m.SetOffset(r.off) + } + + return m +} + +func (r *Range) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.Range) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.len = v.GetLength() + r.off = v.GetOffset() + + return nil +} + +func RangesToGRPC(rs []Range) (res []*object.Range) { + if rs != nil { + res = make([]*object.Range, 0, len(rs)) + + for i := range rs { + res = append(res, rs[i].ToGRPCMessage().(*object.Range)) + } + } + + return +} + +func RangesFromGRPC(rs []*object.Range) (res []Range, err error) { + if rs != nil { + res = make([]Range, len(rs)) + + for i := range rs { + err = res[i].FromGRPCMessage(rs[i]) + if err != nil { + return + } + } + } + + return +} + +func (r *GetRangeRequestBody) ToGRPCMessage() grpc.Message { + var m *object.GetRangeRequest_Body + + if r != nil { + m = new(object.GetRangeRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetRange(r.rng.ToGRPCMessage().(*object.Range)) + m.SetRaw(r.raw) + } + + return m +} + +func (r *GetRangeRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + rng := v.GetRange() + if rng == nil { + r.rng = nil + } else { + if r.rng == nil { + r.rng = new(Range) + } + + err = r.rng.FromGRPCMessage(rng) + if err != nil { + return err + } + } + + r.raw = v.GetRaw() + + return nil +} + +func (r *GetRangeRequest) ToGRPCMessage() grpc.Message { + var m *object.GetRangeRequest + + if r != nil { + m = new(object.GetRangeRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRangeRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *GetRangeRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRangeRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *GetRangePartChunk) ToGRPCMessage() grpc.Message { + var m *object.GetRangeResponse_Body_Chunk + + if r != nil { + m = new(object.GetRangeResponse_Body_Chunk) + + m.Chunk = r.chunk + } + + return m +} + +func (r *GetRangePartChunk) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeResponse_Body_Chunk) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.chunk = v.Chunk + + return nil +} + +func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message { + var m *object.GetRangeResponse_Body + + if r != nil { + m = new(object.GetRangeResponse_Body) + + switch v := r.rngPart.(type) { + case nil: + m.RangePart = nil + case *GetRangePartChunk: + m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk).Chunk) + case *SplitInfo: + m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) + case *ECInfo: + m.SetEcInfo(v.ToGRPCMessage().(*object.ECInfo)) + default: + panic(fmt.Sprintf("unknown get range part %T", v)) + } + } + + return m +} + +func (r *GetRangeResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.rngPart = nil + + switch pt := v.GetRangePart().(type) { + case nil: + case *object.GetRangeResponse_Body_Chunk: + if pt != nil { + partChunk := new(GetRangePartChunk) + r.rngPart = partChunk + err = partChunk.FromGRPCMessage(pt) + } + case *object.GetRangeResponse_Body_SplitInfo: + if pt != nil { + partSplit := new(SplitInfo) + r.rngPart = partSplit + err = partSplit.FromGRPCMessage(pt.SplitInfo) + } + case *object.GetRangeResponse_Body_EcInfo: + if pt != nil { + partEC := new(ECInfo) + r.rngPart = partEC + err = partEC.FromGRPCMessage(pt.EcInfo) + } + default: + err = fmt.Errorf("unknown get range part %T", pt) + } + + return err +} + +func (r *GetRangeResponse) ToGRPCMessage() grpc.Message { + var m *object.GetRangeResponse + + if r != nil { + m = new(object.GetRangeResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRangeResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *GetRangeResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRangeResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *GetRangeHashRequestBody) ToGRPCMessage() grpc.Message { + var m *object.GetRangeHashRequest_Body + + if r != nil { + m = new(object.GetRangeHashRequest_Body) + + m.SetAddress(r.addr.ToGRPCMessage().(*refsGRPC.Address)) + m.SetRanges(RangesToGRPC(r.rngs)) + m.SetType(refs.ChecksumTypeToGRPC(r.typ)) + m.SetSalt(r.salt) + } + + return m +} + +func (r *GetRangeHashRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeHashRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.addr = nil + } else { + if r.addr == nil { + r.addr = new(refs.Address) + } + + err = r.addr.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + r.rngs, err = RangesFromGRPC(v.GetRanges()) + if err != nil { + return err + } + + r.typ = refs.ChecksumTypeFromGRPC(v.GetType()) + r.salt = v.GetSalt() + + return nil +} + +func (r *GetRangeHashRequest) ToGRPCMessage() grpc.Message { + var m *object.GetRangeHashRequest + + if r != nil { + m = new(object.GetRangeHashRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRangeHashRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *GetRangeHashRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeHashRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRangeHashRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *GetRangeHashResponseBody) ToGRPCMessage() grpc.Message { + var m *object.GetRangeHashResponse_Body + + if r != nil { + m = new(object.GetRangeHashResponse_Body) + + m.SetType(refs.ChecksumTypeToGRPC(r.typ)) + m.SetHashList(r.hashList) + } + + return m +} + +func (r *GetRangeHashResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeHashResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.typ = refs.ChecksumTypeFromGRPC(v.GetType()) + r.hashList = v.GetHashList() + + return nil +} + +func (r *GetRangeHashResponse) ToGRPCMessage() grpc.Message { + var m *object.GetRangeHashResponse + + if r != nil { + m = new(object.GetRangeHashResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.GetRangeHashResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *GetRangeHashResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.GetRangeHashResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetRangeHashResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *PutSingleRequestBody) ToGRPCMessage() grpc.Message { + var m *object.PutSingleRequest_Body + + if r != nil { + m = new(object.PutSingleRequest_Body) + m.SetObject(r.GetObject().ToGRPCMessage().(*object.Object)) + m.SetCopiesNumber(r.GetCopiesNumber()) + } + + return m +} + +func (r *PutSingleRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + if v.GetObject() == nil { + r.object = nil + } else { + if r.object == nil { + r.object = new(Object) + } + + err := r.object.FromGRPCMessage(v.GetObject()) + if err != nil { + return err + } + } + + r.copyNum = v.GetCopiesNumber() + + return nil +} + +func (r *PutSingleRequest) ToGRPCMessage() grpc.Message { + var m *object.PutSingleRequest + + if r != nil { + m = new(object.PutSingleRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.PutSingleRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *PutSingleRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutSingleRequestBody) + } + + err := r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *PutSingleResponseBody) ToGRPCMessage() grpc.Message { + var b *object.PutSingleResponse_Body + if r != nil { + b = new(object.PutSingleResponse_Body) + } + return b +} + +func (r *PutSingleResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + return nil +} + +func (r *PutSingleResponse) ToGRPCMessage() grpc.Message { + var m *object.PutSingleResponse + + if r != nil { + m = new(object.PutSingleResponse) + + m.SetBody(r.body.ToGRPCMessage().(*object.PutSingleResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *PutSingleResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PutSingleResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PutSingleResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} + +func (r *PatchRequestBodyPatch) ToGRPCMessage() grpc.Message { + var m *object.PatchRequest_Body_Patch + + if r != nil { + m = new(object.PatchRequest_Body_Patch) + + m.SetSourceRange(r.GetRange().ToGRPCMessage().(*object.Range)) + m.SetChunk(r.GetChunk()) + } + + return m +} + +func (r *PatchRequestBodyPatch) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchRequest_Body_Patch) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + srcRange := v.GetSourceRange() + if srcRange == nil { + r.Range = nil + } else { + if r.Range == nil { + r.Range = new(Range) + } + + err = r.Range.FromGRPCMessage(srcRange) + if err != nil { + return err + } + } + + r.Chunk = v.GetChunk() + + return nil +} + +func (r *PatchRequestBody) ToGRPCMessage() grpc.Message { + var m *object.PatchRequest_Body + + if r != nil { + m = new(object.PatchRequest_Body) + + m.SetAddress(r.address.ToGRPCMessage().(*refsGRPC.Address)) + m.SetNewAttributes(AttributesToGRPC(r.newAttributes)) + m.SetReplaceAttributes(r.replaceAttributes) + m.SetPatch(r.patch.ToGRPCMessage().(*object.PatchRequest_Body_Patch)) + m.SetNewSplitHeader(r.newSplitHeader.ToGRPCMessage().(*object.Header_Split)) + } + + return m +} + +func (r *PatchRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + addr := v.GetAddress() + if addr == nil { + r.address = nil + } else { + if r.address == nil { + r.address = new(refs.Address) + } + + err = r.address.FromGRPCMessage(addr) + if err != nil { + return err + } + } + + r.newAttributes, err = AttributesFromGRPC(v.GetNewAttributes()) + if err != nil { + return err + } + + r.replaceAttributes = v.GetReplaceAttributes() + + patch := v.GetPatch() + if patch == nil { + r.patch = nil + } else { + if r.patch == nil { + r.patch = new(PatchRequestBodyPatch) + } + + err = r.patch.FromGRPCMessage(patch) + if err != nil { + return err + } + } + + newSplitHeader := v.GetNewSplitHeader() + if newSplitHeader == nil { + r.newSplitHeader = nil + } else { + if r.newSplitHeader == nil { + r.newSplitHeader = new(SplitHeader) + } + + err = r.newSplitHeader.FromGRPCMessage(newSplitHeader) + if err != nil { + return err + } + } + + return nil +} + +func (r *PatchRequest) ToGRPCMessage() grpc.Message { + var m *object.PatchRequest + + if r != nil { + m = new(object.PatchRequest) + + m.SetBody(r.body.ToGRPCMessage().(*object.PatchRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *PatchRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(PatchRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *PatchResponseBody) ToGRPCMessage() grpc.Message { + var m *object.PatchResponse_Body + + if r != nil { + m = new(object.PatchResponse_Body) + + m.SetObjectId(r.ObjectID.ToGRPCMessage().(*refsGRPC.ObjectID)) + } + + return m +} + +func (r *PatchResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + objID := v.GetObjectId() + if objID == nil { + r.ObjectID = nil + } else { + if r.ObjectID == nil { + r.ObjectID = new(refs.ObjectID) + } + + err = r.ObjectID.FromGRPCMessage(objID) + if err != nil { + return err + } + } + + return nil +} + +func (r *PatchResponse) ToGRPCMessage() grpc.Message { + var m *object.PatchResponse + + if r != nil { + m = new(object.PatchResponse) + + m.SetBody(r.Body.ToGRPCMessage().(*object.PatchResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *PatchResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*object.PatchResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.Body = nil + } else { + if r.Body == nil { + r.Body = new(PatchResponseBody) + } + + err = r.Body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.ResponseHeaders.FromMessage(v) +} diff --git a/api/object/filters.go b/api/object/filters.go new file mode 100644 index 00000000..9fe024dc --- /dev/null +++ b/api/object/filters.go @@ -0,0 +1,58 @@ +package object + +// ReservedFilterPrefix is a prefix of key to object header value or property. +const ReservedFilterPrefix = "$Object:" + +const ( + // FilterHeaderVersion is a filter key to "version" field of the object header. + FilterHeaderVersion = ReservedFilterPrefix + "version" + + // FilterHeaderObjectID is a filter key to "object_id" field of the object. + FilterHeaderObjectID = ReservedFilterPrefix + "objectID" + + // FilterHeaderContainerID is a filter key to "container_id" field of the object header. + FilterHeaderContainerID = ReservedFilterPrefix + "containerID" + + // FilterHeaderOwnerID is a filter key to "owner_id" field of the object header. + FilterHeaderOwnerID = ReservedFilterPrefix + "ownerID" + + // FilterHeaderCreationEpoch is a filter key to "creation_epoch" field of the object header. + FilterHeaderCreationEpoch = ReservedFilterPrefix + "creationEpoch" + + // FilterHeaderPayloadLength is a filter key to "payload_length" field of the object header. + FilterHeaderPayloadLength = ReservedFilterPrefix + "payloadLength" + + // FilterHeaderPayloadHash is a filter key to "payload_hash" field of the object header. + FilterHeaderPayloadHash = ReservedFilterPrefix + "payloadHash" + + // FilterHeaderObjectType is a filter key to "object_type" field of the object header. + FilterHeaderObjectType = ReservedFilterPrefix + "objectType" + + // FilterHeaderHomomorphicHash is a filter key to "homomorphic_hash" field of the object header. + FilterHeaderHomomorphicHash = ReservedFilterPrefix + "homomorphicHash" + + // FilterHeaderParent is a filter key to "split.parent" field of the object header. + FilterHeaderParent = ReservedFilterPrefix + "split.parent" + + // FilterHeaderSplitID is a filter key to "split.splitID" field of the object header. + FilterHeaderSplitID = ReservedFilterPrefix + "split.splitID" + + // FilterHeaderECParent is a filter key to "ec.parent" field of the object header. + FilterHeaderECParent = ReservedFilterPrefix + "ec.parent" +) + +const ( + // FilterPropertyRoot is a filter key to check if regular object is on top of split hierarchy. + FilterPropertyRoot = ReservedFilterPrefix + "ROOT" + + // FilterPropertyPhy is a filter key to check if an object physically stored on a node. + FilterPropertyPhy = ReservedFilterPrefix + "PHY" +) + +const ( + // BooleanPropertyValueTrue is a true value for boolean property filters. + BooleanPropertyValueTrue = "true" + + // BooleanPropertyValueFalse is a false value for boolean property filters. + BooleanPropertyValueFalse = "" +) diff --git a/api/object/grpc/service.pb.go b/api/object/grpc/service.pb.go new file mode 100644 index 00000000..8926f5cb --- /dev/null +++ b/api/object/grpc/service.pb.go @@ -0,0 +1,6275 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/object/grpc/service.proto + +//go:build !protoopaque + +package object + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GET object request +type GetRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of get object request message. + Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest) Reset() { + *x = GetRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRequest) GetBody() *GetRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *GetRequest) SetBody(v *GetRequest_Body) { + x.Body = v +} + +func (x *GetRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *GetRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *GetRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *GetRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *GetRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *GetRequest) ClearBody() { + x.Body = nil +} + +func (x *GetRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *GetRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type GetRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get object request message. + Body *GetRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 GetRequest_builder) Build() *GetRequest { + m0 := &GetRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// GET object response +type GetResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of get object response message. + Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse) Reset() { + *x = GetResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse) GetBody() *GetResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *GetResponse) SetBody(v *GetResponse_Body) { + x.Body = v +} + +func (x *GetResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *GetResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *GetResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *GetResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *GetResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *GetResponse) ClearBody() { + x.Body = nil +} + +func (x *GetResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *GetResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type GetResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get object response message. + Body *GetResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 GetResponse_builder) Build() *GetResponse { + m0 := &GetResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// PUT object request +type PutRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of put object request message. + Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest) Reset() { + *x = PutRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest) ProtoMessage() {} + +func (x *PutRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest) GetBody() *PutRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *PutRequest) SetBody(v *PutRequest_Body) { + x.Body = v +} + +func (x *PutRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *PutRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *PutRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *PutRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *PutRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *PutRequest) ClearBody() { + x.Body = nil +} + +func (x *PutRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *PutRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type PutRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of put object request message. + Body *PutRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 PutRequest_builder) Build() *PutRequest { + m0 := &PutRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// PUT Object response +type PutResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of put object response message. + Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse) Reset() { + *x = PutResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutResponse) GetBody() *PutResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *PutResponse) SetBody(v *PutResponse_Body) { + x.Body = v +} + +func (x *PutResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *PutResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *PutResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *PutResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *PutResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *PutResponse) ClearBody() { + x.Body = nil +} + +func (x *PutResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *PutResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type PutResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of put object response message. + Body *PutResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 PutResponse_builder) Build() *PutResponse { + m0 := &PutResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Object DELETE request +type DeleteRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of delete object request message. + Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteRequest) GetBody() *DeleteRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *DeleteRequest) SetBody(v *DeleteRequest_Body) { + x.Body = v +} + +func (x *DeleteRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *DeleteRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *DeleteRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *DeleteRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *DeleteRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *DeleteRequest) ClearBody() { + x.Body = nil +} + +func (x *DeleteRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *DeleteRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type DeleteRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of delete object request message. + Body *DeleteRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 DeleteRequest_builder) Build() *DeleteRequest { + m0 := &DeleteRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// DeleteResponse body is empty because we cannot guarantee permanent object +// removal in distributed system. +type DeleteResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of delete object response message. + Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteResponse) GetBody() *DeleteResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *DeleteResponse) SetBody(v *DeleteResponse_Body) { + x.Body = v +} + +func (x *DeleteResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *DeleteResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *DeleteResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *DeleteResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *DeleteResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *DeleteResponse) ClearBody() { + x.Body = nil +} + +func (x *DeleteResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *DeleteResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type DeleteResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of delete object response message. + Body *DeleteResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 DeleteResponse_builder) Build() *DeleteResponse { + m0 := &DeleteResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Object HEAD request +type HeadRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of head object request message. + Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeadRequest) Reset() { + *x = HeadRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadRequest) ProtoMessage() {} + +func (x *HeadRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeadRequest) GetBody() *HeadRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *HeadRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *HeadRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *HeadRequest) SetBody(v *HeadRequest_Body) { + x.Body = v +} + +func (x *HeadRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *HeadRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *HeadRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *HeadRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *HeadRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *HeadRequest) ClearBody() { + x.Body = nil +} + +func (x *HeadRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *HeadRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type HeadRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of head object request message. + Body *HeadRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 HeadRequest_builder) Build() *HeadRequest { + m0 := &HeadRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Tuple of a full object header and signature of an `ObjectID`. \ +// Signed `ObjectID` is present to verify full header's authenticity through the +// following steps: +// +// 1. Calculate `SHA-256` of the marshalled `Header` structure +// 2. Check if the resulting hash matches `ObjectID` +// 3. Check if `ObjectID` signature in `signature` field is correct +type HeaderWithSignature struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Full object header + Header *Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + // Signed `ObjectID` to verify full header's authenticity + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeaderWithSignature) Reset() { + *x = HeaderWithSignature{} + mi := &file_api_object_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeaderWithSignature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeaderWithSignature) ProtoMessage() {} + +func (x *HeaderWithSignature) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeaderWithSignature) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *HeaderWithSignature) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *HeaderWithSignature) SetHeader(v *Header) { + x.Header = v +} + +func (x *HeaderWithSignature) SetSignature(v *grpc1.Signature) { + x.Signature = v +} + +func (x *HeaderWithSignature) HasHeader() bool { + if x == nil { + return false + } + return x.Header != nil +} + +func (x *HeaderWithSignature) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *HeaderWithSignature) ClearHeader() { + x.Header = nil +} + +func (x *HeaderWithSignature) ClearSignature() { + x.Signature = nil +} + +type HeaderWithSignature_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Full object header + Header *Header + // Signed `ObjectID` to verify full header's authenticity + Signature *grpc1.Signature +} + +func (b0 HeaderWithSignature_builder) Build() *HeaderWithSignature { + m0 := &HeaderWithSignature{} + b, x := &b0, m0 + _, _ = b, x + x.Header = b.Header + x.Signature = b.Signature + return m0 +} + +// Object HEAD response +type HeadResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of head object response message. + Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeadResponse) Reset() { + *x = HeadResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadResponse) ProtoMessage() {} + +func (x *HeadResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeadResponse) GetBody() *HeadResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *HeadResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *HeadResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *HeadResponse) SetBody(v *HeadResponse_Body) { + x.Body = v +} + +func (x *HeadResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *HeadResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *HeadResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *HeadResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *HeadResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *HeadResponse) ClearBody() { + x.Body = nil +} + +func (x *HeadResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *HeadResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type HeadResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of head object response message. + Body *HeadResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 HeadResponse_builder) Build() *HeadResponse { + m0 := &HeadResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Object Search request +type SearchRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of search object request message. + Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchRequest) Reset() { + *x = SearchRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest) ProtoMessage() {} + +func (x *SearchRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchRequest) GetBody() *SearchRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SearchRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *SearchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *SearchRequest) SetBody(v *SearchRequest_Body) { + x.Body = v +} + +func (x *SearchRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *SearchRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *SearchRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *SearchRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *SearchRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *SearchRequest) ClearBody() { + x.Body = nil +} + +func (x *SearchRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *SearchRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type SearchRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of search object request message. + Body *SearchRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 SearchRequest_builder) Build() *SearchRequest { + m0 := &SearchRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Search response +type SearchResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of search object response message. + Body *SearchResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchResponse) Reset() { + *x = SearchResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchResponse) ProtoMessage() {} + +func (x *SearchResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchResponse) GetBody() *SearchResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SearchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *SearchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *SearchResponse) SetBody(v *SearchResponse_Body) { + x.Body = v +} + +func (x *SearchResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *SearchResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *SearchResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *SearchResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *SearchResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *SearchResponse) ClearBody() { + x.Body = nil +} + +func (x *SearchResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *SearchResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type SearchResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of search object response message. + Body *SearchResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 SearchResponse_builder) Build() *SearchResponse { + m0 := &SearchResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Object payload range.Ranges of zero length SHOULD be considered as invalid. +type Range struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Offset of the range from the object payload start + Offset *uint64 `protobuf:"varint,1,opt,name=offset" json:"offset,omitempty"` + // Length in bytes of the object payload range + Length *uint64 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Range) Reset() { + *x = Range{} + mi := &file_api_object_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Range) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Range) ProtoMessage() {} + +func (x *Range) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Range) GetOffset() uint64 { + if x != nil && x.Offset != nil { + return *x.Offset + } + return 0 +} + +func (x *Range) GetLength() uint64 { + if x != nil && x.Length != nil { + return *x.Length + } + return 0 +} + +func (x *Range) SetOffset(v uint64) { + x.Offset = &v +} + +func (x *Range) SetLength(v uint64) { + x.Length = &v +} + +func (x *Range) HasOffset() bool { + if x == nil { + return false + } + return x.Offset != nil +} + +func (x *Range) HasLength() bool { + if x == nil { + return false + } + return x.Length != nil +} + +func (x *Range) ClearOffset() { + x.Offset = nil +} + +func (x *Range) ClearLength() { + x.Length = nil +} + +type Range_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Offset of the range from the object payload start + Offset *uint64 + // Length in bytes of the object payload range + Length *uint64 +} + +func (b0 Range_builder) Build() *Range { + m0 := &Range{} + b, x := &b0, m0 + _, _ = b, x + x.Offset = b.Offset + x.Length = b.Length + return m0 +} + +// Request part of object's payload +type GetRangeRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of get range object request message. + Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeRequest) Reset() { + *x = GetRangeRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeRequest) ProtoMessage() {} + +func (x *GetRangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeRequest) GetBody() *GetRangeRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRangeRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRangeRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { + x.Body = v +} + +func (x *GetRangeRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *GetRangeRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *GetRangeRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *GetRangeRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *GetRangeRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *GetRangeRequest) ClearBody() { + x.Body = nil +} + +func (x *GetRangeRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *GetRangeRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type GetRangeRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get range object request message. + Body *GetRangeRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 GetRangeRequest_builder) Build() *GetRangeRequest { + m0 := &GetRangeRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Get part of object's payload +type GetRangeResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of get range object response message. + Body *GetRangeResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeResponse) Reset() { + *x = GetRangeResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeResponse) ProtoMessage() {} + +func (x *GetRangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeResponse) GetBody() *GetRangeResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRangeResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRangeResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { + x.Body = v +} + +func (x *GetRangeResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *GetRangeResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *GetRangeResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *GetRangeResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *GetRangeResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *GetRangeResponse) ClearBody() { + x.Body = nil +} + +func (x *GetRangeResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *GetRangeResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type GetRangeResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get range object response message. + Body *GetRangeResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 GetRangeResponse_builder) Build() *GetRangeResponse { + m0 := &GetRangeResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Get hash of object's payload part +type GetRangeHashRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of get range hash object request message. + Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeHashRequest) Reset() { + *x = GetRangeHashRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeHashRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashRequest) ProtoMessage() {} + +func (x *GetRangeHashRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRangeHashRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRangeHashRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { + x.Body = v +} + +func (x *GetRangeHashRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *GetRangeHashRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *GetRangeHashRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *GetRangeHashRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *GetRangeHashRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *GetRangeHashRequest) ClearBody() { + x.Body = nil +} + +func (x *GetRangeHashRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *GetRangeHashRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type GetRangeHashRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get range hash object request message. + Body *GetRangeHashRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 GetRangeHashRequest_builder) Build() *GetRangeHashRequest { + m0 := &GetRangeHashRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Get hash of object's payload part +type GetRangeHashResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of get range hash object response message. + Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeHashResponse) Reset() { + *x = GetRangeHashResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeHashResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashResponse) ProtoMessage() {} + +func (x *GetRangeHashResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *GetRangeHashResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { + x.Body = v +} + +func (x *GetRangeHashResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *GetRangeHashResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *GetRangeHashResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *GetRangeHashResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *GetRangeHashResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *GetRangeHashResponse) ClearBody() { + x.Body = nil +} + +func (x *GetRangeHashResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *GetRangeHashResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type GetRangeHashResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get range hash object response message. + Body *GetRangeHashResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 GetRangeHashResponse_builder) Build() *GetRangeHashResponse { + m0 := &GetRangeHashResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Object PUT Single request +type PutSingleRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of put single object request message. + Body *PutSingleRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutSingleRequest) Reset() { + *x = PutSingleRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutSingleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleRequest) ProtoMessage() {} + +func (x *PutSingleRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutSingleRequest) GetBody() *PutSingleRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutSingleRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutSingleRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *PutSingleRequest) SetBody(v *PutSingleRequest_Body) { + x.Body = v +} + +func (x *PutSingleRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *PutSingleRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *PutSingleRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *PutSingleRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *PutSingleRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *PutSingleRequest) ClearBody() { + x.Body = nil +} + +func (x *PutSingleRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *PutSingleRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type PutSingleRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of put single object request message. + Body *PutSingleRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 PutSingleRequest_builder) Build() *PutSingleRequest { + m0 := &PutSingleRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Object PUT Single response +type PutSingleResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of put single object response message. + Body *PutSingleResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutSingleResponse) Reset() { + *x = PutSingleResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutSingleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleResponse) ProtoMessage() {} + +func (x *PutSingleResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutSingleResponse) GetBody() *PutSingleResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PutSingleResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PutSingleResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *PutSingleResponse) SetBody(v *PutSingleResponse_Body) { + x.Body = v +} + +func (x *PutSingleResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *PutSingleResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *PutSingleResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *PutSingleResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *PutSingleResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *PutSingleResponse) ClearBody() { + x.Body = nil +} + +func (x *PutSingleResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *PutSingleResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type PutSingleResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of put single object response message. + Body *PutSingleResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 PutSingleResponse_builder) Build() *PutSingleResponse { + m0 := &PutSingleResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Object PATCH request +type PatchRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body for patch request message. + Body *PatchRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchRequest) Reset() { + *x = PatchRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest) ProtoMessage() {} + +func (x *PatchRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchRequest) GetBody() *PatchRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PatchRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PatchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *PatchRequest) SetBody(v *PatchRequest_Body) { + x.Body = v +} + +func (x *PatchRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *PatchRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *PatchRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *PatchRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *PatchRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *PatchRequest) ClearBody() { + x.Body = nil +} + +func (x *PatchRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *PatchRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type PatchRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body for patch request message. + Body *PatchRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 PatchRequest_builder) Build() *PatchRequest { + m0 := &PatchRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Object PATCH response +type PatchResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body for patch response message. + Body *PatchResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchResponse) Reset() { + *x = PatchResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchResponse) ProtoMessage() {} + +func (x *PatchResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchResponse) GetBody() *PatchResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *PatchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *PatchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *PatchResponse) SetBody(v *PatchResponse_Body) { + x.Body = v +} + +func (x *PatchResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *PatchResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *PatchResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *PatchResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *PatchResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *PatchResponse) ClearBody() { + x.Body = nil +} + +func (x *PatchResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *PatchResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type PatchResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body for patch response message. + Body *PatchResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 PatchResponse_builder) Build() *PatchResponse { + m0 := &PatchResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// GET Object request body +type GetRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Address of the requested object + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node + Raw *bool `protobuf:"varint,2,opt,name=raw" json:"raw,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest_Body) Reset() { + *x = GetRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest_Body) ProtoMessage() {} + +func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *GetRequest_Body) GetRaw() bool { + if x != nil && x.Raw != nil { + return *x.Raw + } + return false +} + +func (x *GetRequest_Body) SetAddress(v *grpc1.Address) { + x.Address = v +} + +func (x *GetRequest_Body) SetRaw(v bool) { + x.Raw = &v +} + +func (x *GetRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.Address != nil +} + +func (x *GetRequest_Body) HasRaw() bool { + if x == nil { + return false + } + return x.Raw != nil +} + +func (x *GetRequest_Body) ClearAddress() { + x.Address = nil +} + +func (x *GetRequest_Body) ClearRaw() { + x.Raw = nil +} + +type GetRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the requested object + Address *grpc1.Address + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node + Raw *bool +} + +func (b0 GetRequest_Body_builder) Build() *GetRequest_Body { + m0 := &GetRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Address = b.Address + x.Raw = b.Raw + return m0 +} + +// GET Object Response body +type GetResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Single message in the response stream. + // + // Types that are valid to be assigned to ObjectPart: + // + // *GetResponse_Body_Init_ + // *GetResponse_Body_Chunk + // *GetResponse_Body_SplitInfo + // *GetResponse_Body_EcInfo + ObjectPart isGetResponse_Body_ObjectPart `protobuf_oneof:"object_part"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse_Body) Reset() { + *x = GetResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body) ProtoMessage() {} + +func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse_Body) GetObjectPart() isGetResponse_Body_ObjectPart { + if x != nil { + return x.ObjectPart + } + return nil +} + +func (x *GetResponse_Body) GetInit() *GetResponse_Body_Init { + if x != nil { + if x, ok := x.ObjectPart.(*GetResponse_Body_Init_); ok { + return x.Init + } + } + return nil +} + +func (x *GetResponse_Body) GetChunk() []byte { + if x != nil { + if x, ok := x.ObjectPart.(*GetResponse_Body_Chunk); ok { + return x.Chunk + } + } + return nil +} + +func (x *GetResponse_Body) GetSplitInfo() *SplitInfo { + if x != nil { + if x, ok := x.ObjectPart.(*GetResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + } + return nil +} + +func (x *GetResponse_Body) GetEcInfo() *ECInfo { + if x != nil { + if x, ok := x.ObjectPart.(*GetResponse_Body_EcInfo); ok { + return x.EcInfo + } + } + return nil +} + +func (x *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { + if v == nil { + x.ObjectPart = nil + return + } + x.ObjectPart = &GetResponse_Body_Init_{v} +} + +func (x *GetResponse_Body) SetChunk(v []byte) { + if v == nil { + v = []byte{} + } + x.ObjectPart = &GetResponse_Body_Chunk{v} +} + +func (x *GetResponse_Body) SetSplitInfo(v *SplitInfo) { + if v == nil { + x.ObjectPart = nil + return + } + x.ObjectPart = &GetResponse_Body_SplitInfo{v} +} + +func (x *GetResponse_Body) SetEcInfo(v *ECInfo) { + if v == nil { + x.ObjectPart = nil + return + } + x.ObjectPart = &GetResponse_Body_EcInfo{v} +} + +func (x *GetResponse_Body) HasObjectPart() bool { + if x == nil { + return false + } + return x.ObjectPart != nil +} + +func (x *GetResponse_Body) HasInit() bool { + if x == nil { + return false + } + _, ok := x.ObjectPart.(*GetResponse_Body_Init_) + return ok +} + +func (x *GetResponse_Body) HasChunk() bool { + if x == nil { + return false + } + _, ok := x.ObjectPart.(*GetResponse_Body_Chunk) + return ok +} + +func (x *GetResponse_Body) HasSplitInfo() bool { + if x == nil { + return false + } + _, ok := x.ObjectPart.(*GetResponse_Body_SplitInfo) + return ok +} + +func (x *GetResponse_Body) HasEcInfo() bool { + if x == nil { + return false + } + _, ok := x.ObjectPart.(*GetResponse_Body_EcInfo) + return ok +} + +func (x *GetResponse_Body) ClearObjectPart() { + x.ObjectPart = nil +} + +func (x *GetResponse_Body) ClearInit() { + if _, ok := x.ObjectPart.(*GetResponse_Body_Init_); ok { + x.ObjectPart = nil + } +} + +func (x *GetResponse_Body) ClearChunk() { + if _, ok := x.ObjectPart.(*GetResponse_Body_Chunk); ok { + x.ObjectPart = nil + } +} + +func (x *GetResponse_Body) ClearSplitInfo() { + if _, ok := x.ObjectPart.(*GetResponse_Body_SplitInfo); ok { + x.ObjectPart = nil + } +} + +func (x *GetResponse_Body) ClearEcInfo() { + if _, ok := x.ObjectPart.(*GetResponse_Body_EcInfo); ok { + x.ObjectPart = nil + } +} + +const GetResponse_Body_ObjectPart_not_set_case case_GetResponse_Body_ObjectPart = 0 +const GetResponse_Body_Init_case case_GetResponse_Body_ObjectPart = 1 +const GetResponse_Body_Chunk_case case_GetResponse_Body_ObjectPart = 2 +const GetResponse_Body_SplitInfo_case case_GetResponse_Body_ObjectPart = 3 +const GetResponse_Body_EcInfo_case case_GetResponse_Body_ObjectPart = 4 + +func (x *GetResponse_Body) WhichObjectPart() case_GetResponse_Body_ObjectPart { + if x == nil { + return GetResponse_Body_ObjectPart_not_set_case + } + switch x.ObjectPart.(type) { + case *GetResponse_Body_Init_: + return GetResponse_Body_Init_case + case *GetResponse_Body_Chunk: + return GetResponse_Body_Chunk_case + case *GetResponse_Body_SplitInfo: + return GetResponse_Body_SplitInfo_case + case *GetResponse_Body_EcInfo: + return GetResponse_Body_EcInfo_case + default: + return GetResponse_Body_ObjectPart_not_set_case + } +} + +type GetResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Single message in the response stream. + + // Fields of oneof ObjectPart: + // Initial part of the object stream + Init *GetResponse_Body_Init + // Chunked object payload + Chunk []byte + // Meta information of split hierarchy for object assembly. + SplitInfo *SplitInfo + // Meta information for EC object assembly. + EcInfo *ECInfo + // -- end of ObjectPart +} + +func (b0 GetResponse_Body_builder) Build() *GetResponse_Body { + m0 := &GetResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Init != nil { + x.ObjectPart = &GetResponse_Body_Init_{b.Init} + } + if b.Chunk != nil { + x.ObjectPart = &GetResponse_Body_Chunk{b.Chunk} + } + if b.SplitInfo != nil { + x.ObjectPart = &GetResponse_Body_SplitInfo{b.SplitInfo} + } + if b.EcInfo != nil { + x.ObjectPart = &GetResponse_Body_EcInfo{b.EcInfo} + } + return m0 +} + +type case_GetResponse_Body_ObjectPart protoreflect.FieldNumber + +func (x case_GetResponse_Body_ObjectPart) String() string { + md := file_api_object_grpc_service_proto_msgTypes[21].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isGetResponse_Body_ObjectPart interface { + isGetResponse_Body_ObjectPart() +} + +type GetResponse_Body_Init_ struct { + // Initial part of the object stream + Init *GetResponse_Body_Init `protobuf:"bytes,1,opt,name=init,oneof"` +} + +type GetResponse_Body_Chunk struct { + // Chunked object payload + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,oneof"` +} + +type GetResponse_Body_SplitInfo struct { + // Meta information of split hierarchy for object assembly. + SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,oneof"` +} + +type GetResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,4,opt,name=ec_info,json=ecInfo,oneof"` +} + +func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} + +func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} + +func (*GetResponse_Body_SplitInfo) isGetResponse_Body_ObjectPart() {} + +func (*GetResponse_Body_EcInfo) isGetResponse_Body_ObjectPart() {} + +// Initial part of the `Object` structure stream. Technically it's a +// set of all `Object` structure's fields except `payload`. +type GetResponse_Body_Init struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Object's unique identifier. + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId" json:"object_id,omitempty"` + // Signed `ObjectID` + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + // Object metadata headers + Header *Header `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse_Body_Init) Reset() { + *x = GetResponse_Body_Init{} + mi := &file_api_object_grpc_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse_Body_Init) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body_Init) ProtoMessage() {} + +func (x *GetResponse_Body_Init) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse_Body_Init) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *GetResponse_Body_Init) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *GetResponse_Body_Init) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *GetResponse_Body_Init) SetObjectId(v *grpc1.ObjectID) { + x.ObjectId = v +} + +func (x *GetResponse_Body_Init) SetSignature(v *grpc1.Signature) { + x.Signature = v +} + +func (x *GetResponse_Body_Init) SetHeader(v *Header) { + x.Header = v +} + +func (x *GetResponse_Body_Init) HasObjectId() bool { + if x == nil { + return false + } + return x.ObjectId != nil +} + +func (x *GetResponse_Body_Init) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *GetResponse_Body_Init) HasHeader() bool { + if x == nil { + return false + } + return x.Header != nil +} + +func (x *GetResponse_Body_Init) ClearObjectId() { + x.ObjectId = nil +} + +func (x *GetResponse_Body_Init) ClearSignature() { + x.Signature = nil +} + +func (x *GetResponse_Body_Init) ClearHeader() { + x.Header = nil +} + +type GetResponse_Body_Init_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object's unique identifier. + ObjectId *grpc1.ObjectID + // Signed `ObjectID` + Signature *grpc1.Signature + // Object metadata headers + Header *Header +} + +func (b0 GetResponse_Body_Init_builder) Build() *GetResponse_Body_Init { + m0 := &GetResponse_Body_Init{} + b, x := &b0, m0 + _, _ = b, x + x.ObjectId = b.ObjectId + x.Signature = b.Signature + x.Header = b.Header + return m0 +} + +// PUT request body +type PutRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Single message in the request stream. + // + // Types that are valid to be assigned to ObjectPart: + // + // *PutRequest_Body_Init_ + // *PutRequest_Body_Chunk + ObjectPart isPutRequest_Body_ObjectPart `protobuf_oneof:"object_part"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest_Body) Reset() { + *x = PutRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body) ProtoMessage() {} + +func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest_Body) GetObjectPart() isPutRequest_Body_ObjectPart { + if x != nil { + return x.ObjectPart + } + return nil +} + +func (x *PutRequest_Body) GetInit() *PutRequest_Body_Init { + if x != nil { + if x, ok := x.ObjectPart.(*PutRequest_Body_Init_); ok { + return x.Init + } + } + return nil +} + +func (x *PutRequest_Body) GetChunk() []byte { + if x != nil { + if x, ok := x.ObjectPart.(*PutRequest_Body_Chunk); ok { + return x.Chunk + } + } + return nil +} + +func (x *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { + if v == nil { + x.ObjectPart = nil + return + } + x.ObjectPart = &PutRequest_Body_Init_{v} +} + +func (x *PutRequest_Body) SetChunk(v []byte) { + if v == nil { + v = []byte{} + } + x.ObjectPart = &PutRequest_Body_Chunk{v} +} + +func (x *PutRequest_Body) HasObjectPart() bool { + if x == nil { + return false + } + return x.ObjectPart != nil +} + +func (x *PutRequest_Body) HasInit() bool { + if x == nil { + return false + } + _, ok := x.ObjectPart.(*PutRequest_Body_Init_) + return ok +} + +func (x *PutRequest_Body) HasChunk() bool { + if x == nil { + return false + } + _, ok := x.ObjectPart.(*PutRequest_Body_Chunk) + return ok +} + +func (x *PutRequest_Body) ClearObjectPart() { + x.ObjectPart = nil +} + +func (x *PutRequest_Body) ClearInit() { + if _, ok := x.ObjectPart.(*PutRequest_Body_Init_); ok { + x.ObjectPart = nil + } +} + +func (x *PutRequest_Body) ClearChunk() { + if _, ok := x.ObjectPart.(*PutRequest_Body_Chunk); ok { + x.ObjectPart = nil + } +} + +const PutRequest_Body_ObjectPart_not_set_case case_PutRequest_Body_ObjectPart = 0 +const PutRequest_Body_Init_case case_PutRequest_Body_ObjectPart = 1 +const PutRequest_Body_Chunk_case case_PutRequest_Body_ObjectPart = 2 + +func (x *PutRequest_Body) WhichObjectPart() case_PutRequest_Body_ObjectPart { + if x == nil { + return PutRequest_Body_ObjectPart_not_set_case + } + switch x.ObjectPart.(type) { + case *PutRequest_Body_Init_: + return PutRequest_Body_Init_case + case *PutRequest_Body_Chunk: + return PutRequest_Body_Chunk_case + default: + return PutRequest_Body_ObjectPart_not_set_case + } +} + +type PutRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Single message in the request stream. + + // Fields of oneof ObjectPart: + // Initial part of the object stream + Init *PutRequest_Body_Init + // Chunked object payload + Chunk []byte + // -- end of ObjectPart +} + +func (b0 PutRequest_Body_builder) Build() *PutRequest_Body { + m0 := &PutRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Init != nil { + x.ObjectPart = &PutRequest_Body_Init_{b.Init} + } + if b.Chunk != nil { + x.ObjectPart = &PutRequest_Body_Chunk{b.Chunk} + } + return m0 +} + +type case_PutRequest_Body_ObjectPart protoreflect.FieldNumber + +func (x case_PutRequest_Body_ObjectPart) String() string { + md := file_api_object_grpc_service_proto_msgTypes[23].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isPutRequest_Body_ObjectPart interface { + isPutRequest_Body_ObjectPart() +} + +type PutRequest_Body_Init_ struct { + // Initial part of the object stream + Init *PutRequest_Body_Init `protobuf:"bytes,1,opt,name=init,oneof"` +} + +type PutRequest_Body_Chunk struct { + // Chunked object payload + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,oneof"` +} + +func (*PutRequest_Body_Init_) isPutRequest_Body_ObjectPart() {} + +func (*PutRequest_Body_Chunk) isPutRequest_Body_ObjectPart() {} + +// Newly created object structure parameters. If some optional parameters +// are not set, they will be calculated by a peer node. +type PutRequest_Body_Init struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // ObjectID if available. + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId" json:"object_id,omitempty"` + // Object signature if available + Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + // Object's Header + Header *Header `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` + // Number of copies of the object to store within the RPC call. By + // default, object is processed according to the container's placement + // policy. Can be one of: + // 1. A single number; applied to the whole request and is treated as + // a minimal number of nodes that must store an object to complete the + // request successfully. + // 2. An ordered array; every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the + // placement vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 `protobuf:"varint,4,rep,packed,name=copies_number,json=copiesNumber" json:"copies_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest_Body_Init) Reset() { + *x = PutRequest_Body_Init{} + mi := &file_api_object_grpc_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest_Body_Init) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body_Init) ProtoMessage() {} + +func (x *PutRequest_Body_Init) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest_Body_Init) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *PutRequest_Body_Init) GetSignature() *grpc1.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *PutRequest_Body_Init) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *PutRequest_Body_Init) GetCopiesNumber() []uint32 { + if x != nil { + return x.CopiesNumber + } + return nil +} + +func (x *PutRequest_Body_Init) SetObjectId(v *grpc1.ObjectID) { + x.ObjectId = v +} + +func (x *PutRequest_Body_Init) SetSignature(v *grpc1.Signature) { + x.Signature = v +} + +func (x *PutRequest_Body_Init) SetHeader(v *Header) { + x.Header = v +} + +func (x *PutRequest_Body_Init) SetCopiesNumber(v []uint32) { + x.CopiesNumber = v +} + +func (x *PutRequest_Body_Init) HasObjectId() bool { + if x == nil { + return false + } + return x.ObjectId != nil +} + +func (x *PutRequest_Body_Init) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *PutRequest_Body_Init) HasHeader() bool { + if x == nil { + return false + } + return x.Header != nil +} + +func (x *PutRequest_Body_Init) ClearObjectId() { + x.ObjectId = nil +} + +func (x *PutRequest_Body_Init) ClearSignature() { + x.Signature = nil +} + +func (x *PutRequest_Body_Init) ClearHeader() { + x.Header = nil +} + +type PutRequest_Body_Init_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // ObjectID if available. + ObjectId *grpc1.ObjectID + // Object signature if available + Signature *grpc1.Signature + // Object's Header + Header *Header + // Number of copies of the object to store within the RPC call. By + // default, object is processed according to the container's placement + // policy. Can be one of: + // 1. A single number; applied to the whole request and is treated as + // a minimal number of nodes that must store an object to complete the + // request successfully. + // 2. An ordered array; every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the + // placement vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 +} + +func (b0 PutRequest_Body_Init_builder) Build() *PutRequest_Body_Init { + m0 := &PutRequest_Body_Init{} + b, x := &b0, m0 + _, _ = b, x + x.ObjectId = b.ObjectId + x.Signature = b.Signature + x.Header = b.Header + x.CopiesNumber = b.CopiesNumber + return m0 +} + +// PUT Object response body +type PutResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of the saved object + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId" json:"object_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse_Body) Reset() { + *x = PutResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse_Body) ProtoMessage() {} + +func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutResponse_Body) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *PutResponse_Body) SetObjectId(v *grpc1.ObjectID) { + x.ObjectId = v +} + +func (x *PutResponse_Body) HasObjectId() bool { + if x == nil { + return false + } + return x.ObjectId != nil +} + +func (x *PutResponse_Body) ClearObjectId() { + x.ObjectId = nil +} + +type PutResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the saved object + ObjectId *grpc1.ObjectID +} + +func (b0 PutResponse_Body_builder) Build() *PutResponse_Body { + m0 := &PutResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ObjectId = b.ObjectId + return m0 +} + +// Object DELETE request body +type DeleteRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Address of the object to be deleted + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest_Body) Reset() { + *x = DeleteRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest_Body) ProtoMessage() {} + +func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *DeleteRequest_Body) SetAddress(v *grpc1.Address) { + x.Address = v +} + +func (x *DeleteRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.Address != nil +} + +func (x *DeleteRequest_Body) ClearAddress() { + x.Address = nil +} + +type DeleteRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the object to be deleted + Address *grpc1.Address +} + +func (b0 DeleteRequest_Body_builder) Build() *DeleteRequest_Body { + m0 := &DeleteRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Address = b.Address + return m0 +} + +// Object DELETE Response has an empty body. +type DeleteResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Address of the tombstone created for the deleted object + Tombstone *grpc1.Address `protobuf:"bytes,1,opt,name=tombstone" json:"tombstone,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse_Body) Reset() { + *x = DeleteResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse_Body) ProtoMessage() {} + +func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteResponse_Body) GetTombstone() *grpc1.Address { + if x != nil { + return x.Tombstone + } + return nil +} + +func (x *DeleteResponse_Body) SetTombstone(v *grpc1.Address) { + x.Tombstone = v +} + +func (x *DeleteResponse_Body) HasTombstone() bool { + if x == nil { + return false + } + return x.Tombstone != nil +} + +func (x *DeleteResponse_Body) ClearTombstone() { + x.Tombstone = nil +} + +type DeleteResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the tombstone created for the deleted object + Tombstone *grpc1.Address +} + +func (b0 DeleteResponse_Body_builder) Build() *DeleteResponse_Body { + m0 := &DeleteResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Tombstone = b.Tombstone + return m0 +} + +// Object HEAD request body +type HeadRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Address of the object with the requested Header + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + // Return only minimal header subset + MainOnly *bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly" json:"main_only,omitempty"` + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node + Raw *bool `protobuf:"varint,3,opt,name=raw" json:"raw,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeadRequest_Body) Reset() { + *x = HeadRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeadRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadRequest_Body) ProtoMessage() {} + +func (x *HeadRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeadRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *HeadRequest_Body) GetMainOnly() bool { + if x != nil && x.MainOnly != nil { + return *x.MainOnly + } + return false +} + +func (x *HeadRequest_Body) GetRaw() bool { + if x != nil && x.Raw != nil { + return *x.Raw + } + return false +} + +func (x *HeadRequest_Body) SetAddress(v *grpc1.Address) { + x.Address = v +} + +func (x *HeadRequest_Body) SetMainOnly(v bool) { + x.MainOnly = &v +} + +func (x *HeadRequest_Body) SetRaw(v bool) { + x.Raw = &v +} + +func (x *HeadRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.Address != nil +} + +func (x *HeadRequest_Body) HasMainOnly() bool { + if x == nil { + return false + } + return x.MainOnly != nil +} + +func (x *HeadRequest_Body) HasRaw() bool { + if x == nil { + return false + } + return x.Raw != nil +} + +func (x *HeadRequest_Body) ClearAddress() { + x.Address = nil +} + +func (x *HeadRequest_Body) ClearMainOnly() { + x.MainOnly = nil +} + +func (x *HeadRequest_Body) ClearRaw() { + x.Raw = nil +} + +type HeadRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the object with the requested Header + Address *grpc1.Address + // Return only minimal header subset + MainOnly *bool + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node + Raw *bool +} + +func (b0 HeadRequest_Body_builder) Build() *HeadRequest_Body { + m0 := &HeadRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Address = b.Address + x.MainOnly = b.MainOnly + x.Raw = b.Raw + return m0 +} + +// Object HEAD response body +type HeadResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Requested object header, it's part or meta information about split + // object. + // + // Types that are valid to be assigned to Head: + // + // *HeadResponse_Body_Header + // *HeadResponse_Body_ShortHeader + // *HeadResponse_Body_SplitInfo + // *HeadResponse_Body_EcInfo + Head isHeadResponse_Body_Head `protobuf_oneof:"head"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeadResponse_Body) Reset() { + *x = HeadResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeadResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadResponse_Body) ProtoMessage() {} + +func (x *HeadResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeadResponse_Body) GetHead() isHeadResponse_Body_Head { + if x != nil { + return x.Head + } + return nil +} + +func (x *HeadResponse_Body) GetHeader() *HeaderWithSignature { + if x != nil { + if x, ok := x.Head.(*HeadResponse_Body_Header); ok { + return x.Header + } + } + return nil +} + +func (x *HeadResponse_Body) GetShortHeader() *ShortHeader { + if x != nil { + if x, ok := x.Head.(*HeadResponse_Body_ShortHeader); ok { + return x.ShortHeader + } + } + return nil +} + +func (x *HeadResponse_Body) GetSplitInfo() *SplitInfo { + if x != nil { + if x, ok := x.Head.(*HeadResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + } + return nil +} + +func (x *HeadResponse_Body) GetEcInfo() *ECInfo { + if x != nil { + if x, ok := x.Head.(*HeadResponse_Body_EcInfo); ok { + return x.EcInfo + } + } + return nil +} + +func (x *HeadResponse_Body) SetHeader(v *HeaderWithSignature) { + if v == nil { + x.Head = nil + return + } + x.Head = &HeadResponse_Body_Header{v} +} + +func (x *HeadResponse_Body) SetShortHeader(v *ShortHeader) { + if v == nil { + x.Head = nil + return + } + x.Head = &HeadResponse_Body_ShortHeader{v} +} + +func (x *HeadResponse_Body) SetSplitInfo(v *SplitInfo) { + if v == nil { + x.Head = nil + return + } + x.Head = &HeadResponse_Body_SplitInfo{v} +} + +func (x *HeadResponse_Body) SetEcInfo(v *ECInfo) { + if v == nil { + x.Head = nil + return + } + x.Head = &HeadResponse_Body_EcInfo{v} +} + +func (x *HeadResponse_Body) HasHead() bool { + if x == nil { + return false + } + return x.Head != nil +} + +func (x *HeadResponse_Body) HasHeader() bool { + if x == nil { + return false + } + _, ok := x.Head.(*HeadResponse_Body_Header) + return ok +} + +func (x *HeadResponse_Body) HasShortHeader() bool { + if x == nil { + return false + } + _, ok := x.Head.(*HeadResponse_Body_ShortHeader) + return ok +} + +func (x *HeadResponse_Body) HasSplitInfo() bool { + if x == nil { + return false + } + _, ok := x.Head.(*HeadResponse_Body_SplitInfo) + return ok +} + +func (x *HeadResponse_Body) HasEcInfo() bool { + if x == nil { + return false + } + _, ok := x.Head.(*HeadResponse_Body_EcInfo) + return ok +} + +func (x *HeadResponse_Body) ClearHead() { + x.Head = nil +} + +func (x *HeadResponse_Body) ClearHeader() { + if _, ok := x.Head.(*HeadResponse_Body_Header); ok { + x.Head = nil + } +} + +func (x *HeadResponse_Body) ClearShortHeader() { + if _, ok := x.Head.(*HeadResponse_Body_ShortHeader); ok { + x.Head = nil + } +} + +func (x *HeadResponse_Body) ClearSplitInfo() { + if _, ok := x.Head.(*HeadResponse_Body_SplitInfo); ok { + x.Head = nil + } +} + +func (x *HeadResponse_Body) ClearEcInfo() { + if _, ok := x.Head.(*HeadResponse_Body_EcInfo); ok { + x.Head = nil + } +} + +const HeadResponse_Body_Head_not_set_case case_HeadResponse_Body_Head = 0 +const HeadResponse_Body_Header_case case_HeadResponse_Body_Head = 1 +const HeadResponse_Body_ShortHeader_case case_HeadResponse_Body_Head = 2 +const HeadResponse_Body_SplitInfo_case case_HeadResponse_Body_Head = 3 +const HeadResponse_Body_EcInfo_case case_HeadResponse_Body_Head = 4 + +func (x *HeadResponse_Body) WhichHead() case_HeadResponse_Body_Head { + if x == nil { + return HeadResponse_Body_Head_not_set_case + } + switch x.Head.(type) { + case *HeadResponse_Body_Header: + return HeadResponse_Body_Header_case + case *HeadResponse_Body_ShortHeader: + return HeadResponse_Body_ShortHeader_case + case *HeadResponse_Body_SplitInfo: + return HeadResponse_Body_SplitInfo_case + case *HeadResponse_Body_EcInfo: + return HeadResponse_Body_EcInfo_case + default: + return HeadResponse_Body_Head_not_set_case + } +} + +type HeadResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Requested object header, it's part or meta information about split + // object. + + // Fields of oneof Head: + // Full object's `Header` with `ObjectID` signature + Header *HeaderWithSignature + // Short object header + ShortHeader *ShortHeader + // Meta information of split hierarchy. + SplitInfo *SplitInfo + // Meta information for EC object assembly. + EcInfo *ECInfo + // -- end of Head +} + +func (b0 HeadResponse_Body_builder) Build() *HeadResponse_Body { + m0 := &HeadResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Header != nil { + x.Head = &HeadResponse_Body_Header{b.Header} + } + if b.ShortHeader != nil { + x.Head = &HeadResponse_Body_ShortHeader{b.ShortHeader} + } + if b.SplitInfo != nil { + x.Head = &HeadResponse_Body_SplitInfo{b.SplitInfo} + } + if b.EcInfo != nil { + x.Head = &HeadResponse_Body_EcInfo{b.EcInfo} + } + return m0 +} + +type case_HeadResponse_Body_Head protoreflect.FieldNumber + +func (x case_HeadResponse_Body_Head) String() string { + md := file_api_object_grpc_service_proto_msgTypes[29].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isHeadResponse_Body_Head interface { + isHeadResponse_Body_Head() +} + +type HeadResponse_Body_Header struct { + // Full object's `Header` with `ObjectID` signature + Header *HeaderWithSignature `protobuf:"bytes,1,opt,name=header,oneof"` +} + +type HeadResponse_Body_ShortHeader struct { + // Short object header + ShortHeader *ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,oneof"` +} + +type HeadResponse_Body_SplitInfo struct { + // Meta information of split hierarchy. + SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,oneof"` +} + +type HeadResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,4,opt,name=ec_info,json=ecInfo,oneof"` +} + +func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {} + +func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} + +func (*HeadResponse_Body_SplitInfo) isHeadResponse_Body_Head() {} + +func (*HeadResponse_Body_EcInfo) isHeadResponse_Body_Head() {} + +// Object Search request body +type SearchRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Container identifier were to search + ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId" json:"container_id,omitempty"` + // Version of the Query Language used + Version *uint32 `protobuf:"varint,2,opt,name=version" json:"version,omitempty"` + // List of search expressions + Filters []*SearchRequest_Body_Filter `protobuf:"bytes,3,rep,name=filters" json:"filters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchRequest_Body) Reset() { + *x = SearchRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest_Body) ProtoMessage() {} + +func (x *SearchRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *SearchRequest_Body) GetVersion() uint32 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { + if x != nil { + return x.Filters + } + return nil +} + +func (x *SearchRequest_Body) SetContainerId(v *grpc1.ContainerID) { + x.ContainerId = v +} + +func (x *SearchRequest_Body) SetVersion(v uint32) { + x.Version = &v +} + +func (x *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { + x.Filters = v +} + +func (x *SearchRequest_Body) HasContainerId() bool { + if x == nil { + return false + } + return x.ContainerId != nil +} + +func (x *SearchRequest_Body) HasVersion() bool { + if x == nil { + return false + } + return x.Version != nil +} + +func (x *SearchRequest_Body) ClearContainerId() { + x.ContainerId = nil +} + +func (x *SearchRequest_Body) ClearVersion() { + x.Version = nil +} + +type SearchRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container identifier were to search + ContainerId *grpc1.ContainerID + // Version of the Query Language used + Version *uint32 + // List of search expressions + Filters []*SearchRequest_Body_Filter +} + +func (b0 SearchRequest_Body_builder) Build() *SearchRequest_Body { + m0 := &SearchRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ContainerId = b.ContainerId + x.Version = b.Version + x.Filters = b.Filters + return m0 +} + +// Filter structure checks if the object header field or the attribute +// content matches a value. +// +// If no filters are set, search request will return all objects of the +// container, including Regular object and Tombstone +// objects. Most human users expect to get only object they can directly +// work with. In that case, `$Object:ROOT` filter should be used. +// +// By default `key` field refers to the corresponding object's `Attribute`. +// Some Object's header fields can also be accessed by adding `$Object:` +// prefix to the name. Here is the list of fields available via this prefix: +// +// - $Object:version \ +// version +// - $Object:objectID \ +// object_id +// - $Object:containerID \ +// container_id +// - $Object:ownerID \ +// owner_id +// - $Object:creationEpoch \ +// creation_epoch +// - $Object:payloadLength \ +// payload_length +// - $Object:payloadHash \ +// payload_hash +// - $Object:objectType \ +// object_type +// - $Object:homomorphicHash \ +// homomorphic_hash +// - $Object:split.parent \ +// object_id of parent +// - $Object:split.splitID \ +// 16 byte UUIDv4 used to identify the split object hierarchy parts +// - $Object:ec.parent \ +// If the object is stored according to EC policy, then ec_parent +// attribute is set to return an id list of all related EC chunks. +// +// There are some well-known filter aliases to match objects by certain +// properties: +// +// - $Object:ROOT \ +// Returns only `REGULAR` type objects that are not split or that are the +// top level root objects in a split hierarchy. This includes objects not +// present physically, like large objects split into smaller objects +// without a separate top-level root object. Objects of other types like +// Locks and Tombstones will not be shown. This filter may be +// useful for listing objects like `ls` command of some virtual file +// system. This filter is activated if the `key` exists, disregarding the +// value and matcher type. +// - $Object:PHY \ +// Returns only objects physically stored in the system. This filter is +// activated if the `key` exists, disregarding the value and matcher type. +// +// Note: using filters with a key with prefix `$Object:` and match type +// `NOT_PRESENT `is not recommended since this is not a cross-version +// approach. Behavior when processing this kind of filters is undefined. +type SearchRequest_Body_Filter struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Match type to use + MatchType *MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,enum=neo.fs.v2.object.MatchType" json:"match_type,omitempty"` + // Attribute or Header fields to match + Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + // Value to match + Value *string `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchRequest_Body_Filter) Reset() { + *x = SearchRequest_Body_Filter{} + mi := &file_api_object_grpc_service_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchRequest_Body_Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest_Body_Filter) ProtoMessage() {} + +func (x *SearchRequest_Body_Filter) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchRequest_Body_Filter) GetMatchType() MatchType { + if x != nil && x.MatchType != nil { + return *x.MatchType + } + return MatchType_MATCH_TYPE_UNSPECIFIED +} + +func (x *SearchRequest_Body_Filter) GetKey() string { + if x != nil && x.Key != nil { + return *x.Key + } + return "" +} + +func (x *SearchRequest_Body_Filter) GetValue() string { + if x != nil && x.Value != nil { + return *x.Value + } + return "" +} + +func (x *SearchRequest_Body_Filter) SetMatchType(v MatchType) { + x.MatchType = &v +} + +func (x *SearchRequest_Body_Filter) SetKey(v string) { + x.Key = &v +} + +func (x *SearchRequest_Body_Filter) SetValue(v string) { + x.Value = &v +} + +func (x *SearchRequest_Body_Filter) HasMatchType() bool { + if x == nil { + return false + } + return x.MatchType != nil +} + +func (x *SearchRequest_Body_Filter) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *SearchRequest_Body_Filter) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *SearchRequest_Body_Filter) ClearMatchType() { + x.MatchType = nil +} + +func (x *SearchRequest_Body_Filter) ClearKey() { + x.Key = nil +} + +func (x *SearchRequest_Body_Filter) ClearValue() { + x.Value = nil +} + +type SearchRequest_Body_Filter_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Match type to use + MatchType *MatchType + // Attribute or Header fields to match + Key *string + // Value to match + Value *string +} + +func (b0 SearchRequest_Body_Filter_builder) Build() *SearchRequest_Body_Filter { + m0 := &SearchRequest_Body_Filter{} + b, x := &b0, m0 + _, _ = b, x + x.MatchType = b.MatchType + x.Key = b.Key + x.Value = b.Value + return m0 +} + +// Object Search response body +type SearchResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // List of `ObjectID`s that match the search query + IdList []*grpc1.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList" json:"id_list,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchResponse_Body) Reset() { + *x = SearchResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchResponse_Body) ProtoMessage() {} + +func (x *SearchResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchResponse_Body) GetIdList() []*grpc1.ObjectID { + if x != nil { + return x.IdList + } + return nil +} + +func (x *SearchResponse_Body) SetIdList(v []*grpc1.ObjectID) { + x.IdList = v +} + +type SearchResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of `ObjectID`s that match the search query + IdList []*grpc1.ObjectID +} + +func (b0 SearchResponse_Body_builder) Build() *SearchResponse_Body { + m0 := &SearchResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.IdList = b.IdList + return m0 +} + +// Byte range of object's payload request body +type GetRangeRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Address of the object containing the requested payload range + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + // Requested payload range + Range *Range `protobuf:"bytes,2,opt,name=range" json:"range,omitempty"` + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node. + Raw *bool `protobuf:"varint,3,opt,name=raw" json:"raw,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeRequest_Body) Reset() { + *x = GetRangeRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeRequest_Body) ProtoMessage() {} + +func (x *GetRangeRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *GetRangeRequest_Body) GetRange() *Range { + if x != nil { + return x.Range + } + return nil +} + +func (x *GetRangeRequest_Body) GetRaw() bool { + if x != nil && x.Raw != nil { + return *x.Raw + } + return false +} + +func (x *GetRangeRequest_Body) SetAddress(v *grpc1.Address) { + x.Address = v +} + +func (x *GetRangeRequest_Body) SetRange(v *Range) { + x.Range = v +} + +func (x *GetRangeRequest_Body) SetRaw(v bool) { + x.Raw = &v +} + +func (x *GetRangeRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.Address != nil +} + +func (x *GetRangeRequest_Body) HasRange() bool { + if x == nil { + return false + } + return x.Range != nil +} + +func (x *GetRangeRequest_Body) HasRaw() bool { + if x == nil { + return false + } + return x.Raw != nil +} + +func (x *GetRangeRequest_Body) ClearAddress() { + x.Address = nil +} + +func (x *GetRangeRequest_Body) ClearRange() { + x.Range = nil +} + +func (x *GetRangeRequest_Body) ClearRaw() { + x.Raw = nil +} + +type GetRangeRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the object containing the requested payload range + Address *grpc1.Address + // Requested payload range + Range *Range + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node. + Raw *bool +} + +func (b0 GetRangeRequest_Body_builder) Build() *GetRangeRequest_Body { + m0 := &GetRangeRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Address = b.Address + x.Range = b.Range + x.Raw = b.Raw + return m0 +} + +// Get Range response body uses streams to transfer the response. Because +// object payload considered a byte sequence, there is no need to have some +// initial preamble message. The requested byte range is sent as a series +// chunks. +type GetRangeResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Requested object range or meta information about split object. + // + // Types that are valid to be assigned to RangePart: + // + // *GetRangeResponse_Body_Chunk + // *GetRangeResponse_Body_SplitInfo + // *GetRangeResponse_Body_EcInfo + RangePart isGetRangeResponse_Body_RangePart `protobuf_oneof:"range_part"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeResponse_Body) Reset() { + *x = GetRangeResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeResponse_Body) ProtoMessage() {} + +func (x *GetRangeResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeResponse_Body) GetRangePart() isGetRangeResponse_Body_RangePart { + if x != nil { + return x.RangePart + } + return nil +} + +func (x *GetRangeResponse_Body) GetChunk() []byte { + if x != nil { + if x, ok := x.RangePart.(*GetRangeResponse_Body_Chunk); ok { + return x.Chunk + } + } + return nil +} + +func (x *GetRangeResponse_Body) GetSplitInfo() *SplitInfo { + if x != nil { + if x, ok := x.RangePart.(*GetRangeResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + } + return nil +} + +func (x *GetRangeResponse_Body) GetEcInfo() *ECInfo { + if x != nil { + if x, ok := x.RangePart.(*GetRangeResponse_Body_EcInfo); ok { + return x.EcInfo + } + } + return nil +} + +func (x *GetRangeResponse_Body) SetChunk(v []byte) { + if v == nil { + v = []byte{} + } + x.RangePart = &GetRangeResponse_Body_Chunk{v} +} + +func (x *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) { + if v == nil { + x.RangePart = nil + return + } + x.RangePart = &GetRangeResponse_Body_SplitInfo{v} +} + +func (x *GetRangeResponse_Body) SetEcInfo(v *ECInfo) { + if v == nil { + x.RangePart = nil + return + } + x.RangePart = &GetRangeResponse_Body_EcInfo{v} +} + +func (x *GetRangeResponse_Body) HasRangePart() bool { + if x == nil { + return false + } + return x.RangePart != nil +} + +func (x *GetRangeResponse_Body) HasChunk() bool { + if x == nil { + return false + } + _, ok := x.RangePart.(*GetRangeResponse_Body_Chunk) + return ok +} + +func (x *GetRangeResponse_Body) HasSplitInfo() bool { + if x == nil { + return false + } + _, ok := x.RangePart.(*GetRangeResponse_Body_SplitInfo) + return ok +} + +func (x *GetRangeResponse_Body) HasEcInfo() bool { + if x == nil { + return false + } + _, ok := x.RangePart.(*GetRangeResponse_Body_EcInfo) + return ok +} + +func (x *GetRangeResponse_Body) ClearRangePart() { + x.RangePart = nil +} + +func (x *GetRangeResponse_Body) ClearChunk() { + if _, ok := x.RangePart.(*GetRangeResponse_Body_Chunk); ok { + x.RangePart = nil + } +} + +func (x *GetRangeResponse_Body) ClearSplitInfo() { + if _, ok := x.RangePart.(*GetRangeResponse_Body_SplitInfo); ok { + x.RangePart = nil + } +} + +func (x *GetRangeResponse_Body) ClearEcInfo() { + if _, ok := x.RangePart.(*GetRangeResponse_Body_EcInfo); ok { + x.RangePart = nil + } +} + +const GetRangeResponse_Body_RangePart_not_set_case case_GetRangeResponse_Body_RangePart = 0 +const GetRangeResponse_Body_Chunk_case case_GetRangeResponse_Body_RangePart = 1 +const GetRangeResponse_Body_SplitInfo_case case_GetRangeResponse_Body_RangePart = 2 +const GetRangeResponse_Body_EcInfo_case case_GetRangeResponse_Body_RangePart = 3 + +func (x *GetRangeResponse_Body) WhichRangePart() case_GetRangeResponse_Body_RangePart { + if x == nil { + return GetRangeResponse_Body_RangePart_not_set_case + } + switch x.RangePart.(type) { + case *GetRangeResponse_Body_Chunk: + return GetRangeResponse_Body_Chunk_case + case *GetRangeResponse_Body_SplitInfo: + return GetRangeResponse_Body_SplitInfo_case + case *GetRangeResponse_Body_EcInfo: + return GetRangeResponse_Body_EcInfo_case + default: + return GetRangeResponse_Body_RangePart_not_set_case + } +} + +type GetRangeResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Requested object range or meta information about split object. + + // Fields of oneof RangePart: + // Chunked object payload's range. + Chunk []byte + // Meta information of split hierarchy. + SplitInfo *SplitInfo + // Meta information for EC object assembly. + EcInfo *ECInfo + // -- end of RangePart +} + +func (b0 GetRangeResponse_Body_builder) Build() *GetRangeResponse_Body { + m0 := &GetRangeResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Chunk != nil { + x.RangePart = &GetRangeResponse_Body_Chunk{b.Chunk} + } + if b.SplitInfo != nil { + x.RangePart = &GetRangeResponse_Body_SplitInfo{b.SplitInfo} + } + if b.EcInfo != nil { + x.RangePart = &GetRangeResponse_Body_EcInfo{b.EcInfo} + } + return m0 +} + +type case_GetRangeResponse_Body_RangePart protoreflect.FieldNumber + +func (x case_GetRangeResponse_Body_RangePart) String() string { + md := file_api_object_grpc_service_proto_msgTypes[34].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isGetRangeResponse_Body_RangePart interface { + isGetRangeResponse_Body_RangePart() +} + +type GetRangeResponse_Body_Chunk struct { + // Chunked object payload's range. + Chunk []byte `protobuf:"bytes,1,opt,name=chunk,oneof"` +} + +type GetRangeResponse_Body_SplitInfo struct { + // Meta information of split hierarchy. + SplitInfo *SplitInfo `protobuf:"bytes,2,opt,name=split_info,json=splitInfo,oneof"` +} + +type GetRangeResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,3,opt,name=ec_info,json=ecInfo,oneof"` +} + +func (*GetRangeResponse_Body_Chunk) isGetRangeResponse_Body_RangePart() {} + +func (*GetRangeResponse_Body_SplitInfo) isGetRangeResponse_Body_RangePart() {} + +func (*GetRangeResponse_Body_EcInfo) isGetRangeResponse_Body_RangePart() {} + +// Get hash of object's payload part request body. +type GetRangeHashRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Address of the object that containing the requested payload range + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + // List of object's payload ranges to calculate homomorphic hash + Ranges []*Range `protobuf:"bytes,2,rep,name=ranges" json:"ranges,omitempty"` + // Binary salt to XOR object's payload ranges before hash calculation + Salt []byte `protobuf:"bytes,3,opt,name=salt" json:"salt,omitempty"` + // Checksum algorithm type + Type *grpc1.ChecksumType `protobuf:"varint,4,opt,name=type,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeHashRequest_Body) Reset() { + *x = GetRangeHashRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeHashRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashRequest_Body) ProtoMessage() {} + +func (x *GetRangeHashRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeHashRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *GetRangeHashRequest_Body) GetRanges() []*Range { + if x != nil { + return x.Ranges + } + return nil +} + +func (x *GetRangeHashRequest_Body) GetSalt() []byte { + if x != nil { + return x.Salt + } + return nil +} + +func (x *GetRangeHashRequest_Body) GetType() grpc1.ChecksumType { + if x != nil && x.Type != nil { + return *x.Type + } + return grpc1.ChecksumType(0) +} + +func (x *GetRangeHashRequest_Body) SetAddress(v *grpc1.Address) { + x.Address = v +} + +func (x *GetRangeHashRequest_Body) SetRanges(v []*Range) { + x.Ranges = v +} + +func (x *GetRangeHashRequest_Body) SetSalt(v []byte) { + if v == nil { + v = []byte{} + } + x.Salt = v +} + +func (x *GetRangeHashRequest_Body) SetType(v grpc1.ChecksumType) { + x.Type = &v +} + +func (x *GetRangeHashRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.Address != nil +} + +func (x *GetRangeHashRequest_Body) HasSalt() bool { + if x == nil { + return false + } + return x.Salt != nil +} + +func (x *GetRangeHashRequest_Body) HasType() bool { + if x == nil { + return false + } + return x.Type != nil +} + +func (x *GetRangeHashRequest_Body) ClearAddress() { + x.Address = nil +} + +func (x *GetRangeHashRequest_Body) ClearSalt() { + x.Salt = nil +} + +func (x *GetRangeHashRequest_Body) ClearType() { + x.Type = nil +} + +type GetRangeHashRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the object that containing the requested payload range + Address *grpc1.Address + // List of object's payload ranges to calculate homomorphic hash + Ranges []*Range + // Binary salt to XOR object's payload ranges before hash calculation + Salt []byte + // Checksum algorithm type + Type *grpc1.ChecksumType +} + +func (b0 GetRangeHashRequest_Body_builder) Build() *GetRangeHashRequest_Body { + m0 := &GetRangeHashRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Address = b.Address + x.Ranges = b.Ranges + x.Salt = b.Salt + x.Type = b.Type + return m0 +} + +// Get hash of object's payload part response body. +type GetRangeHashResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Checksum algorithm type + Type *grpc1.ChecksumType `protobuf:"varint,1,opt,name=type,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + // List of range hashes in a binary format + HashList [][]byte `protobuf:"bytes,2,rep,name=hash_list,json=hashList" json:"hash_list,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeHashResponse_Body) Reset() { + *x = GetRangeHashResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeHashResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashResponse_Body) ProtoMessage() {} + +func (x *GetRangeHashResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeHashResponse_Body) GetType() grpc1.ChecksumType { + if x != nil && x.Type != nil { + return *x.Type + } + return grpc1.ChecksumType(0) +} + +func (x *GetRangeHashResponse_Body) GetHashList() [][]byte { + if x != nil { + return x.HashList + } + return nil +} + +func (x *GetRangeHashResponse_Body) SetType(v grpc1.ChecksumType) { + x.Type = &v +} + +func (x *GetRangeHashResponse_Body) SetHashList(v [][]byte) { + x.HashList = v +} + +func (x *GetRangeHashResponse_Body) HasType() bool { + if x == nil { + return false + } + return x.Type != nil +} + +func (x *GetRangeHashResponse_Body) ClearType() { + x.Type = nil +} + +type GetRangeHashResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Checksum algorithm type + Type *grpc1.ChecksumType + // List of range hashes in a binary format + HashList [][]byte +} + +func (b0 GetRangeHashResponse_Body_builder) Build() *GetRangeHashResponse_Body { + m0 := &GetRangeHashResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Type = b.Type + x.HashList = b.HashList + return m0 +} + +// PUT Single request body +type PutSingleRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Prepared object with payload. + Object *Object `protobuf:"bytes,1,opt,name=object" json:"object,omitempty"` + // Number of copies of the object to store within the RPC call. By default, + // object is processed according to the container's placement policy. + // Every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the placement + // vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 `protobuf:"varint,2,rep,packed,name=copies_number,json=copiesNumber" json:"copies_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutSingleRequest_Body) Reset() { + *x = PutSingleRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutSingleRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleRequest_Body) ProtoMessage() {} + +func (x *PutSingleRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutSingleRequest_Body) GetObject() *Object { + if x != nil { + return x.Object + } + return nil +} + +func (x *PutSingleRequest_Body) GetCopiesNumber() []uint32 { + if x != nil { + return x.CopiesNumber + } + return nil +} + +func (x *PutSingleRequest_Body) SetObject(v *Object) { + x.Object = v +} + +func (x *PutSingleRequest_Body) SetCopiesNumber(v []uint32) { + x.CopiesNumber = v +} + +func (x *PutSingleRequest_Body) HasObject() bool { + if x == nil { + return false + } + return x.Object != nil +} + +func (x *PutSingleRequest_Body) ClearObject() { + x.Object = nil +} + +type PutSingleRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Prepared object with payload. + Object *Object + // Number of copies of the object to store within the RPC call. By default, + // object is processed according to the container's placement policy. + // Every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the placement + // vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 +} + +func (b0 PutSingleRequest_Body_builder) Build() *PutSingleRequest_Body { + m0 := &PutSingleRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Object = b.Object + x.CopiesNumber = b.CopiesNumber + return m0 +} + +// PUT Single Object response body +type PutSingleResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutSingleResponse_Body) Reset() { + *x = PutSingleResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutSingleResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleResponse_Body) ProtoMessage() {} + +func (x *PutSingleResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type PutSingleResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 PutSingleResponse_Body_builder) Build() *PutSingleResponse_Body { + m0 := &PutSingleResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// PATCH request body +type PatchRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The address of the object that is requested to get patched. + Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + // New attributes for the object. See `replace_attributes` flag usage to + // define how new attributes should be set. + NewAttributes []*Header_Attribute `protobuf:"bytes,2,rep,name=new_attributes,json=newAttributes" json:"new_attributes,omitempty"` + // If this flag is set, then the object's attributes will be entirely + // replaced by `new_attributes` list. The empty `new_attributes` list with + // `replace_attributes = true` just resets attributes list for the object. + // + // Default `false` value for this flag means the attributes will be just + // merged. If the incoming `new_attributes` list contains already existing + // key, then it just replaces it while merging the lists. + ReplaceAttributes *bool `protobuf:"varint,3,opt,name=replace_attributes,json=replaceAttributes" json:"replace_attributes,omitempty"` + // New split header for the object. This defines how the object will relate + // to other objects in a split operation. + NewSplitHeader *Header_Split `protobuf:"bytes,5,opt,name=new_split_header,json=newSplitHeader" json:"new_split_header,omitempty"` + // The patch that is applied for the object. + Patch *PatchRequest_Body_Patch `protobuf:"bytes,4,opt,name=patch" json:"patch,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchRequest_Body) Reset() { + *x = PatchRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest_Body) ProtoMessage() {} + +func (x *PatchRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.Address + } + return nil +} + +func (x *PatchRequest_Body) GetNewAttributes() []*Header_Attribute { + if x != nil { + return x.NewAttributes + } + return nil +} + +func (x *PatchRequest_Body) GetReplaceAttributes() bool { + if x != nil && x.ReplaceAttributes != nil { + return *x.ReplaceAttributes + } + return false +} + +func (x *PatchRequest_Body) GetNewSplitHeader() *Header_Split { + if x != nil { + return x.NewSplitHeader + } + return nil +} + +func (x *PatchRequest_Body) GetPatch() *PatchRequest_Body_Patch { + if x != nil { + return x.Patch + } + return nil +} + +func (x *PatchRequest_Body) SetAddress(v *grpc1.Address) { + x.Address = v +} + +func (x *PatchRequest_Body) SetNewAttributes(v []*Header_Attribute) { + x.NewAttributes = v +} + +func (x *PatchRequest_Body) SetReplaceAttributes(v bool) { + x.ReplaceAttributes = &v +} + +func (x *PatchRequest_Body) SetNewSplitHeader(v *Header_Split) { + x.NewSplitHeader = v +} + +func (x *PatchRequest_Body) SetPatch(v *PatchRequest_Body_Patch) { + x.Patch = v +} + +func (x *PatchRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.Address != nil +} + +func (x *PatchRequest_Body) HasReplaceAttributes() bool { + if x == nil { + return false + } + return x.ReplaceAttributes != nil +} + +func (x *PatchRequest_Body) HasNewSplitHeader() bool { + if x == nil { + return false + } + return x.NewSplitHeader != nil +} + +func (x *PatchRequest_Body) HasPatch() bool { + if x == nil { + return false + } + return x.Patch != nil +} + +func (x *PatchRequest_Body) ClearAddress() { + x.Address = nil +} + +func (x *PatchRequest_Body) ClearReplaceAttributes() { + x.ReplaceAttributes = nil +} + +func (x *PatchRequest_Body) ClearNewSplitHeader() { + x.NewSplitHeader = nil +} + +func (x *PatchRequest_Body) ClearPatch() { + x.Patch = nil +} + +type PatchRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The address of the object that is requested to get patched. + Address *grpc1.Address + // New attributes for the object. See `replace_attributes` flag usage to + // define how new attributes should be set. + NewAttributes []*Header_Attribute + // If this flag is set, then the object's attributes will be entirely + // replaced by `new_attributes` list. The empty `new_attributes` list with + // `replace_attributes = true` just resets attributes list for the object. + // + // Default `false` value for this flag means the attributes will be just + // merged. If the incoming `new_attributes` list contains already existing + // key, then it just replaces it while merging the lists. + ReplaceAttributes *bool + // New split header for the object. This defines how the object will relate + // to other objects in a split operation. + NewSplitHeader *Header_Split + // The patch that is applied for the object. + Patch *PatchRequest_Body_Patch +} + +func (b0 PatchRequest_Body_builder) Build() *PatchRequest_Body { + m0 := &PatchRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Address = b.Address + x.NewAttributes = b.NewAttributes + x.ReplaceAttributes = b.ReplaceAttributes + x.NewSplitHeader = b.NewSplitHeader + x.Patch = b.Patch + return m0 +} + +// The patch for the object's payload. +type PatchRequest_Body_Patch struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The range of the source object for which the payload is replaced by the + // patch's chunk. If the range's `length = 0`, then the patch's chunk is + // just appended to the original payload starting from the `offest` + // without any replace. + SourceRange *Range `protobuf:"bytes,1,opt,name=source_range,json=sourceRange" json:"source_range,omitempty"` + // The chunk that is being appended to or that replaces the original + // payload on the given range. + Chunk []byte `protobuf:"bytes,2,opt,name=chunk" json:"chunk,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchRequest_Body_Patch) Reset() { + *x = PatchRequest_Body_Patch{} + mi := &file_api_object_grpc_service_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchRequest_Body_Patch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest_Body_Patch) ProtoMessage() {} + +func (x *PatchRequest_Body_Patch) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchRequest_Body_Patch) GetSourceRange() *Range { + if x != nil { + return x.SourceRange + } + return nil +} + +func (x *PatchRequest_Body_Patch) GetChunk() []byte { + if x != nil { + return x.Chunk + } + return nil +} + +func (x *PatchRequest_Body_Patch) SetSourceRange(v *Range) { + x.SourceRange = v +} + +func (x *PatchRequest_Body_Patch) SetChunk(v []byte) { + if v == nil { + v = []byte{} + } + x.Chunk = v +} + +func (x *PatchRequest_Body_Patch) HasSourceRange() bool { + if x == nil { + return false + } + return x.SourceRange != nil +} + +func (x *PatchRequest_Body_Patch) HasChunk() bool { + if x == nil { + return false + } + return x.Chunk != nil +} + +func (x *PatchRequest_Body_Patch) ClearSourceRange() { + x.SourceRange = nil +} + +func (x *PatchRequest_Body_Patch) ClearChunk() { + x.Chunk = nil +} + +type PatchRequest_Body_Patch_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The range of the source object for which the payload is replaced by the + // patch's chunk. If the range's `length = 0`, then the patch's chunk is + // just appended to the original payload starting from the `offest` + // without any replace. + SourceRange *Range + // The chunk that is being appended to or that replaces the original + // payload on the given range. + Chunk []byte +} + +func (b0 PatchRequest_Body_Patch_builder) Build() *PatchRequest_Body_Patch { + m0 := &PatchRequest_Body_Patch{} + b, x := &b0, m0 + _, _ = b, x + x.SourceRange = b.SourceRange + x.Chunk = b.Chunk + return m0 +} + +// PATCH response body +type PatchResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The object ID of the saved patched object. + ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId" json:"object_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchResponse_Body) Reset() { + *x = PatchResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchResponse_Body) ProtoMessage() {} + +func (x *PatchResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchResponse_Body) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *PatchResponse_Body) SetObjectId(v *grpc1.ObjectID) { + x.ObjectId = v +} + +func (x *PatchResponse_Body) HasObjectId() bool { + if x == nil { + return false + } + return x.ObjectId != nil +} + +func (x *PatchResponse_Body) ClearObjectId() { + x.ObjectId = nil +} + +type PatchResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The object ID of the saved patched object. + ObjectId *grpc1.ObjectID +} + +func (b0 PatchResponse_Body_builder) Build() *PatchResponse_Body { + m0 := &PatchResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.ObjectId = b.ObjectId + return m0 +} + +var File_api_object_grpc_service_proto protoreflect.FileDescriptor + +var file_api_object_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaa, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x4b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x03, 0x72, 0x61, 0x77, 0x22, 0xee, 0x04, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x8a, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x3d, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, + 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, + 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, + 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, + 0x6f, 0x48, 0x00, 0x52, 0x06, 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xa8, 0x01, 0x0a, 0x04, + 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, + 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0x9b, 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xbb, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, + 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, + 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, + 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, + 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xcd, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, + 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, + 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, + 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x9e, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, + 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x1a, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x74, 0x6f, 0x6d, + 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, + 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, + 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, + 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, + 0xec, 0x03, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x86, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, + 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, + 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, + 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, + 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, + 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x39, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, + 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, + 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe3, 0x02, 0x0a, 0x0f, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x7a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, + 0x22, 0x8d, 0x03, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x9f, + 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, + 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, + 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, 0x65, 0x63, 0x49, 0x6e, + 0x66, 0x6f, 0x42, 0x0c, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, + 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0xb0, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, + 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, + 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, + 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x55, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, + 0x73, 0x74, 0x22, 0xc8, 0x02, 0x0a, 0x10, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x5d, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, + 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xf5, 0x01, + 0x0a, 0x11, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xfd, 0x04, 0x0a, 0x0c, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x99, 0x03, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x52, 0x0d, 0x6e, 0x65, 0x77, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x72, 0x65, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x48, 0x0a, 0x10, 0x6e, 0x65, 0x77, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x0e, 0x6e, 0x65, 0x77, 0x53, 0x70, + 0x6c, 0x69, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x05, 0x70, 0x61, 0x74, + 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x50, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x59, 0x0a, 0x05, 0x50, 0x61, + 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x72, 0x61, + 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, + 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa4, 0x02, 0x0a, 0x0d, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3d, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x32, 0xd4, 0x05, 0x0a, + 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, + 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, + 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, + 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, + 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, + 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x54, 0x0a, 0x09, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x22, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x63, 0x68, + 0x12, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x28, 0x01, 0x42, 0x62, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 42) +var file_api_object_grpc_service_proto_goTypes = []any{ + (*GetRequest)(nil), // 0: neo.fs.v2.object.GetRequest + (*GetResponse)(nil), // 1: neo.fs.v2.object.GetResponse + (*PutRequest)(nil), // 2: neo.fs.v2.object.PutRequest + (*PutResponse)(nil), // 3: neo.fs.v2.object.PutResponse + (*DeleteRequest)(nil), // 4: neo.fs.v2.object.DeleteRequest + (*DeleteResponse)(nil), // 5: neo.fs.v2.object.DeleteResponse + (*HeadRequest)(nil), // 6: neo.fs.v2.object.HeadRequest + (*HeaderWithSignature)(nil), // 7: neo.fs.v2.object.HeaderWithSignature + (*HeadResponse)(nil), // 8: neo.fs.v2.object.HeadResponse + (*SearchRequest)(nil), // 9: neo.fs.v2.object.SearchRequest + (*SearchResponse)(nil), // 10: neo.fs.v2.object.SearchResponse + (*Range)(nil), // 11: neo.fs.v2.object.Range + (*GetRangeRequest)(nil), // 12: neo.fs.v2.object.GetRangeRequest + (*GetRangeResponse)(nil), // 13: neo.fs.v2.object.GetRangeResponse + (*GetRangeHashRequest)(nil), // 14: neo.fs.v2.object.GetRangeHashRequest + (*GetRangeHashResponse)(nil), // 15: neo.fs.v2.object.GetRangeHashResponse + (*PutSingleRequest)(nil), // 16: neo.fs.v2.object.PutSingleRequest + (*PutSingleResponse)(nil), // 17: neo.fs.v2.object.PutSingleResponse + (*PatchRequest)(nil), // 18: neo.fs.v2.object.PatchRequest + (*PatchResponse)(nil), // 19: neo.fs.v2.object.PatchResponse + (*GetRequest_Body)(nil), // 20: neo.fs.v2.object.GetRequest.Body + (*GetResponse_Body)(nil), // 21: neo.fs.v2.object.GetResponse.Body + (*GetResponse_Body_Init)(nil), // 22: neo.fs.v2.object.GetResponse.Body.Init + (*PutRequest_Body)(nil), // 23: neo.fs.v2.object.PutRequest.Body + (*PutRequest_Body_Init)(nil), // 24: neo.fs.v2.object.PutRequest.Body.Init + (*PutResponse_Body)(nil), // 25: neo.fs.v2.object.PutResponse.Body + (*DeleteRequest_Body)(nil), // 26: neo.fs.v2.object.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 27: neo.fs.v2.object.DeleteResponse.Body + (*HeadRequest_Body)(nil), // 28: neo.fs.v2.object.HeadRequest.Body + (*HeadResponse_Body)(nil), // 29: neo.fs.v2.object.HeadResponse.Body + (*SearchRequest_Body)(nil), // 30: neo.fs.v2.object.SearchRequest.Body + (*SearchRequest_Body_Filter)(nil), // 31: neo.fs.v2.object.SearchRequest.Body.Filter + (*SearchResponse_Body)(nil), // 32: neo.fs.v2.object.SearchResponse.Body + (*GetRangeRequest_Body)(nil), // 33: neo.fs.v2.object.GetRangeRequest.Body + (*GetRangeResponse_Body)(nil), // 34: neo.fs.v2.object.GetRangeResponse.Body + (*GetRangeHashRequest_Body)(nil), // 35: neo.fs.v2.object.GetRangeHashRequest.Body + (*GetRangeHashResponse_Body)(nil), // 36: neo.fs.v2.object.GetRangeHashResponse.Body + (*PutSingleRequest_Body)(nil), // 37: neo.fs.v2.object.PutSingleRequest.Body + (*PutSingleResponse_Body)(nil), // 38: neo.fs.v2.object.PutSingleResponse.Body + (*PatchRequest_Body)(nil), // 39: neo.fs.v2.object.PatchRequest.Body + (*PatchRequest_Body_Patch)(nil), // 40: neo.fs.v2.object.PatchRequest.Body.Patch + (*PatchResponse_Body)(nil), // 41: neo.fs.v2.object.PatchResponse.Body + (*grpc.RequestMetaHeader)(nil), // 42: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 43: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 44: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 45: neo.fs.v2.session.ResponseVerificationHeader + (*Header)(nil), // 46: neo.fs.v2.object.Header + (*grpc1.Signature)(nil), // 47: neo.fs.v2.refs.Signature + (*grpc1.Address)(nil), // 48: neo.fs.v2.refs.Address + (*SplitInfo)(nil), // 49: neo.fs.v2.object.SplitInfo + (*ECInfo)(nil), // 50: neo.fs.v2.object.ECInfo + (*grpc1.ObjectID)(nil), // 51: neo.fs.v2.refs.ObjectID + (*ShortHeader)(nil), // 52: neo.fs.v2.object.ShortHeader + (*grpc1.ContainerID)(nil), // 53: neo.fs.v2.refs.ContainerID + (MatchType)(0), // 54: neo.fs.v2.object.MatchType + (grpc1.ChecksumType)(0), // 55: neo.fs.v2.refs.ChecksumType + (*Object)(nil), // 56: neo.fs.v2.object.Object + (*Header_Attribute)(nil), // 57: neo.fs.v2.object.Header.Attribute + (*Header_Split)(nil), // 58: neo.fs.v2.object.Header.Split +} +var file_api_object_grpc_service_proto_depIdxs = []int32{ + 20, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body + 42, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 21, // 3: neo.fs.v2.object.GetResponse.body:type_name -> neo.fs.v2.object.GetResponse.Body + 44, // 4: neo.fs.v2.object.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 5: neo.fs.v2.object.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 23, // 6: neo.fs.v2.object.PutRequest.body:type_name -> neo.fs.v2.object.PutRequest.Body + 42, // 7: neo.fs.v2.object.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 8: neo.fs.v2.object.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 25, // 9: neo.fs.v2.object.PutResponse.body:type_name -> neo.fs.v2.object.PutResponse.Body + 44, // 10: neo.fs.v2.object.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 11: neo.fs.v2.object.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 26, // 12: neo.fs.v2.object.DeleteRequest.body:type_name -> neo.fs.v2.object.DeleteRequest.Body + 42, // 13: neo.fs.v2.object.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 14: neo.fs.v2.object.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 27, // 15: neo.fs.v2.object.DeleteResponse.body:type_name -> neo.fs.v2.object.DeleteResponse.Body + 44, // 16: neo.fs.v2.object.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 17: neo.fs.v2.object.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 28, // 18: neo.fs.v2.object.HeadRequest.body:type_name -> neo.fs.v2.object.HeadRequest.Body + 42, // 19: neo.fs.v2.object.HeadRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 20: neo.fs.v2.object.HeadRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 46, // 21: neo.fs.v2.object.HeaderWithSignature.header:type_name -> neo.fs.v2.object.Header + 47, // 22: neo.fs.v2.object.HeaderWithSignature.signature:type_name -> neo.fs.v2.refs.Signature + 29, // 23: neo.fs.v2.object.HeadResponse.body:type_name -> neo.fs.v2.object.HeadResponse.Body + 44, // 24: neo.fs.v2.object.HeadResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 25: neo.fs.v2.object.HeadResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 30, // 26: neo.fs.v2.object.SearchRequest.body:type_name -> neo.fs.v2.object.SearchRequest.Body + 42, // 27: neo.fs.v2.object.SearchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 28: neo.fs.v2.object.SearchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 32, // 29: neo.fs.v2.object.SearchResponse.body:type_name -> neo.fs.v2.object.SearchResponse.Body + 44, // 30: neo.fs.v2.object.SearchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 31: neo.fs.v2.object.SearchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 33, // 32: neo.fs.v2.object.GetRangeRequest.body:type_name -> neo.fs.v2.object.GetRangeRequest.Body + 42, // 33: neo.fs.v2.object.GetRangeRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 34: neo.fs.v2.object.GetRangeRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 34, // 35: neo.fs.v2.object.GetRangeResponse.body:type_name -> neo.fs.v2.object.GetRangeResponse.Body + 44, // 36: neo.fs.v2.object.GetRangeResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 37: neo.fs.v2.object.GetRangeResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 35, // 38: neo.fs.v2.object.GetRangeHashRequest.body:type_name -> neo.fs.v2.object.GetRangeHashRequest.Body + 42, // 39: neo.fs.v2.object.GetRangeHashRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 40: neo.fs.v2.object.GetRangeHashRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 36, // 41: neo.fs.v2.object.GetRangeHashResponse.body:type_name -> neo.fs.v2.object.GetRangeHashResponse.Body + 44, // 42: neo.fs.v2.object.GetRangeHashResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 37, // 44: neo.fs.v2.object.PutSingleRequest.body:type_name -> neo.fs.v2.object.PutSingleRequest.Body + 42, // 45: neo.fs.v2.object.PutSingleRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 46: neo.fs.v2.object.PutSingleRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 38, // 47: neo.fs.v2.object.PutSingleResponse.body:type_name -> neo.fs.v2.object.PutSingleResponse.Body + 44, // 48: neo.fs.v2.object.PutSingleResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 49: neo.fs.v2.object.PutSingleResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 39, // 50: neo.fs.v2.object.PatchRequest.body:type_name -> neo.fs.v2.object.PatchRequest.Body + 42, // 51: neo.fs.v2.object.PatchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 52: neo.fs.v2.object.PatchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 41, // 53: neo.fs.v2.object.PatchResponse.body:type_name -> neo.fs.v2.object.PatchResponse.Body + 44, // 54: neo.fs.v2.object.PatchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 55: neo.fs.v2.object.PatchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 48, // 56: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 22, // 57: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init + 49, // 58: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 59: neo.fs.v2.object.GetResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 51, // 60: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 47, // 61: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 46, // 62: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header + 24, // 63: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init + 51, // 64: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 47, // 65: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 46, // 66: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header + 51, // 67: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 48, // 68: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 48, // 69: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address + 48, // 70: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 7, // 71: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature + 52, // 72: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader + 49, // 73: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 74: neo.fs.v2.object.HeadResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 53, // 75: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 31, // 76: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 54, // 77: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 51, // 78: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 48, // 79: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 80: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 49, // 81: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 82: neo.fs.v2.object.GetRangeResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 48, // 83: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 84: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 55, // 85: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 55, // 86: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 56, // 87: neo.fs.v2.object.PutSingleRequest.Body.object:type_name -> neo.fs.v2.object.Object + 48, // 88: neo.fs.v2.object.PatchRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 57, // 89: neo.fs.v2.object.PatchRequest.Body.new_attributes:type_name -> neo.fs.v2.object.Header.Attribute + 58, // 90: neo.fs.v2.object.PatchRequest.Body.new_split_header:type_name -> neo.fs.v2.object.Header.Split + 40, // 91: neo.fs.v2.object.PatchRequest.Body.patch:type_name -> neo.fs.v2.object.PatchRequest.Body.Patch + 11, // 92: neo.fs.v2.object.PatchRequest.Body.Patch.source_range:type_name -> neo.fs.v2.object.Range + 51, // 93: neo.fs.v2.object.PatchResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 0, // 94: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 95: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 96: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 97: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 98: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 99: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 100: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 16, // 101: neo.fs.v2.object.ObjectService.PutSingle:input_type -> neo.fs.v2.object.PutSingleRequest + 18, // 102: neo.fs.v2.object.ObjectService.Patch:input_type -> neo.fs.v2.object.PatchRequest + 1, // 103: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 104: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 105: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 106: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 107: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 108: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 109: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 17, // 110: neo.fs.v2.object.ObjectService.PutSingle:output_type -> neo.fs.v2.object.PutSingleResponse + 19, // 111: neo.fs.v2.object.ObjectService.Patch:output_type -> neo.fs.v2.object.PatchResponse + 103, // [103:112] is the sub-list for method output_type + 94, // [94:103] is the sub-list for method input_type + 94, // [94:94] is the sub-list for extension type_name + 94, // [94:94] is the sub-list for extension extendee + 0, // [0:94] is the sub-list for field type_name +} + +func init() { file_api_object_grpc_service_proto_init() } +func file_api_object_grpc_service_proto_init() { + if File_api_object_grpc_service_proto != nil { + return + } + file_api_object_grpc_types_proto_init() + file_api_object_grpc_service_proto_msgTypes[21].OneofWrappers = []any{ + (*GetResponse_Body_Init_)(nil), + (*GetResponse_Body_Chunk)(nil), + (*GetResponse_Body_SplitInfo)(nil), + (*GetResponse_Body_EcInfo)(nil), + } + file_api_object_grpc_service_proto_msgTypes[23].OneofWrappers = []any{ + (*PutRequest_Body_Init_)(nil), + (*PutRequest_Body_Chunk)(nil), + } + file_api_object_grpc_service_proto_msgTypes[29].OneofWrappers = []any{ + (*HeadResponse_Body_Header)(nil), + (*HeadResponse_Body_ShortHeader)(nil), + (*HeadResponse_Body_SplitInfo)(nil), + (*HeadResponse_Body_EcInfo)(nil), + } + file_api_object_grpc_service_proto_msgTypes[34].OneofWrappers = []any{ + (*GetRangeResponse_Body_Chunk)(nil), + (*GetRangeResponse_Body_SplitInfo)(nil), + (*GetRangeResponse_Body_EcInfo)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_object_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 42, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_object_grpc_service_proto_goTypes, + DependencyIndexes: file_api_object_grpc_service_proto_depIdxs, + MessageInfos: file_api_object_grpc_service_proto_msgTypes, + }.Build() + File_api_object_grpc_service_proto = out.File + file_api_object_grpc_service_proto_rawDesc = nil + file_api_object_grpc_service_proto_goTypes = nil + file_api_object_grpc_service_proto_depIdxs = nil +} diff --git a/api/object/grpc/service_grpc.pb.go b/api/object/grpc/service_grpc.pb.go new file mode 100644 index 00000000..77c02af8 --- /dev/null +++ b/api/object/grpc/service_grpc.pb.go @@ -0,0 +1,1035 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.2 +// source: api/object/grpc/service.proto + +package object + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + ObjectService_Get_FullMethodName = "/neo.fs.v2.object.ObjectService/Get" + ObjectService_Put_FullMethodName = "/neo.fs.v2.object.ObjectService/Put" + ObjectService_Delete_FullMethodName = "/neo.fs.v2.object.ObjectService/Delete" + ObjectService_Head_FullMethodName = "/neo.fs.v2.object.ObjectService/Head" + ObjectService_Search_FullMethodName = "/neo.fs.v2.object.ObjectService/Search" + ObjectService_GetRange_FullMethodName = "/neo.fs.v2.object.ObjectService/GetRange" + ObjectService_GetRangeHash_FullMethodName = "/neo.fs.v2.object.ObjectService/GetRangeHash" + ObjectService_PutSingle_FullMethodName = "/neo.fs.v2.object.ObjectService/PutSingle" + ObjectService_Patch_FullMethodName = "/neo.fs.v2.object.ObjectService/Patch" +) + +// ObjectServiceClient is the client API for ObjectService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// `ObjectService` provides API for manipulating objects. Object operations do +// not affect the sidechain and are only served by nodes in p2p style. +type ObjectServiceClient interface { + // Receive full object structure, including Headers and payload. Response uses + // gRPC stream. First response message carries the object with the requested + // address. Chunk messages are parts of the object's payload if it is needed. + // All messages, except the first one, carry payload chunks. The requested + // object can be restored by concatenation of object message payload and all + // chunks keeping the receiving order. + // + // Extended headers can change `Get` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` + // (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or the latest one + // otherwise) of Network Map to find an object until the depth limit is + // reached. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetResponse], error) + // Put the object into container. Request uses gRPC stream. First message + // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object + // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see + // session package). Chunk messages are considered by server as a part of an + // object payload. All messages, except first one, SHOULD be payload chunks. + // Chunk messages SHOULD be sent in the direct order of fragmentation. + // + // Extended headers can change `Put` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one + // locked object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or + // has + // + // been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Put(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[PutRequest, PutResponse], error) + // Delete the object from a container. There is no immediate removal + // guarantee. Object will be marked for removal and deleted eventually. + // + // Extended headers can change `Delete` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // the object could not be deleted because it has not been \ + // found within the container; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Returns the object Headers without data payload. By default full header is + // returned. If `main_only` request field is set, the short header with only + // the very minimal information will be returned instead. + // + // Extended headers can change `Head` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) + // Search objects in container. Search query allows to match by Object + // Header's filed values. Please see the corresponding FrostFS Technical + // Specification section for more details. + // + // Extended headers can change `Search` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SearchResponse], error) + // Get byte range of data payload. Range is set as an (offset, length) tuple. + // Like in `Get` method, the response uses gRPC stream. Requested range can be + // restored by concatenation of all received payload chunks keeping the + // receiving order. + // + // Extended headers can change `GetRange` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetRangeResponse], error) + // Returns homomorphic or regular hash of object's payload range after + // applying XOR operation with the provided `salt`. Ranges are set of (offset, + // length) tuples. Hashes order in response corresponds to the ranges order in + // the request. Note that hash is calculated for XORed data. + // + // Extended headers can change `GetRangeHash` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) + // Put the prepared object into container. + // `ContainerID`, `ObjectID`, `OwnerID`, `PayloadHash` and `PayloadLength` of + // an object MUST be set. + // + // Extended headers can change `Put` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one + // locked object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or + // has + // + // been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error) + // Patch the object. Request uses gRPC stream. First message must set + // the address of the object that is going to get patched. If the object's + // attributes are patched, then these attrubutes must be set only within the + // first stream message. + // + // If the patch request is performed by NOT the object's owner but if the + // actor has the permission to perform the patch, then `OwnerID` of the object + // is changed. In this case the object's owner loses the object's ownership + // after the patch request is successfully done. + // + // As objects are content-addressable the patching causes new object ID + // generation for the patched object. This object id is set witihn + // `PatchResponse`. But the object id may remain unchanged in such cases: + // 1. The chunk of the applying patch contains the same value as the object's + // payload within the same range; + // 2. The patch that reverts the changes applied by preceding patch; + // 3. The application of the same patches for the object a few times. + // + // Extended headers can change `Patch` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully patched and saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or + // has been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Patch(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[PatchRequest, PatchResponse], error) +} + +type objectServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewObjectServiceClient(cc grpc.ClientConnInterface) ObjectServiceClient { + return &objectServiceClient{cc} +} + +func (c *objectServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[0], ObjectService_Get_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[GetRequest, GetResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_GetClient = grpc.ServerStreamingClient[GetResponse] + +func (c *objectServiceClient) Put(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[PutRequest, PutResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[1], ObjectService_Put_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[PutRequest, PutResponse]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_PutClient = grpc.ClientStreamingClient[PutRequest, PutResponse] + +func (c *objectServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, ObjectService_Delete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *objectServiceClient) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HeadResponse) + err := c.cc.Invoke(ctx, ObjectService_Head_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *objectServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SearchResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[2], ObjectService_Search_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[SearchRequest, SearchResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_SearchClient = grpc.ServerStreamingClient[SearchResponse] + +func (c *objectServiceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetRangeResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[3], ObjectService_GetRange_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[GetRangeRequest, GetRangeResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_GetRangeClient = grpc.ServerStreamingClient[GetRangeResponse] + +func (c *objectServiceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetRangeHashResponse) + err := c.cc.Invoke(ctx, ObjectService_GetRangeHash_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *objectServiceClient) PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PutSingleResponse) + err := c.cc.Invoke(ctx, ObjectService_PutSingle_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *objectServiceClient) Patch(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[PatchRequest, PatchResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ObjectService_ServiceDesc.Streams[4], ObjectService_Patch_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[PatchRequest, PatchResponse]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_PatchClient = grpc.ClientStreamingClient[PatchRequest, PatchResponse] + +// ObjectServiceServer is the server API for ObjectService service. +// All implementations should embed UnimplementedObjectServiceServer +// for forward compatibility. +// +// `ObjectService` provides API for manipulating objects. Object operations do +// not affect the sidechain and are only served by nodes in p2p style. +type ObjectServiceServer interface { + // Receive full object structure, including Headers and payload. Response uses + // gRPC stream. First response message carries the object with the requested + // address. Chunk messages are parts of the object's payload if it is needed. + // All messages, except the first one, carry payload chunks. The requested + // object can be restored by concatenation of object message payload and all + // chunks keeping the receiving order. + // + // Extended headers can change `Get` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH` + // (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or the latest one + // otherwise) of Network Map to find an object until the depth limit is + // reached. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // read access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Get(*GetRequest, grpc.ServerStreamingServer[GetResponse]) error + // Put the object into container. Request uses gRPC stream. First message + // SHOULD be of PutHeader type. `ContainerID` and `OwnerID` of an object + // SHOULD be set. Session token SHOULD be obtained before `PUT` operation (see + // session package). Chunk messages are considered by server as a part of an + // object payload. All messages, except first one, SHOULD be payload chunks. + // Chunk messages SHOULD be sent in the direct order of fragmentation. + // + // Extended headers can change `Put` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one + // locked object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or + // has + // + // been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Put(grpc.ClientStreamingServer[PutRequest, PutResponse]) error + // Delete the object from a container. There is no immediate removal + // guarantee. Object will be marked for removal and deleted eventually. + // + // Extended headers can change `Delete` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully marked to be removed from the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // delete access to the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // the object could not be deleted because it has not been \ + // found within the container; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // deleting a locked object is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Returns the object Headers without data payload. By default full header is + // returned. If `main_only` request field is set, the short header with only + // the very minimal information will be returned instead. + // + // Extended headers can change `Head` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object header has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation HEAD of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Head(context.Context, *HeadRequest) (*HeadResponse, error) + // Search objects in container. Search query allows to match by Object + // Header's filed values. Please see the corresponding FrostFS Technical + // Specification section for more details. + // + // Extended headers can change `Search` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // objects have been successfully selected; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation SEARCH of the object is denied; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // search container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Search(*SearchRequest, grpc.ServerStreamingServer[SearchResponse]) error + // Get byte range of data payload. Range is set as an (offset, length) tuple. + // Like in `Get` method, the response uses gRPC stream. Requested range can be + // restored by concatenation of all received payload chunks keeping the + // receiving order. + // + // Extended headers can change `GetRange` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully read; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGE of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + GetRange(*GetRangeRequest, grpc.ServerStreamingServer[GetRangeResponse]) error + // Returns homomorphic or regular hash of object's payload range after + // applying XOR operation with the provided `salt`. Ranges are set of (offset, + // length) tuples. Hashes order in response corresponds to the ranges order in + // the request. Note that hash is calculated for XORed data. + // + // Extended headers can change `GetRangeHash` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH ] \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ + // (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ + // Will try older versions of Network Map to find an object until the depth + // limit is reached. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // data range of the object payload has been successfully hashed; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // access to operation RANGEHASH of the object is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) + // Put the prepared object into container. + // `ContainerID`, `ObjectID`, `OwnerID`, `PayloadHash` and `PayloadLength` of + // an object MUST be set. + // + // Extended headers can change `Put` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requested version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **LOCKED** (2050, SECTION_OBJECT): \ + // placement of an object of type TOMBSTONE that includes at least one + // locked object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \ + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or + // has + // + // been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error) + // Patch the object. Request uses gRPC stream. First message must set + // the address of the object that is going to get patched. If the object's + // attributes are patched, then these attrubutes must be set only within the + // first stream message. + // + // If the patch request is performed by NOT the object's owner but if the + // actor has the permission to perform the patch, then `OwnerID` of the object + // is changed. In this case the object's owner loses the object's ownership + // after the patch request is successfully done. + // + // As objects are content-addressable the patching causes new object ID + // generation for the patched object. This object id is set witihn + // `PatchResponse`. But the object id may remain unchanged in such cases: + // 1. The chunk of the applying patch contains the same value as the object's + // payload within the same range; + // 2. The patch that reverts the changes applied by preceding patch; + // 3. The application of the same patches for the object a few times. + // + // Extended headers can change `Patch` behaviour: + // - [ __SYSTEM__NETMAP_EPOCH \ + // (`__NEOFS__NETMAP_EPOCH` is deprecated) \ + // Will use the requsted version of Network Map for object placement + // calculation. + // + // Please refer to detailed `XHeader` description. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): \ + // object has been successfully patched and saved in the container; + // - Common failures (SECTION_FAILURE_COMMON); + // - **ACCESS_DENIED** (2048, SECTION_OBJECT): \ + // write access to the container is denied; + // - **OBJECT_NOT_FOUND** (2049, SECTION_OBJECT): \ + // object not found in container; + // - **OBJECT_ALREADY_REMOVED** (2052, SECTION_OBJECT): \ + // the requested object has been marked as deleted. + // - **OUT_OF_RANGE** (2053, SECTION_OBJECT): \ + // the requested range is out of bounds; + // - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \ + // object storage container not found; + // - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \ + // access to container is denied; + // - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \ + // (for trusted object preparation) session private key does not exist or + // has been deleted; + // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ + // provided session token has expired. + Patch(grpc.ClientStreamingServer[PatchRequest, PatchResponse]) error +} + +// UnimplementedObjectServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedObjectServiceServer struct{} + +func (UnimplementedObjectServiceServer) Get(*GetRequest, grpc.ServerStreamingServer[GetResponse]) error { + return status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedObjectServiceServer) Put(grpc.ClientStreamingServer[PutRequest, PutResponse]) error { + return status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (UnimplementedObjectServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedObjectServiceServer) Head(context.Context, *HeadRequest) (*HeadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Head not implemented") +} +func (UnimplementedObjectServiceServer) Search(*SearchRequest, grpc.ServerStreamingServer[SearchResponse]) error { + return status.Errorf(codes.Unimplemented, "method Search not implemented") +} +func (UnimplementedObjectServiceServer) GetRange(*GetRangeRequest, grpc.ServerStreamingServer[GetRangeResponse]) error { + return status.Errorf(codes.Unimplemented, "method GetRange not implemented") +} +func (UnimplementedObjectServiceServer) GetRangeHash(context.Context, *GetRangeHashRequest) (*GetRangeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") +} +func (UnimplementedObjectServiceServer) PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PutSingle not implemented") +} +func (UnimplementedObjectServiceServer) Patch(grpc.ClientStreamingServer[PatchRequest, PatchResponse]) error { + return status.Errorf(codes.Unimplemented, "method Patch not implemented") +} +func (UnimplementedObjectServiceServer) testEmbeddedByValue() {} + +// UnsafeObjectServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ObjectServiceServer will +// result in compilation errors. +type UnsafeObjectServiceServer interface { + mustEmbedUnimplementedObjectServiceServer() +} + +func RegisterObjectServiceServer(s grpc.ServiceRegistrar, srv ObjectServiceServer) { + // If the following call pancis, it indicates UnimplementedObjectServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ObjectService_ServiceDesc, srv) +} + +func _ObjectService_Get_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ObjectServiceServer).Get(m, &grpc.GenericServerStream[GetRequest, GetResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_GetServer = grpc.ServerStreamingServer[GetResponse] + +func _ObjectService_Put_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ObjectServiceServer).Put(&grpc.GenericServerStream[PutRequest, PutResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_PutServer = grpc.ClientStreamingServer[PutRequest, PutResponse] + +func _ObjectService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ObjectServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ObjectService_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ObjectServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ObjectService_Head_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HeadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ObjectServiceServer).Head(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ObjectService_Head_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ObjectServiceServer).Head(ctx, req.(*HeadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ObjectService_Search_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SearchRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ObjectServiceServer).Search(m, &grpc.GenericServerStream[SearchRequest, SearchResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_SearchServer = grpc.ServerStreamingServer[SearchResponse] + +func _ObjectService_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRangeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ObjectServiceServer).GetRange(m, &grpc.GenericServerStream[GetRangeRequest, GetRangeResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_GetRangeServer = grpc.ServerStreamingServer[GetRangeResponse] + +func _ObjectService_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRangeHashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ObjectServiceServer).GetRangeHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ObjectService_GetRangeHash_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ObjectServiceServer).GetRangeHash(ctx, req.(*GetRangeHashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ObjectService_PutSingle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutSingleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ObjectServiceServer).PutSingle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ObjectService_PutSingle_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ObjectServiceServer).PutSingle(ctx, req.(*PutSingleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ObjectService_Patch_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ObjectServiceServer).Patch(&grpc.GenericServerStream[PatchRequest, PatchResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ObjectService_PatchServer = grpc.ClientStreamingServer[PatchRequest, PatchResponse] + +// ObjectService_ServiceDesc is the grpc.ServiceDesc for ObjectService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ObjectService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.object.ObjectService", + HandlerType: (*ObjectServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Delete", + Handler: _ObjectService_Delete_Handler, + }, + { + MethodName: "Head", + Handler: _ObjectService_Head_Handler, + }, + { + MethodName: "GetRangeHash", + Handler: _ObjectService_GetRangeHash_Handler, + }, + { + MethodName: "PutSingle", + Handler: _ObjectService_PutSingle_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Get", + Handler: _ObjectService_Get_Handler, + ServerStreams: true, + }, + { + StreamName: "Put", + Handler: _ObjectService_Put_Handler, + ClientStreams: true, + }, + { + StreamName: "Search", + Handler: _ObjectService_Search_Handler, + ServerStreams: true, + }, + { + StreamName: "GetRange", + Handler: _ObjectService_GetRange_Handler, + ServerStreams: true, + }, + { + StreamName: "Patch", + Handler: _ObjectService_Patch_Handler, + ClientStreams: true, + }, + }, + Metadata: "api/object/grpc/service.proto", +} diff --git a/api/object/grpc/service_protoopaque.pb.go b/api/object/grpc/service_protoopaque.pb.go new file mode 100644 index 00000000..8c74ef04 --- /dev/null +++ b/api/object/grpc/service_protoopaque.pb.go @@ -0,0 +1,6150 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/object/grpc/service.proto + +//go:build protoopaque + +package object + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GET object request +type GetRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *GetRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest) Reset() { + *x = GetRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRequest) GetBody() *GetRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *GetRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *GetRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *GetRequest) SetBody(v *GetRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *GetRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *GetRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *GetRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *GetRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *GetRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *GetRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *GetRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *GetRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type GetRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get object request message. + Body *GetRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 GetRequest_builder) Build() *GetRequest { + m0 := &GetRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// GET object response +type GetResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *GetResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse) Reset() { + *x = GetResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse) GetBody() *GetResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *GetResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *GetResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *GetResponse) SetBody(v *GetResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *GetResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *GetResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *GetResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *GetResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *GetResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *GetResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *GetResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *GetResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type GetResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get object response message. + Body *GetResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 GetResponse_builder) Build() *GetResponse { + m0 := &GetResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// PUT object request +type PutRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *PutRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest) Reset() { + *x = PutRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest) ProtoMessage() {} + +func (x *PutRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest) GetBody() *PutRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *PutRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *PutRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *PutRequest) SetBody(v *PutRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *PutRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *PutRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *PutRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *PutRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *PutRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *PutRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *PutRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *PutRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type PutRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of put object request message. + Body *PutRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 PutRequest_builder) Build() *PutRequest { + m0 := &PutRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// PUT Object response +type PutResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *PutResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse) Reset() { + *x = PutResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutResponse) GetBody() *PutResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *PutResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *PutResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *PutResponse) SetBody(v *PutResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *PutResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *PutResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *PutResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *PutResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *PutResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *PutResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *PutResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *PutResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type PutResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of put object response message. + Body *PutResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 PutResponse_builder) Build() *PutResponse { + m0 := &PutResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Object DELETE request +type DeleteRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *DeleteRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteRequest) GetBody() *DeleteRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *DeleteRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *DeleteRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *DeleteRequest) SetBody(v *DeleteRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *DeleteRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *DeleteRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *DeleteRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *DeleteRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *DeleteRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *DeleteRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *DeleteRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *DeleteRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type DeleteRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of delete object request message. + Body *DeleteRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 DeleteRequest_builder) Build() *DeleteRequest { + m0 := &DeleteRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// DeleteResponse body is empty because we cannot guarantee permanent object +// removal in distributed system. +type DeleteResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *DeleteResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteResponse) GetBody() *DeleteResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *DeleteResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *DeleteResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *DeleteResponse) SetBody(v *DeleteResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *DeleteResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *DeleteResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *DeleteResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *DeleteResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *DeleteResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *DeleteResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *DeleteResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *DeleteResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type DeleteResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of delete object response message. + Body *DeleteResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 DeleteResponse_builder) Build() *DeleteResponse { + m0 := &DeleteResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Object HEAD request +type HeadRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *HeadRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeadRequest) Reset() { + *x = HeadRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadRequest) ProtoMessage() {} + +func (x *HeadRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeadRequest) GetBody() *HeadRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *HeadRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *HeadRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *HeadRequest) SetBody(v *HeadRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *HeadRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *HeadRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *HeadRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *HeadRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *HeadRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *HeadRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *HeadRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *HeadRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type HeadRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of head object request message. + Body *HeadRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 HeadRequest_builder) Build() *HeadRequest { + m0 := &HeadRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Tuple of a full object header and signature of an `ObjectID`. \ +// Signed `ObjectID` is present to verify full header's authenticity through the +// following steps: +// +// 1. Calculate `SHA-256` of the marshalled `Header` structure +// 2. Check if the resulting hash matches `ObjectID` +// 3. Check if `ObjectID` signature in `signature` field is correct +type HeaderWithSignature struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Header *Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + xxx_hidden_Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeaderWithSignature) Reset() { + *x = HeaderWithSignature{} + mi := &file_api_object_grpc_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeaderWithSignature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeaderWithSignature) ProtoMessage() {} + +func (x *HeaderWithSignature) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeaderWithSignature) GetHeader() *Header { + if x != nil { + return x.xxx_hidden_Header + } + return nil +} + +func (x *HeaderWithSignature) GetSignature() *grpc1.Signature { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *HeaderWithSignature) SetHeader(v *Header) { + x.xxx_hidden_Header = v +} + +func (x *HeaderWithSignature) SetSignature(v *grpc1.Signature) { + x.xxx_hidden_Signature = v +} + +func (x *HeaderWithSignature) HasHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_Header != nil +} + +func (x *HeaderWithSignature) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *HeaderWithSignature) ClearHeader() { + x.xxx_hidden_Header = nil +} + +func (x *HeaderWithSignature) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +type HeaderWithSignature_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Full object header + Header *Header + // Signed `ObjectID` to verify full header's authenticity + Signature *grpc1.Signature +} + +func (b0 HeaderWithSignature_builder) Build() *HeaderWithSignature { + m0 := &HeaderWithSignature{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Header = b.Header + x.xxx_hidden_Signature = b.Signature + return m0 +} + +// Object HEAD response +type HeadResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *HeadResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeadResponse) Reset() { + *x = HeadResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadResponse) ProtoMessage() {} + +func (x *HeadResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeadResponse) GetBody() *HeadResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *HeadResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *HeadResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *HeadResponse) SetBody(v *HeadResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *HeadResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *HeadResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *HeadResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *HeadResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *HeadResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *HeadResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *HeadResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *HeadResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type HeadResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of head object response message. + Body *HeadResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 HeadResponse_builder) Build() *HeadResponse { + m0 := &HeadResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Object Search request +type SearchRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *SearchRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchRequest) Reset() { + *x = SearchRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest) ProtoMessage() {} + +func (x *SearchRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchRequest) GetBody() *SearchRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *SearchRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *SearchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *SearchRequest) SetBody(v *SearchRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *SearchRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *SearchRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *SearchRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *SearchRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *SearchRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *SearchRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *SearchRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *SearchRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type SearchRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of search object request message. + Body *SearchRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 SearchRequest_builder) Build() *SearchRequest { + m0 := &SearchRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Search response +type SearchResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *SearchResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchResponse) Reset() { + *x = SearchResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchResponse) ProtoMessage() {} + +func (x *SearchResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchResponse) GetBody() *SearchResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *SearchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *SearchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *SearchResponse) SetBody(v *SearchResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *SearchResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *SearchResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *SearchResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *SearchResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *SearchResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *SearchResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *SearchResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *SearchResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type SearchResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of search object response message. + Body *SearchResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 SearchResponse_builder) Build() *SearchResponse { + m0 := &SearchResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Object payload range.Ranges of zero length SHOULD be considered as invalid. +type Range struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Offset uint64 `protobuf:"varint,1,opt,name=offset" json:"offset,omitempty"` + xxx_hidden_Length uint64 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Range) Reset() { + *x = Range{} + mi := &file_api_object_grpc_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Range) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Range) ProtoMessage() {} + +func (x *Range) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Range) GetOffset() uint64 { + if x != nil { + return x.xxx_hidden_Offset + } + return 0 +} + +func (x *Range) GetLength() uint64 { + if x != nil { + return x.xxx_hidden_Length + } + return 0 +} + +func (x *Range) SetOffset(v uint64) { + x.xxx_hidden_Offset = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *Range) SetLength(v uint64) { + x.xxx_hidden_Length = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *Range) HasOffset() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Range) HasLength() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Range) ClearOffset() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Offset = 0 +} + +func (x *Range) ClearLength() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Length = 0 +} + +type Range_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Offset of the range from the object payload start + Offset *uint64 + // Length in bytes of the object payload range + Length *uint64 +} + +func (b0 Range_builder) Build() *Range { + m0 := &Range{} + b, x := &b0, m0 + _, _ = b, x + if b.Offset != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Offset = *b.Offset + } + if b.Length != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Length = *b.Length + } + return m0 +} + +// Request part of object's payload +type GetRangeRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *GetRangeRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeRequest) Reset() { + *x = GetRangeRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeRequest) ProtoMessage() {} + +func (x *GetRangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeRequest) GetBody() *GetRangeRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *GetRangeRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *GetRangeRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *GetRangeRequest) SetBody(v *GetRangeRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *GetRangeRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *GetRangeRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *GetRangeRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *GetRangeRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *GetRangeRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *GetRangeRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *GetRangeRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *GetRangeRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type GetRangeRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get range object request message. + Body *GetRangeRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 GetRangeRequest_builder) Build() *GetRangeRequest { + m0 := &GetRangeRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Get part of object's payload +type GetRangeResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *GetRangeResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeResponse) Reset() { + *x = GetRangeResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeResponse) ProtoMessage() {} + +func (x *GetRangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeResponse) GetBody() *GetRangeResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *GetRangeResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *GetRangeResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *GetRangeResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *GetRangeResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *GetRangeResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *GetRangeResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *GetRangeResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *GetRangeResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *GetRangeResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *GetRangeResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type GetRangeResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get range object response message. + Body *GetRangeResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 GetRangeResponse_builder) Build() *GetRangeResponse { + m0 := &GetRangeResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Get hash of object's payload part +type GetRangeHashRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *GetRangeHashRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeHashRequest) Reset() { + *x = GetRangeHashRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeHashRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashRequest) ProtoMessage() {} + +func (x *GetRangeHashRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *GetRangeHashRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *GetRangeHashRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *GetRangeHashRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *GetRangeHashRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *GetRangeHashRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *GetRangeHashRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *GetRangeHashRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *GetRangeHashRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *GetRangeHashRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *GetRangeHashRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type GetRangeHashRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get range hash object request message. + Body *GetRangeHashRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 GetRangeHashRequest_builder) Build() *GetRangeHashRequest { + m0 := &GetRangeHashRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Get hash of object's payload part +type GetRangeHashResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *GetRangeHashResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeHashResponse) Reset() { + *x = GetRangeHashResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeHashResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashResponse) ProtoMessage() {} + +func (x *GetRangeHashResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *GetRangeHashResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *GetRangeHashResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *GetRangeHashResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *GetRangeHashResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *GetRangeHashResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *GetRangeHashResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *GetRangeHashResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *GetRangeHashResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *GetRangeHashResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *GetRangeHashResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type GetRangeHashResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of get range hash object response message. + Body *GetRangeHashResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 GetRangeHashResponse_builder) Build() *GetRangeHashResponse { + m0 := &GetRangeHashResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Object PUT Single request +type PutSingleRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *PutSingleRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutSingleRequest) Reset() { + *x = PutSingleRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutSingleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleRequest) ProtoMessage() {} + +func (x *PutSingleRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutSingleRequest) GetBody() *PutSingleRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *PutSingleRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *PutSingleRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *PutSingleRequest) SetBody(v *PutSingleRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *PutSingleRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *PutSingleRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *PutSingleRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *PutSingleRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *PutSingleRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *PutSingleRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *PutSingleRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *PutSingleRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type PutSingleRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of put single object request message. + Body *PutSingleRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 PutSingleRequest_builder) Build() *PutSingleRequest { + m0 := &PutSingleRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Object PUT Single response +type PutSingleResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *PutSingleResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutSingleResponse) Reset() { + *x = PutSingleResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutSingleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleResponse) ProtoMessage() {} + +func (x *PutSingleResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutSingleResponse) GetBody() *PutSingleResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *PutSingleResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *PutSingleResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *PutSingleResponse) SetBody(v *PutSingleResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *PutSingleResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *PutSingleResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *PutSingleResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *PutSingleResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *PutSingleResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *PutSingleResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *PutSingleResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *PutSingleResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type PutSingleResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of put single object response message. + Body *PutSingleResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 PutSingleResponse_builder) Build() *PutSingleResponse { + m0 := &PutSingleResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Object PATCH request +type PatchRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *PatchRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchRequest) Reset() { + *x = PatchRequest{} + mi := &file_api_object_grpc_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest) ProtoMessage() {} + +func (x *PatchRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchRequest) GetBody() *PatchRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *PatchRequest) GetMetaHeader() *grpc.RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *PatchRequest) GetVerifyHeader() *grpc.RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *PatchRequest) SetBody(v *PatchRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *PatchRequest) SetMetaHeader(v *grpc.RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *PatchRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *PatchRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *PatchRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *PatchRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *PatchRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *PatchRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *PatchRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type PatchRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body for patch request message. + Body *PatchRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.RequestVerificationHeader +} + +func (b0 PatchRequest_builder) Build() *PatchRequest { + m0 := &PatchRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Object PATCH response +type PatchResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *PatchResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchResponse) Reset() { + *x = PatchResponse{} + mi := &file_api_object_grpc_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchResponse) ProtoMessage() {} + +func (x *PatchResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchResponse) GetBody() *PatchResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *PatchResponse) GetMetaHeader() *grpc.ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *PatchResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *PatchResponse) SetBody(v *PatchResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *PatchResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *PatchResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *PatchResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *PatchResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *PatchResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *PatchResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *PatchResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *PatchResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type PatchResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body for patch response message. + Body *PatchResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *grpc.ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *grpc.ResponseVerificationHeader +} + +func (b0 PatchResponse_builder) Build() *PatchResponse { + m0 := &PatchResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// GET Object request body +type GetRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + xxx_hidden_Raw bool `protobuf:"varint,2,opt,name=raw" json:"raw,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest_Body) Reset() { + *x = GetRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest_Body) ProtoMessage() {} + +func (x *GetRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.xxx_hidden_Address + } + return nil +} + +func (x *GetRequest_Body) GetRaw() bool { + if x != nil { + return x.xxx_hidden_Raw + } + return false +} + +func (x *GetRequest_Body) SetAddress(v *grpc1.Address) { + x.xxx_hidden_Address = v +} + +func (x *GetRequest_Body) SetRaw(v bool) { + x.xxx_hidden_Raw = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *GetRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.xxx_hidden_Address != nil +} + +func (x *GetRequest_Body) HasRaw() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *GetRequest_Body) ClearAddress() { + x.xxx_hidden_Address = nil +} + +func (x *GetRequest_Body) ClearRaw() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Raw = false +} + +type GetRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the requested object + Address *grpc1.Address + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node + Raw *bool +} + +func (b0 GetRequest_Body_builder) Build() *GetRequest_Body { + m0 := &GetRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Address = b.Address + if b.Raw != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Raw = *b.Raw + } + return m0 +} + +// GET Object Response body +type GetResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ObjectPart isGetResponse_Body_ObjectPart `protobuf_oneof:"object_part"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse_Body) Reset() { + *x = GetResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body) ProtoMessage() {} + +func (x *GetResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse_Body) GetInit() *GetResponse_Body_Init { + if x != nil { + if x, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_Init_); ok { + return x.Init + } + } + return nil +} + +func (x *GetResponse_Body) GetChunk() []byte { + if x != nil { + if x, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_Chunk); ok { + return x.Chunk + } + } + return nil +} + +func (x *GetResponse_Body) GetSplitInfo() *SplitInfo { + if x != nil { + if x, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + } + return nil +} + +func (x *GetResponse_Body) GetEcInfo() *ECInfo { + if x != nil { + if x, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_EcInfo); ok { + return x.EcInfo + } + } + return nil +} + +func (x *GetResponse_Body) SetInit(v *GetResponse_Body_Init) { + if v == nil { + x.xxx_hidden_ObjectPart = nil + return + } + x.xxx_hidden_ObjectPart = &getResponse_Body_Init_{v} +} + +func (x *GetResponse_Body) SetChunk(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_ObjectPart = &getResponse_Body_Chunk{v} +} + +func (x *GetResponse_Body) SetSplitInfo(v *SplitInfo) { + if v == nil { + x.xxx_hidden_ObjectPart = nil + return + } + x.xxx_hidden_ObjectPart = &getResponse_Body_SplitInfo{v} +} + +func (x *GetResponse_Body) SetEcInfo(v *ECInfo) { + if v == nil { + x.xxx_hidden_ObjectPart = nil + return + } + x.xxx_hidden_ObjectPart = &getResponse_Body_EcInfo{v} +} + +func (x *GetResponse_Body) HasObjectPart() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObjectPart != nil +} + +func (x *GetResponse_Body) HasInit() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_Init_) + return ok +} + +func (x *GetResponse_Body) HasChunk() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_Chunk) + return ok +} + +func (x *GetResponse_Body) HasSplitInfo() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_SplitInfo) + return ok +} + +func (x *GetResponse_Body) HasEcInfo() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_EcInfo) + return ok +} + +func (x *GetResponse_Body) ClearObjectPart() { + x.xxx_hidden_ObjectPart = nil +} + +func (x *GetResponse_Body) ClearInit() { + if _, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_Init_); ok { + x.xxx_hidden_ObjectPart = nil + } +} + +func (x *GetResponse_Body) ClearChunk() { + if _, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_Chunk); ok { + x.xxx_hidden_ObjectPart = nil + } +} + +func (x *GetResponse_Body) ClearSplitInfo() { + if _, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_SplitInfo); ok { + x.xxx_hidden_ObjectPart = nil + } +} + +func (x *GetResponse_Body) ClearEcInfo() { + if _, ok := x.xxx_hidden_ObjectPart.(*getResponse_Body_EcInfo); ok { + x.xxx_hidden_ObjectPart = nil + } +} + +const GetResponse_Body_ObjectPart_not_set_case case_GetResponse_Body_ObjectPart = 0 +const GetResponse_Body_Init_case case_GetResponse_Body_ObjectPart = 1 +const GetResponse_Body_Chunk_case case_GetResponse_Body_ObjectPart = 2 +const GetResponse_Body_SplitInfo_case case_GetResponse_Body_ObjectPart = 3 +const GetResponse_Body_EcInfo_case case_GetResponse_Body_ObjectPart = 4 + +func (x *GetResponse_Body) WhichObjectPart() case_GetResponse_Body_ObjectPart { + if x == nil { + return GetResponse_Body_ObjectPart_not_set_case + } + switch x.xxx_hidden_ObjectPart.(type) { + case *getResponse_Body_Init_: + return GetResponse_Body_Init_case + case *getResponse_Body_Chunk: + return GetResponse_Body_Chunk_case + case *getResponse_Body_SplitInfo: + return GetResponse_Body_SplitInfo_case + case *getResponse_Body_EcInfo: + return GetResponse_Body_EcInfo_case + default: + return GetResponse_Body_ObjectPart_not_set_case + } +} + +type GetResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Single message in the response stream. + + // Fields of oneof xxx_hidden_ObjectPart: + // Initial part of the object stream + Init *GetResponse_Body_Init + // Chunked object payload + Chunk []byte + // Meta information of split hierarchy for object assembly. + SplitInfo *SplitInfo + // Meta information for EC object assembly. + EcInfo *ECInfo + // -- end of xxx_hidden_ObjectPart +} + +func (b0 GetResponse_Body_builder) Build() *GetResponse_Body { + m0 := &GetResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Init != nil { + x.xxx_hidden_ObjectPart = &getResponse_Body_Init_{b.Init} + } + if b.Chunk != nil { + x.xxx_hidden_ObjectPart = &getResponse_Body_Chunk{b.Chunk} + } + if b.SplitInfo != nil { + x.xxx_hidden_ObjectPart = &getResponse_Body_SplitInfo{b.SplitInfo} + } + if b.EcInfo != nil { + x.xxx_hidden_ObjectPart = &getResponse_Body_EcInfo{b.EcInfo} + } + return m0 +} + +type case_GetResponse_Body_ObjectPart protoreflect.FieldNumber + +func (x case_GetResponse_Body_ObjectPart) String() string { + md := file_api_object_grpc_service_proto_msgTypes[21].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isGetResponse_Body_ObjectPart interface { + isGetResponse_Body_ObjectPart() +} + +type getResponse_Body_Init_ struct { + // Initial part of the object stream + Init *GetResponse_Body_Init `protobuf:"bytes,1,opt,name=init,oneof"` +} + +type getResponse_Body_Chunk struct { + // Chunked object payload + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,oneof"` +} + +type getResponse_Body_SplitInfo struct { + // Meta information of split hierarchy for object assembly. + SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,oneof"` +} + +type getResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,4,opt,name=ec_info,json=ecInfo,oneof"` +} + +func (*getResponse_Body_Init_) isGetResponse_Body_ObjectPart() {} + +func (*getResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {} + +func (*getResponse_Body_SplitInfo) isGetResponse_Body_ObjectPart() {} + +func (*getResponse_Body_EcInfo) isGetResponse_Body_ObjectPart() {} + +// Initial part of the `Object` structure stream. Technically it's a +// set of all `Object` structure's fields except `payload`. +type GetResponse_Body_Init struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId" json:"object_id,omitempty"` + xxx_hidden_Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + xxx_hidden_Header *Header `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse_Body_Init) Reset() { + *x = GetResponse_Body_Init{} + mi := &file_api_object_grpc_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse_Body_Init) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse_Body_Init) ProtoMessage() {} + +func (x *GetResponse_Body_Init) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetResponse_Body_Init) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.xxx_hidden_ObjectId + } + return nil +} + +func (x *GetResponse_Body_Init) GetSignature() *grpc1.Signature { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *GetResponse_Body_Init) GetHeader() *Header { + if x != nil { + return x.xxx_hidden_Header + } + return nil +} + +func (x *GetResponse_Body_Init) SetObjectId(v *grpc1.ObjectID) { + x.xxx_hidden_ObjectId = v +} + +func (x *GetResponse_Body_Init) SetSignature(v *grpc1.Signature) { + x.xxx_hidden_Signature = v +} + +func (x *GetResponse_Body_Init) SetHeader(v *Header) { + x.xxx_hidden_Header = v +} + +func (x *GetResponse_Body_Init) HasObjectId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObjectId != nil +} + +func (x *GetResponse_Body_Init) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *GetResponse_Body_Init) HasHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_Header != nil +} + +func (x *GetResponse_Body_Init) ClearObjectId() { + x.xxx_hidden_ObjectId = nil +} + +func (x *GetResponse_Body_Init) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +func (x *GetResponse_Body_Init) ClearHeader() { + x.xxx_hidden_Header = nil +} + +type GetResponse_Body_Init_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object's unique identifier. + ObjectId *grpc1.ObjectID + // Signed `ObjectID` + Signature *grpc1.Signature + // Object metadata headers + Header *Header +} + +func (b0 GetResponse_Body_Init_builder) Build() *GetResponse_Body_Init { + m0 := &GetResponse_Body_Init{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ObjectId = b.ObjectId + x.xxx_hidden_Signature = b.Signature + x.xxx_hidden_Header = b.Header + return m0 +} + +// PUT request body +type PutRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ObjectPart isPutRequest_Body_ObjectPart `protobuf_oneof:"object_part"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest_Body) Reset() { + *x = PutRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body) ProtoMessage() {} + +func (x *PutRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest_Body) GetInit() *PutRequest_Body_Init { + if x != nil { + if x, ok := x.xxx_hidden_ObjectPart.(*putRequest_Body_Init_); ok { + return x.Init + } + } + return nil +} + +func (x *PutRequest_Body) GetChunk() []byte { + if x != nil { + if x, ok := x.xxx_hidden_ObjectPart.(*putRequest_Body_Chunk); ok { + return x.Chunk + } + } + return nil +} + +func (x *PutRequest_Body) SetInit(v *PutRequest_Body_Init) { + if v == nil { + x.xxx_hidden_ObjectPart = nil + return + } + x.xxx_hidden_ObjectPart = &putRequest_Body_Init_{v} +} + +func (x *PutRequest_Body) SetChunk(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_ObjectPart = &putRequest_Body_Chunk{v} +} + +func (x *PutRequest_Body) HasObjectPart() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObjectPart != nil +} + +func (x *PutRequest_Body) HasInit() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_ObjectPart.(*putRequest_Body_Init_) + return ok +} + +func (x *PutRequest_Body) HasChunk() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_ObjectPart.(*putRequest_Body_Chunk) + return ok +} + +func (x *PutRequest_Body) ClearObjectPart() { + x.xxx_hidden_ObjectPart = nil +} + +func (x *PutRequest_Body) ClearInit() { + if _, ok := x.xxx_hidden_ObjectPart.(*putRequest_Body_Init_); ok { + x.xxx_hidden_ObjectPart = nil + } +} + +func (x *PutRequest_Body) ClearChunk() { + if _, ok := x.xxx_hidden_ObjectPart.(*putRequest_Body_Chunk); ok { + x.xxx_hidden_ObjectPart = nil + } +} + +const PutRequest_Body_ObjectPart_not_set_case case_PutRequest_Body_ObjectPart = 0 +const PutRequest_Body_Init_case case_PutRequest_Body_ObjectPart = 1 +const PutRequest_Body_Chunk_case case_PutRequest_Body_ObjectPart = 2 + +func (x *PutRequest_Body) WhichObjectPart() case_PutRequest_Body_ObjectPart { + if x == nil { + return PutRequest_Body_ObjectPart_not_set_case + } + switch x.xxx_hidden_ObjectPart.(type) { + case *putRequest_Body_Init_: + return PutRequest_Body_Init_case + case *putRequest_Body_Chunk: + return PutRequest_Body_Chunk_case + default: + return PutRequest_Body_ObjectPart_not_set_case + } +} + +type PutRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Single message in the request stream. + + // Fields of oneof xxx_hidden_ObjectPart: + // Initial part of the object stream + Init *PutRequest_Body_Init + // Chunked object payload + Chunk []byte + // -- end of xxx_hidden_ObjectPart +} + +func (b0 PutRequest_Body_builder) Build() *PutRequest_Body { + m0 := &PutRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Init != nil { + x.xxx_hidden_ObjectPart = &putRequest_Body_Init_{b.Init} + } + if b.Chunk != nil { + x.xxx_hidden_ObjectPart = &putRequest_Body_Chunk{b.Chunk} + } + return m0 +} + +type case_PutRequest_Body_ObjectPart protoreflect.FieldNumber + +func (x case_PutRequest_Body_ObjectPart) String() string { + md := file_api_object_grpc_service_proto_msgTypes[23].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isPutRequest_Body_ObjectPart interface { + isPutRequest_Body_ObjectPart() +} + +type putRequest_Body_Init_ struct { + // Initial part of the object stream + Init *PutRequest_Body_Init `protobuf:"bytes,1,opt,name=init,oneof"` +} + +type putRequest_Body_Chunk struct { + // Chunked object payload + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,oneof"` +} + +func (*putRequest_Body_Init_) isPutRequest_Body_ObjectPart() {} + +func (*putRequest_Body_Chunk) isPutRequest_Body_ObjectPart() {} + +// Newly created object structure parameters. If some optional parameters +// are not set, they will be calculated by a peer node. +type PutRequest_Body_Init struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId" json:"object_id,omitempty"` + xxx_hidden_Signature *grpc1.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + xxx_hidden_Header *Header `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` + xxx_hidden_CopiesNumber []uint32 `protobuf:"varint,4,rep,packed,name=copies_number,json=copiesNumber" json:"copies_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest_Body_Init) Reset() { + *x = PutRequest_Body_Init{} + mi := &file_api_object_grpc_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest_Body_Init) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest_Body_Init) ProtoMessage() {} + +func (x *PutRequest_Body_Init) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutRequest_Body_Init) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.xxx_hidden_ObjectId + } + return nil +} + +func (x *PutRequest_Body_Init) GetSignature() *grpc1.Signature { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *PutRequest_Body_Init) GetHeader() *Header { + if x != nil { + return x.xxx_hidden_Header + } + return nil +} + +func (x *PutRequest_Body_Init) GetCopiesNumber() []uint32 { + if x != nil { + return x.xxx_hidden_CopiesNumber + } + return nil +} + +func (x *PutRequest_Body_Init) SetObjectId(v *grpc1.ObjectID) { + x.xxx_hidden_ObjectId = v +} + +func (x *PutRequest_Body_Init) SetSignature(v *grpc1.Signature) { + x.xxx_hidden_Signature = v +} + +func (x *PutRequest_Body_Init) SetHeader(v *Header) { + x.xxx_hidden_Header = v +} + +func (x *PutRequest_Body_Init) SetCopiesNumber(v []uint32) { + x.xxx_hidden_CopiesNumber = v +} + +func (x *PutRequest_Body_Init) HasObjectId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObjectId != nil +} + +func (x *PutRequest_Body_Init) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *PutRequest_Body_Init) HasHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_Header != nil +} + +func (x *PutRequest_Body_Init) ClearObjectId() { + x.xxx_hidden_ObjectId = nil +} + +func (x *PutRequest_Body_Init) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +func (x *PutRequest_Body_Init) ClearHeader() { + x.xxx_hidden_Header = nil +} + +type PutRequest_Body_Init_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // ObjectID if available. + ObjectId *grpc1.ObjectID + // Object signature if available + Signature *grpc1.Signature + // Object's Header + Header *Header + // Number of copies of the object to store within the RPC call. By + // default, object is processed according to the container's placement + // policy. Can be one of: + // 1. A single number; applied to the whole request and is treated as + // a minimal number of nodes that must store an object to complete the + // request successfully. + // 2. An ordered array; every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the + // placement vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 +} + +func (b0 PutRequest_Body_Init_builder) Build() *PutRequest_Body_Init { + m0 := &PutRequest_Body_Init{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ObjectId = b.ObjectId + x.xxx_hidden_Signature = b.Signature + x.xxx_hidden_Header = b.Header + x.xxx_hidden_CopiesNumber = b.CopiesNumber + return m0 +} + +// PUT Object response body +type PutResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId" json:"object_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse_Body) Reset() { + *x = PutResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse_Body) ProtoMessage() {} + +func (x *PutResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutResponse_Body) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.xxx_hidden_ObjectId + } + return nil +} + +func (x *PutResponse_Body) SetObjectId(v *grpc1.ObjectID) { + x.xxx_hidden_ObjectId = v +} + +func (x *PutResponse_Body) HasObjectId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObjectId != nil +} + +func (x *PutResponse_Body) ClearObjectId() { + x.xxx_hidden_ObjectId = nil +} + +type PutResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the saved object + ObjectId *grpc1.ObjectID +} + +func (b0 PutResponse_Body_builder) Build() *PutResponse_Body { + m0 := &PutResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ObjectId = b.ObjectId + return m0 +} + +// Object DELETE request body +type DeleteRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest_Body) Reset() { + *x = DeleteRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest_Body) ProtoMessage() {} + +func (x *DeleteRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.xxx_hidden_Address + } + return nil +} + +func (x *DeleteRequest_Body) SetAddress(v *grpc1.Address) { + x.xxx_hidden_Address = v +} + +func (x *DeleteRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.xxx_hidden_Address != nil +} + +func (x *DeleteRequest_Body) ClearAddress() { + x.xxx_hidden_Address = nil +} + +type DeleteRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the object to be deleted + Address *grpc1.Address +} + +func (b0 DeleteRequest_Body_builder) Build() *DeleteRequest_Body { + m0 := &DeleteRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Address = b.Address + return m0 +} + +// Object DELETE Response has an empty body. +type DeleteResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Tombstone *grpc1.Address `protobuf:"bytes,1,opt,name=tombstone" json:"tombstone,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse_Body) Reset() { + *x = DeleteResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse_Body) ProtoMessage() {} + +func (x *DeleteResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *DeleteResponse_Body) GetTombstone() *grpc1.Address { + if x != nil { + return x.xxx_hidden_Tombstone + } + return nil +} + +func (x *DeleteResponse_Body) SetTombstone(v *grpc1.Address) { + x.xxx_hidden_Tombstone = v +} + +func (x *DeleteResponse_Body) HasTombstone() bool { + if x == nil { + return false + } + return x.xxx_hidden_Tombstone != nil +} + +func (x *DeleteResponse_Body) ClearTombstone() { + x.xxx_hidden_Tombstone = nil +} + +type DeleteResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the tombstone created for the deleted object + Tombstone *grpc1.Address +} + +func (b0 DeleteResponse_Body_builder) Build() *DeleteResponse_Body { + m0 := &DeleteResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Tombstone = b.Tombstone + return m0 +} + +// Object HEAD request body +type HeadRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + xxx_hidden_MainOnly bool `protobuf:"varint,2,opt,name=main_only,json=mainOnly" json:"main_only,omitempty"` + xxx_hidden_Raw bool `protobuf:"varint,3,opt,name=raw" json:"raw,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeadRequest_Body) Reset() { + *x = HeadRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeadRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadRequest_Body) ProtoMessage() {} + +func (x *HeadRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeadRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.xxx_hidden_Address + } + return nil +} + +func (x *HeadRequest_Body) GetMainOnly() bool { + if x != nil { + return x.xxx_hidden_MainOnly + } + return false +} + +func (x *HeadRequest_Body) GetRaw() bool { + if x != nil { + return x.xxx_hidden_Raw + } + return false +} + +func (x *HeadRequest_Body) SetAddress(v *grpc1.Address) { + x.xxx_hidden_Address = v +} + +func (x *HeadRequest_Body) SetMainOnly(v bool) { + x.xxx_hidden_MainOnly = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *HeadRequest_Body) SetRaw(v bool) { + x.xxx_hidden_Raw = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *HeadRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.xxx_hidden_Address != nil +} + +func (x *HeadRequest_Body) HasMainOnly() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *HeadRequest_Body) HasRaw() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *HeadRequest_Body) ClearAddress() { + x.xxx_hidden_Address = nil +} + +func (x *HeadRequest_Body) ClearMainOnly() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_MainOnly = false +} + +func (x *HeadRequest_Body) ClearRaw() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Raw = false +} + +type HeadRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the object with the requested Header + Address *grpc1.Address + // Return only minimal header subset + MainOnly *bool + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node + Raw *bool +} + +func (b0 HeadRequest_Body_builder) Build() *HeadRequest_Body { + m0 := &HeadRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Address = b.Address + if b.MainOnly != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_MainOnly = *b.MainOnly + } + if b.Raw != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Raw = *b.Raw + } + return m0 +} + +// Object HEAD response body +type HeadResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Head isHeadResponse_Body_Head `protobuf_oneof:"head"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HeadResponse_Body) Reset() { + *x = HeadResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HeadResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeadResponse_Body) ProtoMessage() {} + +func (x *HeadResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *HeadResponse_Body) GetHeader() *HeaderWithSignature { + if x != nil { + if x, ok := x.xxx_hidden_Head.(*headResponse_Body_Header); ok { + return x.Header + } + } + return nil +} + +func (x *HeadResponse_Body) GetShortHeader() *ShortHeader { + if x != nil { + if x, ok := x.xxx_hidden_Head.(*headResponse_Body_ShortHeader); ok { + return x.ShortHeader + } + } + return nil +} + +func (x *HeadResponse_Body) GetSplitInfo() *SplitInfo { + if x != nil { + if x, ok := x.xxx_hidden_Head.(*headResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + } + return nil +} + +func (x *HeadResponse_Body) GetEcInfo() *ECInfo { + if x != nil { + if x, ok := x.xxx_hidden_Head.(*headResponse_Body_EcInfo); ok { + return x.EcInfo + } + } + return nil +} + +func (x *HeadResponse_Body) SetHeader(v *HeaderWithSignature) { + if v == nil { + x.xxx_hidden_Head = nil + return + } + x.xxx_hidden_Head = &headResponse_Body_Header{v} +} + +func (x *HeadResponse_Body) SetShortHeader(v *ShortHeader) { + if v == nil { + x.xxx_hidden_Head = nil + return + } + x.xxx_hidden_Head = &headResponse_Body_ShortHeader{v} +} + +func (x *HeadResponse_Body) SetSplitInfo(v *SplitInfo) { + if v == nil { + x.xxx_hidden_Head = nil + return + } + x.xxx_hidden_Head = &headResponse_Body_SplitInfo{v} +} + +func (x *HeadResponse_Body) SetEcInfo(v *ECInfo) { + if v == nil { + x.xxx_hidden_Head = nil + return + } + x.xxx_hidden_Head = &headResponse_Body_EcInfo{v} +} + +func (x *HeadResponse_Body) HasHead() bool { + if x == nil { + return false + } + return x.xxx_hidden_Head != nil +} + +func (x *HeadResponse_Body) HasHeader() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Head.(*headResponse_Body_Header) + return ok +} + +func (x *HeadResponse_Body) HasShortHeader() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Head.(*headResponse_Body_ShortHeader) + return ok +} + +func (x *HeadResponse_Body) HasSplitInfo() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Head.(*headResponse_Body_SplitInfo) + return ok +} + +func (x *HeadResponse_Body) HasEcInfo() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Head.(*headResponse_Body_EcInfo) + return ok +} + +func (x *HeadResponse_Body) ClearHead() { + x.xxx_hidden_Head = nil +} + +func (x *HeadResponse_Body) ClearHeader() { + if _, ok := x.xxx_hidden_Head.(*headResponse_Body_Header); ok { + x.xxx_hidden_Head = nil + } +} + +func (x *HeadResponse_Body) ClearShortHeader() { + if _, ok := x.xxx_hidden_Head.(*headResponse_Body_ShortHeader); ok { + x.xxx_hidden_Head = nil + } +} + +func (x *HeadResponse_Body) ClearSplitInfo() { + if _, ok := x.xxx_hidden_Head.(*headResponse_Body_SplitInfo); ok { + x.xxx_hidden_Head = nil + } +} + +func (x *HeadResponse_Body) ClearEcInfo() { + if _, ok := x.xxx_hidden_Head.(*headResponse_Body_EcInfo); ok { + x.xxx_hidden_Head = nil + } +} + +const HeadResponse_Body_Head_not_set_case case_HeadResponse_Body_Head = 0 +const HeadResponse_Body_Header_case case_HeadResponse_Body_Head = 1 +const HeadResponse_Body_ShortHeader_case case_HeadResponse_Body_Head = 2 +const HeadResponse_Body_SplitInfo_case case_HeadResponse_Body_Head = 3 +const HeadResponse_Body_EcInfo_case case_HeadResponse_Body_Head = 4 + +func (x *HeadResponse_Body) WhichHead() case_HeadResponse_Body_Head { + if x == nil { + return HeadResponse_Body_Head_not_set_case + } + switch x.xxx_hidden_Head.(type) { + case *headResponse_Body_Header: + return HeadResponse_Body_Header_case + case *headResponse_Body_ShortHeader: + return HeadResponse_Body_ShortHeader_case + case *headResponse_Body_SplitInfo: + return HeadResponse_Body_SplitInfo_case + case *headResponse_Body_EcInfo: + return HeadResponse_Body_EcInfo_case + default: + return HeadResponse_Body_Head_not_set_case + } +} + +type HeadResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Requested object header, it's part or meta information about split + // object. + + // Fields of oneof xxx_hidden_Head: + // Full object's `Header` with `ObjectID` signature + Header *HeaderWithSignature + // Short object header + ShortHeader *ShortHeader + // Meta information of split hierarchy. + SplitInfo *SplitInfo + // Meta information for EC object assembly. + EcInfo *ECInfo + // -- end of xxx_hidden_Head +} + +func (b0 HeadResponse_Body_builder) Build() *HeadResponse_Body { + m0 := &HeadResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Header != nil { + x.xxx_hidden_Head = &headResponse_Body_Header{b.Header} + } + if b.ShortHeader != nil { + x.xxx_hidden_Head = &headResponse_Body_ShortHeader{b.ShortHeader} + } + if b.SplitInfo != nil { + x.xxx_hidden_Head = &headResponse_Body_SplitInfo{b.SplitInfo} + } + if b.EcInfo != nil { + x.xxx_hidden_Head = &headResponse_Body_EcInfo{b.EcInfo} + } + return m0 +} + +type case_HeadResponse_Body_Head protoreflect.FieldNumber + +func (x case_HeadResponse_Body_Head) String() string { + md := file_api_object_grpc_service_proto_msgTypes[29].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isHeadResponse_Body_Head interface { + isHeadResponse_Body_Head() +} + +type headResponse_Body_Header struct { + // Full object's `Header` with `ObjectID` signature + Header *HeaderWithSignature `protobuf:"bytes,1,opt,name=header,oneof"` +} + +type headResponse_Body_ShortHeader struct { + // Short object header + ShortHeader *ShortHeader `protobuf:"bytes,2,opt,name=short_header,json=shortHeader,oneof"` +} + +type headResponse_Body_SplitInfo struct { + // Meta information of split hierarchy. + SplitInfo *SplitInfo `protobuf:"bytes,3,opt,name=split_info,json=splitInfo,oneof"` +} + +type headResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,4,opt,name=ec_info,json=ecInfo,oneof"` +} + +func (*headResponse_Body_Header) isHeadResponse_Body_Head() {} + +func (*headResponse_Body_ShortHeader) isHeadResponse_Body_Head() {} + +func (*headResponse_Body_SplitInfo) isHeadResponse_Body_Head() {} + +func (*headResponse_Body_EcInfo) isHeadResponse_Body_Head() {} + +// Object Search request body +type SearchRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ContainerId *grpc1.ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId" json:"container_id,omitempty"` + xxx_hidden_Version uint32 `protobuf:"varint,2,opt,name=version" json:"version,omitempty"` + xxx_hidden_Filters *[]*SearchRequest_Body_Filter `protobuf:"bytes,3,rep,name=filters" json:"filters,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchRequest_Body) Reset() { + *x = SearchRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest_Body) ProtoMessage() {} + +func (x *SearchRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchRequest_Body) GetContainerId() *grpc1.ContainerID { + if x != nil { + return x.xxx_hidden_ContainerId + } + return nil +} + +func (x *SearchRequest_Body) GetVersion() uint32 { + if x != nil { + return x.xxx_hidden_Version + } + return 0 +} + +func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter { + if x != nil { + if x.xxx_hidden_Filters != nil { + return *x.xxx_hidden_Filters + } + } + return nil +} + +func (x *SearchRequest_Body) SetContainerId(v *grpc1.ContainerID) { + x.xxx_hidden_ContainerId = v +} + +func (x *SearchRequest_Body) SetVersion(v uint32) { + x.xxx_hidden_Version = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) { + x.xxx_hidden_Filters = &v +} + +func (x *SearchRequest_Body) HasContainerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ContainerId != nil +} + +func (x *SearchRequest_Body) HasVersion() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *SearchRequest_Body) ClearContainerId() { + x.xxx_hidden_ContainerId = nil +} + +func (x *SearchRequest_Body) ClearVersion() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Version = 0 +} + +type SearchRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container identifier were to search + ContainerId *grpc1.ContainerID + // Version of the Query Language used + Version *uint32 + // List of search expressions + Filters []*SearchRequest_Body_Filter +} + +func (b0 SearchRequest_Body_builder) Build() *SearchRequest_Body { + m0 := &SearchRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ContainerId = b.ContainerId + if b.Version != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Version = *b.Version + } + x.xxx_hidden_Filters = &b.Filters + return m0 +} + +// Filter structure checks if the object header field or the attribute +// content matches a value. +// +// If no filters are set, search request will return all objects of the +// container, including Regular object and Tombstone +// objects. Most human users expect to get only object they can directly +// work with. In that case, `$Object:ROOT` filter should be used. +// +// By default `key` field refers to the corresponding object's `Attribute`. +// Some Object's header fields can also be accessed by adding `$Object:` +// prefix to the name. Here is the list of fields available via this prefix: +// +// - $Object:version \ +// version +// - $Object:objectID \ +// object_id +// - $Object:containerID \ +// container_id +// - $Object:ownerID \ +// owner_id +// - $Object:creationEpoch \ +// creation_epoch +// - $Object:payloadLength \ +// payload_length +// - $Object:payloadHash \ +// payload_hash +// - $Object:objectType \ +// object_type +// - $Object:homomorphicHash \ +// homomorphic_hash +// - $Object:split.parent \ +// object_id of parent +// - $Object:split.splitID \ +// 16 byte UUIDv4 used to identify the split object hierarchy parts +// - $Object:ec.parent \ +// If the object is stored according to EC policy, then ec_parent +// attribute is set to return an id list of all related EC chunks. +// +// There are some well-known filter aliases to match objects by certain +// properties: +// +// - $Object:ROOT \ +// Returns only `REGULAR` type objects that are not split or that are the +// top level root objects in a split hierarchy. This includes objects not +// present physically, like large objects split into smaller objects +// without a separate top-level root object. Objects of other types like +// Locks and Tombstones will not be shown. This filter may be +// useful for listing objects like `ls` command of some virtual file +// system. This filter is activated if the `key` exists, disregarding the +// value and matcher type. +// - $Object:PHY \ +// Returns only objects physically stored in the system. This filter is +// activated if the `key` exists, disregarding the value and matcher type. +// +// Note: using filters with a key with prefix `$Object:` and match type +// `NOT_PRESENT `is not recommended since this is not a cross-version +// approach. Behavior when processing this kind of filters is undefined. +type SearchRequest_Body_Filter struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_MatchType MatchType `protobuf:"varint,1,opt,name=match_type,json=matchType,enum=neo.fs.v2.object.MatchType" json:"match_type,omitempty"` + xxx_hidden_Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + xxx_hidden_Value *string `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchRequest_Body_Filter) Reset() { + *x = SearchRequest_Body_Filter{} + mi := &file_api_object_grpc_service_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchRequest_Body_Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest_Body_Filter) ProtoMessage() {} + +func (x *SearchRequest_Body_Filter) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchRequest_Body_Filter) GetMatchType() MatchType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_MatchType + } + } + return MatchType_MATCH_TYPE_UNSPECIFIED +} + +func (x *SearchRequest_Body_Filter) GetKey() string { + if x != nil { + if x.xxx_hidden_Key != nil { + return *x.xxx_hidden_Key + } + return "" + } + return "" +} + +func (x *SearchRequest_Body_Filter) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *SearchRequest_Body_Filter) SetMatchType(v MatchType) { + x.xxx_hidden_MatchType = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *SearchRequest_Body_Filter) SetKey(v string) { + x.xxx_hidden_Key = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *SearchRequest_Body_Filter) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *SearchRequest_Body_Filter) HasMatchType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *SearchRequest_Body_Filter) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *SearchRequest_Body_Filter) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *SearchRequest_Body_Filter) ClearMatchType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_MatchType = MatchType_MATCH_TYPE_UNSPECIFIED +} + +func (x *SearchRequest_Body_Filter) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Key = nil +} + +func (x *SearchRequest_Body_Filter) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Value = nil +} + +type SearchRequest_Body_Filter_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Match type to use + MatchType *MatchType + // Attribute or Header fields to match + Key *string + // Value to match + Value *string +} + +func (b0 SearchRequest_Body_Filter_builder) Build() *SearchRequest_Body_Filter { + m0 := &SearchRequest_Body_Filter{} + b, x := &b0, m0 + _, _ = b, x + if b.MatchType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_MatchType = *b.MatchType + } + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Key = b.Key + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Object Search response body +type SearchResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_IdList *[]*grpc1.ObjectID `protobuf:"bytes,1,rep,name=id_list,json=idList" json:"id_list,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SearchResponse_Body) Reset() { + *x = SearchResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SearchResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchResponse_Body) ProtoMessage() {} + +func (x *SearchResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SearchResponse_Body) GetIdList() []*grpc1.ObjectID { + if x != nil { + if x.xxx_hidden_IdList != nil { + return *x.xxx_hidden_IdList + } + } + return nil +} + +func (x *SearchResponse_Body) SetIdList(v []*grpc1.ObjectID) { + x.xxx_hidden_IdList = &v +} + +type SearchResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // List of `ObjectID`s that match the search query + IdList []*grpc1.ObjectID +} + +func (b0 SearchResponse_Body_builder) Build() *SearchResponse_Body { + m0 := &SearchResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_IdList = &b.IdList + return m0 +} + +// Byte range of object's payload request body +type GetRangeRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + xxx_hidden_Range *Range `protobuf:"bytes,2,opt,name=range" json:"range,omitempty"` + xxx_hidden_Raw bool `protobuf:"varint,3,opt,name=raw" json:"raw,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeRequest_Body) Reset() { + *x = GetRangeRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeRequest_Body) ProtoMessage() {} + +func (x *GetRangeRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.xxx_hidden_Address + } + return nil +} + +func (x *GetRangeRequest_Body) GetRange() *Range { + if x != nil { + return x.xxx_hidden_Range + } + return nil +} + +func (x *GetRangeRequest_Body) GetRaw() bool { + if x != nil { + return x.xxx_hidden_Raw + } + return false +} + +func (x *GetRangeRequest_Body) SetAddress(v *grpc1.Address) { + x.xxx_hidden_Address = v +} + +func (x *GetRangeRequest_Body) SetRange(v *Range) { + x.xxx_hidden_Range = v +} + +func (x *GetRangeRequest_Body) SetRaw(v bool) { + x.xxx_hidden_Raw = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *GetRangeRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.xxx_hidden_Address != nil +} + +func (x *GetRangeRequest_Body) HasRange() bool { + if x == nil { + return false + } + return x.xxx_hidden_Range != nil +} + +func (x *GetRangeRequest_Body) HasRaw() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *GetRangeRequest_Body) ClearAddress() { + x.xxx_hidden_Address = nil +} + +func (x *GetRangeRequest_Body) ClearRange() { + x.xxx_hidden_Range = nil +} + +func (x *GetRangeRequest_Body) ClearRaw() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Raw = false +} + +type GetRangeRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the object containing the requested payload range + Address *grpc1.Address + // Requested payload range + Range *Range + // If `raw` flag is set, request will work only with objects that are + // physically stored on the peer node. + Raw *bool +} + +func (b0 GetRangeRequest_Body_builder) Build() *GetRangeRequest_Body { + m0 := &GetRangeRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Address = b.Address + x.xxx_hidden_Range = b.Range + if b.Raw != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Raw = *b.Raw + } + return m0 +} + +// Get Range response body uses streams to transfer the response. Because +// object payload considered a byte sequence, there is no need to have some +// initial preamble message. The requested byte range is sent as a series +// chunks. +type GetRangeResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_RangePart isGetRangeResponse_Body_RangePart `protobuf_oneof:"range_part"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeResponse_Body) Reset() { + *x = GetRangeResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeResponse_Body) ProtoMessage() {} + +func (x *GetRangeResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeResponse_Body) GetChunk() []byte { + if x != nil { + if x, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_Chunk); ok { + return x.Chunk + } + } + return nil +} + +func (x *GetRangeResponse_Body) GetSplitInfo() *SplitInfo { + if x != nil { + if x, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_SplitInfo); ok { + return x.SplitInfo + } + } + return nil +} + +func (x *GetRangeResponse_Body) GetEcInfo() *ECInfo { + if x != nil { + if x, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_EcInfo); ok { + return x.EcInfo + } + } + return nil +} + +func (x *GetRangeResponse_Body) SetChunk(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_RangePart = &getRangeResponse_Body_Chunk{v} +} + +func (x *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) { + if v == nil { + x.xxx_hidden_RangePart = nil + return + } + x.xxx_hidden_RangePart = &getRangeResponse_Body_SplitInfo{v} +} + +func (x *GetRangeResponse_Body) SetEcInfo(v *ECInfo) { + if v == nil { + x.xxx_hidden_RangePart = nil + return + } + x.xxx_hidden_RangePart = &getRangeResponse_Body_EcInfo{v} +} + +func (x *GetRangeResponse_Body) HasRangePart() bool { + if x == nil { + return false + } + return x.xxx_hidden_RangePart != nil +} + +func (x *GetRangeResponse_Body) HasChunk() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_Chunk) + return ok +} + +func (x *GetRangeResponse_Body) HasSplitInfo() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_SplitInfo) + return ok +} + +func (x *GetRangeResponse_Body) HasEcInfo() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_EcInfo) + return ok +} + +func (x *GetRangeResponse_Body) ClearRangePart() { + x.xxx_hidden_RangePart = nil +} + +func (x *GetRangeResponse_Body) ClearChunk() { + if _, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_Chunk); ok { + x.xxx_hidden_RangePart = nil + } +} + +func (x *GetRangeResponse_Body) ClearSplitInfo() { + if _, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_SplitInfo); ok { + x.xxx_hidden_RangePart = nil + } +} + +func (x *GetRangeResponse_Body) ClearEcInfo() { + if _, ok := x.xxx_hidden_RangePart.(*getRangeResponse_Body_EcInfo); ok { + x.xxx_hidden_RangePart = nil + } +} + +const GetRangeResponse_Body_RangePart_not_set_case case_GetRangeResponse_Body_RangePart = 0 +const GetRangeResponse_Body_Chunk_case case_GetRangeResponse_Body_RangePart = 1 +const GetRangeResponse_Body_SplitInfo_case case_GetRangeResponse_Body_RangePart = 2 +const GetRangeResponse_Body_EcInfo_case case_GetRangeResponse_Body_RangePart = 3 + +func (x *GetRangeResponse_Body) WhichRangePart() case_GetRangeResponse_Body_RangePart { + if x == nil { + return GetRangeResponse_Body_RangePart_not_set_case + } + switch x.xxx_hidden_RangePart.(type) { + case *getRangeResponse_Body_Chunk: + return GetRangeResponse_Body_Chunk_case + case *getRangeResponse_Body_SplitInfo: + return GetRangeResponse_Body_SplitInfo_case + case *getRangeResponse_Body_EcInfo: + return GetRangeResponse_Body_EcInfo_case + default: + return GetRangeResponse_Body_RangePart_not_set_case + } +} + +type GetRangeResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Requested object range or meta information about split object. + + // Fields of oneof xxx_hidden_RangePart: + // Chunked object payload's range. + Chunk []byte + // Meta information of split hierarchy. + SplitInfo *SplitInfo + // Meta information for EC object assembly. + EcInfo *ECInfo + // -- end of xxx_hidden_RangePart +} + +func (b0 GetRangeResponse_Body_builder) Build() *GetRangeResponse_Body { + m0 := &GetRangeResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Chunk != nil { + x.xxx_hidden_RangePart = &getRangeResponse_Body_Chunk{b.Chunk} + } + if b.SplitInfo != nil { + x.xxx_hidden_RangePart = &getRangeResponse_Body_SplitInfo{b.SplitInfo} + } + if b.EcInfo != nil { + x.xxx_hidden_RangePart = &getRangeResponse_Body_EcInfo{b.EcInfo} + } + return m0 +} + +type case_GetRangeResponse_Body_RangePart protoreflect.FieldNumber + +func (x case_GetRangeResponse_Body_RangePart) String() string { + md := file_api_object_grpc_service_proto_msgTypes[34].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isGetRangeResponse_Body_RangePart interface { + isGetRangeResponse_Body_RangePart() +} + +type getRangeResponse_Body_Chunk struct { + // Chunked object payload's range. + Chunk []byte `protobuf:"bytes,1,opt,name=chunk,oneof"` +} + +type getRangeResponse_Body_SplitInfo struct { + // Meta information of split hierarchy. + SplitInfo *SplitInfo `protobuf:"bytes,2,opt,name=split_info,json=splitInfo,oneof"` +} + +type getRangeResponse_Body_EcInfo struct { + // Meta information for EC object assembly. + EcInfo *ECInfo `protobuf:"bytes,3,opt,name=ec_info,json=ecInfo,oneof"` +} + +func (*getRangeResponse_Body_Chunk) isGetRangeResponse_Body_RangePart() {} + +func (*getRangeResponse_Body_SplitInfo) isGetRangeResponse_Body_RangePart() {} + +func (*getRangeResponse_Body_EcInfo) isGetRangeResponse_Body_RangePart() {} + +// Get hash of object's payload part request body. +type GetRangeHashRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + xxx_hidden_Ranges *[]*Range `protobuf:"bytes,2,rep,name=ranges" json:"ranges,omitempty"` + xxx_hidden_Salt []byte `protobuf:"bytes,3,opt,name=salt" json:"salt,omitempty"` + xxx_hidden_Type grpc1.ChecksumType `protobuf:"varint,4,opt,name=type,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeHashRequest_Body) Reset() { + *x = GetRangeHashRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeHashRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashRequest_Body) ProtoMessage() {} + +func (x *GetRangeHashRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeHashRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.xxx_hidden_Address + } + return nil +} + +func (x *GetRangeHashRequest_Body) GetRanges() []*Range { + if x != nil { + if x.xxx_hidden_Ranges != nil { + return *x.xxx_hidden_Ranges + } + } + return nil +} + +func (x *GetRangeHashRequest_Body) GetSalt() []byte { + if x != nil { + return x.xxx_hidden_Salt + } + return nil +} + +func (x *GetRangeHashRequest_Body) GetType() grpc1.ChecksumType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 3) { + return x.xxx_hidden_Type + } + } + return grpc1.ChecksumType(0) +} + +func (x *GetRangeHashRequest_Body) SetAddress(v *grpc1.Address) { + x.xxx_hidden_Address = v +} + +func (x *GetRangeHashRequest_Body) SetRanges(v []*Range) { + x.xxx_hidden_Ranges = &v +} + +func (x *GetRangeHashRequest_Body) SetSalt(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Salt = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *GetRangeHashRequest_Body) SetType(v grpc1.ChecksumType) { + x.xxx_hidden_Type = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *GetRangeHashRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.xxx_hidden_Address != nil +} + +func (x *GetRangeHashRequest_Body) HasSalt() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *GetRangeHashRequest_Body) HasType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *GetRangeHashRequest_Body) ClearAddress() { + x.xxx_hidden_Address = nil +} + +func (x *GetRangeHashRequest_Body) ClearSalt() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Salt = nil +} + +func (x *GetRangeHashRequest_Body) ClearType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Type = grpc1.ChecksumType_CHECKSUM_TYPE_UNSPECIFIED +} + +type GetRangeHashRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Address of the object that containing the requested payload range + Address *grpc1.Address + // List of object's payload ranges to calculate homomorphic hash + Ranges []*Range + // Binary salt to XOR object's payload ranges before hash calculation + Salt []byte + // Checksum algorithm type + Type *grpc1.ChecksumType +} + +func (b0 GetRangeHashRequest_Body_builder) Build() *GetRangeHashRequest_Body { + m0 := &GetRangeHashRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Address = b.Address + x.xxx_hidden_Ranges = &b.Ranges + if b.Salt != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_Salt = b.Salt + } + if b.Type != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Type = *b.Type + } + return m0 +} + +// Get hash of object's payload part response body. +type GetRangeHashResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Type grpc1.ChecksumType `protobuf:"varint,1,opt,name=type,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + xxx_hidden_HashList [][]byte `protobuf:"bytes,2,rep,name=hash_list,json=hashList" json:"hash_list,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRangeHashResponse_Body) Reset() { + *x = GetRangeHashResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRangeHashResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRangeHashResponse_Body) ProtoMessage() {} + +func (x *GetRangeHashResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GetRangeHashResponse_Body) GetType() grpc1.ChecksumType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_Type + } + } + return grpc1.ChecksumType(0) +} + +func (x *GetRangeHashResponse_Body) GetHashList() [][]byte { + if x != nil { + return x.xxx_hidden_HashList + } + return nil +} + +func (x *GetRangeHashResponse_Body) SetType(v grpc1.ChecksumType) { + x.xxx_hidden_Type = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *GetRangeHashResponse_Body) SetHashList(v [][]byte) { + x.xxx_hidden_HashList = v +} + +func (x *GetRangeHashResponse_Body) HasType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *GetRangeHashResponse_Body) ClearType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Type = grpc1.ChecksumType_CHECKSUM_TYPE_UNSPECIFIED +} + +type GetRangeHashResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Checksum algorithm type + Type *grpc1.ChecksumType + // List of range hashes in a binary format + HashList [][]byte +} + +func (b0 GetRangeHashResponse_Body_builder) Build() *GetRangeHashResponse_Body { + m0 := &GetRangeHashResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Type != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Type = *b.Type + } + x.xxx_hidden_HashList = b.HashList + return m0 +} + +// PUT Single request body +type PutSingleRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Object *Object `protobuf:"bytes,1,opt,name=object" json:"object,omitempty"` + xxx_hidden_CopiesNumber []uint32 `protobuf:"varint,2,rep,packed,name=copies_number,json=copiesNumber" json:"copies_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutSingleRequest_Body) Reset() { + *x = PutSingleRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutSingleRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleRequest_Body) ProtoMessage() {} + +func (x *PutSingleRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PutSingleRequest_Body) GetObject() *Object { + if x != nil { + return x.xxx_hidden_Object + } + return nil +} + +func (x *PutSingleRequest_Body) GetCopiesNumber() []uint32 { + if x != nil { + return x.xxx_hidden_CopiesNumber + } + return nil +} + +func (x *PutSingleRequest_Body) SetObject(v *Object) { + x.xxx_hidden_Object = v +} + +func (x *PutSingleRequest_Body) SetCopiesNumber(v []uint32) { + x.xxx_hidden_CopiesNumber = v +} + +func (x *PutSingleRequest_Body) HasObject() bool { + if x == nil { + return false + } + return x.xxx_hidden_Object != nil +} + +func (x *PutSingleRequest_Body) ClearObject() { + x.xxx_hidden_Object = nil +} + +type PutSingleRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Prepared object with payload. + Object *Object + // Number of copies of the object to store within the RPC call. By default, + // object is processed according to the container's placement policy. + // Every number is treated as a minimal number of + // nodes in a corresponding placement vector that must store an object + // to complete the request successfully. The length MUST equal the placement + // vectors number, otherwise request is considered malformed. + CopiesNumber []uint32 +} + +func (b0 PutSingleRequest_Body_builder) Build() *PutSingleRequest_Body { + m0 := &PutSingleRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Object = b.Object + x.xxx_hidden_CopiesNumber = b.CopiesNumber + return m0 +} + +// PUT Single Object response body +type PutSingleResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutSingleResponse_Body) Reset() { + *x = PutSingleResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutSingleResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutSingleResponse_Body) ProtoMessage() {} + +func (x *PutSingleResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type PutSingleResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 PutSingleResponse_Body_builder) Build() *PutSingleResponse_Body { + m0 := &PutSingleResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +// PATCH request body +type PatchRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Address *grpc1.Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + xxx_hidden_NewAttributes *[]*Header_Attribute `protobuf:"bytes,2,rep,name=new_attributes,json=newAttributes" json:"new_attributes,omitempty"` + xxx_hidden_ReplaceAttributes bool `protobuf:"varint,3,opt,name=replace_attributes,json=replaceAttributes" json:"replace_attributes,omitempty"` + xxx_hidden_NewSplitHeader *Header_Split `protobuf:"bytes,5,opt,name=new_split_header,json=newSplitHeader" json:"new_split_header,omitempty"` + xxx_hidden_Patch *PatchRequest_Body_Patch `protobuf:"bytes,4,opt,name=patch" json:"patch,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchRequest_Body) Reset() { + *x = PatchRequest_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest_Body) ProtoMessage() {} + +func (x *PatchRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchRequest_Body) GetAddress() *grpc1.Address { + if x != nil { + return x.xxx_hidden_Address + } + return nil +} + +func (x *PatchRequest_Body) GetNewAttributes() []*Header_Attribute { + if x != nil { + if x.xxx_hidden_NewAttributes != nil { + return *x.xxx_hidden_NewAttributes + } + } + return nil +} + +func (x *PatchRequest_Body) GetReplaceAttributes() bool { + if x != nil { + return x.xxx_hidden_ReplaceAttributes + } + return false +} + +func (x *PatchRequest_Body) GetNewSplitHeader() *Header_Split { + if x != nil { + return x.xxx_hidden_NewSplitHeader + } + return nil +} + +func (x *PatchRequest_Body) GetPatch() *PatchRequest_Body_Patch { + if x != nil { + return x.xxx_hidden_Patch + } + return nil +} + +func (x *PatchRequest_Body) SetAddress(v *grpc1.Address) { + x.xxx_hidden_Address = v +} + +func (x *PatchRequest_Body) SetNewAttributes(v []*Header_Attribute) { + x.xxx_hidden_NewAttributes = &v +} + +func (x *PatchRequest_Body) SetReplaceAttributes(v bool) { + x.xxx_hidden_ReplaceAttributes = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 5) +} + +func (x *PatchRequest_Body) SetNewSplitHeader(v *Header_Split) { + x.xxx_hidden_NewSplitHeader = v +} + +func (x *PatchRequest_Body) SetPatch(v *PatchRequest_Body_Patch) { + x.xxx_hidden_Patch = v +} + +func (x *PatchRequest_Body) HasAddress() bool { + if x == nil { + return false + } + return x.xxx_hidden_Address != nil +} + +func (x *PatchRequest_Body) HasReplaceAttributes() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *PatchRequest_Body) HasNewSplitHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_NewSplitHeader != nil +} + +func (x *PatchRequest_Body) HasPatch() bool { + if x == nil { + return false + } + return x.xxx_hidden_Patch != nil +} + +func (x *PatchRequest_Body) ClearAddress() { + x.xxx_hidden_Address = nil +} + +func (x *PatchRequest_Body) ClearReplaceAttributes() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_ReplaceAttributes = false +} + +func (x *PatchRequest_Body) ClearNewSplitHeader() { + x.xxx_hidden_NewSplitHeader = nil +} + +func (x *PatchRequest_Body) ClearPatch() { + x.xxx_hidden_Patch = nil +} + +type PatchRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The address of the object that is requested to get patched. + Address *grpc1.Address + // New attributes for the object. See `replace_attributes` flag usage to + // define how new attributes should be set. + NewAttributes []*Header_Attribute + // If this flag is set, then the object's attributes will be entirely + // replaced by `new_attributes` list. The empty `new_attributes` list with + // `replace_attributes = true` just resets attributes list for the object. + // + // Default `false` value for this flag means the attributes will be just + // merged. If the incoming `new_attributes` list contains already existing + // key, then it just replaces it while merging the lists. + ReplaceAttributes *bool + // New split header for the object. This defines how the object will relate + // to other objects in a split operation. + NewSplitHeader *Header_Split + // The patch that is applied for the object. + Patch *PatchRequest_Body_Patch +} + +func (b0 PatchRequest_Body_builder) Build() *PatchRequest_Body { + m0 := &PatchRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Address = b.Address + x.xxx_hidden_NewAttributes = &b.NewAttributes + if b.ReplaceAttributes != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 5) + x.xxx_hidden_ReplaceAttributes = *b.ReplaceAttributes + } + x.xxx_hidden_NewSplitHeader = b.NewSplitHeader + x.xxx_hidden_Patch = b.Patch + return m0 +} + +// The patch for the object's payload. +type PatchRequest_Body_Patch struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_SourceRange *Range `protobuf:"bytes,1,opt,name=source_range,json=sourceRange" json:"source_range,omitempty"` + xxx_hidden_Chunk []byte `protobuf:"bytes,2,opt,name=chunk" json:"chunk,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchRequest_Body_Patch) Reset() { + *x = PatchRequest_Body_Patch{} + mi := &file_api_object_grpc_service_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchRequest_Body_Patch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchRequest_Body_Patch) ProtoMessage() {} + +func (x *PatchRequest_Body_Patch) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchRequest_Body_Patch) GetSourceRange() *Range { + if x != nil { + return x.xxx_hidden_SourceRange + } + return nil +} + +func (x *PatchRequest_Body_Patch) GetChunk() []byte { + if x != nil { + return x.xxx_hidden_Chunk + } + return nil +} + +func (x *PatchRequest_Body_Patch) SetSourceRange(v *Range) { + x.xxx_hidden_SourceRange = v +} + +func (x *PatchRequest_Body_Patch) SetChunk(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Chunk = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *PatchRequest_Body_Patch) HasSourceRange() bool { + if x == nil { + return false + } + return x.xxx_hidden_SourceRange != nil +} + +func (x *PatchRequest_Body_Patch) HasChunk() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *PatchRequest_Body_Patch) ClearSourceRange() { + x.xxx_hidden_SourceRange = nil +} + +func (x *PatchRequest_Body_Patch) ClearChunk() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Chunk = nil +} + +type PatchRequest_Body_Patch_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The range of the source object for which the payload is replaced by the + // patch's chunk. If the range's `length = 0`, then the patch's chunk is + // just appended to the original payload starting from the `offest` + // without any replace. + SourceRange *Range + // The chunk that is being appended to or that replaces the original + // payload on the given range. + Chunk []byte +} + +func (b0 PatchRequest_Body_Patch_builder) Build() *PatchRequest_Body_Patch { + m0 := &PatchRequest_Body_Patch{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_SourceRange = b.SourceRange + if b.Chunk != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Chunk = b.Chunk + } + return m0 +} + +// PATCH response body +type PatchResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ObjectId *grpc1.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectId" json:"object_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PatchResponse_Body) Reset() { + *x = PatchResponse_Body{} + mi := &file_api_object_grpc_service_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PatchResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatchResponse_Body) ProtoMessage() {} + +func (x *PatchResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_service_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *PatchResponse_Body) GetObjectId() *grpc1.ObjectID { + if x != nil { + return x.xxx_hidden_ObjectId + } + return nil +} + +func (x *PatchResponse_Body) SetObjectId(v *grpc1.ObjectID) { + x.xxx_hidden_ObjectId = v +} + +func (x *PatchResponse_Body) HasObjectId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObjectId != nil +} + +func (x *PatchResponse_Body) ClearObjectId() { + x.xxx_hidden_ObjectId = nil +} + +type PatchResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The object ID of the saved patched object. + ObjectId *grpc1.ObjectID +} + +func (b0 PatchResponse_Body_builder) Build() *PatchResponse_Body { + m0 := &PatchResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ObjectId = b.ObjectId + return m0 +} + +var File_api_object_grpc_service_proto protoreflect.FileDescriptor + +var file_api_object_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaa, 0x02, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x4b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x03, 0x72, 0x61, 0x77, 0x22, 0xee, 0x04, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, + 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x8a, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x79, 0x12, 0x3d, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, + 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, + 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, + 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, + 0x6f, 0x48, 0x00, 0x52, 0x06, 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0xa8, 0x01, 0x0a, 0x04, + 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, + 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x70, 0x61, 0x72, 0x74, 0x22, 0x9b, 0x04, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0xbb, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3c, + 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, + 0x49, 0x6e, 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x05, + 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, + 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0xcd, 0x01, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x35, 0x0a, + 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, + 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, + 0x61, 0x72, 0x74, 0x22, 0xa0, 0x02, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x9e, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x04, + 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, + 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x1a, 0x3d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x74, 0x6f, 0x6d, + 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, + 0x22, 0xc9, 0x02, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x36, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, + 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0x80, 0x01, 0x0a, + 0x13, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, + 0xec, 0x03, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x86, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3f, + 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x42, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, + 0x65, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x22, 0xfb, + 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x95, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3e, 0x0a, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6c, + 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa2, 0x02, 0x0a, + 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x39, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, + 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x06, 0x69, 0x64, 0x4c, 0x69, 0x73, + 0x74, 0x22, 0x37, 0x0a, 0x05, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe3, 0x02, 0x0a, 0x0f, 0x47, + 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, + 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x1a, 0x7a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x2d, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x72, 0x61, 0x77, + 0x22, 0x8d, 0x03, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x9f, + 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x12, + 0x3c, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x48, 0x00, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, + 0x07, 0x65, 0x63, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x06, 0x65, 0x63, 0x49, 0x6e, + 0x66, 0x6f, 0x42, 0x0c, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, + 0x22, 0xa2, 0x03, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, + 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x1a, 0xb0, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, + 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, + 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, + 0x61, 0x6c, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xca, 0x02, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x55, 0x0a, 0x04, 0x42, + 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6c, 0x69, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x4c, 0x69, + 0x73, 0x74, 0x22, 0xc8, 0x02, 0x0a, 0x10, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x5d, + 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x70, 0x69, + 0x65, 0x73, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x0c, 0x63, 0x6f, 0x70, 0x69, 0x65, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xf5, 0x01, + 0x0a, 0x11, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xfd, 0x04, 0x0a, 0x0c, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, + 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x99, 0x03, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x0e, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x52, 0x0d, 0x6e, 0x65, 0x77, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x72, 0x65, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x48, 0x0a, 0x10, 0x6e, 0x65, 0x77, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x0e, 0x6e, 0x65, 0x77, 0x53, 0x70, + 0x6c, 0x69, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x05, 0x70, 0x61, 0x74, + 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x50, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x59, 0x0a, 0x05, 0x50, 0x61, + 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x72, 0x61, + 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, + 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xa4, 0x02, 0x0a, 0x0d, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3d, 0x0a, + 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x32, 0xd4, 0x05, 0x0a, + 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, + 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, + 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x4b, 0x0a, 0x06, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, + 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, + 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x53, 0x0a, + 0x08, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x30, 0x01, 0x12, 0x5d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, + 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x65, 0x74, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x54, 0x0a, 0x09, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x22, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x63, 0x68, + 0x12, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x28, 0x01, 0x42, 0x62, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_object_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 42) +var file_api_object_grpc_service_proto_goTypes = []any{ + (*GetRequest)(nil), // 0: neo.fs.v2.object.GetRequest + (*GetResponse)(nil), // 1: neo.fs.v2.object.GetResponse + (*PutRequest)(nil), // 2: neo.fs.v2.object.PutRequest + (*PutResponse)(nil), // 3: neo.fs.v2.object.PutResponse + (*DeleteRequest)(nil), // 4: neo.fs.v2.object.DeleteRequest + (*DeleteResponse)(nil), // 5: neo.fs.v2.object.DeleteResponse + (*HeadRequest)(nil), // 6: neo.fs.v2.object.HeadRequest + (*HeaderWithSignature)(nil), // 7: neo.fs.v2.object.HeaderWithSignature + (*HeadResponse)(nil), // 8: neo.fs.v2.object.HeadResponse + (*SearchRequest)(nil), // 9: neo.fs.v2.object.SearchRequest + (*SearchResponse)(nil), // 10: neo.fs.v2.object.SearchResponse + (*Range)(nil), // 11: neo.fs.v2.object.Range + (*GetRangeRequest)(nil), // 12: neo.fs.v2.object.GetRangeRequest + (*GetRangeResponse)(nil), // 13: neo.fs.v2.object.GetRangeResponse + (*GetRangeHashRequest)(nil), // 14: neo.fs.v2.object.GetRangeHashRequest + (*GetRangeHashResponse)(nil), // 15: neo.fs.v2.object.GetRangeHashResponse + (*PutSingleRequest)(nil), // 16: neo.fs.v2.object.PutSingleRequest + (*PutSingleResponse)(nil), // 17: neo.fs.v2.object.PutSingleResponse + (*PatchRequest)(nil), // 18: neo.fs.v2.object.PatchRequest + (*PatchResponse)(nil), // 19: neo.fs.v2.object.PatchResponse + (*GetRequest_Body)(nil), // 20: neo.fs.v2.object.GetRequest.Body + (*GetResponse_Body)(nil), // 21: neo.fs.v2.object.GetResponse.Body + (*GetResponse_Body_Init)(nil), // 22: neo.fs.v2.object.GetResponse.Body.Init + (*PutRequest_Body)(nil), // 23: neo.fs.v2.object.PutRequest.Body + (*PutRequest_Body_Init)(nil), // 24: neo.fs.v2.object.PutRequest.Body.Init + (*PutResponse_Body)(nil), // 25: neo.fs.v2.object.PutResponse.Body + (*DeleteRequest_Body)(nil), // 26: neo.fs.v2.object.DeleteRequest.Body + (*DeleteResponse_Body)(nil), // 27: neo.fs.v2.object.DeleteResponse.Body + (*HeadRequest_Body)(nil), // 28: neo.fs.v2.object.HeadRequest.Body + (*HeadResponse_Body)(nil), // 29: neo.fs.v2.object.HeadResponse.Body + (*SearchRequest_Body)(nil), // 30: neo.fs.v2.object.SearchRequest.Body + (*SearchRequest_Body_Filter)(nil), // 31: neo.fs.v2.object.SearchRequest.Body.Filter + (*SearchResponse_Body)(nil), // 32: neo.fs.v2.object.SearchResponse.Body + (*GetRangeRequest_Body)(nil), // 33: neo.fs.v2.object.GetRangeRequest.Body + (*GetRangeResponse_Body)(nil), // 34: neo.fs.v2.object.GetRangeResponse.Body + (*GetRangeHashRequest_Body)(nil), // 35: neo.fs.v2.object.GetRangeHashRequest.Body + (*GetRangeHashResponse_Body)(nil), // 36: neo.fs.v2.object.GetRangeHashResponse.Body + (*PutSingleRequest_Body)(nil), // 37: neo.fs.v2.object.PutSingleRequest.Body + (*PutSingleResponse_Body)(nil), // 38: neo.fs.v2.object.PutSingleResponse.Body + (*PatchRequest_Body)(nil), // 39: neo.fs.v2.object.PatchRequest.Body + (*PatchRequest_Body_Patch)(nil), // 40: neo.fs.v2.object.PatchRequest.Body.Patch + (*PatchResponse_Body)(nil), // 41: neo.fs.v2.object.PatchResponse.Body + (*grpc.RequestMetaHeader)(nil), // 42: neo.fs.v2.session.RequestMetaHeader + (*grpc.RequestVerificationHeader)(nil), // 43: neo.fs.v2.session.RequestVerificationHeader + (*grpc.ResponseMetaHeader)(nil), // 44: neo.fs.v2.session.ResponseMetaHeader + (*grpc.ResponseVerificationHeader)(nil), // 45: neo.fs.v2.session.ResponseVerificationHeader + (*Header)(nil), // 46: neo.fs.v2.object.Header + (*grpc1.Signature)(nil), // 47: neo.fs.v2.refs.Signature + (*grpc1.Address)(nil), // 48: neo.fs.v2.refs.Address + (*SplitInfo)(nil), // 49: neo.fs.v2.object.SplitInfo + (*ECInfo)(nil), // 50: neo.fs.v2.object.ECInfo + (*grpc1.ObjectID)(nil), // 51: neo.fs.v2.refs.ObjectID + (*ShortHeader)(nil), // 52: neo.fs.v2.object.ShortHeader + (*grpc1.ContainerID)(nil), // 53: neo.fs.v2.refs.ContainerID + (MatchType)(0), // 54: neo.fs.v2.object.MatchType + (grpc1.ChecksumType)(0), // 55: neo.fs.v2.refs.ChecksumType + (*Object)(nil), // 56: neo.fs.v2.object.Object + (*Header_Attribute)(nil), // 57: neo.fs.v2.object.Header.Attribute + (*Header_Split)(nil), // 58: neo.fs.v2.object.Header.Split +} +var file_api_object_grpc_service_proto_depIdxs = []int32{ + 20, // 0: neo.fs.v2.object.GetRequest.body:type_name -> neo.fs.v2.object.GetRequest.Body + 42, // 1: neo.fs.v2.object.GetRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 2: neo.fs.v2.object.GetRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 21, // 3: neo.fs.v2.object.GetResponse.body:type_name -> neo.fs.v2.object.GetResponse.Body + 44, // 4: neo.fs.v2.object.GetResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 5: neo.fs.v2.object.GetResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 23, // 6: neo.fs.v2.object.PutRequest.body:type_name -> neo.fs.v2.object.PutRequest.Body + 42, // 7: neo.fs.v2.object.PutRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 8: neo.fs.v2.object.PutRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 25, // 9: neo.fs.v2.object.PutResponse.body:type_name -> neo.fs.v2.object.PutResponse.Body + 44, // 10: neo.fs.v2.object.PutResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 11: neo.fs.v2.object.PutResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 26, // 12: neo.fs.v2.object.DeleteRequest.body:type_name -> neo.fs.v2.object.DeleteRequest.Body + 42, // 13: neo.fs.v2.object.DeleteRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 14: neo.fs.v2.object.DeleteRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 27, // 15: neo.fs.v2.object.DeleteResponse.body:type_name -> neo.fs.v2.object.DeleteResponse.Body + 44, // 16: neo.fs.v2.object.DeleteResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 17: neo.fs.v2.object.DeleteResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 28, // 18: neo.fs.v2.object.HeadRequest.body:type_name -> neo.fs.v2.object.HeadRequest.Body + 42, // 19: neo.fs.v2.object.HeadRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 20: neo.fs.v2.object.HeadRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 46, // 21: neo.fs.v2.object.HeaderWithSignature.header:type_name -> neo.fs.v2.object.Header + 47, // 22: neo.fs.v2.object.HeaderWithSignature.signature:type_name -> neo.fs.v2.refs.Signature + 29, // 23: neo.fs.v2.object.HeadResponse.body:type_name -> neo.fs.v2.object.HeadResponse.Body + 44, // 24: neo.fs.v2.object.HeadResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 25: neo.fs.v2.object.HeadResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 30, // 26: neo.fs.v2.object.SearchRequest.body:type_name -> neo.fs.v2.object.SearchRequest.Body + 42, // 27: neo.fs.v2.object.SearchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 28: neo.fs.v2.object.SearchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 32, // 29: neo.fs.v2.object.SearchResponse.body:type_name -> neo.fs.v2.object.SearchResponse.Body + 44, // 30: neo.fs.v2.object.SearchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 31: neo.fs.v2.object.SearchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 33, // 32: neo.fs.v2.object.GetRangeRequest.body:type_name -> neo.fs.v2.object.GetRangeRequest.Body + 42, // 33: neo.fs.v2.object.GetRangeRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 34: neo.fs.v2.object.GetRangeRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 34, // 35: neo.fs.v2.object.GetRangeResponse.body:type_name -> neo.fs.v2.object.GetRangeResponse.Body + 44, // 36: neo.fs.v2.object.GetRangeResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 37: neo.fs.v2.object.GetRangeResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 35, // 38: neo.fs.v2.object.GetRangeHashRequest.body:type_name -> neo.fs.v2.object.GetRangeHashRequest.Body + 42, // 39: neo.fs.v2.object.GetRangeHashRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 40: neo.fs.v2.object.GetRangeHashRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 36, // 41: neo.fs.v2.object.GetRangeHashResponse.body:type_name -> neo.fs.v2.object.GetRangeHashResponse.Body + 44, // 42: neo.fs.v2.object.GetRangeHashResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 43: neo.fs.v2.object.GetRangeHashResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 37, // 44: neo.fs.v2.object.PutSingleRequest.body:type_name -> neo.fs.v2.object.PutSingleRequest.Body + 42, // 45: neo.fs.v2.object.PutSingleRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 46: neo.fs.v2.object.PutSingleRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 38, // 47: neo.fs.v2.object.PutSingleResponse.body:type_name -> neo.fs.v2.object.PutSingleResponse.Body + 44, // 48: neo.fs.v2.object.PutSingleResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 49: neo.fs.v2.object.PutSingleResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 39, // 50: neo.fs.v2.object.PatchRequest.body:type_name -> neo.fs.v2.object.PatchRequest.Body + 42, // 51: neo.fs.v2.object.PatchRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 43, // 52: neo.fs.v2.object.PatchRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 41, // 53: neo.fs.v2.object.PatchResponse.body:type_name -> neo.fs.v2.object.PatchResponse.Body + 44, // 54: neo.fs.v2.object.PatchResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 45, // 55: neo.fs.v2.object.PatchResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 48, // 56: neo.fs.v2.object.GetRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 22, // 57: neo.fs.v2.object.GetResponse.Body.init:type_name -> neo.fs.v2.object.GetResponse.Body.Init + 49, // 58: neo.fs.v2.object.GetResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 59: neo.fs.v2.object.GetResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 51, // 60: neo.fs.v2.object.GetResponse.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 47, // 61: neo.fs.v2.object.GetResponse.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 46, // 62: neo.fs.v2.object.GetResponse.Body.Init.header:type_name -> neo.fs.v2.object.Header + 24, // 63: neo.fs.v2.object.PutRequest.Body.init:type_name -> neo.fs.v2.object.PutRequest.Body.Init + 51, // 64: neo.fs.v2.object.PutRequest.Body.Init.object_id:type_name -> neo.fs.v2.refs.ObjectID + 47, // 65: neo.fs.v2.object.PutRequest.Body.Init.signature:type_name -> neo.fs.v2.refs.Signature + 46, // 66: neo.fs.v2.object.PutRequest.Body.Init.header:type_name -> neo.fs.v2.object.Header + 51, // 67: neo.fs.v2.object.PutResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 48, // 68: neo.fs.v2.object.DeleteRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 48, // 69: neo.fs.v2.object.DeleteResponse.Body.tombstone:type_name -> neo.fs.v2.refs.Address + 48, // 70: neo.fs.v2.object.HeadRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 7, // 71: neo.fs.v2.object.HeadResponse.Body.header:type_name -> neo.fs.v2.object.HeaderWithSignature + 52, // 72: neo.fs.v2.object.HeadResponse.Body.short_header:type_name -> neo.fs.v2.object.ShortHeader + 49, // 73: neo.fs.v2.object.HeadResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 74: neo.fs.v2.object.HeadResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 53, // 75: neo.fs.v2.object.SearchRequest.Body.container_id:type_name -> neo.fs.v2.refs.ContainerID + 31, // 76: neo.fs.v2.object.SearchRequest.Body.filters:type_name -> neo.fs.v2.object.SearchRequest.Body.Filter + 54, // 77: neo.fs.v2.object.SearchRequest.Body.Filter.match_type:type_name -> neo.fs.v2.object.MatchType + 51, // 78: neo.fs.v2.object.SearchResponse.Body.id_list:type_name -> neo.fs.v2.refs.ObjectID + 48, // 79: neo.fs.v2.object.GetRangeRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 80: neo.fs.v2.object.GetRangeRequest.Body.range:type_name -> neo.fs.v2.object.Range + 49, // 81: neo.fs.v2.object.GetRangeResponse.Body.split_info:type_name -> neo.fs.v2.object.SplitInfo + 50, // 82: neo.fs.v2.object.GetRangeResponse.Body.ec_info:type_name -> neo.fs.v2.object.ECInfo + 48, // 83: neo.fs.v2.object.GetRangeHashRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 11, // 84: neo.fs.v2.object.GetRangeHashRequest.Body.ranges:type_name -> neo.fs.v2.object.Range + 55, // 85: neo.fs.v2.object.GetRangeHashRequest.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 55, // 86: neo.fs.v2.object.GetRangeHashResponse.Body.type:type_name -> neo.fs.v2.refs.ChecksumType + 56, // 87: neo.fs.v2.object.PutSingleRequest.Body.object:type_name -> neo.fs.v2.object.Object + 48, // 88: neo.fs.v2.object.PatchRequest.Body.address:type_name -> neo.fs.v2.refs.Address + 57, // 89: neo.fs.v2.object.PatchRequest.Body.new_attributes:type_name -> neo.fs.v2.object.Header.Attribute + 58, // 90: neo.fs.v2.object.PatchRequest.Body.new_split_header:type_name -> neo.fs.v2.object.Header.Split + 40, // 91: neo.fs.v2.object.PatchRequest.Body.patch:type_name -> neo.fs.v2.object.PatchRequest.Body.Patch + 11, // 92: neo.fs.v2.object.PatchRequest.Body.Patch.source_range:type_name -> neo.fs.v2.object.Range + 51, // 93: neo.fs.v2.object.PatchResponse.Body.object_id:type_name -> neo.fs.v2.refs.ObjectID + 0, // 94: neo.fs.v2.object.ObjectService.Get:input_type -> neo.fs.v2.object.GetRequest + 2, // 95: neo.fs.v2.object.ObjectService.Put:input_type -> neo.fs.v2.object.PutRequest + 4, // 96: neo.fs.v2.object.ObjectService.Delete:input_type -> neo.fs.v2.object.DeleteRequest + 6, // 97: neo.fs.v2.object.ObjectService.Head:input_type -> neo.fs.v2.object.HeadRequest + 9, // 98: neo.fs.v2.object.ObjectService.Search:input_type -> neo.fs.v2.object.SearchRequest + 12, // 99: neo.fs.v2.object.ObjectService.GetRange:input_type -> neo.fs.v2.object.GetRangeRequest + 14, // 100: neo.fs.v2.object.ObjectService.GetRangeHash:input_type -> neo.fs.v2.object.GetRangeHashRequest + 16, // 101: neo.fs.v2.object.ObjectService.PutSingle:input_type -> neo.fs.v2.object.PutSingleRequest + 18, // 102: neo.fs.v2.object.ObjectService.Patch:input_type -> neo.fs.v2.object.PatchRequest + 1, // 103: neo.fs.v2.object.ObjectService.Get:output_type -> neo.fs.v2.object.GetResponse + 3, // 104: neo.fs.v2.object.ObjectService.Put:output_type -> neo.fs.v2.object.PutResponse + 5, // 105: neo.fs.v2.object.ObjectService.Delete:output_type -> neo.fs.v2.object.DeleteResponse + 8, // 106: neo.fs.v2.object.ObjectService.Head:output_type -> neo.fs.v2.object.HeadResponse + 10, // 107: neo.fs.v2.object.ObjectService.Search:output_type -> neo.fs.v2.object.SearchResponse + 13, // 108: neo.fs.v2.object.ObjectService.GetRange:output_type -> neo.fs.v2.object.GetRangeResponse + 15, // 109: neo.fs.v2.object.ObjectService.GetRangeHash:output_type -> neo.fs.v2.object.GetRangeHashResponse + 17, // 110: neo.fs.v2.object.ObjectService.PutSingle:output_type -> neo.fs.v2.object.PutSingleResponse + 19, // 111: neo.fs.v2.object.ObjectService.Patch:output_type -> neo.fs.v2.object.PatchResponse + 103, // [103:112] is the sub-list for method output_type + 94, // [94:103] is the sub-list for method input_type + 94, // [94:94] is the sub-list for extension type_name + 94, // [94:94] is the sub-list for extension extendee + 0, // [0:94] is the sub-list for field type_name +} + +func init() { file_api_object_grpc_service_proto_init() } +func file_api_object_grpc_service_proto_init() { + if File_api_object_grpc_service_proto != nil { + return + } + file_api_object_grpc_types_proto_init() + file_api_object_grpc_service_proto_msgTypes[21].OneofWrappers = []any{ + (*getResponse_Body_Init_)(nil), + (*getResponse_Body_Chunk)(nil), + (*getResponse_Body_SplitInfo)(nil), + (*getResponse_Body_EcInfo)(nil), + } + file_api_object_grpc_service_proto_msgTypes[23].OneofWrappers = []any{ + (*putRequest_Body_Init_)(nil), + (*putRequest_Body_Chunk)(nil), + } + file_api_object_grpc_service_proto_msgTypes[29].OneofWrappers = []any{ + (*headResponse_Body_Header)(nil), + (*headResponse_Body_ShortHeader)(nil), + (*headResponse_Body_SplitInfo)(nil), + (*headResponse_Body_EcInfo)(nil), + } + file_api_object_grpc_service_proto_msgTypes[34].OneofWrappers = []any{ + (*getRangeResponse_Body_Chunk)(nil), + (*getRangeResponse_Body_SplitInfo)(nil), + (*getRangeResponse_Body_EcInfo)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_object_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 42, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_object_grpc_service_proto_goTypes, + DependencyIndexes: file_api_object_grpc_service_proto_depIdxs, + MessageInfos: file_api_object_grpc_service_proto_msgTypes, + }.Build() + File_api_object_grpc_service_proto = out.File + file_api_object_grpc_service_proto_rawDesc = nil + file_api_object_grpc_service_proto_goTypes = nil + file_api_object_grpc_service_proto_depIdxs = nil +} diff --git a/api/object/grpc/types.pb.go b/api/object/grpc/types.pb.go new file mode 100644 index 00000000..8404e30b --- /dev/null +++ b/api/object/grpc/types.pb.go @@ -0,0 +1,2093 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/object/grpc/types.proto + +//go:build !protoopaque + +package object + +import ( + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Type of the object payload content. Only `REGULAR` type objects can be split, +// hence `TOMBSTONE` and `LOCK` payload is limited by the +// maximum object size. +// +// String presentation of object type is the same as definition: +// * REGULAR +// * TOMBSTONE +// * LOCK +type ObjectType int32 + +const ( + // Just a normal object + ObjectType_REGULAR ObjectType = 0 + // Used internally to identify deleted objects + ObjectType_TOMBSTONE ObjectType = 1 + // Object lock + ObjectType_LOCK ObjectType = 3 +) + +// Enum value maps for ObjectType. +var ( + ObjectType_name = map[int32]string{ + 0: "REGULAR", + 1: "TOMBSTONE", + 3: "LOCK", + } + ObjectType_value = map[string]int32{ + "REGULAR": 0, + "TOMBSTONE": 1, + "LOCK": 3, + } +) + +func (x ObjectType) Enum() *ObjectType { + p := new(ObjectType) + *p = x + return p +} + +func (x ObjectType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ObjectType) Descriptor() protoreflect.EnumDescriptor { + return file_api_object_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (ObjectType) Type() protoreflect.EnumType { + return &file_api_object_grpc_types_proto_enumTypes[0] +} + +func (x ObjectType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Type of match expression +type MatchType int32 + +const ( + // Unknown. Not used + MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 + // Full string match + MatchType_STRING_EQUAL MatchType = 1 + // Full string mismatch + MatchType_STRING_NOT_EQUAL MatchType = 2 + // Lack of key + MatchType_NOT_PRESENT MatchType = 3 + // String prefix match + MatchType_COMMON_PREFIX MatchType = 4 +) + +// Enum value maps for MatchType. +var ( + MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", + 3: "NOT_PRESENT", + 4: "COMMON_PREFIX", + } + MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, + "NOT_PRESENT": 3, + "COMMON_PREFIX": 4, + } +) + +func (x MatchType) Enum() *MatchType { + p := new(MatchType) + *p = x + return p +} + +func (x MatchType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MatchType) Descriptor() protoreflect.EnumDescriptor { + return file_api_object_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (MatchType) Type() protoreflect.EnumType { + return &file_api_object_grpc_types_proto_enumTypes[1] +} + +func (x MatchType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Short header fields +type ShortHeader struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Object format version. Effectively, the version of API library used to + // create particular object. + Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + // Epoch when the object was created + CreationEpoch *uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch" json:"creation_epoch,omitempty"` + // Object's owner + OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + // Type of the object payload content + ObjectType *ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` + // Size of payload in bytes. + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown + PayloadLength *uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength" json:"payload_length,omitempty"` + // Hash of payload bytes + PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash" json:"payload_hash,omitempty"` + // Homomorphic hash of the object payload + HomomorphicHash *grpc.Checksum `protobuf:"bytes,7,opt,name=homomorphic_hash,json=homomorphicHash" json:"homomorphic_hash,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ShortHeader) Reset() { + *x = ShortHeader{} + mi := &file_api_object_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ShortHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShortHeader) ProtoMessage() {} + +func (x *ShortHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ShortHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} + +func (x *ShortHeader) GetCreationEpoch() uint64 { + if x != nil && x.CreationEpoch != nil { + return *x.CreationEpoch + } + return 0 +} + +func (x *ShortHeader) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *ShortHeader) GetObjectType() ObjectType { + if x != nil && x.ObjectType != nil { + return *x.ObjectType + } + return ObjectType_REGULAR +} + +func (x *ShortHeader) GetPayloadLength() uint64 { + if x != nil && x.PayloadLength != nil { + return *x.PayloadLength + } + return 0 +} + +func (x *ShortHeader) GetPayloadHash() *grpc.Checksum { + if x != nil { + return x.PayloadHash + } + return nil +} + +func (x *ShortHeader) GetHomomorphicHash() *grpc.Checksum { + if x != nil { + return x.HomomorphicHash + } + return nil +} + +func (x *ShortHeader) SetVersion(v *grpc.Version) { + x.Version = v +} + +func (x *ShortHeader) SetCreationEpoch(v uint64) { + x.CreationEpoch = &v +} + +func (x *ShortHeader) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} + +func (x *ShortHeader) SetObjectType(v ObjectType) { + x.ObjectType = &v +} + +func (x *ShortHeader) SetPayloadLength(v uint64) { + x.PayloadLength = &v +} + +func (x *ShortHeader) SetPayloadHash(v *grpc.Checksum) { + x.PayloadHash = v +} + +func (x *ShortHeader) SetHomomorphicHash(v *grpc.Checksum) { + x.HomomorphicHash = v +} + +func (x *ShortHeader) HasVersion() bool { + if x == nil { + return false + } + return x.Version != nil +} + +func (x *ShortHeader) HasCreationEpoch() bool { + if x == nil { + return false + } + return x.CreationEpoch != nil +} + +func (x *ShortHeader) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *ShortHeader) HasObjectType() bool { + if x == nil { + return false + } + return x.ObjectType != nil +} + +func (x *ShortHeader) HasPayloadLength() bool { + if x == nil { + return false + } + return x.PayloadLength != nil +} + +func (x *ShortHeader) HasPayloadHash() bool { + if x == nil { + return false + } + return x.PayloadHash != nil +} + +func (x *ShortHeader) HasHomomorphicHash() bool { + if x == nil { + return false + } + return x.HomomorphicHash != nil +} + +func (x *ShortHeader) ClearVersion() { + x.Version = nil +} + +func (x *ShortHeader) ClearCreationEpoch() { + x.CreationEpoch = nil +} + +func (x *ShortHeader) ClearOwnerId() { + x.OwnerId = nil +} + +func (x *ShortHeader) ClearObjectType() { + x.ObjectType = nil +} + +func (x *ShortHeader) ClearPayloadLength() { + x.PayloadLength = nil +} + +func (x *ShortHeader) ClearPayloadHash() { + x.PayloadHash = nil +} + +func (x *ShortHeader) ClearHomomorphicHash() { + x.HomomorphicHash = nil +} + +type ShortHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object format version. Effectively, the version of API library used to + // create particular object. + Version *grpc.Version + // Epoch when the object was created + CreationEpoch *uint64 + // Object's owner + OwnerId *grpc.OwnerID + // Type of the object payload content + ObjectType *ObjectType + // Size of payload in bytes. + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown + PayloadLength *uint64 + // Hash of payload bytes + PayloadHash *grpc.Checksum + // Homomorphic hash of the object payload + HomomorphicHash *grpc.Checksum +} + +func (b0 ShortHeader_builder) Build() *ShortHeader { + m0 := &ShortHeader{} + b, x := &b0, m0 + _, _ = b, x + x.Version = b.Version + x.CreationEpoch = b.CreationEpoch + x.OwnerId = b.OwnerId + x.ObjectType = b.ObjectType + x.PayloadLength = b.PayloadLength + x.PayloadHash = b.PayloadHash + x.HomomorphicHash = b.HomomorphicHash + return m0 +} + +// Object Header +type Header struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Object format version. Effectively, the version of API library used to + // create particular object + Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + // Object's container + ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID" json:"container_id,omitempty"` + // Object's owner + OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + // Object creation Epoch + CreationEpoch *uint64 `protobuf:"varint,4,opt,name=creation_epoch,json=creationEpoch" json:"creation_epoch,omitempty"` + // Size of payload in bytes. + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown. + PayloadLength *uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength" json:"payload_length,omitempty"` + // Hash of payload bytes + PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash" json:"payload_hash,omitempty"` + // Type of the object payload content + ObjectType *ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` + // Homomorphic hash of the object payload + HomomorphicHash *grpc.Checksum `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash" json:"homomorphic_hash,omitempty"` + // Session token, if it was used during Object creation. Need it to verify + // integrity and authenticity out of Request scope. + SessionToken *grpc1.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken" json:"session_token,omitempty"` + // User-defined object attributes + Attributes []*Header_Attribute `protobuf:"bytes,10,rep,name=attributes" json:"attributes,omitempty"` + // Position of the object in the split hierarchy + Split *Header_Split `protobuf:"bytes,11,opt,name=split" json:"split,omitempty"` + // Erasure code chunk information. + Ec *Header_EC `protobuf:"bytes,12,opt,name=ec" json:"ec,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Header) Reset() { + *x = Header{} + mi := &file_api_object_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header) ProtoMessage() {} + +func (x *Header) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Header) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} + +func (x *Header) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *Header) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *Header) GetCreationEpoch() uint64 { + if x != nil && x.CreationEpoch != nil { + return *x.CreationEpoch + } + return 0 +} + +func (x *Header) GetPayloadLength() uint64 { + if x != nil && x.PayloadLength != nil { + return *x.PayloadLength + } + return 0 +} + +func (x *Header) GetPayloadHash() *grpc.Checksum { + if x != nil { + return x.PayloadHash + } + return nil +} + +func (x *Header) GetObjectType() ObjectType { + if x != nil && x.ObjectType != nil { + return *x.ObjectType + } + return ObjectType_REGULAR +} + +func (x *Header) GetHomomorphicHash() *grpc.Checksum { + if x != nil { + return x.HomomorphicHash + } + return nil +} + +func (x *Header) GetSessionToken() *grpc1.SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} + +func (x *Header) GetAttributes() []*Header_Attribute { + if x != nil { + return x.Attributes + } + return nil +} + +func (x *Header) GetSplit() *Header_Split { + if x != nil { + return x.Split + } + return nil +} + +func (x *Header) GetEc() *Header_EC { + if x != nil { + return x.Ec + } + return nil +} + +func (x *Header) SetVersion(v *grpc.Version) { + x.Version = v +} + +func (x *Header) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} + +func (x *Header) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} + +func (x *Header) SetCreationEpoch(v uint64) { + x.CreationEpoch = &v +} + +func (x *Header) SetPayloadLength(v uint64) { + x.PayloadLength = &v +} + +func (x *Header) SetPayloadHash(v *grpc.Checksum) { + x.PayloadHash = v +} + +func (x *Header) SetObjectType(v ObjectType) { + x.ObjectType = &v +} + +func (x *Header) SetHomomorphicHash(v *grpc.Checksum) { + x.HomomorphicHash = v +} + +func (x *Header) SetSessionToken(v *grpc1.SessionToken) { + x.SessionToken = v +} + +func (x *Header) SetAttributes(v []*Header_Attribute) { + x.Attributes = v +} + +func (x *Header) SetSplit(v *Header_Split) { + x.Split = v +} + +func (x *Header) SetEc(v *Header_EC) { + x.Ec = v +} + +func (x *Header) HasVersion() bool { + if x == nil { + return false + } + return x.Version != nil +} + +func (x *Header) HasContainerId() bool { + if x == nil { + return false + } + return x.ContainerId != nil +} + +func (x *Header) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *Header) HasCreationEpoch() bool { + if x == nil { + return false + } + return x.CreationEpoch != nil +} + +func (x *Header) HasPayloadLength() bool { + if x == nil { + return false + } + return x.PayloadLength != nil +} + +func (x *Header) HasPayloadHash() bool { + if x == nil { + return false + } + return x.PayloadHash != nil +} + +func (x *Header) HasObjectType() bool { + if x == nil { + return false + } + return x.ObjectType != nil +} + +func (x *Header) HasHomomorphicHash() bool { + if x == nil { + return false + } + return x.HomomorphicHash != nil +} + +func (x *Header) HasSessionToken() bool { + if x == nil { + return false + } + return x.SessionToken != nil +} + +func (x *Header) HasSplit() bool { + if x == nil { + return false + } + return x.Split != nil +} + +func (x *Header) HasEc() bool { + if x == nil { + return false + } + return x.Ec != nil +} + +func (x *Header) ClearVersion() { + x.Version = nil +} + +func (x *Header) ClearContainerId() { + x.ContainerId = nil +} + +func (x *Header) ClearOwnerId() { + x.OwnerId = nil +} + +func (x *Header) ClearCreationEpoch() { + x.CreationEpoch = nil +} + +func (x *Header) ClearPayloadLength() { + x.PayloadLength = nil +} + +func (x *Header) ClearPayloadHash() { + x.PayloadHash = nil +} + +func (x *Header) ClearObjectType() { + x.ObjectType = nil +} + +func (x *Header) ClearHomomorphicHash() { + x.HomomorphicHash = nil +} + +func (x *Header) ClearSessionToken() { + x.SessionToken = nil +} + +func (x *Header) ClearSplit() { + x.Split = nil +} + +func (x *Header) ClearEc() { + x.Ec = nil +} + +type Header_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object format version. Effectively, the version of API library used to + // create particular object + Version *grpc.Version + // Object's container + ContainerId *grpc.ContainerID + // Object's owner + OwnerId *grpc.OwnerID + // Object creation Epoch + CreationEpoch *uint64 + // Size of payload in bytes. + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown. + PayloadLength *uint64 + // Hash of payload bytes + PayloadHash *grpc.Checksum + // Type of the object payload content + ObjectType *ObjectType + // Homomorphic hash of the object payload + HomomorphicHash *grpc.Checksum + // Session token, if it was used during Object creation. Need it to verify + // integrity and authenticity out of Request scope. + SessionToken *grpc1.SessionToken + // User-defined object attributes + Attributes []*Header_Attribute + // Position of the object in the split hierarchy + Split *Header_Split + // Erasure code chunk information. + Ec *Header_EC +} + +func (b0 Header_builder) Build() *Header { + m0 := &Header{} + b, x := &b0, m0 + _, _ = b, x + x.Version = b.Version + x.ContainerId = b.ContainerId + x.OwnerId = b.OwnerId + x.CreationEpoch = b.CreationEpoch + x.PayloadLength = b.PayloadLength + x.PayloadHash = b.PayloadHash + x.ObjectType = b.ObjectType + x.HomomorphicHash = b.HomomorphicHash + x.SessionToken = b.SessionToken + x.Attributes = b.Attributes + x.Split = b.Split + x.Ec = b.Ec + return m0 +} + +// Object structure. Object is immutable and content-addressed. It means +// `ObjectID` will change if the header or the payload changes. It's calculated +// as a hash of header field which contains hash of the object's payload. +// +// For non-regular object types payload format depends on object type specified +// in the header. +type Object struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Object's unique identifier. + ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectID" json:"object_id,omitempty"` + // Signed object_id + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + // Object metadata headers + Header *Header `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` + // Payload bytes + Payload []byte `protobuf:"bytes,4,opt,name=payload" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Object) Reset() { + *x = Object{} + mi := &file_api_object_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Object) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Object) ProtoMessage() {} + +func (x *Object) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Object) GetObjectId() *grpc.ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *Object) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *Object) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *Object) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *Object) SetObjectId(v *grpc.ObjectID) { + x.ObjectId = v +} + +func (x *Object) SetSignature(v *grpc.Signature) { + x.Signature = v +} + +func (x *Object) SetHeader(v *Header) { + x.Header = v +} + +func (x *Object) SetPayload(v []byte) { + if v == nil { + v = []byte{} + } + x.Payload = v +} + +func (x *Object) HasObjectId() bool { + if x == nil { + return false + } + return x.ObjectId != nil +} + +func (x *Object) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *Object) HasHeader() bool { + if x == nil { + return false + } + return x.Header != nil +} + +func (x *Object) HasPayload() bool { + if x == nil { + return false + } + return x.Payload != nil +} + +func (x *Object) ClearObjectId() { + x.ObjectId = nil +} + +func (x *Object) ClearSignature() { + x.Signature = nil +} + +func (x *Object) ClearHeader() { + x.Header = nil +} + +func (x *Object) ClearPayload() { + x.Payload = nil +} + +type Object_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object's unique identifier. + ObjectId *grpc.ObjectID + // Signed object_id + Signature *grpc.Signature + // Object metadata headers + Header *Header + // Payload bytes + Payload []byte +} + +func (b0 Object_builder) Build() *Object { + m0 := &Object{} + b, x := &b0, m0 + _, _ = b, x + x.ObjectId = b.ObjectId + x.Signature = b.Signature + x.Header = b.Header + x.Payload = b.Payload + return m0 +} + +// Meta information of split hierarchy for object assembly. With the last part +// one can traverse linked list of split hierarchy back to the first part and +// assemble the original object. With a linking object one can assemble an +// object right from the object parts. +type SplitInfo struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // 16 byte UUID used to identify the split object hierarchy parts. + SplitId []byte `protobuf:"bytes,1,opt,name=split_id,json=splitId" json:"split_id,omitempty"` + // The identifier of the last object in split hierarchy parts. It contains + // split header with the original object header. + LastPart *grpc.ObjectID `protobuf:"bytes,2,opt,name=last_part,json=lastPart" json:"last_part,omitempty"` + // The identifier of a linking object for split hierarchy parts. It contains + // split header with the original object header and a sorted list of + // object parts. + Link *grpc.ObjectID `protobuf:"bytes,3,opt,name=link" json:"link,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SplitInfo) Reset() { + *x = SplitInfo{} + mi := &file_api_object_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SplitInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SplitInfo) ProtoMessage() {} + +func (x *SplitInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SplitInfo) GetSplitId() []byte { + if x != nil { + return x.SplitId + } + return nil +} + +func (x *SplitInfo) GetLastPart() *grpc.ObjectID { + if x != nil { + return x.LastPart + } + return nil +} + +func (x *SplitInfo) GetLink() *grpc.ObjectID { + if x != nil { + return x.Link + } + return nil +} + +func (x *SplitInfo) SetSplitId(v []byte) { + if v == nil { + v = []byte{} + } + x.SplitId = v +} + +func (x *SplitInfo) SetLastPart(v *grpc.ObjectID) { + x.LastPart = v +} + +func (x *SplitInfo) SetLink(v *grpc.ObjectID) { + x.Link = v +} + +func (x *SplitInfo) HasSplitId() bool { + if x == nil { + return false + } + return x.SplitId != nil +} + +func (x *SplitInfo) HasLastPart() bool { + if x == nil { + return false + } + return x.LastPart != nil +} + +func (x *SplitInfo) HasLink() bool { + if x == nil { + return false + } + return x.Link != nil +} + +func (x *SplitInfo) ClearSplitId() { + x.SplitId = nil +} + +func (x *SplitInfo) ClearLastPart() { + x.LastPart = nil +} + +func (x *SplitInfo) ClearLink() { + x.Link = nil +} + +type SplitInfo_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // 16 byte UUID used to identify the split object hierarchy parts. + SplitId []byte + // The identifier of the last object in split hierarchy parts. It contains + // split header with the original object header. + LastPart *grpc.ObjectID + // The identifier of a linking object for split hierarchy parts. It contains + // split header with the original object header and a sorted list of + // object parts. + Link *grpc.ObjectID +} + +func (b0 SplitInfo_builder) Build() *SplitInfo { + m0 := &SplitInfo{} + b, x := &b0, m0 + _, _ = b, x + x.SplitId = b.SplitId + x.LastPart = b.LastPart + x.Link = b.Link + return m0 +} + +// Meta information for the erasure-encoded object. +type ECInfo struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Chunk stored on the node. + Chunks []*ECInfo_Chunk `protobuf:"bytes,1,rep,name=chunks" json:"chunks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ECInfo) Reset() { + *x = ECInfo{} + mi := &file_api_object_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ECInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ECInfo) ProtoMessage() {} + +func (x *ECInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ECInfo) GetChunks() []*ECInfo_Chunk { + if x != nil { + return x.Chunks + } + return nil +} + +func (x *ECInfo) SetChunks(v []*ECInfo_Chunk) { + x.Chunks = v +} + +type ECInfo_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Chunk stored on the node. + Chunks []*ECInfo_Chunk +} + +func (b0 ECInfo_builder) Build() *ECInfo { + m0 := &ECInfo{} + b, x := &b0, m0 + _, _ = b, x + x.Chunks = b.Chunks + return m0 +} + +// `Attribute` is a user-defined Key-Value metadata pair attached to an +// object. +// +// Key name must be an object-unique valid UTF-8 string. Value can't be empty. +// Objects with duplicated attribute names or attributes with empty values +// will be considered invalid. +// +// There are some "well-known" attributes starting with `__SYSTEM__` +// (`__NEOFS__` is deprecated) prefix that affect system behaviour: +// +// - [ __SYSTEM__UPLOAD_ID ] \ +// (`__NEOFS__UPLOAD_ID` is deprecated) \ +// Marks smaller parts of a split bigger object +// - [ __SYSTEM__EXPIRATION_EPOCH ] \ +// (`__NEOFS__EXPIRATION_EPOCH` is deprecated) \ +// The epoch after which object with no LOCKs on it becomes unavailable. +// Locked object continues to be available until each of the LOCKs expire. +// - [ __SYSTEM__TICK_EPOCH ] \ +// (`__NEOFS__TICK_EPOCH` is deprecated) \ +// Decimal number that defines what epoch must produce +// object notification with UTF-8 object address in a +// body (`0` value produces notification right after +// object put) +// - [ __SYSTEM__TICK_TOPIC ] \ +// (`__NEOFS__TICK_TOPIC` is deprecated) \ +// UTF-8 string topic ID that is used for object notification +// +// And some well-known attributes used by applications only: +// +// - Name \ +// Human-friendly name +// - FileName \ +// File name to be associated with the object on saving +// - FilePath \ +// Full path to be associated with the object on saving. Should start with a +// '/' and use '/' as a delimiting symbol. Trailing '/' should be +// interpreted as a virtual directory marker. If an object has conflicting +// FilePath and FileName, FilePath should have higher priority, because it +// is used to construct the directory tree. FilePath with trailing '/' and +// non-empty FileName attribute should not be used together. +// - Timestamp \ +// User-defined local time of object creation in Unix Timestamp format +// - Content-Type \ +// MIME Content Type of object's payload +// +// For detailed description of each well-known attribute please see the +// corresponding section in FrostFS Technical Specification. +type Header_Attribute struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // string key to the object attribute + Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + // string value of the object attribute + Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Header_Attribute) Reset() { + *x = Header_Attribute{} + mi := &file_api_object_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header_Attribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header_Attribute) ProtoMessage() {} + +func (x *Header_Attribute) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Header_Attribute) GetKey() string { + if x != nil && x.Key != nil { + return *x.Key + } + return "" +} + +func (x *Header_Attribute) GetValue() string { + if x != nil && x.Value != nil { + return *x.Value + } + return "" +} + +func (x *Header_Attribute) SetKey(v string) { + x.Key = &v +} + +func (x *Header_Attribute) SetValue(v string) { + x.Value = &v +} + +func (x *Header_Attribute) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *Header_Attribute) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *Header_Attribute) ClearKey() { + x.Key = nil +} + +func (x *Header_Attribute) ClearValue() { + x.Value = nil +} + +type Header_Attribute_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // string key to the object attribute + Key *string + // string value of the object attribute + Value *string +} + +func (b0 Header_Attribute_builder) Build() *Header_Attribute { + m0 := &Header_Attribute{} + b, x := &b0, m0 + _, _ = b, x + x.Key = b.Key + x.Value = b.Value + return m0 +} + +// Bigger objects can be split into a chain of smaller objects. Information +// about inter-dependencies between spawned objects and how to re-construct +// the original one is in the `Split` headers. Parent and children objects +// must be within the same container. +type Header_Split struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of the origin object. Known only to the minor child. + Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` + // Identifier of the left split neighbor + Previous *grpc.ObjectID `protobuf:"bytes,2,opt,name=previous" json:"previous,omitempty"` + // `signature` field of the parent object. Used to reconstruct parent. + ParentSignature *grpc.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature" json:"parent_signature,omitempty"` + // `header` field of the parent object. Used to reconstruct parent. + ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader" json:"parent_header,omitempty"` + // List of identifiers of the objects generated by splitting current one. + Children []*grpc.ObjectID `protobuf:"bytes,5,rep,name=children" json:"children,omitempty"` + // 16 byte UUIDv4 used to identify the split object hierarchy parts. Must be + // unique inside container. All objects participating in the split must have + // the same `split_id` value. + SplitId []byte `protobuf:"bytes,6,opt,name=split_id,json=splitID" json:"split_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Header_Split) Reset() { + *x = Header_Split{} + mi := &file_api_object_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header_Split) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header_Split) ProtoMessage() {} + +func (x *Header_Split) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Header_Split) GetParent() *grpc.ObjectID { + if x != nil { + return x.Parent + } + return nil +} + +func (x *Header_Split) GetPrevious() *grpc.ObjectID { + if x != nil { + return x.Previous + } + return nil +} + +func (x *Header_Split) GetParentSignature() *grpc.Signature { + if x != nil { + return x.ParentSignature + } + return nil +} + +func (x *Header_Split) GetParentHeader() *Header { + if x != nil { + return x.ParentHeader + } + return nil +} + +func (x *Header_Split) GetChildren() []*grpc.ObjectID { + if x != nil { + return x.Children + } + return nil +} + +func (x *Header_Split) GetSplitId() []byte { + if x != nil { + return x.SplitId + } + return nil +} + +func (x *Header_Split) SetParent(v *grpc.ObjectID) { + x.Parent = v +} + +func (x *Header_Split) SetPrevious(v *grpc.ObjectID) { + x.Previous = v +} + +func (x *Header_Split) SetParentSignature(v *grpc.Signature) { + x.ParentSignature = v +} + +func (x *Header_Split) SetParentHeader(v *Header) { + x.ParentHeader = v +} + +func (x *Header_Split) SetChildren(v []*grpc.ObjectID) { + x.Children = v +} + +func (x *Header_Split) SetSplitId(v []byte) { + if v == nil { + v = []byte{} + } + x.SplitId = v +} + +func (x *Header_Split) HasParent() bool { + if x == nil { + return false + } + return x.Parent != nil +} + +func (x *Header_Split) HasPrevious() bool { + if x == nil { + return false + } + return x.Previous != nil +} + +func (x *Header_Split) HasParentSignature() bool { + if x == nil { + return false + } + return x.ParentSignature != nil +} + +func (x *Header_Split) HasParentHeader() bool { + if x == nil { + return false + } + return x.ParentHeader != nil +} + +func (x *Header_Split) HasSplitId() bool { + if x == nil { + return false + } + return x.SplitId != nil +} + +func (x *Header_Split) ClearParent() { + x.Parent = nil +} + +func (x *Header_Split) ClearPrevious() { + x.Previous = nil +} + +func (x *Header_Split) ClearParentSignature() { + x.ParentSignature = nil +} + +func (x *Header_Split) ClearParentHeader() { + x.ParentHeader = nil +} + +func (x *Header_Split) ClearSplitId() { + x.SplitId = nil +} + +type Header_Split_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the origin object. Known only to the minor child. + Parent *grpc.ObjectID + // Identifier of the left split neighbor + Previous *grpc.ObjectID + // `signature` field of the parent object. Used to reconstruct parent. + ParentSignature *grpc.Signature + // `header` field of the parent object. Used to reconstruct parent. + ParentHeader *Header + // List of identifiers of the objects generated by splitting current one. + Children []*grpc.ObjectID + // 16 byte UUIDv4 used to identify the split object hierarchy parts. Must be + // unique inside container. All objects participating in the split must have + // the same `split_id` value. + SplitId []byte +} + +func (b0 Header_Split_builder) Build() *Header_Split { + m0 := &Header_Split{} + b, x := &b0, m0 + _, _ = b, x + x.Parent = b.Parent + x.Previous = b.Previous + x.ParentSignature = b.ParentSignature + x.ParentHeader = b.ParentHeader + x.Children = b.Children + x.SplitId = b.SplitId + return m0 +} + +// Erasure code can be applied to any object. +// Information about encoded object structure is stored in `EC` header. +// All objects belonging to a single EC group have the same `parent` field. +type Header_EC struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of the origin object. Known to all chunks. + Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` + // Index of this chunk. + Index *uint32 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` + // Total number of chunks in this split. + Total *uint32 `protobuf:"varint,3,opt,name=total" json:"total,omitempty"` + // Total length of a parent header. Used to trim padding zeroes. + HeaderLength *uint32 `protobuf:"varint,4,opt,name=header_length,json=headerLength" json:"header_length,omitempty"` + // Chunk of a parent header. + Header []byte `protobuf:"bytes,5,opt,name=header" json:"header,omitempty"` + // As the origin object is EC-splitted its identifier is known to all + // chunks as parent. But parent itself can be a part of Split (does not + // relate to EC-split). In this case parent_split_id should be set. + ParentSplitId []byte `protobuf:"bytes,6,opt,name=parent_split_id,json=parentSplitID" json:"parent_split_id,omitempty"` + // EC-parent's parent ID. parent_split_parent_id is set if EC-parent, + // itself, is a part of Split and if an object ID of its parent is + // presented. The field allows to determine how EC-chunk is placed in Split + // hierarchy. + ParentSplitParentId *grpc.ObjectID `protobuf:"bytes,7,opt,name=parent_split_parent_id,json=parentSplitParentID" json:"parent_split_parent_id,omitempty"` + // EC parent's attributes. + ParentAttributes []*Header_Attribute `protobuf:"bytes,8,rep,name=parent_attributes,json=parentAttributes" json:"parent_attributes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Header_EC) Reset() { + *x = Header_EC{} + mi := &file_api_object_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header_EC) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header_EC) ProtoMessage() {} + +func (x *Header_EC) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Header_EC) GetParent() *grpc.ObjectID { + if x != nil { + return x.Parent + } + return nil +} + +func (x *Header_EC) GetIndex() uint32 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +func (x *Header_EC) GetTotal() uint32 { + if x != nil && x.Total != nil { + return *x.Total + } + return 0 +} + +func (x *Header_EC) GetHeaderLength() uint32 { + if x != nil && x.HeaderLength != nil { + return *x.HeaderLength + } + return 0 +} + +func (x *Header_EC) GetHeader() []byte { + if x != nil { + return x.Header + } + return nil +} + +func (x *Header_EC) GetParentSplitId() []byte { + if x != nil { + return x.ParentSplitId + } + return nil +} + +func (x *Header_EC) GetParentSplitParentId() *grpc.ObjectID { + if x != nil { + return x.ParentSplitParentId + } + return nil +} + +func (x *Header_EC) GetParentAttributes() []*Header_Attribute { + if x != nil { + return x.ParentAttributes + } + return nil +} + +func (x *Header_EC) SetParent(v *grpc.ObjectID) { + x.Parent = v +} + +func (x *Header_EC) SetIndex(v uint32) { + x.Index = &v +} + +func (x *Header_EC) SetTotal(v uint32) { + x.Total = &v +} + +func (x *Header_EC) SetHeaderLength(v uint32) { + x.HeaderLength = &v +} + +func (x *Header_EC) SetHeader(v []byte) { + if v == nil { + v = []byte{} + } + x.Header = v +} + +func (x *Header_EC) SetParentSplitId(v []byte) { + if v == nil { + v = []byte{} + } + x.ParentSplitId = v +} + +func (x *Header_EC) SetParentSplitParentId(v *grpc.ObjectID) { + x.ParentSplitParentId = v +} + +func (x *Header_EC) SetParentAttributes(v []*Header_Attribute) { + x.ParentAttributes = v +} + +func (x *Header_EC) HasParent() bool { + if x == nil { + return false + } + return x.Parent != nil +} + +func (x *Header_EC) HasIndex() bool { + if x == nil { + return false + } + return x.Index != nil +} + +func (x *Header_EC) HasTotal() bool { + if x == nil { + return false + } + return x.Total != nil +} + +func (x *Header_EC) HasHeaderLength() bool { + if x == nil { + return false + } + return x.HeaderLength != nil +} + +func (x *Header_EC) HasHeader() bool { + if x == nil { + return false + } + return x.Header != nil +} + +func (x *Header_EC) HasParentSplitId() bool { + if x == nil { + return false + } + return x.ParentSplitId != nil +} + +func (x *Header_EC) HasParentSplitParentId() bool { + if x == nil { + return false + } + return x.ParentSplitParentId != nil +} + +func (x *Header_EC) ClearParent() { + x.Parent = nil +} + +func (x *Header_EC) ClearIndex() { + x.Index = nil +} + +func (x *Header_EC) ClearTotal() { + x.Total = nil +} + +func (x *Header_EC) ClearHeaderLength() { + x.HeaderLength = nil +} + +func (x *Header_EC) ClearHeader() { + x.Header = nil +} + +func (x *Header_EC) ClearParentSplitId() { + x.ParentSplitId = nil +} + +func (x *Header_EC) ClearParentSplitParentId() { + x.ParentSplitParentId = nil +} + +type Header_EC_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the origin object. Known to all chunks. + Parent *grpc.ObjectID + // Index of this chunk. + Index *uint32 + // Total number of chunks in this split. + Total *uint32 + // Total length of a parent header. Used to trim padding zeroes. + HeaderLength *uint32 + // Chunk of a parent header. + Header []byte + // As the origin object is EC-splitted its identifier is known to all + // chunks as parent. But parent itself can be a part of Split (does not + // relate to EC-split). In this case parent_split_id should be set. + ParentSplitId []byte + // EC-parent's parent ID. parent_split_parent_id is set if EC-parent, + // itself, is a part of Split and if an object ID of its parent is + // presented. The field allows to determine how EC-chunk is placed in Split + // hierarchy. + ParentSplitParentId *grpc.ObjectID + // EC parent's attributes. + ParentAttributes []*Header_Attribute +} + +func (b0 Header_EC_builder) Build() *Header_EC { + m0 := &Header_EC{} + b, x := &b0, m0 + _, _ = b, x + x.Parent = b.Parent + x.Index = b.Index + x.Total = b.Total + x.HeaderLength = b.HeaderLength + x.Header = b.Header + x.ParentSplitId = b.ParentSplitId + x.ParentSplitParentId = b.ParentSplitParentId + x.ParentAttributes = b.ParentAttributes + return m0 +} + +type ECInfo_Chunk struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Object ID of the chunk. + Id *grpc.ObjectID `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + // Index of the chunk. + Index *uint32 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` + // Total number of chunks in this split. + Total *uint32 `protobuf:"varint,3,opt,name=total" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ECInfo_Chunk) Reset() { + *x = ECInfo_Chunk{} + mi := &file_api_object_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ECInfo_Chunk) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ECInfo_Chunk) ProtoMessage() {} + +func (x *ECInfo_Chunk) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ECInfo_Chunk) GetId() *grpc.ObjectID { + if x != nil { + return x.Id + } + return nil +} + +func (x *ECInfo_Chunk) GetIndex() uint32 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +func (x *ECInfo_Chunk) GetTotal() uint32 { + if x != nil && x.Total != nil { + return *x.Total + } + return 0 +} + +func (x *ECInfo_Chunk) SetId(v *grpc.ObjectID) { + x.Id = v +} + +func (x *ECInfo_Chunk) SetIndex(v uint32) { + x.Index = &v +} + +func (x *ECInfo_Chunk) SetTotal(v uint32) { + x.Total = &v +} + +func (x *ECInfo_Chunk) HasId() bool { + if x == nil { + return false + } + return x.Id != nil +} + +func (x *ECInfo_Chunk) HasIndex() bool { + if x == nil { + return false + } + return x.Index != nil +} + +func (x *ECInfo_Chunk) HasTotal() bool { + if x == nil { + return false + } + return x.Total != nil +} + +func (x *ECInfo_Chunk) ClearId() { + x.Id = nil +} + +func (x *ECInfo_Chunk) ClearIndex() { + x.Index = nil +} + +func (x *ECInfo_Chunk) ClearTotal() { + x.Total = nil +} + +type ECInfo_Chunk_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object ID of the chunk. + Id *grpc.ObjectID + // Index of the chunk. + Index *uint32 + // Total number of chunks in this split. + Total *uint32 +} + +func (b0 ECInfo_Chunk_builder) Build() *ECInfo_Chunk { + m0 := &ECInfo_Chunk{} + b, x := &b0, m0 + _, _ = b, x + x.Id = b.Id + x.Index = b.Index + x.Total = b.Total + return m0 +} + +var File_api_object_grpc_types_proto protoreflect.FileDescriptor + +var file_api_object_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, + 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x53, 0x68, 0x6f, + 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, + 0x63, 0x68, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, 0x6d, + 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, + 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x22, 0x92, + 0x0b, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x08, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, + 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, + 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3d, 0x0a, 0x0b, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, + 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, + 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x70, 0x6c, + 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x12, + 0x2b, 0x0a, 0x02, 0x65, 0x63, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x45, 0x43, 0x52, 0x02, 0x65, 0x63, 0x1a, 0x33, 0x0a, 0x09, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x1a, 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, + 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, + 0x6f, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, + 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, + 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0xe7, 0x02, 0x0a, 0x02, 0x45, 0x43, + 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x23, + 0x0a, 0x0d, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0f, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, + 0x74, 0x49, 0x44, 0x12, 0x4d, 0x0a, 0x16, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, + 0x6c, 0x69, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x13, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x49, 0x44, 0x12, 0x4f, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, + 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, + 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, + 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, + 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, + 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, + 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x44, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, 0x06, 0x45, 0x43, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x68, + 0x75, 0x6e, 0x6b, 0x52, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, 0x5d, 0x0a, 0x05, 0x43, + 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, 0x0a, 0x0a, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, + 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, + 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x73, + 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, + 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, + 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, + 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, + 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, + 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, + 0x58, 0x10, 0x04, 0x42, 0x62, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_object_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_api_object_grpc_types_proto_goTypes = []any{ + (ObjectType)(0), // 0: neo.fs.v2.object.ObjectType + (MatchType)(0), // 1: neo.fs.v2.object.MatchType + (*ShortHeader)(nil), // 2: neo.fs.v2.object.ShortHeader + (*Header)(nil), // 3: neo.fs.v2.object.Header + (*Object)(nil), // 4: neo.fs.v2.object.Object + (*SplitInfo)(nil), // 5: neo.fs.v2.object.SplitInfo + (*ECInfo)(nil), // 6: neo.fs.v2.object.ECInfo + (*Header_Attribute)(nil), // 7: neo.fs.v2.object.Header.Attribute + (*Header_Split)(nil), // 8: neo.fs.v2.object.Header.Split + (*Header_EC)(nil), // 9: neo.fs.v2.object.Header.EC + (*ECInfo_Chunk)(nil), // 10: neo.fs.v2.object.ECInfo.Chunk + (*grpc.Version)(nil), // 11: neo.fs.v2.refs.Version + (*grpc.OwnerID)(nil), // 12: neo.fs.v2.refs.OwnerID + (*grpc.Checksum)(nil), // 13: neo.fs.v2.refs.Checksum + (*grpc.ContainerID)(nil), // 14: neo.fs.v2.refs.ContainerID + (*grpc1.SessionToken)(nil), // 15: neo.fs.v2.session.SessionToken + (*grpc.ObjectID)(nil), // 16: neo.fs.v2.refs.ObjectID + (*grpc.Signature)(nil), // 17: neo.fs.v2.refs.Signature +} +var file_api_object_grpc_types_proto_depIdxs = []int32{ + 11, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version + 12, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 0, // 2: neo.fs.v2.object.ShortHeader.object_type:type_name -> neo.fs.v2.object.ObjectType + 13, // 3: neo.fs.v2.object.ShortHeader.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 13, // 4: neo.fs.v2.object.ShortHeader.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 11, // 5: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version + 14, // 6: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID + 12, // 7: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 13, // 8: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 0, // 9: neo.fs.v2.object.Header.object_type:type_name -> neo.fs.v2.object.ObjectType + 13, // 10: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 15, // 11: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken + 7, // 12: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute + 8, // 13: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split + 9, // 14: neo.fs.v2.object.Header.ec:type_name -> neo.fs.v2.object.Header.EC + 16, // 15: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID + 17, // 16: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature + 3, // 17: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header + 16, // 18: neo.fs.v2.object.SplitInfo.last_part:type_name -> neo.fs.v2.refs.ObjectID + 16, // 19: neo.fs.v2.object.SplitInfo.link:type_name -> neo.fs.v2.refs.ObjectID + 10, // 20: neo.fs.v2.object.ECInfo.chunks:type_name -> neo.fs.v2.object.ECInfo.Chunk + 16, // 21: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID + 16, // 22: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID + 17, // 23: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature + 3, // 24: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header + 16, // 25: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID + 16, // 26: neo.fs.v2.object.Header.EC.parent:type_name -> neo.fs.v2.refs.ObjectID + 16, // 27: neo.fs.v2.object.Header.EC.parent_split_parent_id:type_name -> neo.fs.v2.refs.ObjectID + 7, // 28: neo.fs.v2.object.Header.EC.parent_attributes:type_name -> neo.fs.v2.object.Header.Attribute + 16, // 29: neo.fs.v2.object.ECInfo.Chunk.id:type_name -> neo.fs.v2.refs.ObjectID + 30, // [30:30] is the sub-list for method output_type + 30, // [30:30] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name +} + +func init() { file_api_object_grpc_types_proto_init() } +func file_api_object_grpc_types_proto_init() { + if File_api_object_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_object_grpc_types_proto_rawDesc, + NumEnums: 2, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_object_grpc_types_proto_goTypes, + DependencyIndexes: file_api_object_grpc_types_proto_depIdxs, + EnumInfos: file_api_object_grpc_types_proto_enumTypes, + MessageInfos: file_api_object_grpc_types_proto_msgTypes, + }.Build() + File_api_object_grpc_types_proto = out.File + file_api_object_grpc_types_proto_rawDesc = nil + file_api_object_grpc_types_proto_goTypes = nil + file_api_object_grpc_types_proto_depIdxs = nil +} diff --git a/api/object/grpc/types_protoopaque.pb.go b/api/object/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..0db84c81 --- /dev/null +++ b/api/object/grpc/types_protoopaque.pb.go @@ -0,0 +1,2156 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/object/grpc/types.proto + +//go:build protoopaque + +package object + +import ( + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Type of the object payload content. Only `REGULAR` type objects can be split, +// hence `TOMBSTONE` and `LOCK` payload is limited by the +// maximum object size. +// +// String presentation of object type is the same as definition: +// * REGULAR +// * TOMBSTONE +// * LOCK +type ObjectType int32 + +const ( + // Just a normal object + ObjectType_REGULAR ObjectType = 0 + // Used internally to identify deleted objects + ObjectType_TOMBSTONE ObjectType = 1 + // Object lock + ObjectType_LOCK ObjectType = 3 +) + +// Enum value maps for ObjectType. +var ( + ObjectType_name = map[int32]string{ + 0: "REGULAR", + 1: "TOMBSTONE", + 3: "LOCK", + } + ObjectType_value = map[string]int32{ + "REGULAR": 0, + "TOMBSTONE": 1, + "LOCK": 3, + } +) + +func (x ObjectType) Enum() *ObjectType { + p := new(ObjectType) + *p = x + return p +} + +func (x ObjectType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ObjectType) Descriptor() protoreflect.EnumDescriptor { + return file_api_object_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (ObjectType) Type() protoreflect.EnumType { + return &file_api_object_grpc_types_proto_enumTypes[0] +} + +func (x ObjectType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Type of match expression +type MatchType int32 + +const ( + // Unknown. Not used + MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0 + // Full string match + MatchType_STRING_EQUAL MatchType = 1 + // Full string mismatch + MatchType_STRING_NOT_EQUAL MatchType = 2 + // Lack of key + MatchType_NOT_PRESENT MatchType = 3 + // String prefix match + MatchType_COMMON_PREFIX MatchType = 4 +) + +// Enum value maps for MatchType. +var ( + MatchType_name = map[int32]string{ + 0: "MATCH_TYPE_UNSPECIFIED", + 1: "STRING_EQUAL", + 2: "STRING_NOT_EQUAL", + 3: "NOT_PRESENT", + 4: "COMMON_PREFIX", + } + MatchType_value = map[string]int32{ + "MATCH_TYPE_UNSPECIFIED": 0, + "STRING_EQUAL": 1, + "STRING_NOT_EQUAL": 2, + "NOT_PRESENT": 3, + "COMMON_PREFIX": 4, + } +) + +func (x MatchType) Enum() *MatchType { + p := new(MatchType) + *p = x + return p +} + +func (x MatchType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MatchType) Descriptor() protoreflect.EnumDescriptor { + return file_api_object_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (MatchType) Type() protoreflect.EnumType { + return &file_api_object_grpc_types_proto_enumTypes[1] +} + +func (x MatchType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Short header fields +type ShortHeader struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + xxx_hidden_CreationEpoch uint64 `protobuf:"varint,2,opt,name=creation_epoch,json=creationEpoch" json:"creation_epoch,omitempty"` + xxx_hidden_OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + xxx_hidden_ObjectType ObjectType `protobuf:"varint,4,opt,name=object_type,json=objectType,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` + xxx_hidden_PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength" json:"payload_length,omitempty"` + xxx_hidden_PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash" json:"payload_hash,omitempty"` + xxx_hidden_HomomorphicHash *grpc.Checksum `protobuf:"bytes,7,opt,name=homomorphic_hash,json=homomorphicHash" json:"homomorphic_hash,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ShortHeader) Reset() { + *x = ShortHeader{} + mi := &file_api_object_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ShortHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShortHeader) ProtoMessage() {} + +func (x *ShortHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ShortHeader) GetVersion() *grpc.Version { + if x != nil { + return x.xxx_hidden_Version + } + return nil +} + +func (x *ShortHeader) GetCreationEpoch() uint64 { + if x != nil { + return x.xxx_hidden_CreationEpoch + } + return 0 +} + +func (x *ShortHeader) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *ShortHeader) GetObjectType() ObjectType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 3) { + return x.xxx_hidden_ObjectType + } + } + return ObjectType_REGULAR +} + +func (x *ShortHeader) GetPayloadLength() uint64 { + if x != nil { + return x.xxx_hidden_PayloadLength + } + return 0 +} + +func (x *ShortHeader) GetPayloadHash() *grpc.Checksum { + if x != nil { + return x.xxx_hidden_PayloadHash + } + return nil +} + +func (x *ShortHeader) GetHomomorphicHash() *grpc.Checksum { + if x != nil { + return x.xxx_hidden_HomomorphicHash + } + return nil +} + +func (x *ShortHeader) SetVersion(v *grpc.Version) { + x.xxx_hidden_Version = v +} + +func (x *ShortHeader) SetCreationEpoch(v uint64) { + x.xxx_hidden_CreationEpoch = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 7) +} + +func (x *ShortHeader) SetOwnerId(v *grpc.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *ShortHeader) SetObjectType(v ObjectType) { + x.xxx_hidden_ObjectType = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 7) +} + +func (x *ShortHeader) SetPayloadLength(v uint64) { + x.xxx_hidden_PayloadLength = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 7) +} + +func (x *ShortHeader) SetPayloadHash(v *grpc.Checksum) { + x.xxx_hidden_PayloadHash = v +} + +func (x *ShortHeader) SetHomomorphicHash(v *grpc.Checksum) { + x.xxx_hidden_HomomorphicHash = v +} + +func (x *ShortHeader) HasVersion() bool { + if x == nil { + return false + } + return x.xxx_hidden_Version != nil +} + +func (x *ShortHeader) HasCreationEpoch() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *ShortHeader) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *ShortHeader) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *ShortHeader) HasPayloadLength() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *ShortHeader) HasPayloadHash() bool { + if x == nil { + return false + } + return x.xxx_hidden_PayloadHash != nil +} + +func (x *ShortHeader) HasHomomorphicHash() bool { + if x == nil { + return false + } + return x.xxx_hidden_HomomorphicHash != nil +} + +func (x *ShortHeader) ClearVersion() { + x.xxx_hidden_Version = nil +} + +func (x *ShortHeader) ClearCreationEpoch() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_CreationEpoch = 0 +} + +func (x *ShortHeader) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +func (x *ShortHeader) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_ObjectType = ObjectType_REGULAR +} + +func (x *ShortHeader) ClearPayloadLength() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_PayloadLength = 0 +} + +func (x *ShortHeader) ClearPayloadHash() { + x.xxx_hidden_PayloadHash = nil +} + +func (x *ShortHeader) ClearHomomorphicHash() { + x.xxx_hidden_HomomorphicHash = nil +} + +type ShortHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object format version. Effectively, the version of API library used to + // create particular object. + Version *grpc.Version + // Epoch when the object was created + CreationEpoch *uint64 + // Object's owner + OwnerId *grpc.OwnerID + // Type of the object payload content + ObjectType *ObjectType + // Size of payload in bytes. + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown + PayloadLength *uint64 + // Hash of payload bytes + PayloadHash *grpc.Checksum + // Homomorphic hash of the object payload + HomomorphicHash *grpc.Checksum +} + +func (b0 ShortHeader_builder) Build() *ShortHeader { + m0 := &ShortHeader{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Version = b.Version + if b.CreationEpoch != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 7) + x.xxx_hidden_CreationEpoch = *b.CreationEpoch + } + x.xxx_hidden_OwnerId = b.OwnerId + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 7) + x.xxx_hidden_ObjectType = *b.ObjectType + } + if b.PayloadLength != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 7) + x.xxx_hidden_PayloadLength = *b.PayloadLength + } + x.xxx_hidden_PayloadHash = b.PayloadHash + x.xxx_hidden_HomomorphicHash = b.HomomorphicHash + return m0 +} + +// Object Header +type Header struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + xxx_hidden_ContainerId *grpc.ContainerID `protobuf:"bytes,2,opt,name=container_id,json=containerID" json:"container_id,omitempty"` + xxx_hidden_OwnerId *grpc.OwnerID `protobuf:"bytes,3,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + xxx_hidden_CreationEpoch uint64 `protobuf:"varint,4,opt,name=creation_epoch,json=creationEpoch" json:"creation_epoch,omitempty"` + xxx_hidden_PayloadLength uint64 `protobuf:"varint,5,opt,name=payload_length,json=payloadLength" json:"payload_length,omitempty"` + xxx_hidden_PayloadHash *grpc.Checksum `protobuf:"bytes,6,opt,name=payload_hash,json=payloadHash" json:"payload_hash,omitempty"` + xxx_hidden_ObjectType ObjectType `protobuf:"varint,7,opt,name=object_type,json=objectType,enum=neo.fs.v2.object.ObjectType" json:"object_type,omitempty"` + xxx_hidden_HomomorphicHash *grpc.Checksum `protobuf:"bytes,8,opt,name=homomorphic_hash,json=homomorphicHash" json:"homomorphic_hash,omitempty"` + xxx_hidden_SessionToken *grpc1.SessionToken `protobuf:"bytes,9,opt,name=session_token,json=sessionToken" json:"session_token,omitempty"` + xxx_hidden_Attributes *[]*Header_Attribute `protobuf:"bytes,10,rep,name=attributes" json:"attributes,omitempty"` + xxx_hidden_Split *Header_Split `protobuf:"bytes,11,opt,name=split" json:"split,omitempty"` + xxx_hidden_Ec *Header_EC `protobuf:"bytes,12,opt,name=ec" json:"ec,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Header) Reset() { + *x = Header{} + mi := &file_api_object_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header) ProtoMessage() {} + +func (x *Header) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Header) GetVersion() *grpc.Version { + if x != nil { + return x.xxx_hidden_Version + } + return nil +} + +func (x *Header) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.xxx_hidden_ContainerId + } + return nil +} + +func (x *Header) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *Header) GetCreationEpoch() uint64 { + if x != nil { + return x.xxx_hidden_CreationEpoch + } + return 0 +} + +func (x *Header) GetPayloadLength() uint64 { + if x != nil { + return x.xxx_hidden_PayloadLength + } + return 0 +} + +func (x *Header) GetPayloadHash() *grpc.Checksum { + if x != nil { + return x.xxx_hidden_PayloadHash + } + return nil +} + +func (x *Header) GetObjectType() ObjectType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 6) { + return x.xxx_hidden_ObjectType + } + } + return ObjectType_REGULAR +} + +func (x *Header) GetHomomorphicHash() *grpc.Checksum { + if x != nil { + return x.xxx_hidden_HomomorphicHash + } + return nil +} + +func (x *Header) GetSessionToken() *grpc1.SessionToken { + if x != nil { + return x.xxx_hidden_SessionToken + } + return nil +} + +func (x *Header) GetAttributes() []*Header_Attribute { + if x != nil { + if x.xxx_hidden_Attributes != nil { + return *x.xxx_hidden_Attributes + } + } + return nil +} + +func (x *Header) GetSplit() *Header_Split { + if x != nil { + return x.xxx_hidden_Split + } + return nil +} + +func (x *Header) GetEc() *Header_EC { + if x != nil { + return x.xxx_hidden_Ec + } + return nil +} + +func (x *Header) SetVersion(v *grpc.Version) { + x.xxx_hidden_Version = v +} + +func (x *Header) SetContainerId(v *grpc.ContainerID) { + x.xxx_hidden_ContainerId = v +} + +func (x *Header) SetOwnerId(v *grpc.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *Header) SetCreationEpoch(v uint64) { + x.xxx_hidden_CreationEpoch = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 12) +} + +func (x *Header) SetPayloadLength(v uint64) { + x.xxx_hidden_PayloadLength = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 12) +} + +func (x *Header) SetPayloadHash(v *grpc.Checksum) { + x.xxx_hidden_PayloadHash = v +} + +func (x *Header) SetObjectType(v ObjectType) { + x.xxx_hidden_ObjectType = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 6, 12) +} + +func (x *Header) SetHomomorphicHash(v *grpc.Checksum) { + x.xxx_hidden_HomomorphicHash = v +} + +func (x *Header) SetSessionToken(v *grpc1.SessionToken) { + x.xxx_hidden_SessionToken = v +} + +func (x *Header) SetAttributes(v []*Header_Attribute) { + x.xxx_hidden_Attributes = &v +} + +func (x *Header) SetSplit(v *Header_Split) { + x.xxx_hidden_Split = v +} + +func (x *Header) SetEc(v *Header_EC) { + x.xxx_hidden_Ec = v +} + +func (x *Header) HasVersion() bool { + if x == nil { + return false + } + return x.xxx_hidden_Version != nil +} + +func (x *Header) HasContainerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ContainerId != nil +} + +func (x *Header) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *Header) HasCreationEpoch() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Header) HasPayloadLength() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *Header) HasPayloadHash() bool { + if x == nil { + return false + } + return x.xxx_hidden_PayloadHash != nil +} + +func (x *Header) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 6) +} + +func (x *Header) HasHomomorphicHash() bool { + if x == nil { + return false + } + return x.xxx_hidden_HomomorphicHash != nil +} + +func (x *Header) HasSessionToken() bool { + if x == nil { + return false + } + return x.xxx_hidden_SessionToken != nil +} + +func (x *Header) HasSplit() bool { + if x == nil { + return false + } + return x.xxx_hidden_Split != nil +} + +func (x *Header) HasEc() bool { + if x == nil { + return false + } + return x.xxx_hidden_Ec != nil +} + +func (x *Header) ClearVersion() { + x.xxx_hidden_Version = nil +} + +func (x *Header) ClearContainerId() { + x.xxx_hidden_ContainerId = nil +} + +func (x *Header) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +func (x *Header) ClearCreationEpoch() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_CreationEpoch = 0 +} + +func (x *Header) ClearPayloadLength() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_PayloadLength = 0 +} + +func (x *Header) ClearPayloadHash() { + x.xxx_hidden_PayloadHash = nil +} + +func (x *Header) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 6) + x.xxx_hidden_ObjectType = ObjectType_REGULAR +} + +func (x *Header) ClearHomomorphicHash() { + x.xxx_hidden_HomomorphicHash = nil +} + +func (x *Header) ClearSessionToken() { + x.xxx_hidden_SessionToken = nil +} + +func (x *Header) ClearSplit() { + x.xxx_hidden_Split = nil +} + +func (x *Header) ClearEc() { + x.xxx_hidden_Ec = nil +} + +type Header_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object format version. Effectively, the version of API library used to + // create particular object + Version *grpc.Version + // Object's container + ContainerId *grpc.ContainerID + // Object's owner + OwnerId *grpc.OwnerID + // Object creation Epoch + CreationEpoch *uint64 + // Size of payload in bytes. + // `0xFFFFFFFFFFFFFFFF` means `payload_length` is unknown. + PayloadLength *uint64 + // Hash of payload bytes + PayloadHash *grpc.Checksum + // Type of the object payload content + ObjectType *ObjectType + // Homomorphic hash of the object payload + HomomorphicHash *grpc.Checksum + // Session token, if it was used during Object creation. Need it to verify + // integrity and authenticity out of Request scope. + SessionToken *grpc1.SessionToken + // User-defined object attributes + Attributes []*Header_Attribute + // Position of the object in the split hierarchy + Split *Header_Split + // Erasure code chunk information. + Ec *Header_EC +} + +func (b0 Header_builder) Build() *Header { + m0 := &Header{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Version = b.Version + x.xxx_hidden_ContainerId = b.ContainerId + x.xxx_hidden_OwnerId = b.OwnerId + if b.CreationEpoch != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 12) + x.xxx_hidden_CreationEpoch = *b.CreationEpoch + } + if b.PayloadLength != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 12) + x.xxx_hidden_PayloadLength = *b.PayloadLength + } + x.xxx_hidden_PayloadHash = b.PayloadHash + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 6, 12) + x.xxx_hidden_ObjectType = *b.ObjectType + } + x.xxx_hidden_HomomorphicHash = b.HomomorphicHash + x.xxx_hidden_SessionToken = b.SessionToken + x.xxx_hidden_Attributes = &b.Attributes + x.xxx_hidden_Split = b.Split + x.xxx_hidden_Ec = b.Ec + return m0 +} + +// Object structure. Object is immutable and content-addressed. It means +// `ObjectID` will change if the header or the payload changes. It's calculated +// as a hash of header field which contains hash of the object's payload. +// +// For non-regular object types payload format depends on object type specified +// in the header. +type Object struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ObjectId *grpc.ObjectID `protobuf:"bytes,1,opt,name=object_id,json=objectID" json:"object_id,omitempty"` + xxx_hidden_Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + xxx_hidden_Header *Header `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` + xxx_hidden_Payload []byte `protobuf:"bytes,4,opt,name=payload" json:"payload,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Object) Reset() { + *x = Object{} + mi := &file_api_object_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Object) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Object) ProtoMessage() {} + +func (x *Object) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Object) GetObjectId() *grpc.ObjectID { + if x != nil { + return x.xxx_hidden_ObjectId + } + return nil +} + +func (x *Object) GetSignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *Object) GetHeader() *Header { + if x != nil { + return x.xxx_hidden_Header + } + return nil +} + +func (x *Object) GetPayload() []byte { + if x != nil { + return x.xxx_hidden_Payload + } + return nil +} + +func (x *Object) SetObjectId(v *grpc.ObjectID) { + x.xxx_hidden_ObjectId = v +} + +func (x *Object) SetSignature(v *grpc.Signature) { + x.xxx_hidden_Signature = v +} + +func (x *Object) SetHeader(v *Header) { + x.xxx_hidden_Header = v +} + +func (x *Object) SetPayload(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Payload = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *Object) HasObjectId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObjectId != nil +} + +func (x *Object) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *Object) HasHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_Header != nil +} + +func (x *Object) HasPayload() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Object) ClearObjectId() { + x.xxx_hidden_ObjectId = nil +} + +func (x *Object) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +func (x *Object) ClearHeader() { + x.xxx_hidden_Header = nil +} + +func (x *Object) ClearPayload() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Payload = nil +} + +type Object_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object's unique identifier. + ObjectId *grpc.ObjectID + // Signed object_id + Signature *grpc.Signature + // Object metadata headers + Header *Header + // Payload bytes + Payload []byte +} + +func (b0 Object_builder) Build() *Object { + m0 := &Object{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ObjectId = b.ObjectId + x.xxx_hidden_Signature = b.Signature + x.xxx_hidden_Header = b.Header + if b.Payload != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Payload = b.Payload + } + return m0 +} + +// Meta information of split hierarchy for object assembly. With the last part +// one can traverse linked list of split hierarchy back to the first part and +// assemble the original object. With a linking object one can assemble an +// object right from the object parts. +type SplitInfo struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_SplitId []byte `protobuf:"bytes,1,opt,name=split_id,json=splitId" json:"split_id,omitempty"` + xxx_hidden_LastPart *grpc.ObjectID `protobuf:"bytes,2,opt,name=last_part,json=lastPart" json:"last_part,omitempty"` + xxx_hidden_Link *grpc.ObjectID `protobuf:"bytes,3,opt,name=link" json:"link,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SplitInfo) Reset() { + *x = SplitInfo{} + mi := &file_api_object_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SplitInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SplitInfo) ProtoMessage() {} + +func (x *SplitInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SplitInfo) GetSplitId() []byte { + if x != nil { + return x.xxx_hidden_SplitId + } + return nil +} + +func (x *SplitInfo) GetLastPart() *grpc.ObjectID { + if x != nil { + return x.xxx_hidden_LastPart + } + return nil +} + +func (x *SplitInfo) GetLink() *grpc.ObjectID { + if x != nil { + return x.xxx_hidden_Link + } + return nil +} + +func (x *SplitInfo) SetSplitId(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_SplitId = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *SplitInfo) SetLastPart(v *grpc.ObjectID) { + x.xxx_hidden_LastPart = v +} + +func (x *SplitInfo) SetLink(v *grpc.ObjectID) { + x.xxx_hidden_Link = v +} + +func (x *SplitInfo) HasSplitId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *SplitInfo) HasLastPart() bool { + if x == nil { + return false + } + return x.xxx_hidden_LastPart != nil +} + +func (x *SplitInfo) HasLink() bool { + if x == nil { + return false + } + return x.xxx_hidden_Link != nil +} + +func (x *SplitInfo) ClearSplitId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_SplitId = nil +} + +func (x *SplitInfo) ClearLastPart() { + x.xxx_hidden_LastPart = nil +} + +func (x *SplitInfo) ClearLink() { + x.xxx_hidden_Link = nil +} + +type SplitInfo_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // 16 byte UUID used to identify the split object hierarchy parts. + SplitId []byte + // The identifier of the last object in split hierarchy parts. It contains + // split header with the original object header. + LastPart *grpc.ObjectID + // The identifier of a linking object for split hierarchy parts. It contains + // split header with the original object header and a sorted list of + // object parts. + Link *grpc.ObjectID +} + +func (b0 SplitInfo_builder) Build() *SplitInfo { + m0 := &SplitInfo{} + b, x := &b0, m0 + _, _ = b, x + if b.SplitId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_SplitId = b.SplitId + } + x.xxx_hidden_LastPart = b.LastPart + x.xxx_hidden_Link = b.Link + return m0 +} + +// Meta information for the erasure-encoded object. +type ECInfo struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Chunks *[]*ECInfo_Chunk `protobuf:"bytes,1,rep,name=chunks" json:"chunks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ECInfo) Reset() { + *x = ECInfo{} + mi := &file_api_object_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ECInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ECInfo) ProtoMessage() {} + +func (x *ECInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ECInfo) GetChunks() []*ECInfo_Chunk { + if x != nil { + if x.xxx_hidden_Chunks != nil { + return *x.xxx_hidden_Chunks + } + } + return nil +} + +func (x *ECInfo) SetChunks(v []*ECInfo_Chunk) { + x.xxx_hidden_Chunks = &v +} + +type ECInfo_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Chunk stored on the node. + Chunks []*ECInfo_Chunk +} + +func (b0 ECInfo_builder) Build() *ECInfo { + m0 := &ECInfo{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Chunks = &b.Chunks + return m0 +} + +// `Attribute` is a user-defined Key-Value metadata pair attached to an +// object. +// +// Key name must be an object-unique valid UTF-8 string. Value can't be empty. +// Objects with duplicated attribute names or attributes with empty values +// will be considered invalid. +// +// There are some "well-known" attributes starting with `__SYSTEM__` +// (`__NEOFS__` is deprecated) prefix that affect system behaviour: +// +// - [ __SYSTEM__UPLOAD_ID ] \ +// (`__NEOFS__UPLOAD_ID` is deprecated) \ +// Marks smaller parts of a split bigger object +// - [ __SYSTEM__EXPIRATION_EPOCH ] \ +// (`__NEOFS__EXPIRATION_EPOCH` is deprecated) \ +// The epoch after which object with no LOCKs on it becomes unavailable. +// Locked object continues to be available until each of the LOCKs expire. +// - [ __SYSTEM__TICK_EPOCH ] \ +// (`__NEOFS__TICK_EPOCH` is deprecated) \ +// Decimal number that defines what epoch must produce +// object notification with UTF-8 object address in a +// body (`0` value produces notification right after +// object put) +// - [ __SYSTEM__TICK_TOPIC ] \ +// (`__NEOFS__TICK_TOPIC` is deprecated) \ +// UTF-8 string topic ID that is used for object notification +// +// And some well-known attributes used by applications only: +// +// - Name \ +// Human-friendly name +// - FileName \ +// File name to be associated with the object on saving +// - FilePath \ +// Full path to be associated with the object on saving. Should start with a +// '/' and use '/' as a delimiting symbol. Trailing '/' should be +// interpreted as a virtual directory marker. If an object has conflicting +// FilePath and FileName, FilePath should have higher priority, because it +// is used to construct the directory tree. FilePath with trailing '/' and +// non-empty FileName attribute should not be used together. +// - Timestamp \ +// User-defined local time of object creation in Unix Timestamp format +// - Content-Type \ +// MIME Content Type of object's payload +// +// For detailed description of each well-known attribute please see the +// corresponding section in FrostFS Technical Specification. +type Header_Attribute struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + xxx_hidden_Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Header_Attribute) Reset() { + *x = Header_Attribute{} + mi := &file_api_object_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header_Attribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header_Attribute) ProtoMessage() {} + +func (x *Header_Attribute) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Header_Attribute) GetKey() string { + if x != nil { + if x.xxx_hidden_Key != nil { + return *x.xxx_hidden_Key + } + return "" + } + return "" +} + +func (x *Header_Attribute) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *Header_Attribute) SetKey(v string) { + x.xxx_hidden_Key = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *Header_Attribute) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *Header_Attribute) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Header_Attribute) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Header_Attribute) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Key = nil +} + +func (x *Header_Attribute) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Value = nil +} + +type Header_Attribute_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // string key to the object attribute + Key *string + // string value of the object attribute + Value *string +} + +func (b0 Header_Attribute_builder) Build() *Header_Attribute { + m0 := &Header_Attribute{} + b, x := &b0, m0 + _, _ = b, x + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Key = b.Key + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Bigger objects can be split into a chain of smaller objects. Information +// about inter-dependencies between spawned objects and how to re-construct +// the original one is in the `Split` headers. Parent and children objects +// must be within the same container. +type Header_Split struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` + xxx_hidden_Previous *grpc.ObjectID `protobuf:"bytes,2,opt,name=previous" json:"previous,omitempty"` + xxx_hidden_ParentSignature *grpc.Signature `protobuf:"bytes,3,opt,name=parent_signature,json=parentSignature" json:"parent_signature,omitempty"` + xxx_hidden_ParentHeader *Header `protobuf:"bytes,4,opt,name=parent_header,json=parentHeader" json:"parent_header,omitempty"` + xxx_hidden_Children *[]*grpc.ObjectID `protobuf:"bytes,5,rep,name=children" json:"children,omitempty"` + xxx_hidden_SplitId []byte `protobuf:"bytes,6,opt,name=split_id,json=splitID" json:"split_id,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Header_Split) Reset() { + *x = Header_Split{} + mi := &file_api_object_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header_Split) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header_Split) ProtoMessage() {} + +func (x *Header_Split) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Header_Split) GetParent() *grpc.ObjectID { + if x != nil { + return x.xxx_hidden_Parent + } + return nil +} + +func (x *Header_Split) GetPrevious() *grpc.ObjectID { + if x != nil { + return x.xxx_hidden_Previous + } + return nil +} + +func (x *Header_Split) GetParentSignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_ParentSignature + } + return nil +} + +func (x *Header_Split) GetParentHeader() *Header { + if x != nil { + return x.xxx_hidden_ParentHeader + } + return nil +} + +func (x *Header_Split) GetChildren() []*grpc.ObjectID { + if x != nil { + if x.xxx_hidden_Children != nil { + return *x.xxx_hidden_Children + } + } + return nil +} + +func (x *Header_Split) GetSplitId() []byte { + if x != nil { + return x.xxx_hidden_SplitId + } + return nil +} + +func (x *Header_Split) SetParent(v *grpc.ObjectID) { + x.xxx_hidden_Parent = v +} + +func (x *Header_Split) SetPrevious(v *grpc.ObjectID) { + x.xxx_hidden_Previous = v +} + +func (x *Header_Split) SetParentSignature(v *grpc.Signature) { + x.xxx_hidden_ParentSignature = v +} + +func (x *Header_Split) SetParentHeader(v *Header) { + x.xxx_hidden_ParentHeader = v +} + +func (x *Header_Split) SetChildren(v []*grpc.ObjectID) { + x.xxx_hidden_Children = &v +} + +func (x *Header_Split) SetSplitId(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_SplitId = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 6) +} + +func (x *Header_Split) HasParent() bool { + if x == nil { + return false + } + return x.xxx_hidden_Parent != nil +} + +func (x *Header_Split) HasPrevious() bool { + if x == nil { + return false + } + return x.xxx_hidden_Previous != nil +} + +func (x *Header_Split) HasParentSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_ParentSignature != nil +} + +func (x *Header_Split) HasParentHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_ParentHeader != nil +} + +func (x *Header_Split) HasSplitId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *Header_Split) ClearParent() { + x.xxx_hidden_Parent = nil +} + +func (x *Header_Split) ClearPrevious() { + x.xxx_hidden_Previous = nil +} + +func (x *Header_Split) ClearParentSignature() { + x.xxx_hidden_ParentSignature = nil +} + +func (x *Header_Split) ClearParentHeader() { + x.xxx_hidden_ParentHeader = nil +} + +func (x *Header_Split) ClearSplitId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_SplitId = nil +} + +type Header_Split_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the origin object. Known only to the minor child. + Parent *grpc.ObjectID + // Identifier of the left split neighbor + Previous *grpc.ObjectID + // `signature` field of the parent object. Used to reconstruct parent. + ParentSignature *grpc.Signature + // `header` field of the parent object. Used to reconstruct parent. + ParentHeader *Header + // List of identifiers of the objects generated by splitting current one. + Children []*grpc.ObjectID + // 16 byte UUIDv4 used to identify the split object hierarchy parts. Must be + // unique inside container. All objects participating in the split must have + // the same `split_id` value. + SplitId []byte +} + +func (b0 Header_Split_builder) Build() *Header_Split { + m0 := &Header_Split{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Parent = b.Parent + x.xxx_hidden_Previous = b.Previous + x.xxx_hidden_ParentSignature = b.ParentSignature + x.xxx_hidden_ParentHeader = b.ParentHeader + x.xxx_hidden_Children = &b.Children + if b.SplitId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 6) + x.xxx_hidden_SplitId = b.SplitId + } + return m0 +} + +// Erasure code can be applied to any object. +// Information about encoded object structure is stored in `EC` header. +// All objects belonging to a single EC group have the same `parent` field. +type Header_EC struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Parent *grpc.ObjectID `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` + xxx_hidden_Index uint32 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` + xxx_hidden_Total uint32 `protobuf:"varint,3,opt,name=total" json:"total,omitempty"` + xxx_hidden_HeaderLength uint32 `protobuf:"varint,4,opt,name=header_length,json=headerLength" json:"header_length,omitempty"` + xxx_hidden_Header []byte `protobuf:"bytes,5,opt,name=header" json:"header,omitempty"` + xxx_hidden_ParentSplitId []byte `protobuf:"bytes,6,opt,name=parent_split_id,json=parentSplitID" json:"parent_split_id,omitempty"` + xxx_hidden_ParentSplitParentId *grpc.ObjectID `protobuf:"bytes,7,opt,name=parent_split_parent_id,json=parentSplitParentID" json:"parent_split_parent_id,omitempty"` + xxx_hidden_ParentAttributes *[]*Header_Attribute `protobuf:"bytes,8,rep,name=parent_attributes,json=parentAttributes" json:"parent_attributes,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Header_EC) Reset() { + *x = Header_EC{} + mi := &file_api_object_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Header_EC) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header_EC) ProtoMessage() {} + +func (x *Header_EC) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Header_EC) GetParent() *grpc.ObjectID { + if x != nil { + return x.xxx_hidden_Parent + } + return nil +} + +func (x *Header_EC) GetIndex() uint32 { + if x != nil { + return x.xxx_hidden_Index + } + return 0 +} + +func (x *Header_EC) GetTotal() uint32 { + if x != nil { + return x.xxx_hidden_Total + } + return 0 +} + +func (x *Header_EC) GetHeaderLength() uint32 { + if x != nil { + return x.xxx_hidden_HeaderLength + } + return 0 +} + +func (x *Header_EC) GetHeader() []byte { + if x != nil { + return x.xxx_hidden_Header + } + return nil +} + +func (x *Header_EC) GetParentSplitId() []byte { + if x != nil { + return x.xxx_hidden_ParentSplitId + } + return nil +} + +func (x *Header_EC) GetParentSplitParentId() *grpc.ObjectID { + if x != nil { + return x.xxx_hidden_ParentSplitParentId + } + return nil +} + +func (x *Header_EC) GetParentAttributes() []*Header_Attribute { + if x != nil { + if x.xxx_hidden_ParentAttributes != nil { + return *x.xxx_hidden_ParentAttributes + } + } + return nil +} + +func (x *Header_EC) SetParent(v *grpc.ObjectID) { + x.xxx_hidden_Parent = v +} + +func (x *Header_EC) SetIndex(v uint32) { + x.xxx_hidden_Index = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 8) +} + +func (x *Header_EC) SetTotal(v uint32) { + x.xxx_hidden_Total = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 8) +} + +func (x *Header_EC) SetHeaderLength(v uint32) { + x.xxx_hidden_HeaderLength = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 8) +} + +func (x *Header_EC) SetHeader(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Header = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 8) +} + +func (x *Header_EC) SetParentSplitId(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_ParentSplitId = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 8) +} + +func (x *Header_EC) SetParentSplitParentId(v *grpc.ObjectID) { + x.xxx_hidden_ParentSplitParentId = v +} + +func (x *Header_EC) SetParentAttributes(v []*Header_Attribute) { + x.xxx_hidden_ParentAttributes = &v +} + +func (x *Header_EC) HasParent() bool { + if x == nil { + return false + } + return x.xxx_hidden_Parent != nil +} + +func (x *Header_EC) HasIndex() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Header_EC) HasTotal() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *Header_EC) HasHeaderLength() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Header_EC) HasHeader() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *Header_EC) HasParentSplitId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *Header_EC) HasParentSplitParentId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ParentSplitParentId != nil +} + +func (x *Header_EC) ClearParent() { + x.xxx_hidden_Parent = nil +} + +func (x *Header_EC) ClearIndex() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Index = 0 +} + +func (x *Header_EC) ClearTotal() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Total = 0 +} + +func (x *Header_EC) ClearHeaderLength() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_HeaderLength = 0 +} + +func (x *Header_EC) ClearHeader() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Header = nil +} + +func (x *Header_EC) ClearParentSplitId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_ParentSplitId = nil +} + +func (x *Header_EC) ClearParentSplitParentId() { + x.xxx_hidden_ParentSplitParentId = nil +} + +type Header_EC_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the origin object. Known to all chunks. + Parent *grpc.ObjectID + // Index of this chunk. + Index *uint32 + // Total number of chunks in this split. + Total *uint32 + // Total length of a parent header. Used to trim padding zeroes. + HeaderLength *uint32 + // Chunk of a parent header. + Header []byte + // As the origin object is EC-splitted its identifier is known to all + // chunks as parent. But parent itself can be a part of Split (does not + // relate to EC-split). In this case parent_split_id should be set. + ParentSplitId []byte + // EC-parent's parent ID. parent_split_parent_id is set if EC-parent, + // itself, is a part of Split and if an object ID of its parent is + // presented. The field allows to determine how EC-chunk is placed in Split + // hierarchy. + ParentSplitParentId *grpc.ObjectID + // EC parent's attributes. + ParentAttributes []*Header_Attribute +} + +func (b0 Header_EC_builder) Build() *Header_EC { + m0 := &Header_EC{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Parent = b.Parent + if b.Index != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 8) + x.xxx_hidden_Index = *b.Index + } + if b.Total != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 8) + x.xxx_hidden_Total = *b.Total + } + if b.HeaderLength != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 8) + x.xxx_hidden_HeaderLength = *b.HeaderLength + } + if b.Header != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 8) + x.xxx_hidden_Header = b.Header + } + if b.ParentSplitId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 8) + x.xxx_hidden_ParentSplitId = b.ParentSplitId + } + x.xxx_hidden_ParentSplitParentId = b.ParentSplitParentId + x.xxx_hidden_ParentAttributes = &b.ParentAttributes + return m0 +} + +type ECInfo_Chunk struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id *grpc.ObjectID `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + xxx_hidden_Index uint32 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` + xxx_hidden_Total uint32 `protobuf:"varint,3,opt,name=total" json:"total,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ECInfo_Chunk) Reset() { + *x = ECInfo_Chunk{} + mi := &file_api_object_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ECInfo_Chunk) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ECInfo_Chunk) ProtoMessage() {} + +func (x *ECInfo_Chunk) ProtoReflect() protoreflect.Message { + mi := &file_api_object_grpc_types_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ECInfo_Chunk) GetId() *grpc.ObjectID { + if x != nil { + return x.xxx_hidden_Id + } + return nil +} + +func (x *ECInfo_Chunk) GetIndex() uint32 { + if x != nil { + return x.xxx_hidden_Index + } + return 0 +} + +func (x *ECInfo_Chunk) GetTotal() uint32 { + if x != nil { + return x.xxx_hidden_Total + } + return 0 +} + +func (x *ECInfo_Chunk) SetId(v *grpc.ObjectID) { + x.xxx_hidden_Id = v +} + +func (x *ECInfo_Chunk) SetIndex(v uint32) { + x.xxx_hidden_Index = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *ECInfo_Chunk) SetTotal(v uint32) { + x.xxx_hidden_Total = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *ECInfo_Chunk) HasId() bool { + if x == nil { + return false + } + return x.xxx_hidden_Id != nil +} + +func (x *ECInfo_Chunk) HasIndex() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *ECInfo_Chunk) HasTotal() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *ECInfo_Chunk) ClearId() { + x.xxx_hidden_Id = nil +} + +func (x *ECInfo_Chunk) ClearIndex() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Index = 0 +} + +func (x *ECInfo_Chunk) ClearTotal() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Total = 0 +} + +type ECInfo_Chunk_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object ID of the chunk. + Id *grpc.ObjectID + // Index of the chunk. + Index *uint32 + // Total number of chunks in this split. + Total *uint32 +} + +func (b0 ECInfo_Chunk_builder) Build() *ECInfo_Chunk { + m0 := &ECInfo_Chunk{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Id = b.Id + if b.Index != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Index = *b.Index + } + if b.Total != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Total = *b.Total + } + return m0 +} + +var File_api_object_grpc_types_proto protoreflect.FileDescriptor + +var file_api_object_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, + 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x83, 0x03, 0x0a, 0x0b, 0x53, 0x68, 0x6f, + 0x72, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, + 0x63, 0x68, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x3d, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x0c, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, 0x6d, + 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, 0x68, + 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x22, 0x92, + 0x0b, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x08, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, + 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x3b, + 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0b, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3d, 0x0a, 0x0b, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x10, 0x68, 0x6f, + 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0f, + 0x68, 0x6f, 0x6d, 0x6f, 0x6d, 0x6f, 0x72, 0x70, 0x68, 0x69, 0x63, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x42, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x70, 0x6c, + 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x2e, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x52, 0x05, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x12, + 0x2b, 0x0a, 0x02, 0x65, 0x63, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x45, 0x43, 0x52, 0x02, 0x65, 0x63, 0x1a, 0x33, 0x0a, 0x09, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x1a, 0xc5, 0x02, 0x0a, 0x05, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, + 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, + 0x6f, 0x75, 0x73, 0x12, 0x44, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, + 0x64, 0x72, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x12, 0x19, + 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x49, 0x44, 0x1a, 0xe7, 0x02, 0x0a, 0x02, 0x45, 0x43, + 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x23, + 0x0a, 0x0d, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0f, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, + 0x74, 0x49, 0x44, 0x12, 0x4d, 0x0a, 0x16, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, + 0x6c, 0x69, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x13, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x6c, 0x69, 0x74, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x49, 0x44, 0x12, 0x4f, 0x0a, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, + 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x30, + 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x53, + 0x70, 0x6c, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, 0x69, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, 0x69, + 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, + 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x04, 0x6c, 0x69, + 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x44, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x9f, 0x01, 0x0a, 0x06, 0x45, 0x43, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x45, 0x43, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x43, 0x68, + 0x75, 0x6e, 0x6b, 0x52, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x1a, 0x5d, 0x0a, 0x05, 0x43, + 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x32, 0x0a, 0x0a, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x47, 0x55, + 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d, 0x42, 0x53, 0x54, 0x4f, + 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x03, 0x2a, 0x73, + 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, + 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, + 0x47, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, + 0x49, 0x4e, 0x47, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, + 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, + 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, + 0x58, 0x10, 0x04, 0x42, 0x62, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, + 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, + 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_object_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_object_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_api_object_grpc_types_proto_goTypes = []any{ + (ObjectType)(0), // 0: neo.fs.v2.object.ObjectType + (MatchType)(0), // 1: neo.fs.v2.object.MatchType + (*ShortHeader)(nil), // 2: neo.fs.v2.object.ShortHeader + (*Header)(nil), // 3: neo.fs.v2.object.Header + (*Object)(nil), // 4: neo.fs.v2.object.Object + (*SplitInfo)(nil), // 5: neo.fs.v2.object.SplitInfo + (*ECInfo)(nil), // 6: neo.fs.v2.object.ECInfo + (*Header_Attribute)(nil), // 7: neo.fs.v2.object.Header.Attribute + (*Header_Split)(nil), // 8: neo.fs.v2.object.Header.Split + (*Header_EC)(nil), // 9: neo.fs.v2.object.Header.EC + (*ECInfo_Chunk)(nil), // 10: neo.fs.v2.object.ECInfo.Chunk + (*grpc.Version)(nil), // 11: neo.fs.v2.refs.Version + (*grpc.OwnerID)(nil), // 12: neo.fs.v2.refs.OwnerID + (*grpc.Checksum)(nil), // 13: neo.fs.v2.refs.Checksum + (*grpc.ContainerID)(nil), // 14: neo.fs.v2.refs.ContainerID + (*grpc1.SessionToken)(nil), // 15: neo.fs.v2.session.SessionToken + (*grpc.ObjectID)(nil), // 16: neo.fs.v2.refs.ObjectID + (*grpc.Signature)(nil), // 17: neo.fs.v2.refs.Signature +} +var file_api_object_grpc_types_proto_depIdxs = []int32{ + 11, // 0: neo.fs.v2.object.ShortHeader.version:type_name -> neo.fs.v2.refs.Version + 12, // 1: neo.fs.v2.object.ShortHeader.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 0, // 2: neo.fs.v2.object.ShortHeader.object_type:type_name -> neo.fs.v2.object.ObjectType + 13, // 3: neo.fs.v2.object.ShortHeader.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 13, // 4: neo.fs.v2.object.ShortHeader.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 11, // 5: neo.fs.v2.object.Header.version:type_name -> neo.fs.v2.refs.Version + 14, // 6: neo.fs.v2.object.Header.container_id:type_name -> neo.fs.v2.refs.ContainerID + 12, // 7: neo.fs.v2.object.Header.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 13, // 8: neo.fs.v2.object.Header.payload_hash:type_name -> neo.fs.v2.refs.Checksum + 0, // 9: neo.fs.v2.object.Header.object_type:type_name -> neo.fs.v2.object.ObjectType + 13, // 10: neo.fs.v2.object.Header.homomorphic_hash:type_name -> neo.fs.v2.refs.Checksum + 15, // 11: neo.fs.v2.object.Header.session_token:type_name -> neo.fs.v2.session.SessionToken + 7, // 12: neo.fs.v2.object.Header.attributes:type_name -> neo.fs.v2.object.Header.Attribute + 8, // 13: neo.fs.v2.object.Header.split:type_name -> neo.fs.v2.object.Header.Split + 9, // 14: neo.fs.v2.object.Header.ec:type_name -> neo.fs.v2.object.Header.EC + 16, // 15: neo.fs.v2.object.Object.object_id:type_name -> neo.fs.v2.refs.ObjectID + 17, // 16: neo.fs.v2.object.Object.signature:type_name -> neo.fs.v2.refs.Signature + 3, // 17: neo.fs.v2.object.Object.header:type_name -> neo.fs.v2.object.Header + 16, // 18: neo.fs.v2.object.SplitInfo.last_part:type_name -> neo.fs.v2.refs.ObjectID + 16, // 19: neo.fs.v2.object.SplitInfo.link:type_name -> neo.fs.v2.refs.ObjectID + 10, // 20: neo.fs.v2.object.ECInfo.chunks:type_name -> neo.fs.v2.object.ECInfo.Chunk + 16, // 21: neo.fs.v2.object.Header.Split.parent:type_name -> neo.fs.v2.refs.ObjectID + 16, // 22: neo.fs.v2.object.Header.Split.previous:type_name -> neo.fs.v2.refs.ObjectID + 17, // 23: neo.fs.v2.object.Header.Split.parent_signature:type_name -> neo.fs.v2.refs.Signature + 3, // 24: neo.fs.v2.object.Header.Split.parent_header:type_name -> neo.fs.v2.object.Header + 16, // 25: neo.fs.v2.object.Header.Split.children:type_name -> neo.fs.v2.refs.ObjectID + 16, // 26: neo.fs.v2.object.Header.EC.parent:type_name -> neo.fs.v2.refs.ObjectID + 16, // 27: neo.fs.v2.object.Header.EC.parent_split_parent_id:type_name -> neo.fs.v2.refs.ObjectID + 7, // 28: neo.fs.v2.object.Header.EC.parent_attributes:type_name -> neo.fs.v2.object.Header.Attribute + 16, // 29: neo.fs.v2.object.ECInfo.Chunk.id:type_name -> neo.fs.v2.refs.ObjectID + 30, // [30:30] is the sub-list for method output_type + 30, // [30:30] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name +} + +func init() { file_api_object_grpc_types_proto_init() } +func file_api_object_grpc_types_proto_init() { + if File_api_object_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_object_grpc_types_proto_rawDesc, + NumEnums: 2, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_object_grpc_types_proto_goTypes, + DependencyIndexes: file_api_object_grpc_types_proto_depIdxs, + EnumInfos: file_api_object_grpc_types_proto_enumTypes, + MessageInfos: file_api_object_grpc_types_proto_msgTypes, + }.Build() + File_api_object_grpc_types_proto = out.File + file_api_object_grpc_types_proto_rawDesc = nil + file_api_object_grpc_types_proto_goTypes = nil + file_api_object_grpc_types_proto_depIdxs = nil +} diff --git a/api/object/json.go b/api/object/json.go new file mode 100644 index 00000000..faef2499 --- /dev/null +++ b/api/object/json.go @@ -0,0 +1,94 @@ +package object + +import ( + object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (h *ShortHeader) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(h) +} + +func (h *ShortHeader) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(h, data, new(object.ShortHeader)) +} + +func (a *Attribute) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(a) +} + +func (a *Attribute) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(a, data, new(object.Header_Attribute)) +} + +func (h *SplitHeader) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(h) +} + +func (h *SplitHeader) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(h, data, new(object.Header_Split)) +} + +func (h *Header) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(h) +} + +func (h *Header) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(h, data, new(object.Header)) +} + +func (h *HeaderWithSignature) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(h) +} + +func (h *HeaderWithSignature) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(h, data, new(object.HeaderWithSignature)) +} + +func (o *Object) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(o) +} + +func (o *Object) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(o, data, new(object.Object)) +} + +func (s *SplitInfo) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(s) +} + +func (s *SplitInfo) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(s, data, new(object.SplitInfo)) +} + +func (e *ECInfo) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(e) +} + +func (e *ECInfo) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(e, data, new(object.ECInfo)) +} + +func (e *ECChunk) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(e) +} + +func (e *ECChunk) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(e, data, new(object.ECInfo_Chunk)) +} + +func (f *SearchFilter) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(f) +} + +func (f *SearchFilter) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(f, data, new(object.SearchRequest_Body_Filter)) +} + +func (r *Range) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(r) +} + +func (r *Range) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(r, data, new(object.Range)) +} diff --git a/api/object/lock.go b/api/object/lock.go new file mode 100644 index 00000000..94be395f --- /dev/null +++ b/api/object/lock.go @@ -0,0 +1,160 @@ +package object + +import ( + "errors" + "fmt" + + lock "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/lock/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +// Lock represents object Lock message from NeoFS API V2 protocol. +type Lock struct { + members []refs.ObjectID +} + +// NumberOfMembers returns length of lock list. +func (x *Lock) NumberOfMembers() int { + if x != nil { + return len(x.members) + } + + return 0 +} + +// IterateMembers passes members of the lock list to f. +func (x *Lock) IterateMembers(f func(refs.ObjectID)) { + if x != nil { + for i := range x.members { + f(x.members[i]) + } + } +} + +// SetMembers sets list of locked members. +// Arg must not be mutated for the duration of the Lock. +func (x *Lock) SetMembers(ids []refs.ObjectID) { + x.members = ids +} + +const ( + _ = iota + fNumLockMembers +) + +// StableMarshal encodes the Lock into Protocol Buffers binary format +// with direct field order. +func (x *Lock) StableMarshal(buf []byte) []byte { + if x == nil || len(x.members) == 0 { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var offset int + + for i := range x.members { + offset += proto.NestedStructureMarshal(fNumLockMembers, buf[offset:], &x.members[i]) + } + + return buf +} + +// StableSize size of the buffer required to write the Lock in Protocol Buffers +// binary format. +func (x *Lock) StableSize() (sz int) { + if x != nil { + for i := range x.members { + sz += proto.NestedStructureSize(fNumLockMembers, &x.members[i]) + } + } + + return +} + +// Unmarshal decodes the Lock from its Protocol Buffers binary format. +func (x *Lock) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(lock.Lock)) +} + +func (x *Lock) ToGRPCMessage() grpc.Message { + var m *lock.Lock + + if x != nil { + m = new(lock.Lock) + + var members []*refsGRPC.ObjectID + + if x.members != nil { + members = make([]*refsGRPC.ObjectID, len(x.members)) + + for i := range x.members { + members[i] = x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID) + } + } + + m.SetMembers(members) + } + + return m +} + +func (x *Lock) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*lock.Lock) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + members := v.GetMembers() + if members == nil { + x.members = nil + } else { + x.members = make([]refs.ObjectID, len(members)) + var err error + + for i := range x.members { + err = x.members[i].FromGRPCMessage(members[i]) + if err != nil { + return err + } + } + } + + return nil +} + +// WriteLock writes Lock to the Object as a payload content. +// The object must not be nil. +func WriteLock(obj *Object, lock Lock) { + hdr := obj.GetHeader() + if hdr == nil { + hdr = new(Header) + obj.SetHeader(hdr) + } + + hdr.SetObjectType(TypeLock) + + payload := lock.StableMarshal(nil) + obj.SetPayload(payload) +} + +// ReadLock reads Lock from the Object payload content. +func ReadLock(lock *Lock, obj Object) error { + payload := obj.GetPayload() + if len(payload) == 0 { + return errors.New("empty payload") + } + + err := lock.Unmarshal(payload) + if err != nil { + return fmt.Errorf("decode lock content from payload: %w", err) + } + + return nil +} diff --git a/api/object/lock_test.go b/api/object/lock_test.go new file mode 100644 index 00000000..25157231 --- /dev/null +++ b/api/object/lock_test.go @@ -0,0 +1,26 @@ +package object_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + objecttest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/test" + "github.com/stretchr/testify/require" +) + +func TestLockRW(t *testing.T) { + var l object.Lock + var obj object.Object + + require.Error(t, object.ReadLock(&l, obj)) + + l = *objecttest.GenerateLock(false) + + object.WriteLock(&obj, l) + + var l2 object.Lock + + require.NoError(t, object.ReadLock(&l2, obj)) + + require.Equal(t, l, l2) +} diff --git a/api/object/marshal.go b/api/object/marshal.go new file mode 100644 index 00000000..2ed888cb --- /dev/null +++ b/api/object/marshal.go @@ -0,0 +1,1431 @@ +package object + +import ( + object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + shortHdrVersionField = 1 + shortHdrEpochField = 2 + shortHdrOwnerField = 3 + shortHdrObjectTypeField = 4 + shortHdrPayloadLength = 5 + shortHdrHashField = 6 + shortHdrHomoHashField = 7 + + attributeKeyField = 1 + attributeValueField = 2 + + splitHdrParentField = 1 + splitHdrPreviousField = 2 + splitHdrParentSignatureField = 3 + splitHdrParentHeaderField = 4 + splitHdrChildrenField = 5 + splitHdrSplitIDField = 6 + + ecHdrParentField = 1 + ecHdrIndexField = 2 + ecHdrTotalField = 3 + ecHdrHeaderLengthField = 4 + ecHdrHeaderField = 5 + ecHdrParentSplitID = 6 + ecHdrParentSplitParentID = 7 + ecHdrParentAttributes = 8 + + hdrVersionField = 1 + hdrContainerIDField = 2 + hdrOwnerIDField = 3 + hdrEpochField = 4 + hdrPayloadLengthField = 5 + hdrPayloadHashField = 6 + hdrObjectTypeField = 7 + hdrHomomorphicHashField = 8 + hdrSessionTokenField = 9 + hdrAttributesField = 10 + hdrSplitField = 11 + hdrECField = 12 + + hdrWithSigHeaderField = 1 + hdrWithSigSignatureField = 2 + + objIDField = 1 + objSignatureField = 2 + objHeaderField = 3 + objPayloadField = 4 + + splitInfoSplitIDField = 1 + splitInfoLastPartField = 2 + splitInfoLinkField = 3 + + ecInfoChunksField = 1 + + ecChunkIDField = 1 + ecChunkIndexField = 2 + ecChunkTotalField = 3 + + getReqBodyAddressField = 1 + getReqBodyRawFlagField = 2 + + getRespInitObjectIDField = 1 + getRespInitSignatureField = 2 + getRespInitHeaderField = 3 + + getRespBodyInitField = 1 + getRespBodyChunkField = 2 + getRespBodySplitInfoField = 3 + getRespBodyECInfoField = 4 + + putReqInitObjectIDField = 1 + putReqInitSignatureField = 2 + putReqInitHeaderField = 3 + putReqInitCopiesNumField = 4 + + putReqBodyInitField = 1 + putReqBodyChunkField = 2 + + putRespBodyObjectIDField = 1 + + deleteReqBodyAddressField = 1 + + deleteRespBodyTombstoneFNum = 1 + + headReqBodyAddressField = 1 + headReqBodyMainFlagField = 2 + headReqBodyRawFlagField = 3 + + headRespBodyHeaderField = 1 + headRespBodyShortHeaderField = 2 + headRespBodySplitInfoField = 3 + headRespBodyECInfoField = 4 + + searchFilterMatchField = 1 + searchFilterNameField = 2 + searchFilterValueField = 3 + + searchReqBodyContainerIDField = 1 + searchReqBodyVersionField = 2 + searchReqBodyFiltersField = 3 + + searchRespBodyObjectIDsField = 1 + + rangeOffsetField = 1 + rangeLengthField = 2 + + getRangeReqBodyAddressField = 1 + getRangeReqBodyRangeField = 2 + getRangeReqBodyRawField = 3 + + getRangeRespChunkField = 1 + getRangeRespSplitInfoField = 2 + getRangeRespECInfoField = 3 + + getRangeHashReqBodyAddressField = 1 + getRangeHashReqBodyRangesField = 2 + getRangeHashReqBodySaltField = 3 + getRangeHashReqBodyTypeField = 4 + + getRangeHashRespBodyTypeField = 1 + getRangeHashRespBodyHashListField = 2 + + putSingleReqObjectField = 1 + putSingleReqCopiesNumberField = 2 + + patchRequestBodyPatchRangeField = 1 + patchRequestBodyPatchChunkField = 2 + + patchRequestBodyAddrField = 1 + patchRequestBodyNewAttrsField = 2 + patchRequestBodyReplaceAttrField = 3 + patchRequestBodyPatchField = 4 + patchRequestBodyNewSplitHeaderField = 5 + + patchResponseBodyObjectIDField = 1 +) + +func (h *ShortHeader) StableMarshal(buf []byte) []byte { + if h == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(shortHdrVersionField, buf[offset:], h.version) + offset += proto.UInt64Marshal(shortHdrEpochField, buf[offset:], h.creatEpoch) + offset += proto.NestedStructureMarshal(shortHdrOwnerField, buf[offset:], h.ownerID) + offset += proto.EnumMarshal(shortHdrObjectTypeField, buf[offset:], int32(h.typ)) + offset += proto.UInt64Marshal(shortHdrPayloadLength, buf[offset:], h.payloadLen) + offset += proto.NestedStructureMarshal(shortHdrHashField, buf[offset:], h.payloadHash) + proto.NestedStructureMarshal(shortHdrHomoHashField, buf[offset:], h.homoHash) + + return buf +} + +func (h *ShortHeader) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(shortHdrVersionField, h.version) + size += proto.UInt64Size(shortHdrEpochField, h.creatEpoch) + size += proto.NestedStructureSize(shortHdrOwnerField, h.ownerID) + size += proto.EnumSize(shortHdrObjectTypeField, int32(h.typ)) + size += proto.UInt64Size(shortHdrPayloadLength, h.payloadLen) + size += proto.NestedStructureSize(shortHdrHashField, h.payloadHash) + size += proto.NestedStructureSize(shortHdrHomoHashField, h.homoHash) + + return size +} + +func (h *ShortHeader) Unmarshal(data []byte) error { + return message.Unmarshal(h, data, new(object.ShortHeader)) +} + +func (a *Attribute) StableMarshal(buf []byte) []byte { + if a == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var offset int + + offset += proto.StringMarshal(attributeKeyField, buf[offset:], a.key) + proto.StringMarshal(attributeValueField, buf[offset:], a.val) + + return buf +} + +func (a *Attribute) StableSize() (size int) { + if a == nil { + return 0 + } + + size += proto.StringSize(shortHdrVersionField, a.key) + size += proto.StringSize(shortHdrEpochField, a.val) + + return size +} + +func (a *Attribute) Unmarshal(data []byte) error { + return message.Unmarshal(a, data, new(object.Header_Attribute)) +} + +func (h *SplitHeader) StableMarshal(buf []byte) []byte { + if h == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(splitHdrParentField, buf[offset:], h.par) + offset += proto.NestedStructureMarshal(splitHdrPreviousField, buf[offset:], h.prev) + offset += proto.NestedStructureMarshal(splitHdrParentSignatureField, buf[offset:], h.parSig) + offset += proto.NestedStructureMarshal(splitHdrParentHeaderField, buf[offset:], h.parHdr) + offset += refs.ObjectIDNestedListMarshal(splitHdrChildrenField, buf[offset:], h.children) + proto.BytesMarshal(splitHdrSplitIDField, buf[offset:], h.splitID) + + return buf +} + +func (h *SplitHeader) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(splitHdrParentField, h.par) + size += proto.NestedStructureSize(splitHdrPreviousField, h.prev) + size += proto.NestedStructureSize(splitHdrParentSignatureField, h.parSig) + size += proto.NestedStructureSize(splitHdrParentHeaderField, h.parHdr) + size += refs.ObjectIDNestedListSize(splitHdrChildrenField, h.children) + size += proto.BytesSize(splitHdrSplitIDField, h.splitID) + + return size +} + +func (h *SplitHeader) Unmarshal(data []byte) error { + return message.Unmarshal(h, data, new(object.Header_Split)) +} + +func (h *ECHeader) StableMarshal(buf []byte) []byte { + if h == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(ecHdrParentField, buf[offset:], h.Parent) + offset += proto.UInt32Marshal(ecHdrIndexField, buf[offset:], h.Index) + offset += proto.UInt32Marshal(ecHdrTotalField, buf[offset:], h.Total) + offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength) + offset += proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header) + offset += proto.BytesMarshal(ecHdrParentSplitID, buf[offset:], h.ParentSplitID) + offset += proto.NestedStructureMarshal(ecHdrParentSplitParentID, buf[offset:], h.ParentSplitParentID) + for i := range h.ParentAttributes { + offset += proto.NestedStructureMarshal(ecHdrParentAttributes, buf[offset:], &h.ParentAttributes[i]) + } + return buf +} + +func (h *ECHeader) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(ecHdrParentField, h.Parent) + size += proto.UInt32Size(ecHdrIndexField, h.Index) + size += proto.UInt32Size(ecHdrTotalField, h.Total) + size += proto.UInt32Size(ecHdrHeaderLengthField, h.HeaderLength) + size += proto.BytesSize(ecHdrHeaderField, h.Header) + size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID) + size += proto.NestedStructureSize(ecHdrParentSplitParentID, h.ParentSplitParentID) + for i := range h.ParentAttributes { + size += proto.NestedStructureSize(ecHdrParentAttributes, &h.ParentAttributes[i]) + } + + return size +} + +func (h *ECHeader) Unmarshal(data []byte) error { + return message.Unmarshal(h, data, new(object.Header_EC)) +} + +func (h *Header) StableMarshal(buf []byte) []byte { + if h == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(hdrVersionField, buf[offset:], h.version) + offset += proto.NestedStructureMarshal(hdrContainerIDField, buf[offset:], h.cid) + offset += proto.NestedStructureMarshal(hdrOwnerIDField, buf[offset:], h.ownerID) + offset += proto.UInt64Marshal(hdrEpochField, buf[offset:], h.creatEpoch) + offset += proto.UInt64Marshal(hdrPayloadLengthField, buf[offset:], h.payloadLen) + offset += proto.NestedStructureMarshal(hdrPayloadHashField, buf[offset:], h.payloadHash) + offset += proto.EnumMarshal(hdrObjectTypeField, buf[offset:], int32(h.typ)) + offset += proto.NestedStructureMarshal(hdrHomomorphicHashField, buf[offset:], h.homoHash) + offset += proto.NestedStructureMarshal(hdrSessionTokenField, buf[offset:], h.sessionToken) + + for i := range h.attr { + offset += proto.NestedStructureMarshal(hdrAttributesField, buf[offset:], &h.attr[i]) + } + + proto.NestedStructureMarshal(hdrSplitField, buf[offset:], h.split) + proto.NestedStructureMarshal(hdrECField, buf[offset:], h.ec) + + return buf +} + +func (h *Header) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(hdrVersionField, h.version) + size += proto.NestedStructureSize(hdrContainerIDField, h.cid) + size += proto.NestedStructureSize(hdrOwnerIDField, h.ownerID) + size += proto.UInt64Size(hdrEpochField, h.creatEpoch) + size += proto.UInt64Size(hdrPayloadLengthField, h.payloadLen) + size += proto.NestedStructureSize(hdrPayloadHashField, h.payloadHash) + size += proto.EnumSize(hdrObjectTypeField, int32(h.typ)) + size += proto.NestedStructureSize(hdrHomomorphicHashField, h.homoHash) + size += proto.NestedStructureSize(hdrSessionTokenField, h.sessionToken) + for i := range h.attr { + size += proto.NestedStructureSize(hdrAttributesField, &h.attr[i]) + } + size += proto.NestedStructureSize(hdrSplitField, h.split) + size += proto.NestedStructureSize(hdrECField, h.ec) + + return size +} + +func (h *Header) Unmarshal(data []byte) error { + return message.Unmarshal(h, data, new(object.Header)) +} + +func (h *HeaderWithSignature) StableMarshal(buf []byte) []byte { + if h == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, h.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(hdrWithSigHeaderField, buf[offset:], h.header) + proto.NestedStructureMarshal(hdrWithSigSignatureField, buf[offset:], h.signature) + + return buf +} + +func (h *HeaderWithSignature) StableSize() (size int) { + if h == nil { + return 0 + } + + size += proto.NestedStructureSize(hdrVersionField, h.header) + size += proto.NestedStructureSize(hdrContainerIDField, h.signature) + + return size +} + +func (h *HeaderWithSignature) Unmarshal(data []byte) error { + return message.Unmarshal(h, data, new(object.HeaderWithSignature)) +} + +func (o *Object) StableMarshal(buf []byte) []byte { + if o == nil { + return []byte{} + } + + if o.marshalData != nil { + if buf == nil { + return o.marshalData + } + copy(buf, o.marshalData) + return buf + } + + if buf == nil { + buf = make([]byte, o.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(objIDField, buf[offset:], o.objectID) + offset += proto.NestedStructureMarshal(objSignatureField, buf[offset:], o.idSig) + offset += proto.NestedStructureMarshal(objHeaderField, buf[offset:], o.header) + proto.BytesMarshal(objPayloadField, buf[offset:], o.payload) + + return buf +} + +// SetMarshalData sets marshal data to reduce memory allocations. +// +// It is unsafe to modify/copy object data after setting marshal data. +func (o *Object) SetMarshalData(data []byte) { + if o == nil { + return + } + o.marshalData = data +} + +func (o *Object) StableSize() (size int) { + if o == nil { + return 0 + } + + size += proto.NestedStructureSize(objIDField, o.objectID) + size += proto.NestedStructureSize(objSignatureField, o.idSig) + size += proto.NestedStructureSize(objHeaderField, o.header) + size += proto.BytesSize(objPayloadField, o.payload) + + return size +} + +func (o *Object) Unmarshal(data []byte) error { + return message.Unmarshal(o, data, new(object.Object)) +} + +func (s *SplitInfo) StableMarshal(buf []byte) []byte { + if s == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var offset int + + offset += proto.BytesMarshal(splitInfoSplitIDField, buf[offset:], s.splitID) + offset += proto.NestedStructureMarshal(splitInfoLastPartField, buf[offset:], s.lastPart) + proto.NestedStructureMarshal(splitInfoLinkField, buf[offset:], s.link) + + return buf +} + +func (s *SplitInfo) StableSize() (size int) { + if s == nil { + return 0 + } + + size += proto.BytesSize(splitInfoSplitIDField, s.splitID) + size += proto.NestedStructureSize(splitInfoLastPartField, s.lastPart) + size += proto.NestedStructureSize(splitInfoLinkField, s.link) + + return size +} + +func (s *SplitInfo) Unmarshal(data []byte) error { + return message.Unmarshal(s, data, new(object.SplitInfo)) +} + +func (e *ECInfo) StableMarshal(buf []byte) []byte { + if e == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, e.StableSize()) + } + + var offset int + + for i := range e.Chunks { + offset += proto.NestedStructureMarshal(ecInfoChunksField, buf[offset:], &e.Chunks[i]) + } + + return buf +} + +func (e *ECInfo) StableSize() (size int) { + if e == nil { + return 0 + } + + for i := range e.Chunks { + size += proto.NestedStructureSize(ecInfoChunksField, &e.Chunks[i]) + } + + return size +} + +func (e *ECInfo) Unmarshal(data []byte) error { + return message.Unmarshal(e, data, new(object.ECInfo)) +} + +func (c *ECChunk) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(ecChunkIDField, buf[offset:], &c.ID) + offset += proto.UInt32Marshal(ecChunkIndexField, buf[offset:], c.Index) + proto.UInt32Marshal(ecChunkTotalField, buf[offset:], c.Total) + + return buf +} + +func (c *ECChunk) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.NestedStructureSize(ecChunkIDField, &c.ID) + size += proto.UInt32Size(ecChunkIndexField, c.Index) + size += proto.UInt32Size(ecChunkTotalField, c.Total) + + return size +} + +func (c *ECChunk) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(object.ECInfo_Chunk)) +} + +func (r *GetRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(getReqBodyAddressField, buf[offset:], r.addr) + proto.BoolMarshal(getReqBodyRawFlagField, buf[offset:], r.raw) + + return buf +} + +func (r *GetRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getReqBodyAddressField, r.addr) + size += proto.BoolSize(getReqBodyRawFlagField, r.raw) + + return size +} + +func (r *GetRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRequest_Body)) +} + +func (r *GetObjectPartInit) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(getRespInitObjectIDField, buf[offset:], r.id) + offset += proto.NestedStructureMarshal(getRespInitSignatureField, buf[offset:], r.sig) + proto.NestedStructureMarshal(getRespInitHeaderField, buf[offset:], r.hdr) + + return buf +} + +func (r *GetObjectPartInit) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getRespInitObjectIDField, r.id) + size += proto.NestedStructureSize(getRespInitSignatureField, r.sig) + size += proto.NestedStructureSize(getRespInitHeaderField, r.hdr) + + return size +} + +func (r *GetObjectPartInit) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetResponse_Body_Init)) +} + +func (r *GetResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + switch v := r.objPart.(type) { + case nil: + case *GetObjectPartInit: + proto.NestedStructureMarshal(getRespBodyInitField, buf, v) + case *GetObjectPartChunk: + if v != nil { + proto.BytesMarshal(getRespBodyChunkField, buf, v.chunk) + } + case *SplitInfo: + proto.NestedStructureMarshal(getRespBodySplitInfoField, buf, v) + case *ECInfo: + proto.NestedStructureMarshal(getRespBodyECInfoField, buf, v) + default: + panic("unknown one of object get response body type") + } + + return buf +} + +func (r *GetResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + switch v := r.objPart.(type) { + case nil: + case *GetObjectPartInit: + size += proto.NestedStructureSize(getRespBodyInitField, v) + case *GetObjectPartChunk: + if v != nil { + size += proto.BytesSize(getRespBodyChunkField, v.chunk) + } + case *SplitInfo: + size += proto.NestedStructureSize(getRespBodySplitInfoField, v) + case *ECInfo: + size += proto.NestedStructureSize(getRespBodyECInfoField, v) + default: + panic("unknown one of object get response body type") + } + + return +} + +func (r *GetResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetResponse_Body)) +} + +func (r *PutObjectPartInit) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id) + offset += proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig) + offset += proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr) + proto.RepeatedUInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) + + return buf +} + +func (r *PutObjectPartInit) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(putReqInitObjectIDField, r.id) + size += proto.NestedStructureSize(putReqInitSignatureField, r.sig) + size += proto.NestedStructureSize(putReqInitHeaderField, r.hdr) + + arrSize, _ := proto.RepeatedUInt32Size(putReqInitCopiesNumField, r.copyNum) + size += arrSize + + return size +} + +func (r *PutObjectPartInit) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutRequest_Body_Init)) +} + +func (r *PutRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + switch v := r.objPart.(type) { + case nil: + case *PutObjectPartInit: + proto.NestedStructureMarshal(putReqBodyInitField, buf, v) + case *PutObjectPartChunk: + if v != nil { + proto.BytesMarshal(putReqBodyChunkField, buf, v.chunk) + } + default: + panic("unknown one of object put request body type") + } + + return buf +} + +func (r *PutRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + switch v := r.objPart.(type) { + case nil: + case *PutObjectPartInit: + size += proto.NestedStructureSize(putReqBodyInitField, v) + case *PutObjectPartChunk: + if v != nil { + size += proto.BytesSize(putReqBodyChunkField, v.chunk) + } + default: + panic("unknown one of object get response body type") + } + + return size +} + +func (r *PutRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutRequest_Body)) +} + +func (r *PutResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + proto.NestedStructureMarshal(putRespBodyObjectIDField, buf, r.id) + + return buf +} + +func (r *PutResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(putRespBodyObjectIDField, r.id) + + return size +} + +func (r *PutResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutResponse_Body)) +} + +func (r *DeleteRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + proto.NestedStructureMarshal(deleteReqBodyAddressField, buf, r.addr) + + return buf +} + +func (r *DeleteRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(deleteReqBodyAddressField, r.addr) + + return size +} + +func (r *DeleteRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.DeleteRequest_Body)) +} + +func (r *DeleteResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + proto.NestedStructureMarshal(deleteRespBodyTombstoneFNum, buf, r.tombstone) + + return buf +} + +func (r *DeleteResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(deleteRespBodyTombstoneFNum, r.tombstone) + + return size +} + +func (r *DeleteResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.DeleteResponse_Body)) +} + +func (r *HeadRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(headReqBodyAddressField, buf[offset:], r.addr) + offset += proto.BoolMarshal(headReqBodyMainFlagField, buf[offset:], r.mainOnly) + proto.BoolMarshal(headReqBodyRawFlagField, buf[offset:], r.raw) + + return buf +} + +func (r *HeadRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(headReqBodyAddressField, r.addr) + size += proto.BoolSize(headReqBodyMainFlagField, r.mainOnly) + size += proto.BoolSize(headReqBodyRawFlagField, r.raw) + + return size +} + +func (r *HeadRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.HeadRequest_Body)) +} + +func (r *HeadResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + switch v := r.hdrPart.(type) { + case nil: + case *HeaderWithSignature: + if v != nil { + proto.NestedStructureMarshal(headRespBodyHeaderField, buf, v) + } + case *ShortHeader: + if v != nil { + proto.NestedStructureMarshal(headRespBodyShortHeaderField, buf, v) + } + case *SplitInfo: + if v != nil { + proto.NestedStructureMarshal(headRespBodySplitInfoField, buf, v) + } + case *ECInfo: + if v != nil { + proto.NestedStructureMarshal(headRespBodyECInfoField, buf, v) + } + default: + panic("unknown one of object put request body type") + } + + return buf +} + +func (r *HeadResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + switch v := r.hdrPart.(type) { + case nil: + case *HeaderWithSignature: + if v != nil { + size += proto.NestedStructureSize(headRespBodyHeaderField, v) + } + case *ShortHeader: + if v != nil { + size += proto.NestedStructureSize(headRespBodyShortHeaderField, v) + } + case *SplitInfo: + if v != nil { + size += proto.NestedStructureSize(headRespBodySplitInfoField, v) + } + case *ECInfo: + if v != nil { + size += proto.NestedStructureSize(headRespBodyECInfoField, v) + } + default: + panic("unknown one of object put request body type") + } + + return +} + +func (r *HeadResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.HeadResponse_Body)) +} + +func (f *SearchFilter) StableMarshal(buf []byte) []byte { + if f == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, f.StableSize()) + } + + var offset int + + offset += proto.EnumMarshal(searchFilterMatchField, buf[offset:], int32(f.matchType)) + offset += proto.StringMarshal(searchFilterNameField, buf[offset:], f.key) + proto.StringMarshal(searchFilterValueField, buf[offset:], f.val) + + return buf +} + +func (f *SearchFilter) StableSize() (size int) { + if f == nil { + return 0 + } + + size += proto.EnumSize(searchFilterMatchField, int32(f.matchType)) + size += proto.StringSize(searchFilterNameField, f.key) + size += proto.StringSize(searchFilterValueField, f.val) + + return size +} + +func (f *SearchFilter) Unmarshal(data []byte) error { + return message.Unmarshal(f, data, new(object.SearchRequest_Body_Filter)) +} + +func (r *SearchRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(searchReqBodyContainerIDField, buf[offset:], r.cid) + offset += proto.UInt32Marshal(searchReqBodyVersionField, buf[offset:], r.version) + + for i := range r.filters { + offset += proto.NestedStructureMarshal(searchReqBodyFiltersField, buf[offset:], &r.filters[i]) + } + + return buf +} + +func (r *SearchRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(searchReqBodyContainerIDField, r.cid) + size += proto.UInt32Size(searchReqBodyVersionField, r.version) + + for i := range r.filters { + size += proto.NestedStructureSize(searchReqBodyFiltersField, &r.filters[i]) + } + + return size +} + +func (r *SearchRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.SearchRequest_Body)) +} + +func (r *SearchResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + refs.ObjectIDNestedListMarshal(searchRespBodyObjectIDsField, buf[offset:], r.idList) + + return buf +} + +func (r *SearchResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += refs.ObjectIDNestedListSize(searchRespBodyObjectIDsField, r.idList) + + return size +} + +func (r *SearchResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.SearchResponse_Body)) +} + +func (r *Range) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.UInt64Marshal(rangeOffsetField, buf[offset:], r.off) + proto.UInt64Marshal(rangeLengthField, buf[offset:], r.len) + + return buf +} + +func (r *Range) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.UInt64Size(rangeOffsetField, r.off) + size += proto.UInt64Size(rangeLengthField, r.len) + + return size +} + +func (r *Range) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.Range)) +} + +func (r *GetRangeRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(getRangeReqBodyAddressField, buf[offset:], r.addr) + offset += proto.NestedStructureMarshal(getRangeReqBodyRangeField, buf[offset:], r.rng) + proto.BoolMarshal(getRangeReqBodyRawField, buf[offset:], r.raw) + + return buf +} + +func (r *GetRangeRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getRangeReqBodyAddressField, r.addr) + size += proto.NestedStructureSize(getRangeReqBodyRangeField, r.rng) + size += proto.BoolSize(getRangeReqBodyRawField, r.raw) + + return size +} + +func (r *GetRangeRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRangeRequest_Body)) +} + +func (r *GetRangeResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + switch v := r.rngPart.(type) { + case nil: + case *GetRangePartChunk: + if v != nil { + proto.BytesMarshal(getRangeRespChunkField, buf, v.chunk) + } + case *SplitInfo: + if v != nil { + proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v) + } + case *ECInfo: + if v != nil { + proto.NestedStructureMarshal(getRangeRespECInfoField, buf, v) + } + default: + panic("unknown one of object get range request body type") + } + + return buf +} + +func (r *GetRangeResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + switch v := r.rngPart.(type) { + case nil: + case *GetRangePartChunk: + if v != nil { + size += proto.BytesSize(getRangeRespChunkField, v.chunk) + } + case *SplitInfo: + if v != nil { + size = proto.NestedStructureSize(getRangeRespSplitInfoField, v) + } + case *ECInfo: + if v != nil { + size = proto.NestedStructureSize(getRangeRespECInfoField, v) + } + default: + panic("unknown one of object get range request body type") + } + + return +} + +func (r *GetRangeResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRangeResponse_Body)) +} + +func (r *GetRangeHashRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(getRangeHashReqBodyAddressField, buf[offset:], r.addr) + + for i := range r.rngs { + offset += proto.NestedStructureMarshal(getRangeHashReqBodyRangesField, buf[offset:], &r.rngs[i]) + } + + offset += proto.BytesMarshal(getRangeHashReqBodySaltField, buf[offset:], r.salt) + proto.EnumMarshal(getRangeHashReqBodyTypeField, buf[offset:], int32(r.typ)) + + return buf +} + +func (r *GetRangeHashRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(getRangeHashReqBodyAddressField, r.addr) + + for i := range r.rngs { + size += proto.NestedStructureSize(getRangeHashReqBodyRangesField, &r.rngs[i]) + } + + size += proto.BytesSize(getRangeHashReqBodySaltField, r.salt) + size += proto.EnumSize(getRangeHashReqBodyTypeField, int32(r.typ)) + + return size +} + +func (r *GetRangeHashRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRangeHashRequest_Body)) +} + +func (r *GetRangeHashResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.EnumMarshal(getRangeHashRespBodyTypeField, buf, int32(r.typ)) + proto.RepeatedBytesMarshal(getRangeHashRespBodyHashListField, buf[offset:], r.hashList) + + return buf +} + +func (r *GetRangeHashResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.EnumSize(getRangeHashRespBodyTypeField, int32(r.typ)) + size += proto.RepeatedBytesSize(getRangeHashRespBodyHashListField, r.hashList) + + return size +} + +func (r *GetRangeHashResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.GetRangeHashResponse_Body)) +} + +func (r *PutSingleRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if r.marshalData != nil { + if buf == nil { + return r.marshalData + } + copy(buf, r.marshalData) + return buf + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + offset += proto.NestedStructureMarshal(putSingleReqObjectField, buf[offset:], r.object) + proto.RepeatedUInt32Marshal(putSingleReqCopiesNumberField, buf[offset:], r.copyNum) + + return buf +} + +// SetMarshalData sets marshal data to reduce memory allocations. +// +// It is unsafe to modify/copy request data after setting marshal data. +func (r *PutSingleRequestBody) SetMarshalData(data []byte) { + if r == nil { + return + } + + r.marshalData = data + + proto.NestedStructureSetMarshalData(putSingleReqObjectField, r.marshalData, r.object) +} + +func (r *PutSingleRequestBody) StableSize() int { + if r == nil { + return 0 + } + + var size int + size += proto.NestedStructureSize(putSingleReqObjectField, r.object) + arrSize, _ := proto.RepeatedUInt32Size(putSingleReqCopiesNumberField, r.copyNum) + size += arrSize + + return size +} + +func (r *PutSingleRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutSingleRequest_Body)) +} + +func (r *PutSingleResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + return buf +} + +func (r *PutSingleResponseBody) StableSize() int { + return 0 +} + +func (r *PutSingleResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PutSingleResponse_Body)) +} + +func (r *PatchRequestBodyPatch) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + offset += proto.NestedStructureMarshal(patchRequestBodyPatchRangeField, buf[offset:], r.GetRange()) + proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.GetChunk()) + + return buf +} + +func (r *PatchRequestBodyPatch) StableSize() int { + if r == nil { + return 0 + } + + var size int + size += proto.NestedStructureSize(patchRequestBodyPatchRangeField, r.GetRange()) + size += proto.BytesSize(patchRequestBodyPatchChunkField, r.GetChunk()) + + return size +} + +func (r *PatchRequestBodyPatch) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PatchRequest_Body_Patch)) +} + +func (r *PatchRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + offset += proto.NestedStructureMarshal(patchRequestBodyAddrField, buf[offset:], r.address) + for i := range r.newAttributes { + offset += proto.NestedStructureMarshal(patchRequestBodyNewAttrsField, buf[offset:], &r.newAttributes[i]) + } + offset += proto.BoolMarshal(patchRequestBodyReplaceAttrField, buf[offset:], r.replaceAttributes) + offset += proto.NestedStructureMarshal(patchRequestBodyPatchField, buf[offset:], r.patch) + proto.NestedStructureMarshal(patchRequestBodyNewSplitHeaderField, buf[offset:], r.newSplitHeader) + + return buf +} + +func (r *PatchRequestBody) StableSize() int { + if r == nil { + return 0 + } + + var size int + size += proto.NestedStructureSize(patchRequestBodyAddrField, r.address) + for i := range r.newAttributes { + size += proto.NestedStructureSize(patchRequestBodyNewAttrsField, &r.newAttributes[i]) + } + size += proto.BoolSize(patchRequestBodyReplaceAttrField, r.replaceAttributes) + size += proto.NestedStructureSize(patchRequestBodyPatchField, r.patch) + size += proto.NestedStructureSize(patchRequestBodyNewSplitHeaderField, r.newSplitHeader) + + return size +} + +func (r *PatchRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PatchRequest_Body)) +} + +func (r *PatchResponseBody) StableSize() int { + if r == nil { + return 0 + } + + var size int + size += proto.NestedStructureSize(patchResponseBodyObjectIDField, r.ObjectID) + + return size +} + +func (r *PatchResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + proto.NestedStructureMarshal(patchResponseBodyObjectIDField, buf[offset:], r.ObjectID) + + return buf +} + +func (r *PatchResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(object.PatchResponse_Body)) +} diff --git a/api/object/message_test.go b/api/object/message_test.go new file mode 100644 index 00000000..21568f87 --- /dev/null +++ b/api/object/message_test.go @@ -0,0 +1,65 @@ +package object_test + +import ( + "testing" + + objecttest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return objecttest.GenerateShortHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateAttribute(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSplitHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeaderWithSplitHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeaderWithECHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateECHeader(empty) }, + func(empty bool) message.Message { return objecttest.GenerateObject(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSplitInfo(empty) }, + func(empty bool) message.Message { return objecttest.GenerateECInfo(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetObjectPartInit(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetObjectPartChunk(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetResponse(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutObjectPartInit(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutObjectPartChunk(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutRequest(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateDeleteRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateDeleteRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateDeleteResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateDeleteResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeadRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeadRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeadResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateHeadResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchFilter(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateSearchResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateRange(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeHashRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeHashRequest(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GenerateGetRangeHashResponse(empty) }, + func(empty bool) message.Message { return objecttest.GenerateLock(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutSingleRequest(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePutSingleResponse(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchRequestBodyPatch(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchRequestBody(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchRequest(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchResponseBody(empty) }, + func(empty bool) message.Message { return objecttest.GeneratePatchResponse(empty) }, + ) +} diff --git a/api/object/status.go b/api/object/status.go new file mode 100644 index 00000000..32fda2b6 --- /dev/null +++ b/api/object/status.go @@ -0,0 +1,91 @@ +package object + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" + statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" +) + +// LocalizeFailStatus checks if passed global status.Code is related to object failure and: +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must not be nil. +func LocalizeFailStatus(c *status.Code) bool { + return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_OBJECT)) +} + +// GlobalizeFail globalizes local code of object failure. +// +// Arg must not be nil. +func GlobalizeFail(c *status.Code) { + c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_OBJECT)) +} + +const ( + // StatusAccessDenied is a local status.Code value for + // ACCESS_DENIED object failure. + StatusAccessDenied status.Code = iota + // StatusNotFound is a local status.Code value for + // OBJECT_NOT_FOUND object failure. + StatusNotFound + // StatusLocked is a local status.Code value for + // LOCKED object failure. + StatusLocked + // StatusLockNonRegularObject is a local status.Code value for + // LOCK_NON_REGULAR_OBJECT object failure. + StatusLockNonRegularObject + // StatusAlreadyRemoved is a local status.Code value for + // OBJECT_ALREADY_REMOVED object failure. + StatusAlreadyRemoved + // StatusOutOfRange is a local status.Code value for + // OUT_OF_RANGE object failure. + StatusOutOfRange +) + +const ( + // detailAccessDeniedDesc is a StatusAccessDenied detail ID for + // human-readable description. + detailAccessDeniedDesc = iota +) + +// WriteAccessDeniedDesc writes human-readable description of StatusAccessDenied +// into status.Status as a detail. The status must not be nil. +// +// Existing details are expected to be ID-unique, otherwise undefined behavior. +func WriteAccessDeniedDesc(st *status.Status, desc string) { + var found bool + + st.IterateDetails(func(d *status.Detail) bool { + if d.ID() == detailAccessDeniedDesc { + found = true + d.SetValue([]byte(desc)) + } + + return found + }) + + if !found { + var d status.Detail + + d.SetID(detailAccessDeniedDesc) + d.SetValue([]byte(desc)) + + st.AppendDetails(d) + } +} + +// ReadAccessDeniedDesc looks up for status detail with human-readable description +// of StatusAccessDenied. Returns empty string if detail is missing. +func ReadAccessDeniedDesc(st status.Status) (desc string) { + st.IterateDetails(func(d *status.Detail) bool { + if d.ID() == detailAccessDeniedDesc { + desc = string(d.Value()) + return true + } + + return false + }) + + return +} diff --git a/api/object/status_test.go b/api/object/status_test.go new file mode 100644 index 00000000..465f5c85 --- /dev/null +++ b/api/object/status_test.go @@ -0,0 +1,35 @@ +package object_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" + statustest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/test" + "github.com/stretchr/testify/require" +) + +func TestStatusCodes(t *testing.T) { + statustest.TestCodes(t, object.LocalizeFailStatus, object.GlobalizeFail, + object.StatusAccessDenied, 2048, + object.StatusNotFound, 2049, + object.StatusLocked, 2050, + object.StatusLockNonRegularObject, 2051, + object.StatusAlreadyRemoved, 2052, + object.StatusOutOfRange, 2053, + ) +} + +func TestAccessDeniedDesc(t *testing.T) { + var st status.Status + + require.Empty(t, object.ReadAccessDeniedDesc(st)) + + const desc = "some description" + + object.WriteAccessDeniedDesc(&st, desc) + require.Equal(t, desc, object.ReadAccessDeniedDesc(st)) + + object.WriteAccessDeniedDesc(&st, desc+"1") + require.Equal(t, desc+"1", object.ReadAccessDeniedDesc(st)) +} diff --git a/api/object/string.go b/api/object/string.go new file mode 100644 index 00000000..137bc2a9 --- /dev/null +++ b/api/object/string.go @@ -0,0 +1,51 @@ +package object + +import ( + object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object/grpc" +) + +// String returns string representation of Type. +func (t Type) String() string { + return TypeToGRPCField(t).String() +} + +// FromString parses Type from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *Type) FromString(s string) bool { + g, ok := object.ObjectType_value[s] + + if ok { + *t = TypeFromGRPCField(object.ObjectType(g)) + } + + return ok +} + +// TypeFromString converts string to Type. +// +// Deprecated: use FromString method. +func TypeFromString(s string) (t Type) { + t.FromString(s) + return +} + +// String returns string representation of MatchType. +func (t MatchType) String() string { + return MatchTypeToGRPCField(t).String() +} + +// FromString parses MatchType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *MatchType) FromString(s string) bool { + g, ok := object.MatchType_value[s] + + if ok { + *t = MatchTypeFromGRPCField(object.MatchType(g)) + } + + return ok +} diff --git a/api/object/test/generate.go b/api/object/test/generate.go new file mode 100644 index 00000000..37345f94 --- /dev/null +++ b/api/object/test/generate.go @@ -0,0 +1,766 @@ +package objecttest + +import ( + crand "crypto/rand" + "math/rand" + "time" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + refstest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/test" +) + +func GenerateShortHeader(empty bool) *object.ShortHeader { + m := new(object.ShortHeader) + + if !empty { + m.SetObjectType(13) + m.SetCreationEpoch(100) + m.SetPayloadLength(12321) + m.SetOwnerID(refstest.GenerateOwnerID(false)) + } + + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetHomomorphicHash(refstest.GenerateChecksum(empty)) + m.SetPayloadHash(refstest.GenerateChecksum(empty)) + + return m +} + +func GenerateAttribute(empty bool) *object.Attribute { + m := new(object.Attribute) + + if !empty { + m.SetKey("object key") + m.SetValue("object value") + } + + return m +} + +func GenerateAttributes(empty bool) []object.Attribute { + var res []object.Attribute + + if !empty { + res = append(res, + *GenerateAttribute(false), + *GenerateAttribute(false), + ) + } + + return res +} + +func GenerateSplitHeader(empty bool) *object.SplitHeader { + return generateSplitHeader(empty, true) +} + +func generateSplitHeader(empty, withPar bool) *object.SplitHeader { + m := new(object.SplitHeader) + + if !empty { + id := make([]byte, 16) + _, _ = crand.Read(id) + + m.SetSplitID(id) + m.SetParent(refstest.GenerateObjectID(false)) + m.SetPrevious(refstest.GenerateObjectID(false)) + m.SetChildren(refstest.GenerateObjectIDs(false)) + } + + m.SetParentSignature(refstest.GenerateSignature(empty)) + + if withPar { + m.SetParentHeader(GenerateHeaderWithSplitHeader(empty)) + } + + return m +} + +func GenerateHeaderWithSplitHeader(empty bool) *object.Header { + m := generateHeader(empty) + m.SetSplit(generateSplitHeader(empty, false)) + return m +} + +func GenerateHeaderWithECHeader(empty bool) *object.Header { + m := generateHeader(empty) + m.SetEC(GenerateECHeader(empty)) + return m +} + +func GenerateECHeader(empty bool) *object.ECHeader { + ech := new(object.ECHeader) + + if !empty { + ech.Parent = refstest.GenerateObjectID(empty) + + ech.ParentSplitID = make([]byte, 16) + _, _ = crand.Read(ech.ParentSplitID) + + ech.ParentSplitParentID = refstest.GenerateObjectID(empty) + ech.ParentAttributes = GenerateAttributes(empty) + ech.Index = 0 + ech.Total = 2 + ech.Header = []byte("chunk of ec-encoded parent header") + ech.HeaderLength = uint32(2 * len(ech.Header)) + } + + return ech +} + +func generateHeader(empty bool) *object.Header { + m := new(object.Header) + + if !empty { + m.SetPayloadLength(777) + m.SetCreationEpoch(432) + m.SetObjectType(111) + m.SetOwnerID(refstest.GenerateOwnerID(false)) + m.SetContainerID(refstest.GenerateContainerID(false)) + m.SetAttributes(GenerateAttributes(false)) + } + + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetPayloadHash(refstest.GenerateChecksum(empty)) + m.SetHomomorphicHash(refstest.GenerateChecksum(empty)) + m.SetSessionToken(sessiontest.GenerateSessionToken(empty)) + + return m +} + +func GenerateHeaderWithSignature(empty bool) *object.HeaderWithSignature { + m := new(object.HeaderWithSignature) + + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetHeader(GenerateHeaderWithSplitHeader(empty)) + + return m +} + +func GenerateObject(empty bool) *object.Object { + m := new(object.Object) + + if !empty { + m.SetPayload([]byte{7, 8, 9}) + m.SetObjectID(refstest.GenerateObjectID(false)) + } + + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetHeader(GenerateHeaderWithSplitHeader(empty)) + + return m +} + +func GenerateSplitInfo(empty bool) *object.SplitInfo { + m := new(object.SplitInfo) + + if !empty { + id := make([]byte, 16) + _, _ = crand.Read(id) + + m.SetSplitID(id) + m.SetLastPart(refstest.GenerateObjectID(false)) + m.SetLink(refstest.GenerateObjectID(false)) + } + + return m +} + +func GenerateECInfo(empty bool) *object.ECInfo { + m := new(object.ECInfo) + + if !empty { + m.Chunks = make([]object.ECChunk, 2) + for i := range m.Chunks { + m.Chunks[i] = *GenerateECChunk(false) + } + } + + return m +} + +func GenerateECChunk(empty bool) *object.ECChunk { + m := new(object.ECChunk) + + if !empty { + m.ID = *refstest.GenerateObjectID(false) + m.Index = 4 + m.Total = 7 + } + + return m +} + +func GenerateGetRequestBody(empty bool) *object.GetRequestBody { + m := new(object.GetRequestBody) + + if !empty { + m.SetRaw(true) + m.SetAddress(refstest.GenerateAddress(false)) + } + + return m +} + +func GenerateGetRequest(empty bool) *object.GetRequest { + m := new(object.GetRequest) + + if !empty { + m.SetBody(GenerateGetRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetObjectPartInit(empty bool) *object.GetObjectPartInit { + m := new(object.GetObjectPartInit) + + if !empty { + m.SetObjectID(refstest.GenerateObjectID(false)) + } + + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetHeader(GenerateHeaderWithSplitHeader(empty)) + + return m +} + +func GenerateGetObjectPartChunk(empty bool) *object.GetObjectPartChunk { + m := new(object.GetObjectPartChunk) + + if !empty { + m.SetChunk([]byte("get chunk")) + } + + return m +} + +func GenerateGetResponseBody(empty bool) *object.GetResponseBody { + m := new(object.GetResponseBody) + + if !empty { + switch randomInt(3) { + case 0: + m.SetObjectPart(GenerateGetObjectPartInit(false)) + case 1: + m.SetObjectPart(GenerateGetObjectPartChunk(false)) + case 2: + m.SetObjectPart(GenerateSplitInfo(false)) + } + } + + return m +} + +func GenerateGetResponse(empty bool) *object.GetResponse { + m := new(object.GetResponse) + + if !empty { + m.SetBody(GenerateGetResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GeneratePutObjectPartInit(empty bool) *object.PutObjectPartInit { + m := new(object.PutObjectPartInit) + + if !empty { + m.SetCopiesNumber([]uint32{234}) + m.SetObjectID(refstest.GenerateObjectID(false)) + } + + m.SetSignature(refstest.GenerateSignature(empty)) + m.SetHeader(GenerateHeaderWithSplitHeader(empty)) + + return m +} + +func GeneratePutObjectPartChunk(empty bool) *object.PutObjectPartChunk { + m := new(object.PutObjectPartChunk) + + if !empty { + m.SetChunk([]byte("put chunk")) + } + + return m +} + +func GeneratePutRequestBody(empty bool) *object.PutRequestBody { + m := new(object.PutRequestBody) + + if !empty { + switch randomInt(2) { + case 0: + m.SetObjectPart(GeneratePutObjectPartInit(false)) + case 1: + m.SetObjectPart(GeneratePutObjectPartChunk(false)) + } + } + + return m +} + +func GeneratePutRequest(empty bool) *object.PutRequest { + m := new(object.PutRequest) + + if !empty { + m.SetBody(GeneratePutRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GeneratePutResponseBody(empty bool) *object.PutResponseBody { + m := new(object.PutResponseBody) + + if !empty { + m.SetObjectID(refstest.GenerateObjectID(false)) + } + + return m +} + +func GeneratePutResponse(empty bool) *object.PutResponse { + m := new(object.PutResponse) + + if !empty { + m.SetBody(GeneratePutResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateDeleteRequestBody(empty bool) *object.DeleteRequestBody { + m := new(object.DeleteRequestBody) + + if !empty { + m.SetAddress(refstest.GenerateAddress(false)) + } + + return m +} + +func GenerateDeleteRequest(empty bool) *object.DeleteRequest { + m := new(object.DeleteRequest) + + if !empty { + m.SetBody(GenerateDeleteRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateDeleteResponseBody(empty bool) *object.DeleteResponseBody { + m := new(object.DeleteResponseBody) + + if !empty { + m.SetTombstone(refstest.GenerateAddress(false)) + } + + return m +} + +func GenerateDeleteResponse(empty bool) *object.DeleteResponse { + m := new(object.DeleteResponse) + + if !empty { + m.SetBody(GenerateDeleteResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateHeadRequestBody(empty bool) *object.HeadRequestBody { + m := new(object.HeadRequestBody) + + if !empty { + m.SetRaw(true) + m.SetMainOnly(true) + m.SetAddress(refstest.GenerateAddress(false)) + } + + return m +} + +func GenerateHeadRequest(empty bool) *object.HeadRequest { + m := new(object.HeadRequest) + + if !empty { + m.SetBody(GenerateHeadRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateHeadResponseBody(empty bool) *object.HeadResponseBody { + m := new(object.HeadResponseBody) + + if !empty { + switch randomInt(3) { + case 0: + m.SetHeaderPart(GenerateHeaderWithSignature(false)) + case 1: + m.SetHeaderPart(GenerateShortHeader(false)) + case 2: + m.SetHeaderPart(GenerateSplitInfo(false)) + } + } + + return m +} + +func GenerateHeadResponse(empty bool) *object.HeadResponse { + m := new(object.HeadResponse) + + if !empty { + m.SetBody(GenerateHeadResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateSearchFilter(empty bool) *object.SearchFilter { + m := new(object.SearchFilter) + + if !empty { + m.SetKey("search filter key") + m.SetValue("search filter val") + m.SetMatchType(987) + } + + return m +} + +func GenerateSearchFilters(empty bool) []object.SearchFilter { + var res []object.SearchFilter + + if !empty { + res = append(res, + *GenerateSearchFilter(false), + *GenerateSearchFilter(false), + ) + } + + return res +} + +func GenerateSearchRequestBody(empty bool) *object.SearchRequestBody { + m := new(object.SearchRequestBody) + + if !empty { + m.SetVersion(555) + m.SetContainerID(refstest.GenerateContainerID(false)) + m.SetFilters(GenerateSearchFilters(false)) + } + + return m +} + +func GenerateSearchRequest(empty bool) *object.SearchRequest { + m := new(object.SearchRequest) + + if !empty { + m.SetBody(GenerateSearchRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateSearchResponseBody(empty bool) *object.SearchResponseBody { + m := new(object.SearchResponseBody) + + if !empty { + m.SetIDList(refstest.GenerateObjectIDs(false)) + } + + return m +} + +func GenerateSearchResponse(empty bool) *object.SearchResponse { + m := new(object.SearchResponse) + + if !empty { + m.SetBody(GenerateSearchResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateRange(empty bool) *object.Range { + m := new(object.Range) + + if !empty { + m.SetLength(11) + m.SetOffset(22) + } + + return m +} + +func GenerateRanges(empty bool) []object.Range { + var res []object.Range + + if !empty { + res = append(res, + *GenerateRange(false), + *GenerateRange(false), + ) + } + + return res +} + +func GenerateGetRangeRequestBody(empty bool) *object.GetRangeRequestBody { + m := new(object.GetRangeRequestBody) + + if !empty { + m.SetRaw(true) + m.SetAddress(refstest.GenerateAddress(empty)) + m.SetRange(GenerateRange(empty)) + } + + return m +} + +func GenerateGetRangeRequest(empty bool) *object.GetRangeRequest { + m := new(object.GetRangeRequest) + + if !empty { + m.SetBody(GenerateGetRangeRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetRangePartChunk(empty bool) *object.GetRangePartChunk { + m := new(object.GetRangePartChunk) + + if !empty { + m.SetChunk([]byte("get range chunk")) + } + + return m +} + +func GenerateGetRangeResponseBody(empty bool) *object.GetRangeResponseBody { + m := new(object.GetRangeResponseBody) + + if !empty { + switch randomInt(2) { + case 0: + m.SetRangePart(GenerateGetRangePartChunk(false)) + case 1: + m.SetRangePart(GenerateSplitInfo(false)) + } + } + + return m +} + +func GenerateGetRangeResponse(empty bool) *object.GetRangeResponse { + m := new(object.GetRangeResponse) + + if !empty { + m.SetBody(GenerateGetRangeResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateGetRangeHashRequestBody(empty bool) *object.GetRangeHashRequestBody { + m := new(object.GetRangeHashRequestBody) + + if !empty { + m.SetSalt([]byte("range hash salt")) + m.SetType(455) + m.SetAddress(refstest.GenerateAddress(false)) + m.SetRanges(GenerateRanges(false)) + } + + return m +} + +func GenerateGetRangeHashRequest(empty bool) *object.GetRangeHashRequest { + m := new(object.GetRangeHashRequest) + + if !empty { + m.SetBody(GenerateGetRangeHashRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateGetRangeHashResponseBody(empty bool) *object.GetRangeHashResponseBody { + m := new(object.GetRangeHashResponseBody) + + if !empty { + m.SetType(678) + m.SetHashList([][]byte{ + refstest.GenerateChecksum(false).GetSum(), + refstest.GenerateChecksum(false).GetSum(), + }) + } + + return m +} + +func GenerateGetRangeHashResponse(empty bool) *object.GetRangeHashResponse { + m := new(object.GetRangeHashResponse) + + if !empty { + m.SetBody(GenerateGetRangeHashResponseBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateLock(empty bool) *object.Lock { + m := new(object.Lock) + + if !empty { + m.SetMembers([]refs.ObjectID{ + *refstest.GenerateObjectID(false), + *refstest.GenerateObjectID(false), + }) + } + + return m +} + +func GeneratePutSingleRequest(empty bool) *object.PutSingleRequest { + m := new(object.PutSingleRequest) + + if !empty { + m.SetBody(GeneratePutSingleRequestBody(false)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GeneratePutSingleRequestBody(empty bool) *object.PutSingleRequestBody { + b := new(object.PutSingleRequestBody) + if !empty { + b.SetObject(GenerateObject(empty)) + b.SetCopiesNumber([]uint32{12345}) + } + return b +} + +func GeneratePutSingleResponse(empty bool) *object.PutSingleResponse { + m := new(object.PutSingleResponse) + if !empty { + m.SetBody(new(object.PutSingleResponseBody)) + } + m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) + return m +} + +func GeneratePatchRequestBodyPatch(empty bool) *object.PatchRequestBodyPatch { + m := new(object.PatchRequestBodyPatch) + + if !empty { + m.Range = GenerateRange(false) + m.Chunk = []byte("GeneratePatchRequestBodyPatch") + } + + return m +} + +func GeneratePatchRequestBody(empty bool) *object.PatchRequestBody { + m := new(object.PatchRequestBody) + + if !empty { + m.SetAddress(refstest.GenerateAddress(empty)) + m.SetNewAttributes(GenerateAttributes(empty)) + m.SetReplaceAttributes(false) + m.SetPatch(GeneratePatchRequestBodyPatch(empty)) + } + + return m +} + +func GeneratePatchRequest(empty bool) *object.PatchRequest { + m := new(object.PatchRequest) + + if !empty { + m.SetBody(GeneratePatchRequestBody(empty)) + } + + m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) + + return m +} + +func GeneratePatchResponseBody(empty bool) *object.PatchResponseBody { + m := new(object.PatchResponseBody) + + if !empty { + m.ObjectID = refstest.GenerateObjectID(empty) + } + + return m +} + +func GeneratePatchResponse(empty bool) *object.PatchResponse { + m := new(object.PatchResponse) + + if !empty { + m.Body = GeneratePatchResponseBody(empty) + } + + return m +} + +func randomInt(n int) int { + return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(n) +} diff --git a/api/object/types.go b/api/object/types.go new file mode 100644 index 00000000..57a93cee --- /dev/null +++ b/api/object/types.go @@ -0,0 +1,1660 @@ +package object + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" +) + +type Type uint32 + +type MatchType uint32 + +type ShortHeader struct { + version *refs.Version + + creatEpoch uint64 + + ownerID *refs.OwnerID + + typ Type + + payloadLen uint64 + + payloadHash, homoHash *refs.Checksum +} + +type Attribute struct { + key, val string +} + +type SplitHeader struct { + par, prev *refs.ObjectID + + parSig *refs.Signature + + parHdr *Header + + children []refs.ObjectID + + splitID []byte +} + +type ECHeader struct { + Parent *refs.ObjectID + ParentSplitID []byte + ParentSplitParentID *refs.ObjectID + ParentAttributes []Attribute + Index uint32 + Total uint32 + Header []byte + HeaderLength uint32 +} + +type Header struct { + version *refs.Version + + cid *refs.ContainerID + + ownerID *refs.OwnerID + + creatEpoch uint64 + + payloadLen uint64 + + payloadHash, homoHash *refs.Checksum + + typ Type + + sessionToken *session.Token + + attr []Attribute + + split *SplitHeader + + ec *ECHeader +} + +type HeaderWithSignature struct { + header *Header + + signature *refs.Signature +} + +type Object struct { + objectID *refs.ObjectID + + idSig *refs.Signature + + header *Header + + payload []byte + + // marshalData holds marshaled data, must not be marshaled by StableMarshal + marshalData []byte +} + +type SplitInfo struct { + splitID []byte + + lastPart *refs.ObjectID + + link *refs.ObjectID +} + +type ECChunk struct { + ID refs.ObjectID + Index uint32 + Total uint32 +} + +type ECInfo struct { + Chunks []ECChunk +} + +type GetRequestBody struct { + addr *refs.Address + + raw bool +} + +type GetObjectPart interface { + getObjectPart() +} + +type GetObjectPartInit struct { + id *refs.ObjectID + + sig *refs.Signature + + hdr *Header +} + +type GetObjectPartChunk struct { + chunk []byte +} + +type GetRequest struct { + body *GetRequestBody + + session.RequestHeaders +} + +type GetResponseBody struct { + objPart GetObjectPart +} + +type PutObjectPart interface { + putObjectPart() +} + +type PutObjectPartInit struct { + id *refs.ObjectID + + sig *refs.Signature + + hdr *Header + + copyNum []uint32 +} + +type PutObjectPartChunk struct { + chunk []byte +} + +type GetResponse struct { + body *GetResponseBody + + session.ResponseHeaders +} + +type PutRequestBody struct { + objPart PutObjectPart +} + +type PutRequest struct { + body *PutRequestBody + + session.RequestHeaders +} + +type PutResponseBody struct { + id *refs.ObjectID +} + +type PutResponse struct { + body *PutResponseBody + + session.ResponseHeaders +} + +type DeleteRequestBody struct { + addr *refs.Address +} + +type DeleteRequest struct { + body *DeleteRequestBody + + session.RequestHeaders +} + +type DeleteResponseBody struct { + tombstone *refs.Address +} + +type DeleteResponse struct { + body *DeleteResponseBody + + session.ResponseHeaders +} + +type HeadRequestBody struct { + addr *refs.Address + + mainOnly, raw bool +} + +type GetHeaderPart interface { + getHeaderPart() +} + +type HeadRequest struct { + body *HeadRequestBody + + session.RequestHeaders +} + +type HeadResponseBody struct { + hdrPart GetHeaderPart +} + +type HeadResponse struct { + body *HeadResponseBody + + session.ResponseHeaders +} + +type SearchFilter struct { + matchType MatchType + + key, val string +} + +type SearchRequestBody struct { + cid *refs.ContainerID + + version uint32 + + filters []SearchFilter +} + +type SearchRequest struct { + body *SearchRequestBody + + session.RequestHeaders +} + +type SearchResponseBody struct { + idList []refs.ObjectID +} + +type SearchResponse struct { + body *SearchResponseBody + + session.ResponseHeaders +} + +type Range struct { + off, len uint64 +} + +type GetRangeRequestBody struct { + addr *refs.Address + + rng *Range + + raw bool +} + +type GetRangeRequest struct { + body *GetRangeRequestBody + + session.RequestHeaders +} + +type GetRangePart interface { + getRangePart() +} + +type GetRangePartChunk struct { + chunk []byte +} + +type GetRangeResponseBody struct { + rngPart GetRangePart +} + +type GetRangeResponse struct { + body *GetRangeResponseBody + + session.ResponseHeaders +} + +type GetRangeHashRequestBody struct { + addr *refs.Address + + rngs []Range + + salt []byte + + typ refs.ChecksumType +} + +type GetRangeHashRequest struct { + body *GetRangeHashRequestBody + + session.RequestHeaders +} + +type GetRangeHashResponseBody struct { + typ refs.ChecksumType + + hashList [][]byte +} + +type GetRangeHashResponse struct { + body *GetRangeHashResponseBody + + session.ResponseHeaders +} + +type PutSingleRequestBody struct { + object *Object + copyNum []uint32 + + // marshalData holds marshaled data, must not be marshaled by StableMarshal + marshalData []byte +} + +type PutSingleRequest struct { + body *PutSingleRequestBody + + session.RequestHeaders +} + +type PutSingleResponseBody struct{} + +type PutSingleResponse struct { + body *PutSingleResponseBody + + session.ResponseHeaders +} + +type PatchRequestBodyPatch struct { + Range *Range + + Chunk []byte +} + +type PatchRequestBody struct { + address *refs.Address + + newAttributes []Attribute + + newSplitHeader *SplitHeader + + replaceAttributes bool + + patch *PatchRequestBodyPatch +} + +type PatchRequest struct { + body *PatchRequestBody + + session.RequestHeaders +} + +type PatchResponseBody struct { + ObjectID *refs.ObjectID +} + +type PatchResponse struct { + Body *PatchResponseBody + + session.ResponseHeaders +} + +const ( + TypeRegular Type = iota + TypeTombstone + _ + TypeLock +) + +const ( + MatchUnknown MatchType = iota + MatchStringEqual + MatchStringNotEqual + MatchNotPresent + MatchCommonPrefix +) + +func (h *ShortHeader) GetVersion() *refs.Version { + if h != nil { + return h.version + } + + return nil +} + +func (h *ShortHeader) SetVersion(v *refs.Version) { + h.version = v +} + +func (h *ShortHeader) GetCreationEpoch() uint64 { + if h != nil { + return h.creatEpoch + } + + return 0 +} + +func (h *ShortHeader) SetCreationEpoch(v uint64) { + h.creatEpoch = v +} + +func (h *ShortHeader) GetOwnerID() *refs.OwnerID { + if h != nil { + return h.ownerID + } + + return nil +} + +func (h *ShortHeader) SetOwnerID(v *refs.OwnerID) { + h.ownerID = v +} + +func (h *ShortHeader) GetObjectType() Type { + if h != nil { + return h.typ + } + + return TypeRegular +} + +func (h *ShortHeader) SetObjectType(v Type) { + h.typ = v +} + +func (h *ShortHeader) GetPayloadLength() uint64 { + if h != nil { + return h.payloadLen + } + + return 0 +} + +func (h *ShortHeader) SetPayloadLength(v uint64) { + h.payloadLen = v +} + +func (h *ShortHeader) GetPayloadHash() *refs.Checksum { + if h != nil { + return h.payloadHash + } + + return nil +} + +func (h *ShortHeader) SetPayloadHash(v *refs.Checksum) { + h.payloadHash = v +} + +func (h *ShortHeader) GetHomomorphicHash() *refs.Checksum { + if h != nil { + return h.homoHash + } + + return nil +} + +func (h *ShortHeader) SetHomomorphicHash(v *refs.Checksum) { + h.homoHash = v +} + +func (h *ShortHeader) getHeaderPart() {} + +func (a *Attribute) GetKey() string { + if a != nil { + return a.key + } + + return "" +} + +func (a *Attribute) SetKey(v string) { + a.key = v +} + +func (a *Attribute) GetValue() string { + if a != nil { + return a.val + } + + return "" +} + +func (a *Attribute) SetValue(v string) { + a.val = v +} + +func (h *SplitHeader) GetParent() *refs.ObjectID { + if h != nil { + return h.par + } + + return nil +} + +func (h *SplitHeader) SetParent(v *refs.ObjectID) { + h.par = v +} + +func (h *SplitHeader) GetPrevious() *refs.ObjectID { + if h != nil { + return h.prev + } + + return nil +} + +func (h *SplitHeader) SetPrevious(v *refs.ObjectID) { + h.prev = v +} + +func (h *SplitHeader) GetParentSignature() *refs.Signature { + if h != nil { + return h.parSig + } + + return nil +} + +func (h *SplitHeader) SetParentSignature(v *refs.Signature) { + h.parSig = v +} + +func (h *SplitHeader) GetParentHeader() *Header { + if h != nil { + return h.parHdr + } + + return nil +} + +func (h *SplitHeader) SetParentHeader(v *Header) { + h.parHdr = v +} + +func (h *SplitHeader) GetChildren() []refs.ObjectID { + if h != nil { + return h.children + } + + return nil +} + +func (h *SplitHeader) SetChildren(v []refs.ObjectID) { + h.children = v +} + +func (h *SplitHeader) GetSplitID() []byte { + if h != nil { + return h.splitID + } + + return nil +} + +func (h *SplitHeader) SetSplitID(v []byte) { + h.splitID = v +} + +func (h *Header) GetVersion() *refs.Version { + if h != nil { + return h.version + } + + return nil +} + +func (h *Header) SetVersion(v *refs.Version) { + h.version = v +} + +func (h *Header) GetContainerID() *refs.ContainerID { + if h != nil { + return h.cid + } + + return nil +} + +func (h *Header) SetContainerID(v *refs.ContainerID) { + h.cid = v +} + +func (h *Header) GetOwnerID() *refs.OwnerID { + if h != nil { + return h.ownerID + } + + return nil +} + +func (h *Header) SetOwnerID(v *refs.OwnerID) { + h.ownerID = v +} + +func (h *Header) GetCreationEpoch() uint64 { + if h != nil { + return h.creatEpoch + } + + return 0 +} + +func (h *Header) SetCreationEpoch(v uint64) { + h.creatEpoch = v +} + +func (h *Header) GetPayloadLength() uint64 { + if h != nil { + return h.payloadLen + } + + return 0 +} + +func (h *Header) SetPayloadLength(v uint64) { + h.payloadLen = v +} + +func (h *Header) GetPayloadHash() *refs.Checksum { + if h != nil { + return h.payloadHash + } + + return nil +} + +func (h *Header) SetPayloadHash(v *refs.Checksum) { + h.payloadHash = v +} + +func (h *Header) GetObjectType() Type { + if h != nil { + return h.typ + } + + return TypeRegular +} + +func (h *Header) SetObjectType(v Type) { + h.typ = v +} + +func (h *Header) GetHomomorphicHash() *refs.Checksum { + if h != nil { + return h.homoHash + } + + return nil +} + +func (h *Header) SetHomomorphicHash(v *refs.Checksum) { + h.homoHash = v +} + +func (h *Header) GetSessionToken() *session.Token { + if h != nil { + return h.sessionToken + } + + return nil +} + +func (h *Header) SetSessionToken(v *session.Token) { + h.sessionToken = v +} + +func (h *Header) GetAttributes() []Attribute { + if h != nil { + return h.attr + } + + return nil +} + +func (h *Header) SetAttributes(v []Attribute) { + h.attr = v +} + +func (h *Header) GetSplit() *SplitHeader { + if h != nil { + return h.split + } + + return nil +} + +func (h *Header) SetSplit(v *SplitHeader) { + h.split = v +} + +func (h *Header) GetEC() *ECHeader { + if h != nil { + return h.ec + } + return nil +} + +func (h *Header) SetEC(v *ECHeader) { + h.ec = v +} + +func (h *HeaderWithSignature) GetHeader() *Header { + if h != nil { + return h.header + } + + return nil +} + +func (h *HeaderWithSignature) SetHeader(v *Header) { + h.header = v +} + +func (h *HeaderWithSignature) GetSignature() *refs.Signature { + if h != nil { + return h.signature + } + + return nil +} + +func (h *HeaderWithSignature) SetSignature(v *refs.Signature) { + h.signature = v +} + +func (h *HeaderWithSignature) getHeaderPart() {} + +func (o *Object) GetObjectID() *refs.ObjectID { + if o != nil { + return o.objectID + } + + return nil +} + +func (o *Object) SetObjectID(v *refs.ObjectID) { + o.objectID = v +} + +func (o *Object) GetSignature() *refs.Signature { + if o != nil { + return o.idSig + } + + return nil +} + +func (o *Object) SetSignature(v *refs.Signature) { + o.idSig = v +} + +func (o *Object) GetHeader() *Header { + if o != nil { + return o.header + } + + return nil +} + +func (o *Object) SetHeader(v *Header) { + o.header = v +} + +func (o *Object) GetPayload() []byte { + if o != nil { + return o.payload + } + + return nil +} + +func (o *Object) SetPayload(v []byte) { + o.payload = v +} + +func (s *SplitInfo) GetSplitID() []byte { + if s != nil { + return s.splitID + } + + return nil +} + +func (s *SplitInfo) SetSplitID(v []byte) { + s.splitID = v +} + +func (s *SplitInfo) GetLastPart() *refs.ObjectID { + if s != nil { + return s.lastPart + } + + return nil +} + +func (s *SplitInfo) SetLastPart(v *refs.ObjectID) { + s.lastPart = v +} + +func (s *SplitInfo) GetLink() *refs.ObjectID { + if s != nil { + return s.link + } + + return nil +} + +func (s *SplitInfo) SetLink(v *refs.ObjectID) { + s.link = v +} + +func (s *SplitInfo) getObjectPart() {} + +func (s *SplitInfo) getHeaderPart() {} + +func (s *SplitInfo) getRangePart() {} + +func (r *GetRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRequestBody) SetAddress(v *refs.Address) { + r.addr = v +} + +func (r *GetRequestBody) GetRaw() bool { + if r != nil { + return r.raw + } + + return false +} + +func (r *GetRequestBody) SetRaw(v bool) { + r.raw = v +} + +func (r *GetRequest) GetBody() *GetRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRequest) SetBody(v *GetRequestBody) { + r.body = v +} + +func (r *GetObjectPartInit) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *GetObjectPartInit) SetObjectID(v *refs.ObjectID) { + r.id = v +} + +func (r *GetObjectPartInit) GetSignature() *refs.Signature { + if r != nil { + return r.sig + } + + return nil +} + +func (r *GetObjectPartInit) SetSignature(v *refs.Signature) { + r.sig = v +} + +func (r *GetObjectPartInit) GetHeader() *Header { + if r != nil { + return r.hdr + } + + return nil +} + +func (r *GetObjectPartInit) SetHeader(v *Header) { + r.hdr = v +} + +func (r *GetObjectPartInit) getObjectPart() {} + +func (r *GetObjectPartChunk) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *GetObjectPartChunk) SetChunk(v []byte) { + r.chunk = v +} + +func (r *GetObjectPartChunk) getObjectPart() {} + +func (r *GetResponseBody) GetObjectPart() GetObjectPart { + if r != nil { + return r.objPart + } + + return nil +} + +func (r *GetResponseBody) SetObjectPart(v GetObjectPart) { + r.objPart = v +} + +func (r *GetResponse) GetBody() *GetResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetResponse) SetBody(v *GetResponseBody) { + r.body = v +} + +func (r *PutObjectPartInit) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *PutObjectPartInit) SetObjectID(v *refs.ObjectID) { + r.id = v +} + +func (r *PutObjectPartInit) GetSignature() *refs.Signature { + if r != nil { + return r.sig + } + + return nil +} + +func (r *PutObjectPartInit) SetSignature(v *refs.Signature) { + r.sig = v +} + +func (r *PutObjectPartInit) GetHeader() *Header { + if r != nil { + return r.hdr + } + + return nil +} + +func (r *PutObjectPartInit) SetHeader(v *Header) { + r.hdr = v +} + +func (r *PutObjectPartInit) GetCopiesNumber() []uint32 { + if r != nil { + return r.copyNum + } + + return nil +} + +func (r *PutObjectPartInit) SetCopiesNumber(v []uint32) { + r.copyNum = v +} + +func (r *PutObjectPartInit) putObjectPart() {} + +func (r *PutObjectPartChunk) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *PutObjectPartChunk) SetChunk(v []byte) { + r.chunk = v +} + +func (r *PutObjectPartChunk) putObjectPart() {} + +func (r *PutRequestBody) GetObjectPart() PutObjectPart { + if r != nil { + return r.objPart + } + + return nil +} + +func (r *PutRequestBody) SetObjectPart(v PutObjectPart) { + r.objPart = v +} + +func (r *PutRequest) GetBody() *PutRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutRequest) SetBody(v *PutRequestBody) { + r.body = v +} + +func (r *PutResponseBody) GetObjectID() *refs.ObjectID { + if r != nil { + return r.id + } + + return nil +} + +func (r *PutResponseBody) SetObjectID(v *refs.ObjectID) { + r.id = v +} + +func (r *PutResponse) GetBody() *PutResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutResponse) SetBody(v *PutResponseBody) { + r.body = v +} + +func (r *DeleteRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *DeleteRequestBody) SetAddress(v *refs.Address) { + r.addr = v +} + +func (r *DeleteRequest) GetBody() *DeleteRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteRequest) SetBody(v *DeleteRequestBody) { + r.body = v +} + +// GetTombstone returns tombstone address. +func (r *DeleteResponseBody) GetTombstone() *refs.Address { + if r != nil { + return r.tombstone + } + + return nil +} + +// SetTombstone sets tombstone address. +func (r *DeleteResponseBody) SetTombstone(v *refs.Address) { + r.tombstone = v +} + +func (r *DeleteResponse) GetBody() *DeleteResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *DeleteResponse) SetBody(v *DeleteResponseBody) { + r.body = v +} + +func (r *HeadRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *HeadRequestBody) SetAddress(v *refs.Address) { + r.addr = v +} + +func (r *HeadRequestBody) GetMainOnly() bool { + if r != nil { + return r.mainOnly + } + + return false +} + +func (r *HeadRequestBody) SetMainOnly(v bool) { + r.mainOnly = v +} + +func (r *HeadRequestBody) GetRaw() bool { + if r != nil { + return r.raw + } + + return false +} + +func (r *HeadRequestBody) SetRaw(v bool) { + r.raw = v +} + +func (r *HeadRequest) GetBody() *HeadRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *HeadRequest) SetBody(v *HeadRequestBody) { + r.body = v +} + +func (r *HeadResponseBody) GetHeaderPart() GetHeaderPart { + if r != nil { + return r.hdrPart + } + + return nil +} + +func (r *HeadResponseBody) SetHeaderPart(v GetHeaderPart) { + r.hdrPart = v +} + +func (r *HeadResponse) GetBody() *HeadResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *HeadResponse) SetBody(v *HeadResponseBody) { + r.body = v +} + +func (f *SearchFilter) GetMatchType() MatchType { + if f != nil { + return f.matchType + } + + return MatchUnknown +} + +func (f *SearchFilter) SetMatchType(v MatchType) { + f.matchType = v +} + +func (f *SearchFilter) GetKey() string { + if f != nil { + return f.key + } + + return "" +} + +func (f *SearchFilter) SetKey(v string) { + f.key = v +} + +func (f *SearchFilter) GetValue() string { + if f != nil { + return f.val + } + + return "" +} + +func (f *SearchFilter) SetValue(v string) { + f.val = v +} + +func (r *SearchRequestBody) GetContainerID() *refs.ContainerID { + if r != nil { + return r.cid + } + + return nil +} + +func (r *SearchRequestBody) SetContainerID(v *refs.ContainerID) { + r.cid = v +} + +func (r *SearchRequestBody) GetVersion() uint32 { + if r != nil { + return r.version + } + + return 0 +} + +func (r *SearchRequestBody) SetVersion(v uint32) { + r.version = v +} + +func (r *SearchRequestBody) GetFilters() []SearchFilter { + if r != nil { + return r.filters + } + + return nil +} + +func (r *SearchRequestBody) SetFilters(v []SearchFilter) { + r.filters = v +} + +func (r *SearchRequest) GetBody() *SearchRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *SearchRequest) SetBody(v *SearchRequestBody) { + r.body = v +} + +func (r *SearchResponseBody) GetIDList() []refs.ObjectID { + if r != nil { + return r.idList + } + + return nil +} + +func (r *SearchResponseBody) SetIDList(v []refs.ObjectID) { + r.idList = v +} + +func (r *SearchResponse) GetBody() *SearchResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *SearchResponse) SetBody(v *SearchResponseBody) { + r.body = v +} + +func (r *Range) GetOffset() uint64 { + if r != nil { + return r.off + } + + return 0 +} + +func (r *Range) SetOffset(v uint64) { + r.off = v +} + +func (r *Range) GetLength() uint64 { + if r != nil { + return r.len + } + + return 0 +} + +func (r *Range) SetLength(v uint64) { + r.len = v +} + +func (r *GetRangeRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRangeRequestBody) SetAddress(v *refs.Address) { + r.addr = v +} + +func (r *GetRangeRequestBody) GetRange() *Range { + if r != nil { + return r.rng + } + + return nil +} + +func (r *GetRangeRequestBody) SetRange(v *Range) { + r.rng = v +} + +func (r *GetRangeRequestBody) GetRaw() bool { + if r != nil { + return r.raw + } + + return false +} + +func (r *GetRangeRequestBody) SetRaw(v bool) { + r.raw = v +} + +func (r *GetRangeRequest) GetBody() *GetRangeRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeRequest) SetBody(v *GetRangeRequestBody) { + r.body = v +} + +func (r *GetRangePartChunk) GetChunk() []byte { + if r != nil { + return r.chunk + } + + return nil +} + +func (r *GetRangePartChunk) SetChunk(v []byte) { + r.chunk = v +} + +func (r *GetRangePartChunk) getRangePart() {} + +func (r *GetRangeResponseBody) GetRangePart() GetRangePart { + if r != nil { + return r.rngPart + } + + return nil +} + +func (r *GetRangeResponseBody) SetRangePart(v GetRangePart) { + r.rngPart = v +} + +func (r *GetRangeResponse) GetBody() *GetRangeResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeResponse) SetBody(v *GetRangeResponseBody) { + r.body = v +} + +func (r *GetRangeHashRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.addr + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetAddress(v *refs.Address) { + r.addr = v +} + +func (r *GetRangeHashRequestBody) GetRanges() []Range { + if r != nil { + return r.rngs + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetRanges(v []Range) { + r.rngs = v +} + +func (r *GetRangeHashRequestBody) GetSalt() []byte { + if r != nil { + return r.salt + } + + return nil +} + +func (r *GetRangeHashRequestBody) SetSalt(v []byte) { + r.salt = v +} + +func (r *GetRangeHashRequestBody) GetType() refs.ChecksumType { + if r != nil { + return r.typ + } + + return refs.UnknownChecksum +} + +func (r *GetRangeHashRequestBody) SetType(v refs.ChecksumType) { + r.typ = v +} + +func (r *GetRangeHashRequest) GetBody() *GetRangeHashRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeHashRequest) SetBody(v *GetRangeHashRequestBody) { + r.body = v +} + +func (r *GetRangeHashResponseBody) GetType() refs.ChecksumType { + if r != nil { + return r.typ + } + + return refs.UnknownChecksum +} + +func (r *GetRangeHashResponseBody) SetType(v refs.ChecksumType) { + r.typ = v +} + +func (r *GetRangeHashResponseBody) GetHashList() [][]byte { + if r != nil { + return r.hashList + } + + return nil +} + +func (r *GetRangeHashResponseBody) SetHashList(v [][]byte) { + r.hashList = v +} + +func (r *GetRangeHashResponse) GetBody() *GetRangeHashResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *GetRangeHashResponse) SetBody(v *GetRangeHashResponseBody) { + r.body = v +} + +func (r *PutSingleRequest) GetBody() *PutSingleRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutSingleRequest) SetBody(v *PutSingleRequestBody) { + r.body = v +} + +func (b *PutSingleRequestBody) GetObject() *Object { + if b == nil { + return nil + } + return b.object +} + +func (b *PutSingleRequestBody) SetObject(o *Object) { + b.object = o +} + +func (b *PutSingleRequestBody) GetCopiesNumber() []uint32 { + if b == nil { + return nil + } + return b.copyNum +} + +func (b *PutSingleRequestBody) SetCopiesNumber(v []uint32) { + b.copyNum = v +} + +func (r *PutSingleResponse) GetBody() *PutSingleResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PutSingleResponse) SetBody(v *PutSingleResponseBody) { + r.body = v +} + +func (r *PatchRequest) GetBody() *PatchRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *PatchRequest) SetBody(v *PatchRequestBody) { + r.body = v +} + +func (r *PatchRequestBody) GetAddress() *refs.Address { + if r != nil { + return r.address + } + + return nil +} + +func (r *PatchRequestBody) SetAddress(addr *refs.Address) { + r.address = addr +} + +func (r *PatchRequestBody) GetNewAttributes() []Attribute { + if r != nil { + return r.newAttributes + } + + return nil +} + +func (r *PatchRequestBody) SetNewAttributes(attrs []Attribute) { + r.newAttributes = attrs +} + +func (r *PatchRequestBody) GetReplaceAttributes() bool { + if r != nil { + return r.replaceAttributes + } + + return false +} + +func (r *PatchRequestBody) SetReplaceAttributes(replace bool) { + r.replaceAttributes = replace +} + +func (r *PatchRequestBody) SetNewSplitHeader(newSplitHeader *SplitHeader) { + r.newSplitHeader = newSplitHeader +} + +func (r *PatchRequestBody) GetNewSplitHeader() *SplitHeader { + return r.newSplitHeader +} + +func (r *PatchRequestBody) GetPatch() *PatchRequestBodyPatch { + if r != nil { + return r.patch + } + + return nil +} + +func (r *PatchRequestBody) SetPatch(patch *PatchRequestBodyPatch) { + r.patch = patch +} + +func (r *PatchResponse) GetBody() *PatchResponseBody { + if r != nil { + return r.Body + } + + return nil +} + +func (r *PatchResponse) SetBody(v *PatchResponseBody) { + r.Body = v +} + +func (r *PatchResponseBody) GetObjectID() *refs.ObjectID { + if r != nil { + return r.ObjectID + } + + return nil +} + +func (r *PatchResponseBody) SetObjectID(objectID *refs.ObjectID) { + r.ObjectID = objectID +} + +func (r *PatchRequestBodyPatch) GetChunk() []byte { + if r != nil { + return r.Chunk + } + + return nil +} + +func (r *PatchRequestBodyPatch) GetRange() *Range { + if r != nil { + return r.Range + } + + return nil +} + +func (s *ECInfo) getObjectPart() {} + +func (s *ECInfo) getHeaderPart() {} + +func (s *ECInfo) getRangePart() {} diff --git a/api/refs/bench_test.go b/api/refs/bench_test.go new file mode 100644 index 00000000..40784c6d --- /dev/null +++ b/api/refs/bench_test.go @@ -0,0 +1,53 @@ +package refs + +import ( + "math/rand" + "strconv" + "testing" +) + +func BenchmarkObjectIDSlice(b *testing.B) { + for _, size := range []int{0, 1, 50} { + b.Run(strconv.Itoa(size)+" elements", func(b *testing.B) { + benchmarkObjectIDSlice(b, size) + }) + } +} + +func benchmarkObjectIDSlice(b *testing.B, size int) { + ids := make([]ObjectID, size) + for i := range ids { + ids[i].val = make([]byte, 32) + rand.Read(ids[i].val) + } + raw := ObjectIDListToGRPCMessage(ids) + + b.Run("to grpc message", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + raw := ObjectIDListToGRPCMessage(ids) + if len(raw) != len(ids) { + b.FailNow() + } + } + }) + b.Run("from grpc message", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + ids, err := ObjectIDListFromGRPCMessage(raw) + if err != nil || len(raw) != len(ids) { + b.FailNow() + } + } + }) + b.Run("marshal", func(b *testing.B) { + b.ReportAllocs() + for range b.N { + buf := make([]byte, ObjectIDNestedListSize(1, ids)) + n := ObjectIDNestedListMarshal(1, buf, ids) + if n != len(buf) { + b.FailNow() + } + } + }) +} diff --git a/api/refs/convert.go b/api/refs/convert.go new file mode 100644 index 00000000..2d8011f6 --- /dev/null +++ b/api/refs/convert.go @@ -0,0 +1,264 @@ +package refs + +import ( + refs "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (o *OwnerID) ToGRPCMessage() grpc.Message { + var m *refs.OwnerID + + if o != nil { + m = new(refs.OwnerID) + + m.SetValue(o.val) + } + + return m +} + +func (o *OwnerID) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.OwnerID) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + o.val = v.GetValue() + + return nil +} + +func (c *ContainerID) ToGRPCMessage() grpc.Message { + var m *refs.ContainerID + + if c != nil { + m = new(refs.ContainerID) + + m.SetValue(c.val) + } + + return m +} + +func (c *ContainerID) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.ContainerID) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + c.val = v.GetValue() + + return nil +} + +func ContainerIDsToGRPCMessage(ids []ContainerID) (res []*refs.ContainerID) { + if ids != nil { + res = make([]*refs.ContainerID, 0, len(ids)) + + for i := range ids { + res = append(res, ids[i].ToGRPCMessage().(*refs.ContainerID)) + } + } + + return +} + +func ContainerIDsFromGRPCMessage(idsV2 []*refs.ContainerID) (res []ContainerID, err error) { + if idsV2 != nil { + res = make([]ContainerID, len(idsV2)) + + for i := range idsV2 { + err = res[i].FromGRPCMessage(idsV2[i]) + if err != nil { + return + } + } + } + + return +} + +func (o *ObjectID) ToGRPCMessage() grpc.Message { + var m *refs.ObjectID + + if o != nil { + m = new(refs.ObjectID) + + m.SetValue(o.val) + } + + return m +} + +func (o *ObjectID) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.ObjectID) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + o.val = v.GetValue() + + return nil +} + +func ObjectIDListToGRPCMessage(ids []ObjectID) (res []*refs.ObjectID) { + if ids != nil { + res = make([]*refs.ObjectID, 0, len(ids)) + + for i := range ids { + res = append(res, ids[i].ToGRPCMessage().(*refs.ObjectID)) + } + } + + return +} + +func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) (res []ObjectID, err error) { + if idsV2 != nil { + res = make([]ObjectID, len(idsV2)) + + for i := range idsV2 { + err = res[i].FromGRPCMessage(idsV2[i]) + if err != nil { + return + } + } + } + + return +} + +func (a *Address) ToGRPCMessage() grpc.Message { + var m *refs.Address + + if a != nil { + m = new(refs.Address) + + m.SetContainerId(a.cid.ToGRPCMessage().(*refs.ContainerID)) + m.SetObjectId(a.oid.ToGRPCMessage().(*refs.ObjectID)) + } + + return m +} + +func (a *Address) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.Address) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + a.cid = nil + } else { + if a.cid == nil { + a.cid = new(ContainerID) + } + + err = a.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } + + oid := v.GetObjectId() + if oid == nil { + a.oid = nil + } else { + if a.oid == nil { + a.oid = new(ObjectID) + } + + err = a.oid.FromGRPCMessage(oid) + } + + return err +} + +func ChecksumTypeToGRPC(t ChecksumType) refs.ChecksumType { + return refs.ChecksumType(t) +} + +func ChecksumTypeFromGRPC(t refs.ChecksumType) ChecksumType { + return ChecksumType(t) +} + +func (c *Checksum) ToGRPCMessage() grpc.Message { + var m *refs.Checksum + + if c != nil { + m = new(refs.Checksum) + + m.SetType(ChecksumTypeToGRPC(c.typ)) + m.SetSum(c.sum) + } + + return m +} + +func (c *Checksum) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.Checksum) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + c.typ = ChecksumTypeFromGRPC(v.GetType()) + c.sum = v.GetSum() + + return nil +} + +func (v *Version) ToGRPCMessage() grpc.Message { + var m *refs.Version + + if v != nil { + m = new(refs.Version) + + m.SetMajor(v.major) + m.SetMinor(v.minor) + } + + return m +} + +func (v *Version) FromGRPCMessage(m grpc.Message) error { + ver, ok := m.(*refs.Version) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + v.major = ver.GetMajor() + v.minor = ver.GetMinor() + + return nil +} + +func (s *Signature) ToGRPCMessage() grpc.Message { + var m *refs.Signature + + if s != nil { + m = new(refs.Signature) + + m.SetKey(s.key) + m.SetSign(s.sign) + m.SetScheme(refs.SignatureScheme(s.scheme)) + } + + return m +} + +func (s *Signature) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*refs.Signature) + if !ok { + return message.NewUnexpectedMessageType(m, s) + } + + s.key = v.GetKey() + s.sign = v.GetSign() + s.scheme = SignatureScheme(v.GetScheme()) + + return nil +} diff --git a/api/refs/grpc/types.pb.go b/api/refs/grpc/types.pb.go new file mode 100644 index 00000000..f8378567 --- /dev/null +++ b/api/refs/grpc/types.pb.go @@ -0,0 +1,1043 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/refs/grpc/types.proto + +//go:build !protoopaque + +package refs + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Signature scheme describes digital signing scheme used for (key, signature) +// pair. +type SignatureScheme int32 + +const ( + // ECDSA with SHA-512 hashing (FIPS 186-3) + SignatureScheme_ECDSA_SHA512 SignatureScheme = 0 + // Deterministic ECDSA with SHA-256 hashing (RFC 6979) + SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 1 + // Deterministic ECDSA with SHA-256 hashing using WalletConnect API. + // Here the algorithm is the same, but the message format differs. + SignatureScheme_ECDSA_RFC6979_SHA256_WALLET_CONNECT SignatureScheme = 2 +) + +// Enum value maps for SignatureScheme. +var ( + SignatureScheme_name = map[int32]string{ + 0: "ECDSA_SHA512", + 1: "ECDSA_RFC6979_SHA256", + 2: "ECDSA_RFC6979_SHA256_WALLET_CONNECT", + } + SignatureScheme_value = map[string]int32{ + "ECDSA_SHA512": 0, + "ECDSA_RFC6979_SHA256": 1, + "ECDSA_RFC6979_SHA256_WALLET_CONNECT": 2, + } +) + +func (x SignatureScheme) Enum() *SignatureScheme { + p := new(SignatureScheme) + *p = x + return p +} + +func (x SignatureScheme) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SignatureScheme) Descriptor() protoreflect.EnumDescriptor { + return file_api_refs_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (SignatureScheme) Type() protoreflect.EnumType { + return &file_api_refs_grpc_types_proto_enumTypes[0] +} + +func (x SignatureScheme) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Checksum algorithm type. +type ChecksumType int32 + +const ( + // Unknown. Not used + ChecksumType_CHECKSUM_TYPE_UNSPECIFIED ChecksumType = 0 + // Tillich-Zemor homomorphic hash function + ChecksumType_TZ ChecksumType = 1 + // SHA-256 + ChecksumType_SHA256 ChecksumType = 2 +) + +// Enum value maps for ChecksumType. +var ( + ChecksumType_name = map[int32]string{ + 0: "CHECKSUM_TYPE_UNSPECIFIED", + 1: "TZ", + 2: "SHA256", + } + ChecksumType_value = map[string]int32{ + "CHECKSUM_TYPE_UNSPECIFIED": 0, + "TZ": 1, + "SHA256": 2, + } +) + +func (x ChecksumType) Enum() *ChecksumType { + p := new(ChecksumType) + *p = x + return p +} + +func (x ChecksumType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ChecksumType) Descriptor() protoreflect.EnumDescriptor { + return file_api_refs_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (ChecksumType) Type() protoreflect.EnumType { + return &file_api_refs_grpc_types_proto_enumTypes[1] +} + +func (x ChecksumType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Objects in FrostFS are addressed by their ContainerID and ObjectID. +// +// String presentation of `Address` is a concatenation of string encoded +// `ContainerID` and `ObjectID` delimited by '/' character. +type Address struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Container identifier + ContainerId *ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerID" json:"container_id,omitempty"` + // Object identifier + ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectID" json:"object_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Address) Reset() { + *x = Address{} + mi := &file_api_refs_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Address) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Address) ProtoMessage() {} + +func (x *Address) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Address) GetContainerId() *ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *Address) GetObjectId() *ObjectID { + if x != nil { + return x.ObjectId + } + return nil +} + +func (x *Address) SetContainerId(v *ContainerID) { + x.ContainerId = v +} + +func (x *Address) SetObjectId(v *ObjectID) { + x.ObjectId = v +} + +func (x *Address) HasContainerId() bool { + if x == nil { + return false + } + return x.ContainerId != nil +} + +func (x *Address) HasObjectId() bool { + if x == nil { + return false + } + return x.ObjectId != nil +} + +func (x *Address) ClearContainerId() { + x.ContainerId = nil +} + +func (x *Address) ClearObjectId() { + x.ObjectId = nil +} + +type Address_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container identifier + ContainerId *ContainerID + // Object identifier + ObjectId *ObjectID +} + +func (b0 Address_builder) Build() *Address { + m0 := &Address{} + b, x := &b0, m0 + _, _ = b, x + x.ContainerId = b.ContainerId + x.ObjectId = b.ObjectId + return m0 +} + +// FrostFS Object unique identifier. Objects are immutable and +// content-addressed. It means `ObjectID` will change if the `header` or the +// `payload` changes. +// +// `ObjectID` is a 32 byte long +// [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of +// the object's `header` field, which, in it's turn, contains the hash of the +// object's payload. +// +// String presentation is a +// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. +// +// JSON value will be data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. +type ObjectID struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Object identifier in a binary format + Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectID) Reset() { + *x = ObjectID{} + mi := &file_api_refs_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectID) ProtoMessage() {} + +func (x *ObjectID) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ObjectID) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *ObjectID) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.Value = v +} + +func (x *ObjectID) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *ObjectID) ClearValue() { + x.Value = nil +} + +type ObjectID_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object identifier in a binary format + Value []byte +} + +func (b0 ObjectID_builder) Build() *ObjectID { + m0 := &ObjectID{} + b, x := &b0, m0 + _, _ = b, x + x.Value = b.Value + return m0 +} + +// FrostFS container identifier. Container structures are immutable and +// content-addressed. +// +// `ContainerID` is a 32 byte long +// [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of +// stable-marshalled container message. +// +// String presentation is a +// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. +// +// JSON value will be data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. +type ContainerID struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Container identifier in a binary format. + Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ContainerID) Reset() { + *x = ContainerID{} + mi := &file_api_refs_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ContainerID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContainerID) ProtoMessage() {} + +func (x *ContainerID) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ContainerID) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *ContainerID) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.Value = v +} + +func (x *ContainerID) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *ContainerID) ClearValue() { + x.Value = nil +} + +type ContainerID_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container identifier in a binary format. + Value []byte +} + +func (b0 ContainerID_builder) Build() *ContainerID { + m0 := &ContainerID{} + b, x := &b0, m0 + _, _ = b, x + x.Value = b.Value + return m0 +} + +// `OwnerID` is a derivative of a user's main public key. The transformation +// algorithm is the same as for Neo3 wallet addresses. Neo3 wallet address can +// be directly used as `OwnerID`. +// +// `OwnerID` is a 25 bytes sequence starting with Neo version prefix byte +// followed by 20 bytes of ScrptHash and 4 bytes of checksum. +// +// String presentation is a [Base58 +// Check](https://en.bitcoin.it/wiki/Base58Check_encoding) Encoded string. +// +// JSON value will be data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. +type OwnerID struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of the container owner in a binary format + Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OwnerID) Reset() { + *x = OwnerID{} + mi := &file_api_refs_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OwnerID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OwnerID) ProtoMessage() {} + +func (x *OwnerID) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OwnerID) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *OwnerID) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.Value = v +} + +func (x *OwnerID) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *OwnerID) ClearValue() { + x.Value = nil +} + +type OwnerID_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container owner in a binary format + Value []byte +} + +func (b0 OwnerID_builder) Build() *OwnerID { + m0 := &OwnerID{} + b, x := &b0, m0 + _, _ = b, x + x.Value = b.Value + return m0 +} + +// API version used by a node. +// +// String presentation is a Semantic Versioning 2.0.0 compatible version string +// with 'v' prefix. i.e. `vX.Y`, where `X` is the major number, `Y` is the minor +// number. +type Version struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Major API version + Major *uint32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"` + // Minor API version + Minor *uint32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Version) Reset() { + *x = Version{} + mi := &file_api_refs_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Version) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Version) ProtoMessage() {} + +func (x *Version) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Version) GetMajor() uint32 { + if x != nil && x.Major != nil { + return *x.Major + } + return 0 +} + +func (x *Version) GetMinor() uint32 { + if x != nil && x.Minor != nil { + return *x.Minor + } + return 0 +} + +func (x *Version) SetMajor(v uint32) { + x.Major = &v +} + +func (x *Version) SetMinor(v uint32) { + x.Minor = &v +} + +func (x *Version) HasMajor() bool { + if x == nil { + return false + } + return x.Major != nil +} + +func (x *Version) HasMinor() bool { + if x == nil { + return false + } + return x.Minor != nil +} + +func (x *Version) ClearMajor() { + x.Major = nil +} + +func (x *Version) ClearMinor() { + x.Minor = nil +} + +type Version_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Major API version + Major *uint32 + // Minor API version + Minor *uint32 +} + +func (b0 Version_builder) Build() *Version { + m0 := &Version{} + b, x := &b0, m0 + _, _ = b, x + x.Major = b.Major + x.Minor = b.Minor + return m0 +} + +// Signature of something in FrostFS. +type Signature struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Public key used for signing + Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + // Signature + Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature" json:"sign,omitempty"` + // Scheme contains digital signature scheme identifier + Scheme *SignatureScheme `protobuf:"varint,3,opt,name=scheme,enum=neo.fs.v2.refs.SignatureScheme" json:"scheme,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Signature) Reset() { + *x = Signature{} + mi := &file_api_refs_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Signature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Signature) ProtoMessage() {} + +func (x *Signature) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Signature) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *Signature) GetSign() []byte { + if x != nil { + return x.Sign + } + return nil +} + +func (x *Signature) GetScheme() SignatureScheme { + if x != nil && x.Scheme != nil { + return *x.Scheme + } + return SignatureScheme_ECDSA_SHA512 +} + +func (x *Signature) SetKey(v []byte) { + if v == nil { + v = []byte{} + } + x.Key = v +} + +func (x *Signature) SetSign(v []byte) { + if v == nil { + v = []byte{} + } + x.Sign = v +} + +func (x *Signature) SetScheme(v SignatureScheme) { + x.Scheme = &v +} + +func (x *Signature) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *Signature) HasSign() bool { + if x == nil { + return false + } + return x.Sign != nil +} + +func (x *Signature) HasScheme() bool { + if x == nil { + return false + } + return x.Scheme != nil +} + +func (x *Signature) ClearKey() { + x.Key = nil +} + +func (x *Signature) ClearSign() { + x.Sign = nil +} + +func (x *Signature) ClearScheme() { + x.Scheme = nil +} + +type Signature_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Public key used for signing + Key []byte + // Signature + Sign []byte + // Scheme contains digital signature scheme identifier + Scheme *SignatureScheme +} + +func (b0 Signature_builder) Build() *Signature { + m0 := &Signature{} + b, x := &b0, m0 + _, _ = b, x + x.Key = b.Key + x.Sign = b.Sign + x.Scheme = b.Scheme + return m0 +} + +// RFC 6979 signature. +type SignatureRFC6979 struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Public key used for signing + Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + // Deterministic ECDSA with SHA-256 hashing + Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature" json:"sign,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SignatureRFC6979) Reset() { + *x = SignatureRFC6979{} + mi := &file_api_refs_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SignatureRFC6979) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignatureRFC6979) ProtoMessage() {} + +func (x *SignatureRFC6979) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SignatureRFC6979) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *SignatureRFC6979) GetSign() []byte { + if x != nil { + return x.Sign + } + return nil +} + +func (x *SignatureRFC6979) SetKey(v []byte) { + if v == nil { + v = []byte{} + } + x.Key = v +} + +func (x *SignatureRFC6979) SetSign(v []byte) { + if v == nil { + v = []byte{} + } + x.Sign = v +} + +func (x *SignatureRFC6979) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *SignatureRFC6979) HasSign() bool { + if x == nil { + return false + } + return x.Sign != nil +} + +func (x *SignatureRFC6979) ClearKey() { + x.Key = nil +} + +func (x *SignatureRFC6979) ClearSign() { + x.Sign = nil +} + +type SignatureRFC6979_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Public key used for signing + Key []byte + // Deterministic ECDSA with SHA-256 hashing + Sign []byte +} + +func (b0 SignatureRFC6979_builder) Build() *SignatureRFC6979 { + m0 := &SignatureRFC6979{} + b, x := &b0, m0 + _, _ = b, x + x.Key = b.Key + x.Sign = b.Sign + return m0 +} + +// Checksum message. +// Depending on checksum algorithm type, the string presentation may vary: +// +// - TZ \ +// Hex encoded string without `0x` prefix +// - SHA256 \ +// Hex encoded string without `0x` prefix +type Checksum struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Checksum algorithm type + Type *ChecksumType `protobuf:"varint,1,opt,name=type,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + // Checksum itself + Sum []byte `protobuf:"bytes,2,opt,name=sum" json:"sum,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Checksum) Reset() { + *x = Checksum{} + mi := &file_api_refs_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Checksum) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Checksum) ProtoMessage() {} + +func (x *Checksum) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Checksum) GetType() ChecksumType { + if x != nil && x.Type != nil { + return *x.Type + } + return ChecksumType_CHECKSUM_TYPE_UNSPECIFIED +} + +func (x *Checksum) GetSum() []byte { + if x != nil { + return x.Sum + } + return nil +} + +func (x *Checksum) SetType(v ChecksumType) { + x.Type = &v +} + +func (x *Checksum) SetSum(v []byte) { + if v == nil { + v = []byte{} + } + x.Sum = v +} + +func (x *Checksum) HasType() bool { + if x == nil { + return false + } + return x.Type != nil +} + +func (x *Checksum) HasSum() bool { + if x == nil { + return false + } + return x.Sum != nil +} + +func (x *Checksum) ClearType() { + x.Type = nil +} + +func (x *Checksum) ClearSum() { + x.Sum = nil +} + +type Checksum_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Checksum algorithm type + Type *ChecksumType + // Checksum itself + Sum []byte +} + +func (b0 Checksum_builder) Build() *Checksum { + m0 := &Checksum{} + b, x := &b0, m0 + _, _ = b, x + x.Type = b.Type + x.Sum = b.Sum + return m0 +} + +var File_api_refs_grpc_types_proto protoreflect.FileDescriptor + +var file_api_refs_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x07, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x22, 0x20, + 0x0a, 0x08, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0x23, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x6f, 0x0a, + 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3d, + 0x0a, 0x10, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, + 0x37, 0x39, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, + 0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, + 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, + 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x66, 0x0a, + 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, + 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, + 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, + 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, + 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, + 0x41, 0x32, 0x35, 0x36, 0x5f, 0x57, 0x41, 0x4c, 0x4c, 0x45, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, + 0x45, 0x43, 0x54, 0x10, 0x02, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, + 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, + 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, + 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x5c, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, + 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x70, 0xe8, 0x07, +} + +var file_api_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_api_refs_grpc_types_proto_goTypes = []any{ + (SignatureScheme)(0), // 0: neo.fs.v2.refs.SignatureScheme + (ChecksumType)(0), // 1: neo.fs.v2.refs.ChecksumType + (*Address)(nil), // 2: neo.fs.v2.refs.Address + (*ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID + (*ContainerID)(nil), // 4: neo.fs.v2.refs.ContainerID + (*OwnerID)(nil), // 5: neo.fs.v2.refs.OwnerID + (*Version)(nil), // 6: neo.fs.v2.refs.Version + (*Signature)(nil), // 7: neo.fs.v2.refs.Signature + (*SignatureRFC6979)(nil), // 8: neo.fs.v2.refs.SignatureRFC6979 + (*Checksum)(nil), // 9: neo.fs.v2.refs.Checksum +} +var file_api_refs_grpc_types_proto_depIdxs = []int32{ + 4, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID + 3, // 1: neo.fs.v2.refs.Address.object_id:type_name -> neo.fs.v2.refs.ObjectID + 0, // 2: neo.fs.v2.refs.Signature.scheme:type_name -> neo.fs.v2.refs.SignatureScheme + 1, // 3: neo.fs.v2.refs.Checksum.type:type_name -> neo.fs.v2.refs.ChecksumType + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_api_refs_grpc_types_proto_init() } +func file_api_refs_grpc_types_proto_init() { + if File_api_refs_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_refs_grpc_types_proto_rawDesc, + NumEnums: 2, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_refs_grpc_types_proto_goTypes, + DependencyIndexes: file_api_refs_grpc_types_proto_depIdxs, + EnumInfos: file_api_refs_grpc_types_proto_enumTypes, + MessageInfos: file_api_refs_grpc_types_proto_msgTypes, + }.Build() + File_api_refs_grpc_types_proto = out.File + file_api_refs_grpc_types_proto_rawDesc = nil + file_api_refs_grpc_types_proto_goTypes = nil + file_api_refs_grpc_types_proto_depIdxs = nil +} diff --git a/api/refs/grpc/types_protoopaque.pb.go b/api/refs/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..ccd51e55 --- /dev/null +++ b/api/refs/grpc/types_protoopaque.pb.go @@ -0,0 +1,1107 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/refs/grpc/types.proto + +//go:build protoopaque + +package refs + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Signature scheme describes digital signing scheme used for (key, signature) +// pair. +type SignatureScheme int32 + +const ( + // ECDSA with SHA-512 hashing (FIPS 186-3) + SignatureScheme_ECDSA_SHA512 SignatureScheme = 0 + // Deterministic ECDSA with SHA-256 hashing (RFC 6979) + SignatureScheme_ECDSA_RFC6979_SHA256 SignatureScheme = 1 + // Deterministic ECDSA with SHA-256 hashing using WalletConnect API. + // Here the algorithm is the same, but the message format differs. + SignatureScheme_ECDSA_RFC6979_SHA256_WALLET_CONNECT SignatureScheme = 2 +) + +// Enum value maps for SignatureScheme. +var ( + SignatureScheme_name = map[int32]string{ + 0: "ECDSA_SHA512", + 1: "ECDSA_RFC6979_SHA256", + 2: "ECDSA_RFC6979_SHA256_WALLET_CONNECT", + } + SignatureScheme_value = map[string]int32{ + "ECDSA_SHA512": 0, + "ECDSA_RFC6979_SHA256": 1, + "ECDSA_RFC6979_SHA256_WALLET_CONNECT": 2, + } +) + +func (x SignatureScheme) Enum() *SignatureScheme { + p := new(SignatureScheme) + *p = x + return p +} + +func (x SignatureScheme) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SignatureScheme) Descriptor() protoreflect.EnumDescriptor { + return file_api_refs_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (SignatureScheme) Type() protoreflect.EnumType { + return &file_api_refs_grpc_types_proto_enumTypes[0] +} + +func (x SignatureScheme) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Checksum algorithm type. +type ChecksumType int32 + +const ( + // Unknown. Not used + ChecksumType_CHECKSUM_TYPE_UNSPECIFIED ChecksumType = 0 + // Tillich-Zemor homomorphic hash function + ChecksumType_TZ ChecksumType = 1 + // SHA-256 + ChecksumType_SHA256 ChecksumType = 2 +) + +// Enum value maps for ChecksumType. +var ( + ChecksumType_name = map[int32]string{ + 0: "CHECKSUM_TYPE_UNSPECIFIED", + 1: "TZ", + 2: "SHA256", + } + ChecksumType_value = map[string]int32{ + "CHECKSUM_TYPE_UNSPECIFIED": 0, + "TZ": 1, + "SHA256": 2, + } +) + +func (x ChecksumType) Enum() *ChecksumType { + p := new(ChecksumType) + *p = x + return p +} + +func (x ChecksumType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ChecksumType) Descriptor() protoreflect.EnumDescriptor { + return file_api_refs_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (ChecksumType) Type() protoreflect.EnumType { + return &file_api_refs_grpc_types_proto_enumTypes[1] +} + +func (x ChecksumType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Objects in FrostFS are addressed by their ContainerID and ObjectID. +// +// String presentation of `Address` is a concatenation of string encoded +// `ContainerID` and `ObjectID` delimited by '/' character. +type Address struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ContainerId *ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerID" json:"container_id,omitempty"` + xxx_hidden_ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectID" json:"object_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Address) Reset() { + *x = Address{} + mi := &file_api_refs_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Address) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Address) ProtoMessage() {} + +func (x *Address) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Address) GetContainerId() *ContainerID { + if x != nil { + return x.xxx_hidden_ContainerId + } + return nil +} + +func (x *Address) GetObjectId() *ObjectID { + if x != nil { + return x.xxx_hidden_ObjectId + } + return nil +} + +func (x *Address) SetContainerId(v *ContainerID) { + x.xxx_hidden_ContainerId = v +} + +func (x *Address) SetObjectId(v *ObjectID) { + x.xxx_hidden_ObjectId = v +} + +func (x *Address) HasContainerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ContainerId != nil +} + +func (x *Address) HasObjectId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObjectId != nil +} + +func (x *Address) ClearContainerId() { + x.xxx_hidden_ContainerId = nil +} + +func (x *Address) ClearObjectId() { + x.xxx_hidden_ObjectId = nil +} + +type Address_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container identifier + ContainerId *ContainerID + // Object identifier + ObjectId *ObjectID +} + +func (b0 Address_builder) Build() *Address { + m0 := &Address{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ContainerId = b.ContainerId + x.xxx_hidden_ObjectId = b.ObjectId + return m0 +} + +// FrostFS Object unique identifier. Objects are immutable and +// content-addressed. It means `ObjectID` will change if the `header` or the +// `payload` changes. +// +// `ObjectID` is a 32 byte long +// [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of +// the object's `header` field, which, in it's turn, contains the hash of the +// object's payload. +// +// String presentation is a +// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. +// +// JSON value will be data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. +type ObjectID struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectID) Reset() { + *x = ObjectID{} + mi := &file_api_refs_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectID) ProtoMessage() {} + +func (x *ObjectID) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ObjectID) GetValue() []byte { + if x != nil { + return x.xxx_hidden_Value + } + return nil +} + +func (x *ObjectID) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Value = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *ObjectID) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *ObjectID) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Value = nil +} + +type ObjectID_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Object identifier in a binary format + Value []byte +} + +func (b0 ObjectID_builder) Build() *ObjectID { + m0 := &ObjectID{} + b, x := &b0, m0 + _, _ = b, x + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// FrostFS container identifier. Container structures are immutable and +// content-addressed. +// +// `ContainerID` is a 32 byte long +// [SHA256](https://csrc.nist.gov/publications/detail/fips/180/4/final) hash of +// stable-marshalled container message. +// +// String presentation is a +// [base58](https://tools.ietf.org/html/draft-msporny-base58-02) encoded string. +// +// JSON value will be data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. +type ContainerID struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ContainerID) Reset() { + *x = ContainerID{} + mi := &file_api_refs_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ContainerID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContainerID) ProtoMessage() {} + +func (x *ContainerID) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ContainerID) GetValue() []byte { + if x != nil { + return x.xxx_hidden_Value + } + return nil +} + +func (x *ContainerID) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Value = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *ContainerID) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *ContainerID) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Value = nil +} + +type ContainerID_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Container identifier in a binary format. + Value []byte +} + +func (b0 ContainerID_builder) Build() *ContainerID { + m0 := &ContainerID{} + b, x := &b0, m0 + _, _ = b, x + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// `OwnerID` is a derivative of a user's main public key. The transformation +// algorithm is the same as for Neo3 wallet addresses. Neo3 wallet address can +// be directly used as `OwnerID`. +// +// `OwnerID` is a 25 bytes sequence starting with Neo version prefix byte +// followed by 20 bytes of ScrptHash and 4 bytes of checksum. +// +// String presentation is a [Base58 +// Check](https://en.bitcoin.it/wiki/Base58Check_encoding) Encoded string. +// +// JSON value will be data encoded as a string using standard base64 +// encoding with paddings. Either +// [standard](https://tools.ietf.org/html/rfc4648#section-4) or +// [URL-safe](https://tools.ietf.org/html/rfc4648#section-5) base64 encoding +// with/without paddings are accepted. +type OwnerID struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OwnerID) Reset() { + *x = OwnerID{} + mi := &file_api_refs_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OwnerID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OwnerID) ProtoMessage() {} + +func (x *OwnerID) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *OwnerID) GetValue() []byte { + if x != nil { + return x.xxx_hidden_Value + } + return nil +} + +func (x *OwnerID) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Value = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *OwnerID) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *OwnerID) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Value = nil +} + +type OwnerID_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of the container owner in a binary format + Value []byte +} + +func (b0 OwnerID_builder) Build() *OwnerID { + m0 := &OwnerID{} + b, x := &b0, m0 + _, _ = b, x + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// API version used by a node. +// +// String presentation is a Semantic Versioning 2.0.0 compatible version string +// with 'v' prefix. i.e. `vX.Y`, where `X` is the major number, `Y` is the minor +// number. +type Version struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Major uint32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"` + xxx_hidden_Minor uint32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Version) Reset() { + *x = Version{} + mi := &file_api_refs_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Version) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Version) ProtoMessage() {} + +func (x *Version) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Version) GetMajor() uint32 { + if x != nil { + return x.xxx_hidden_Major + } + return 0 +} + +func (x *Version) GetMinor() uint32 { + if x != nil { + return x.xxx_hidden_Minor + } + return 0 +} + +func (x *Version) SetMajor(v uint32) { + x.xxx_hidden_Major = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *Version) SetMinor(v uint32) { + x.xxx_hidden_Minor = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *Version) HasMajor() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Version) HasMinor() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Version) ClearMajor() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Major = 0 +} + +func (x *Version) ClearMinor() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Minor = 0 +} + +type Version_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Major API version + Major *uint32 + // Minor API version + Minor *uint32 +} + +func (b0 Version_builder) Build() *Version { + m0 := &Version{} + b, x := &b0, m0 + _, _ = b, x + if b.Major != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Major = *b.Major + } + if b.Minor != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Minor = *b.Minor + } + return m0 +} + +// Signature of something in FrostFS. +type Signature struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + xxx_hidden_Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature" json:"sign,omitempty"` + xxx_hidden_Scheme SignatureScheme `protobuf:"varint,3,opt,name=scheme,enum=neo.fs.v2.refs.SignatureScheme" json:"scheme,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Signature) Reset() { + *x = Signature{} + mi := &file_api_refs_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Signature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Signature) ProtoMessage() {} + +func (x *Signature) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Signature) GetKey() []byte { + if x != nil { + return x.xxx_hidden_Key + } + return nil +} + +func (x *Signature) GetSign() []byte { + if x != nil { + return x.xxx_hidden_Sign + } + return nil +} + +func (x *Signature) GetScheme() SignatureScheme { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 2) { + return x.xxx_hidden_Scheme + } + } + return SignatureScheme_ECDSA_SHA512 +} + +func (x *Signature) SetKey(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Key = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *Signature) SetSign(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Sign = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *Signature) SetScheme(v SignatureScheme) { + x.xxx_hidden_Scheme = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *Signature) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Signature) HasSign() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Signature) HasScheme() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *Signature) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Key = nil +} + +func (x *Signature) ClearSign() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Sign = nil +} + +func (x *Signature) ClearScheme() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Scheme = SignatureScheme_ECDSA_SHA512 +} + +type Signature_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Public key used for signing + Key []byte + // Signature + Sign []byte + // Scheme contains digital signature scheme identifier + Scheme *SignatureScheme +} + +func (b0 Signature_builder) Build() *Signature { + m0 := &Signature{} + b, x := &b0, m0 + _, _ = b, x + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_Key = b.Key + } + if b.Sign != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Sign = b.Sign + } + if b.Scheme != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Scheme = *b.Scheme + } + return m0 +} + +// RFC 6979 signature. +type SignatureRFC6979 struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + xxx_hidden_Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature" json:"sign,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SignatureRFC6979) Reset() { + *x = SignatureRFC6979{} + mi := &file_api_refs_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SignatureRFC6979) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignatureRFC6979) ProtoMessage() {} + +func (x *SignatureRFC6979) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SignatureRFC6979) GetKey() []byte { + if x != nil { + return x.xxx_hidden_Key + } + return nil +} + +func (x *SignatureRFC6979) GetSign() []byte { + if x != nil { + return x.xxx_hidden_Sign + } + return nil +} + +func (x *SignatureRFC6979) SetKey(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Key = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *SignatureRFC6979) SetSign(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Sign = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *SignatureRFC6979) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *SignatureRFC6979) HasSign() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *SignatureRFC6979) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Key = nil +} + +func (x *SignatureRFC6979) ClearSign() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Sign = nil +} + +type SignatureRFC6979_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Public key used for signing + Key []byte + // Deterministic ECDSA with SHA-256 hashing + Sign []byte +} + +func (b0 SignatureRFC6979_builder) Build() *SignatureRFC6979 { + m0 := &SignatureRFC6979{} + b, x := &b0, m0 + _, _ = b, x + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Key = b.Key + } + if b.Sign != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Sign = b.Sign + } + return m0 +} + +// Checksum message. +// Depending on checksum algorithm type, the string presentation may vary: +// +// - TZ \ +// Hex encoded string without `0x` prefix +// - SHA256 \ +// Hex encoded string without `0x` prefix +type Checksum struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Type ChecksumType `protobuf:"varint,1,opt,name=type,enum=neo.fs.v2.refs.ChecksumType" json:"type,omitempty"` + xxx_hidden_Sum []byte `protobuf:"bytes,2,opt,name=sum" json:"sum,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Checksum) Reset() { + *x = Checksum{} + mi := &file_api_refs_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Checksum) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Checksum) ProtoMessage() {} + +func (x *Checksum) ProtoReflect() protoreflect.Message { + mi := &file_api_refs_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Checksum) GetType() ChecksumType { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_Type + } + } + return ChecksumType_CHECKSUM_TYPE_UNSPECIFIED +} + +func (x *Checksum) GetSum() []byte { + if x != nil { + return x.xxx_hidden_Sum + } + return nil +} + +func (x *Checksum) SetType(v ChecksumType) { + x.xxx_hidden_Type = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *Checksum) SetSum(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Sum = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *Checksum) HasType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Checksum) HasSum() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Checksum) ClearType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Type = ChecksumType_CHECKSUM_TYPE_UNSPECIFIED +} + +func (x *Checksum) ClearSum() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Sum = nil +} + +type Checksum_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Checksum algorithm type + Type *ChecksumType + // Checksum itself + Sum []byte +} + +func (b0 Checksum_builder) Build() *Checksum { + m0 := &Checksum{} + b, x := &b0, m0 + _, _ = b, x + if b.Type != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Type = *b.Type + } + if b.Sum != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Sum = b.Sum + } + return m0 +} + +var File_api_refs_grpc_types_proto protoreflect.FileDescriptor + +var file_api_refs_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x07, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x35, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x44, 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x22, 0x20, + 0x0a, 0x08, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0x23, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x1f, 0x0a, 0x07, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x6f, 0x0a, + 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3d, + 0x0a, 0x10, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x46, 0x43, 0x36, 0x39, + 0x37, 0x39, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x4e, 0x0a, + 0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, + 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, + 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x2a, 0x66, 0x0a, + 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, + 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, + 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, + 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x12, 0x27, 0x0a, 0x23, + 0x45, 0x43, 0x44, 0x53, 0x41, 0x5f, 0x52, 0x46, 0x43, 0x36, 0x39, 0x37, 0x39, 0x5f, 0x53, 0x48, + 0x41, 0x32, 0x35, 0x36, 0x5f, 0x57, 0x41, 0x4c, 0x4c, 0x45, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, + 0x45, 0x43, 0x54, 0x10, 0x02, 0x2a, 0x41, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, + 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x53, 0x55, + 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x5a, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, + 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x02, 0x42, 0x5c, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, + 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, + 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x66, 0x73, 0xaa, 0x02, 0x18, 0x4e, 0x65, + 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, + 0x49, 0x2e, 0x52, 0x65, 0x66, 0x73, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x70, 0xe8, 0x07, +} + +var file_api_refs_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_refs_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_api_refs_grpc_types_proto_goTypes = []any{ + (SignatureScheme)(0), // 0: neo.fs.v2.refs.SignatureScheme + (ChecksumType)(0), // 1: neo.fs.v2.refs.ChecksumType + (*Address)(nil), // 2: neo.fs.v2.refs.Address + (*ObjectID)(nil), // 3: neo.fs.v2.refs.ObjectID + (*ContainerID)(nil), // 4: neo.fs.v2.refs.ContainerID + (*OwnerID)(nil), // 5: neo.fs.v2.refs.OwnerID + (*Version)(nil), // 6: neo.fs.v2.refs.Version + (*Signature)(nil), // 7: neo.fs.v2.refs.Signature + (*SignatureRFC6979)(nil), // 8: neo.fs.v2.refs.SignatureRFC6979 + (*Checksum)(nil), // 9: neo.fs.v2.refs.Checksum +} +var file_api_refs_grpc_types_proto_depIdxs = []int32{ + 4, // 0: neo.fs.v2.refs.Address.container_id:type_name -> neo.fs.v2.refs.ContainerID + 3, // 1: neo.fs.v2.refs.Address.object_id:type_name -> neo.fs.v2.refs.ObjectID + 0, // 2: neo.fs.v2.refs.Signature.scheme:type_name -> neo.fs.v2.refs.SignatureScheme + 1, // 3: neo.fs.v2.refs.Checksum.type:type_name -> neo.fs.v2.refs.ChecksumType + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_api_refs_grpc_types_proto_init() } +func file_api_refs_grpc_types_proto_init() { + if File_api_refs_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_refs_grpc_types_proto_rawDesc, + NumEnums: 2, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_refs_grpc_types_proto_goTypes, + DependencyIndexes: file_api_refs_grpc_types_proto_depIdxs, + EnumInfos: file_api_refs_grpc_types_proto_enumTypes, + MessageInfos: file_api_refs_grpc_types_proto_msgTypes, + }.Build() + File_api_refs_grpc_types_proto = out.File + file_api_refs_grpc_types_proto_rawDesc = nil + file_api_refs_grpc_types_proto_goTypes = nil + file_api_refs_grpc_types_proto_depIdxs = nil +} diff --git a/api/refs/json.go b/api/refs/json.go new file mode 100644 index 00000000..652211fc --- /dev/null +++ b/api/refs/json.go @@ -0,0 +1,62 @@ +package refs + +import ( + refs "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +func (a *Address) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(a) +} + +func (a *Address) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(a, data, new(refs.Address)) +} + +func (o *ObjectID) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(o) +} + +func (o *ObjectID) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(o, data, new(refs.ObjectID)) +} + +func (c *ContainerID) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(c) +} + +func (c *ContainerID) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(c, data, new(refs.ContainerID)) +} + +func (o *OwnerID) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(o) +} + +func (o *OwnerID) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(o, data, new(refs.OwnerID)) +} + +func (v *Version) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(v) +} + +func (v *Version) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(v, data, new(refs.Version)) +} + +func (s *Signature) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(s) +} + +func (s *Signature) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(s, data, new(refs.Signature)) +} + +func (c *Checksum) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(c) +} + +func (c *Checksum) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(c, data, new(refs.Checksum)) +} diff --git a/api/refs/marshal.go b/api/refs/marshal.go new file mode 100644 index 00000000..18f84b9a --- /dev/null +++ b/api/refs/marshal.go @@ -0,0 +1,264 @@ +package refs + +import ( + "encoding/binary" + + refs "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" + "google.golang.org/protobuf/encoding/protowire" +) + +const ( + ownerIDValField = 1 + + containerIDValField = 1 + + objectIDValField = 1 + + addressContainerField = 1 + addressObjectField = 2 + + checksumTypeField = 1 + checksumValueField = 2 + + signatureKeyField = 1 + signatureValueField = 2 + signatureSchemeField = 3 + + versionMajorField = 1 + versionMinorField = 2 +) + +func (o *OwnerID) StableMarshal(buf []byte) []byte { + if o == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, o.StableSize()) + } + + proto.BytesMarshal(ownerIDValField, buf, o.val) + + return buf +} + +func (o *OwnerID) StableSize() int { + if o == nil { + return 0 + } + + return proto.BytesSize(ownerIDValField, o.val) +} + +func (o *OwnerID) Unmarshal(data []byte) error { + return message.Unmarshal(o, data, new(refs.OwnerID)) +} + +func (c *ContainerID) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + proto.BytesMarshal(containerIDValField, buf, c.val) + + return buf +} + +func (c *ContainerID) StableSize() int { + if c == nil { + return 0 + } + + return proto.BytesSize(containerIDValField, c.val) +} + +func (c *ContainerID) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(refs.ContainerID)) +} + +func (o *ObjectID) StableMarshal(buf []byte) []byte { + if o == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, o.StableSize()) + } + + proto.BytesMarshal(objectIDValField, buf, o.val) + + return buf +} + +// ObjectIDNestedListSize returns byte length of nested +// repeated ObjectID field with fNum number. +func ObjectIDNestedListSize(fNum int64, ids []ObjectID) (sz int) { + for i := range ids { + sz += proto.NestedStructureSize(fNum, &ids[i]) + } + + return +} + +func (o *ObjectID) StableSize() int { + if o == nil { + return 0 + } + + return proto.BytesSize(objectIDValField, o.val) +} + +// ObjectIDNestedListMarshal writes protobuf repeated ObjectID field +// with fNum number to buf. +func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int) { + prefix := protowire.EncodeTag(protowire.Number(fNum), protowire.BytesType) + for i := range ids { + off += binary.PutUvarint(buf[off:], prefix) + + n := ids[i].StableSize() + off += binary.PutUvarint(buf[off:], uint64(n)) + off += proto.BytesMarshal(objectIDValField, buf[off:], ids[i].val) + } + + return +} + +func (o *ObjectID) Unmarshal(data []byte) error { + return message.Unmarshal(o, data, new(refs.ObjectID)) +} + +func (a *Address) StableMarshal(buf []byte) []byte { + if a == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, a.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(addressContainerField, buf[offset:], a.cid) + proto.NestedStructureMarshal(addressObjectField, buf[offset:], a.oid) + + return buf +} + +func (a *Address) StableSize() (size int) { + if a == nil { + return 0 + } + + size += proto.NestedStructureSize(addressContainerField, a.cid) + size += proto.NestedStructureSize(addressObjectField, a.oid) + + return size +} + +func (a *Address) Unmarshal(data []byte) error { + return message.Unmarshal(a, data, new(refs.Address)) +} + +func (c *Checksum) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + offset += proto.EnumMarshal(checksumTypeField, buf[offset:], int32(c.typ)) + proto.BytesMarshal(checksumValueField, buf[offset:], c.sum) + + return buf +} + +func (c *Checksum) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.EnumSize(checksumTypeField, int32(c.typ)) + size += proto.BytesSize(checksumValueField, c.sum) + + return size +} + +func (c *Checksum) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(refs.Checksum)) +} + +func (s *Signature) StableMarshal(buf []byte) []byte { + if s == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var offset int + + offset += proto.BytesMarshal(signatureKeyField, buf[offset:], s.key) + offset += proto.BytesMarshal(signatureValueField, buf[offset:], s.sign) + proto.EnumMarshal(signatureSchemeField, buf[offset:], int32(s.scheme)) + + return buf +} + +func (s *Signature) StableSize() (size int) { + if s == nil { + return 0 + } + + size += proto.BytesSize(signatureKeyField, s.key) + size += proto.BytesSize(signatureValueField, s.sign) + size += proto.EnumSize(signatureSchemeField, int32(s.scheme)) + + return size +} + +func (s *Signature) Unmarshal(data []byte) error { + return message.Unmarshal(s, data, new(refs.Signature)) +} + +func (v *Version) StableMarshal(buf []byte) []byte { + if v == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, v.StableSize()) + } + + var offset int + + offset += proto.UInt32Marshal(versionMajorField, buf[offset:], v.major) + proto.UInt32Marshal(versionMinorField, buf[offset:], v.minor) + + return buf +} + +func (v *Version) StableSize() (size int) { + if v == nil { + return 0 + } + + size += proto.UInt32Size(versionMajorField, v.major) + size += proto.UInt32Size(versionMinorField, v.minor) + + return size +} + +func (v *Version) Unmarshal(data []byte) error { + return message.Unmarshal(v, data, new(refs.Version)) +} diff --git a/api/refs/message_test.go b/api/refs/message_test.go new file mode 100644 index 00000000..d844f939 --- /dev/null +++ b/api/refs/message_test.go @@ -0,0 +1,21 @@ +package refs_test + +import ( + "testing" + + refstest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return refstest.GenerateOwnerID(empty) }, + func(empty bool) message.Message { return refstest.GenerateObjectID(empty) }, + func(empty bool) message.Message { return refstest.GenerateContainerID(empty) }, + func(empty bool) message.Message { return refstest.GenerateAddress(empty) }, + func(empty bool) message.Message { return refstest.GenerateChecksum(empty) }, + func(empty bool) message.Message { return refstest.GenerateSignature(empty) }, + func(empty bool) message.Message { return refstest.GenerateVersion(empty) }, + ) +} diff --git a/api/refs/string.go b/api/refs/string.go new file mode 100644 index 00000000..637bbaf8 --- /dev/null +++ b/api/refs/string.go @@ -0,0 +1,43 @@ +package refs + +import ( + refs "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" +) + +// String returns string representation of ChecksumType. +func (t ChecksumType) String() string { + return ChecksumTypeToGRPC(t).String() +} + +// FromString parses ChecksumType from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *ChecksumType) FromString(s string) bool { + g, ok := refs.ChecksumType_value[s] + + if ok { + *t = ChecksumTypeFromGRPC(refs.ChecksumType(g)) + } + + return ok +} + +// String returns string representation of SignatureScheme. +func (t SignatureScheme) String() string { + return refs.SignatureScheme(t).String() +} + +// FromString parses SignatureScheme from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (t *SignatureScheme) FromString(s string) bool { + g, ok := refs.SignatureScheme_value[s] + + if ok { + *t = SignatureScheme(refs.SignatureScheme(g)) + } + + return ok +} diff --git a/api/refs/test/generate.go b/api/refs/test/generate.go new file mode 100644 index 00000000..ec9151a2 --- /dev/null +++ b/api/refs/test/generate.go @@ -0,0 +1,127 @@ +package refstest + +import ( + crand "crypto/rand" + "crypto/sha256" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" +) + +func GenerateVersion(empty bool) *refs.Version { + m := new(refs.Version) + + if !empty { + m.SetMajor(2) + m.SetMinor(1) + } + + return m +} + +func GenerateOwnerID(empty bool) *refs.OwnerID { + m := new(refs.OwnerID) + + if !empty { + id := make([]byte, 25) + _, _ = crand.Read(id) + + m.SetValue(id) + } + + return m +} + +func GenerateAddress(empty bool) *refs.Address { + m := new(refs.Address) + + if !empty { + m.SetObjectID(GenerateObjectID(false)) + m.SetContainerID(GenerateContainerID(false)) + } + + return m +} + +func GenerateObjectID(empty bool) *refs.ObjectID { + m := new(refs.ObjectID) + + if !empty { + id := make([]byte, sha256.Size) + _, _ = crand.Read(id) + + m.SetValue(id) + } + + return m +} + +func GenerateObjectIDs(empty bool) []refs.ObjectID { + var ids []refs.ObjectID + + if !empty { + ids = append(ids, + *GenerateObjectID(false), + *GenerateObjectID(false), + ) + } + + return ids +} + +func GenerateContainerID(empty bool) *refs.ContainerID { + m := new(refs.ContainerID) + + if !empty { + id := make([]byte, sha256.Size) + _, _ = crand.Read(id) + + m.SetValue(id) + } + + return m +} + +func GenerateContainerIDs(empty bool) []refs.ContainerID { + var res []refs.ContainerID + + if !empty { + res = append(res, + *GenerateContainerID(false), + *GenerateContainerID(false), + ) + } + + return res +} + +func GenerateSignature(empty bool) *refs.Signature { + m := new(refs.Signature) + + if !empty { + key := make([]byte, 33) + _, _ = crand.Read(key) + + sign := make([]byte, 65) + _, _ = crand.Read(sign) + + m.SetScheme(refs.ECDSA_SHA512) + m.SetKey(key) + m.SetSign(sign) + } + + return m +} + +func GenerateChecksum(empty bool) *refs.Checksum { + m := new(refs.Checksum) + + if !empty { + cs := make([]byte, sha256.Size) + _, _ = crand.Read(cs) + + m.SetType(refs.SHA256) + m.SetSum(cs) + } + + return m +} diff --git a/api/refs/types.go b/api/refs/types.go new file mode 100644 index 00000000..d8f0d9b9 --- /dev/null +++ b/api/refs/types.go @@ -0,0 +1,194 @@ +package refs + +type OwnerID struct { + val []byte +} + +type ContainerID struct { + val []byte +} + +type ObjectID struct { + val []byte +} + +type Address struct { + cid *ContainerID + + oid *ObjectID +} + +type Checksum struct { + typ ChecksumType + + sum []byte +} + +type ChecksumType uint32 + +type SignatureScheme uint32 + +//nolint:revive +const ( + ECDSA_SHA512 SignatureScheme = iota + ECDSA_RFC6979_SHA256 + ECDSA_RFC6979_SHA256_WALLET_CONNECT +) + +type Signature struct { + key, sign []byte + scheme SignatureScheme +} + +type Version struct { + major, minor uint32 +} + +const ( + UnknownChecksum ChecksumType = iota + TillichZemor + SHA256 +) + +func (o *OwnerID) GetValue() []byte { + if o != nil { + return o.val + } + + return nil +} + +func (o *OwnerID) SetValue(v []byte) { + o.val = v +} + +func (c *ContainerID) GetValue() []byte { + if c != nil { + return c.val + } + + return nil +} + +func (c *ContainerID) SetValue(v []byte) { + c.val = v +} + +func (o *ObjectID) GetValue() []byte { + if o != nil { + return o.val + } + + return nil +} + +func (o *ObjectID) SetValue(v []byte) { + o.val = v +} + +func (a *Address) GetContainerID() *ContainerID { + if a != nil { + return a.cid + } + + return nil +} + +func (a *Address) SetContainerID(v *ContainerID) { + a.cid = v +} + +func (a *Address) GetObjectID() *ObjectID { + if a != nil { + return a.oid + } + + return nil +} + +func (a *Address) SetObjectID(v *ObjectID) { + a.oid = v +} + +func (c *Checksum) GetType() ChecksumType { + if c != nil { + return c.typ + } + + return UnknownChecksum +} + +func (c *Checksum) SetType(v ChecksumType) { + c.typ = v +} + +func (c *Checksum) GetSum() []byte { + if c != nil { + return c.sum + } + + return nil +} + +func (c *Checksum) SetSum(v []byte) { + c.sum = v +} + +func (s *Signature) GetKey() []byte { + if s != nil { + return s.key + } + + return nil +} + +func (s *Signature) SetKey(v []byte) { + s.key = v +} + +func (s *Signature) GetSign() []byte { + if s != nil { + return s.sign + } + + return nil +} + +func (s *Signature) SetSign(v []byte) { + s.sign = v +} + +func (s *Signature) GetScheme() SignatureScheme { + if s != nil { + return s.scheme + } + return 0 +} + +func (s *Signature) SetScheme(scheme SignatureScheme) { + s.scheme = scheme +} + +func (v *Version) GetMajor() uint32 { + if v != nil { + return v.major + } + + return 0 +} + +func (v *Version) SetMajor(val uint32) { + v.major = val +} + +func (v *Version) GetMinor() uint32 { + if v != nil { + return v.minor + } + + return 0 +} + +func (v *Version) SetMinor(val uint32) { + v.minor = val +} diff --git a/api/rpc/accounting.go b/api/rpc/accounting.go new file mode 100644 index 00000000..31259bd8 --- /dev/null +++ b/api/rpc/accounting.go @@ -0,0 +1,29 @@ +package rpc + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" +) + +const serviceAccounting = serviceNamePrefix + "accounting.AccountingService" + +const ( + rpcAccountingBalance = "Balance" +) + +// Balance executes AccountingService.Balance RPC. +func Balance( + cli *client.Client, + req *accounting.BalanceRequest, + opts ...client.CallOption, +) (*accounting.BalanceResponse, error) { + resp := new(accounting.BalanceResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceAccounting, rpcAccountingBalance), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/api/rpc/apemanager.go b/api/rpc/apemanager.go new file mode 100644 index 00000000..6494d161 --- /dev/null +++ b/api/rpc/apemanager.go @@ -0,0 +1,60 @@ +package rpc + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" +) + +const serviceAPEManager = frostfsServiceNamePrefix + "apemanager.APEManagerService" + +const ( + rpcAPEManagerAddChain = "AddChain" + rpcAPEManagerRemoveChain = "RemoveChain" + rpcAPEManagerListChains = "ListChains" +) + +func AddChain( + cli *client.Client, + req *apemanager.AddChainRequest, + opts ...client.CallOption, +) (*apemanager.AddChainResponse, error) { + resp := new(apemanager.AddChainResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceAPEManager, rpcAPEManagerAddChain), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func RemoveChain( + cli *client.Client, + req *apemanager.RemoveChainRequest, + opts ...client.CallOption, +) (*apemanager.RemoveChainResponse, error) { + resp := new(apemanager.RemoveChainResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceAPEManager, rpcAPEManagerRemoveChain), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func ListChains( + cli *client.Client, + req *apemanager.ListChainsRequest, + opts ...client.CallOption, +) (*apemanager.ListChainsResponse, error) { + resp := new(apemanager.ListChainsResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceAPEManager, rpcAPEManagerListChains), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/api/rpc/client/call_options.go b/api/rpc/client/call_options.go new file mode 100644 index 00000000..4fe87916 --- /dev/null +++ b/api/rpc/client/call_options.go @@ -0,0 +1,40 @@ +package client + +import ( + "context" + + "google.golang.org/grpc" +) + +// CallOption is a messaging session option within Protobuf RPC. +type CallOption func(*callParameters) + +type callParameters struct { + ctx context.Context // nolint:containedctx + dialer func(context.Context, grpc.ClientConnInterface) error +} + +func defaultCallParameters() *callParameters { + return &callParameters{ + ctx: context.Background(), + } +} + +// WithContext returns option to specify call context. If provided, all network +// communications will be based on this context. Otherwise, context.Background() +// is used. +// +// Context SHOULD NOT be nil. +func WithContext(ctx context.Context) CallOption { + return func(prm *callParameters) { + prm.ctx = ctx + } +} + +// WithDialer returns option to specify grpc dialer. If passed, it will be +// called after the connection is successfully created. +func WithDialer(dialer func(context.Context, grpc.ClientConnInterface) error) CallOption { + return func(prm *callParameters) { + prm.dialer = dialer + } +} diff --git a/api/rpc/client/client.go b/api/rpc/client/client.go new file mode 100644 index 00000000..eeac8964 --- /dev/null +++ b/api/rpc/client/client.go @@ -0,0 +1,30 @@ +package client + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" +) + +// Client represents client for exchanging messages +// with a remote server using Protobuf RPC. +type Client struct { + cfg +} + +// New creates, configures via options and returns new Client instance. +func New(opts ...Option) *Client { + var c Client + c.initDefault() + + for _, opt := range opts { + opt(&c.cfg) + } + + c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithDefaultCallOptions(grpc.ForceCodec(encoding.ProtoCodec{}))) + if c.tlsCfg != nil { + c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithTransportCredentials(credentials.NewTLS(c.tlsCfg))) + } + + return &c +} diff --git a/api/rpc/client/conn.go b/api/rpc/client/conn.go new file mode 100644 index 00000000..f208413c --- /dev/null +++ b/api/rpc/client/conn.go @@ -0,0 +1,24 @@ +package client + +import ( + "io" + + "google.golang.org/grpc" +) + +// Conn is an interface for grpc client connection. +type Conn interface { + grpc.ClientConnInterface + io.Closer +} + +// Conn returns underlying connection. +// +// Returns non-nil result after the first Init() call +// completed without a connection error. +// +// Client should not be used after Close() call +// on the connection: behavior is undefined. +func (c *Client) Conn() io.Closer { + return c.conn +} diff --git a/api/rpc/client/connect.go b/api/rpc/client/connect.go new file mode 100644 index 00000000..e22e0a6d --- /dev/null +++ b/api/rpc/client/connect.go @@ -0,0 +1,72 @@ +package client + +import ( + "context" + "errors" + "fmt" + "net" + "net/url" + + grpcstd "google.golang.org/grpc" +) + +var errInvalidEndpoint = errors.New("invalid endpoint options") + +func (c *Client) openGRPCConn(ctx context.Context, dialer func(ctx context.Context, cc grpcstd.ClientConnInterface) error) error { + if c.conn != nil { + return nil + } + + if c.addr == "" { + return errInvalidEndpoint + } + + var err error + + c.conn, err = grpcstd.NewClient(c.addr, c.grpcDialOpts...) + if err != nil { + return fmt.Errorf("gRPC new client: %w", err) + } + + if dialer != nil { + ctx, cancel := context.WithTimeout(ctx, c.dialTimeout) + defer cancel() + + if err := dialer(ctx, c.conn); err != nil { + _ = c.conn.Close() + return fmt.Errorf("gRPC dial: %w", err) + } + } + + return nil +} + +// ParseURI parses s as address and returns a host and a flag +// indicating that TLS is enabled. If multi-address is provided +// the argument is returned unchanged. +func ParseURI(s string) (string, bool, error) { + uri, err := url.ParseRequestURI(s) + if err != nil { + return s, false, nil + } + + // check if passed string was parsed correctly + // URIs that do not start with a slash after the scheme are interpreted as: + // `scheme:opaque` => if `opaque` is not empty, then it is supposed that URI + // is in `host:port` format + if uri.Host == "" { + uri.Host = uri.Scheme + uri.Scheme = grpcScheme // assume GRPC by default + if uri.Opaque != "" { + uri.Host = net.JoinHostPort(uri.Host, uri.Opaque) + } + } + + switch uri.Scheme { + case grpcTLSScheme, grpcScheme: + default: + return "", false, fmt.Errorf("unsupported scheme: %s", uri.Scheme) + } + + return uri.Host, uri.Scheme == grpcTLSScheme, nil +} diff --git a/api/rpc/client/flows.go b/api/rpc/client/flows.go new file mode 100644 index 00000000..2a945b44 --- /dev/null +++ b/api/rpc/client/flows.go @@ -0,0 +1,140 @@ +package client + +import ( + "errors" + "io" + "sync" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +// SendUnary initializes communication session by RPC info, performs unary RPC +// and closes the session. +func SendUnary(cli *Client, info common.CallMethodInfo, req, resp message.Message, opts ...CallOption) error { + rw, err := cli.initInternal(info, opts...) + if err != nil { + return err + } + + err = rw.WriteMessage(req) + if err != nil { + rw.cancel() + return err + } + + err = rw.ReadMessage(resp) + if err != nil { + rw.cancel() + return err + } + + return rw.Close() +} + +// MessageWriterCloser wraps MessageWriter +// and io.Closer interfaces. +type MessageWriterCloser interface { + MessageWriter + io.Closer +} + +type clientStreamWriterCloser struct { + sw *streamWrapper + resp message.Message +} + +// WriteMessage implements MessageWriterCloser. +func (c *clientStreamWriterCloser) WriteMessage(m message.Message) error { + return c.sw.WriteMessage(m) +} + +func (c *clientStreamWriterCloser) Close() error { + err := c.sw.closeSend() + if err != nil { + c.sw.cancel() + return err + } + + if err = c.sw.ReadMessage(c.resp); err != nil { + c.sw.cancel() + return err + } + + return c.sw.Close() +} + +// OpenClientStream initializes communication session by RPC info, opens client-side stream +// and returns its interface. +// +// All stream writes must be performed before the closing. Close must be called once. +func OpenClientStream(cli *Client, info common.CallMethodInfo, resp message.Message, opts ...CallOption) (MessageWriterCloser, error) { + rw, err := cli.initInternal(info, opts...) + if err != nil { + return nil, err + } + + return &clientStreamWriterCloser{ + sw: rw, + resp: resp, + }, nil +} + +// MessageReaderCloser wraps MessageReader +// and io.Closer interface. +type MessageReaderCloser interface { + MessageReader + io.Closer +} + +type serverStreamReaderCloser struct { + rw *streamWrapper + + once sync.Once + + req message.Message +} + +func (s *serverStreamReaderCloser) ReadMessage(msg message.Message) error { + var err error + + s.once.Do(func() { + err = s.rw.WriteMessage(s.req) + }) + + if err != nil { + s.rw.cancel() + return err + } + + err = s.rw.ReadMessage(msg) + if !errors.Is(err, io.EOF) { + if err != nil { + s.rw.cancel() + } + return err + } + + err = s.rw.Close() + if err != nil { + return err + } + + return io.EOF +} + +// OpenServerStream initializes communication session by RPC info, opens server-side stream +// and returns its interface. +// +// All stream reads must be performed before the closing. Close must be called once. +func OpenServerStream(cli *Client, info common.CallMethodInfo, req message.Message, opts ...CallOption) (MessageReader, error) { + rw, err := cli.initInternal(info, opts...) + if err != nil { + return nil, err + } + + return &serverStreamReaderCloser{ + rw: rw, + req: req, + }, nil +} diff --git a/api/rpc/client/init.go b/api/rpc/client/init.go new file mode 100644 index 00000000..834f5dad --- /dev/null +++ b/api/rpc/client/init.go @@ -0,0 +1,118 @@ +package client + +import ( + "context" + "io" + "time" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "google.golang.org/grpc" +) + +// MessageReader is an interface of the Message reader. +type MessageReader interface { + // ReadMessage reads the next Message. + // + // Returns io.EOF if there are no more messages to read. + // ReadMessage should not be called after io.EOF occasion. + ReadMessage(message.Message) error +} + +// MessageWriter is an interface of the Message writer. +type MessageWriter interface { + // WriteMessage writers the next Message. + // + // WriteMessage should not be called after any error. + WriteMessage(message.Message) error +} + +// MessageReadWriter is a component interface +// for transmitting raw Protobuf messages. +type MessageReadWriter interface { + MessageReader + MessageWriter + + // Closes the communication session. + // + // All calls to send/receive messages must be done before closing. + io.Closer +} + +// Init initiates a messaging session and returns the interface for message transmitting. +func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageReadWriter, error) { + return c.initInternal(info, opts...) +} + +func (c *Client) initInternal(info common.CallMethodInfo, opts ...CallOption) (*streamWrapper, error) { + prm := defaultCallParameters() + + for _, opt := range opts { + opt(prm) + } + + if err := c.openGRPCConn(prm.ctx, prm.dialer); err != nil { + return nil, err + } + + ctx, cancel := context.WithCancel(prm.ctx) + + // `conn.NewStream` doesn't check if `conn` may turn up invalidated right before this invocation. + // In such cases, the operation can hang indefinitely, with the context timeout being the only + // mechanism to cancel it. + // + // We use a separate timer instead of context timeout because the latter + // would propagate to all subsequent read/write operations on the opened stream, + // which is not desired for the stream's lifecycle management. + dialTimeoutTimer := time.NewTimer(c.dialTimeout) + defer func() { + dialTimeoutTimer.Stop() + select { + case <-dialTimeoutTimer.C: + default: + } + }() + + type newStreamRes struct { + stream grpc.ClientStream + err error + } + newStreamCh := make(chan newStreamRes) + + go func() { + stream, err := c.conn.NewStream(ctx, &grpc.StreamDesc{ + StreamName: info.Name, + ServerStreams: info.ServerStream(), + ClientStreams: info.ClientStream(), + }, toMethodName(info)) + + newStreamCh <- newStreamRes{ + stream: stream, + err: err, + } + }() + + var res newStreamRes + + select { + case <-dialTimeoutTimer.C: + cancel() + res = <-newStreamCh + if res.stream != nil && res.err == nil { + _ = res.stream.CloseSend() + } + return nil, context.DeadlineExceeded + case res = <-newStreamCh: + } + + if res.err != nil { + cancel() + return nil, res.err + } + + return &streamWrapper{ + ClientStream: res.stream, + cancel: cancel, + timeout: c.rwTimeout, + }, nil +} diff --git a/api/rpc/client/options.go b/api/rpc/client/options.go new file mode 100644 index 00000000..df6f6ed8 --- /dev/null +++ b/api/rpc/client/options.go @@ -0,0 +1,130 @@ +package client + +import ( + "crypto/tls" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +const ( + grpcScheme = "grpc" + grpcTLSScheme = "grpcs" +) + +// Option is a Client's option. +type Option func(*cfg) + +type cfg struct { + addr string + + dialTimeout time.Duration + rwTimeout time.Duration + + tlsCfg *tls.Config + grpcDialOpts []grpc.DialOption + + conn Conn +} + +const ( + defaultDialTimeout = 5 * time.Second + defaultRWTimeout = 1 * time.Minute +) + +func (c *cfg) initDefault() { + c.dialTimeout = defaultDialTimeout + c.rwTimeout = defaultRWTimeout + c.grpcDialOpts = []grpc.DialOption{ + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithDisableServiceConfig(), + } +} + +// WithNetworkAddress returns option to specify +// network address of the remote server. +// +// Ignored if WithGRPCConn is provided. +func WithNetworkAddress(v string) Option { + return func(c *cfg) { + if v != "" { + c.addr = v + } + } +} + +// WithNetworkURIAddress combines WithNetworkAddress and WithTLSCfg options +// based on arguments. +// +// Do not use along with WithNetworkAddress and WithTLSCfg. +// +// Ignored if WithGRPCConn is provided. +func WithNetworkURIAddress(addr string, tlsCfg *tls.Config) []Option { + host, isTLS, err := ParseURI(addr) + if err != nil { + return nil + } + + opts := make([]Option, 2) + opts[0] = WithNetworkAddress(host) + if isTLS { + if tlsCfg == nil { + tlsCfg = &tls.Config{} + } + opts[1] = WithTLSCfg(tlsCfg) + } else { + opts[1] = WithTLSCfg(nil) + } + + return opts +} + +// WithDialTimeout returns option to specify +// dial timeout of the remote server connection. +// +// Ignored if WithGRPCConn is provided. +func WithDialTimeout(v time.Duration) Option { + return func(c *cfg) { + if v > 0 { + c.dialTimeout = v + } + } +} + +// WithRWTimeout returns option to specify timeout +// for reading and writing single gRPC message. +func WithRWTimeout(v time.Duration) Option { + return func(c *cfg) { + if v > 0 { + c.rwTimeout = v + } + } +} + +// WithTLSCfg returns option to specify +// TLS configuration. +// +// Ignored if WithGRPCConn is provided. +func WithTLSCfg(v *tls.Config) Option { + return func(c *cfg) { + c.tlsCfg = v + } +} + +// WithGRPCConn returns option to specify +// gRPC virtual connection. +func WithGRPCConn(v Conn) Option { + return func(c *cfg) { + if v != nil { + c.conn = v + } + } +} + +// WithGRPCDialOptions returns an option to specify grpc.DialOption. +func WithGRPCDialOptions(opts []grpc.DialOption) Option { + return func(c *cfg) { + c.grpcDialOpts = append(c.grpcDialOpts, opts...) + } +} diff --git a/api/rpc/client/options_test.go b/api/rpc/client/options_test.go new file mode 100644 index 00000000..56704b6c --- /dev/null +++ b/api/rpc/client/options_test.go @@ -0,0 +1,197 @@ +package client + +import ( + "crypto/tls" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestWithNetworkURIAddress(t *testing.T) { + hostPort := "frostfs.example.com:8080" + apiPort := "127.0.0.1:8080" + serverName := "testServer" + + testCases := []struct { + uri string + tlsConfig *tls.Config + + wantHost string + wantTLS bool + }{ + { + uri: grpcScheme + "://" + hostPort, + tlsConfig: nil, + wantHost: "frostfs.example.com:8080", + wantTLS: false, + }, + { + uri: grpcScheme + "://" + hostPort, + tlsConfig: &tls.Config{}, + wantHost: "frostfs.example.com:8080", + wantTLS: false, + }, + { + uri: grpcTLSScheme + "://" + hostPort, + tlsConfig: nil, + wantHost: "frostfs.example.com:8080", + wantTLS: true, + }, + { + uri: grpcTLSScheme + "://" + hostPort, + tlsConfig: &tls.Config{ServerName: serverName}, + wantHost: "frostfs.example.com:8080", + wantTLS: true, + }, + { + uri: "wrongScheme://" + hostPort, + tlsConfig: nil, + wantHost: "", + wantTLS: false, + }, + { + uri: "impossibleToParseIt", + tlsConfig: nil, + wantHost: "impossibleToParseIt", + wantTLS: false, + }, + { + uri: hostPort, + tlsConfig: nil, + wantHost: hostPort, + wantTLS: false, + }, + { + uri: apiPort, + tlsConfig: nil, + wantHost: apiPort, + wantTLS: false, + }, + } + + for _, test := range testCases { + cfg := &cfg{} + opts := WithNetworkURIAddress(test.uri, test.tlsConfig) + + for _, opt := range opts { + opt(cfg) + } + + require.Equal(t, test.wantHost, cfg.addr, test.uri) + require.Equal(t, test.wantTLS, cfg.tlsCfg != nil, test.uri) + // check if custom tlsConfig was applied + if test.tlsConfig != nil && test.wantTLS { + require.Equal(t, test.tlsConfig.ServerName, cfg.tlsCfg.ServerName, test.uri) + } + } +} + +func Test_WithNetworkAddress_WithTLS_WithNetworkURIAddress(t *testing.T) { + addr1, addr2 := "example1.com:8080", "example2.com:8080" + + testCases := []struct { + addr string + withTLS bool + + uri string + + wantHost string + wantTLS bool + }{ + { + addr: addr1, + withTLS: true, + + uri: grpcScheme + "://" + addr2, + + wantHost: addr2, + wantTLS: false, + }, + { + addr: addr1, + withTLS: false, + + uri: grpcTLSScheme + "://" + addr2, + + wantHost: addr2, + wantTLS: true, + }, + } + + for _, test := range testCases { + // order: + // 1. WithNetworkAddress + // 2. WithTLSCfg(if test.withTLS == true) + // 3. WithNetworkURIAddress + config := &cfg{} + opts := []Option{WithNetworkAddress(test.addr)} + + if test.withTLS { + opts = append(opts, WithTLSCfg(&tls.Config{})) + } + + opts = append(opts, WithNetworkURIAddress(test.uri, nil)...) + + for _, opt := range opts { + opt(config) + } + + require.Equal(t, test.wantHost, config.addr, test.addr) + require.Equal(t, test.wantTLS, config.tlsCfg != nil, test.addr) + } +} + +func Test_WithNetworkURIAddress_WithTLS_WithNetworkAddress(t *testing.T) { + addr1, addr2 := "example1.com:8080", "example2.com:8080" + + testCases := []struct { + addr string + withTLS bool + + uri string + + wantHost string + wantTLS bool + }{ + { + uri: grpcScheme + "://" + addr1, + + addr: addr2, + withTLS: true, + + wantHost: addr2, + wantTLS: true, + }, + { + uri: grpcTLSScheme + "://" + addr1, + + addr: addr2, + withTLS: false, + + wantHost: addr2, + wantTLS: true, + }, + } + + for _, test := range testCases { + // order: + // 1. WithNetworkURIAddress + // 2. WithNetworkAddress + // 3. WithTLSCfg(if test.withTLS == true) + config := &cfg{} + opts := WithNetworkURIAddress(test.uri, nil) + + opts = append(opts, WithNetworkAddress(test.addr)) + + if test.withTLS { + opts = append(opts, WithTLSCfg(&tls.Config{})) + } + + for _, opt := range opts { + opt(config) + } + + require.Equal(t, test.wantHost, config.addr, test.uri) + require.Equal(t, test.wantTLS, config.tlsCfg != nil, test.uri) + } +} diff --git a/api/rpc/client/stream_wrapper.go b/api/rpc/client/stream_wrapper.go new file mode 100644 index 00000000..85d5ad51 --- /dev/null +++ b/api/rpc/client/stream_wrapper.go @@ -0,0 +1,67 @@ +package client + +import ( + "context" + "time" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "google.golang.org/grpc" +) + +type streamWrapper struct { + grpc.ClientStream + timeout time.Duration + cancel context.CancelFunc +} + +func (w streamWrapper) ReadMessage(m message.Message) error { + // Can be optimized: we can create blank message here. + gm := m.ToGRPCMessage() + + err := w.withTimeout(func() error { + return w.ClientStream.RecvMsg(gm) + }) + if err != nil { + return err + } + + return m.FromGRPCMessage(gm) +} + +func (w streamWrapper) WriteMessage(m message.Message) error { + return w.withTimeout(func() error { + return w.ClientStream.SendMsg(m.ToGRPCMessage()) + }) +} + +func (w *streamWrapper) closeSend() error { + return w.withTimeout(w.ClientStream.CloseSend) +} + +func (w *streamWrapper) Close() error { + w.cancel() + return nil +} + +func (w *streamWrapper) withTimeout(closure func() error) error { + ch := make(chan error, 1) + go func() { + ch <- closure() + close(ch) + }() + + tt := time.NewTimer(w.timeout) + + select { + case err := <-ch: + tt.Stop() + select { + case <-tt.C: + default: + } + return err + case <-tt.C: + w.cancel() + return context.DeadlineExceeded + } +} diff --git a/api/rpc/client/util.go b/api/rpc/client/util.go new file mode 100644 index 00000000..3d68b950 --- /dev/null +++ b/api/rpc/client/util.go @@ -0,0 +1,13 @@ +package client + +import ( + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" +) + +const methodNameFmt = "/%s/%s" + +func toMethodName(p common.CallMethodInfo) string { + return fmt.Sprintf(methodNameFmt, p.Service, p.Name) +} diff --git a/api/rpc/common.go b/api/rpc/common.go new file mode 100644 index 00000000..8177694f --- /dev/null +++ b/api/rpc/common.go @@ -0,0 +1,10 @@ +package rpc + +const ( + // serviceNamePrefix is still used in "old" services but should be + // considered as deprecated. Since new services use "frostfs" root, + // `frostfsServiceNamePrefix` must be used for their rpc interface. + serviceNamePrefix = "neo.fs.v2." + + frostfsServiceNamePrefix = "frostfs.v2." +) diff --git a/api/rpc/common/call.go b/api/rpc/common/call.go new file mode 100644 index 00000000..bc3410aa --- /dev/null +++ b/api/rpc/common/call.go @@ -0,0 +1,75 @@ +package common + +type callType uint8 + +const ( + _ callType = iota + callUnary + callClientStream + callServerStream + callBidirStream +) + +// CallMethodInfo is an information about the RPC. +type CallMethodInfo struct { + // Name of the service. + Service string + + // Name of the RPC. + Name string + + t callType +} + +// ServerStream checks if CallMethodInfo contains +// information about the server-side streaming RPC. +func (c CallMethodInfo) ServerStream() bool { + return c.t == callServerStream || c.t == callBidirStream +} + +// ClientStream checks if CallMethodInfo contains +// information about the client-side streaming RPC. +func (c CallMethodInfo) ClientStream() bool { + return c.t == callClientStream || c.t == callBidirStream +} + +func (c *CallMethodInfo) setCommon(service, name string) { + c.Service = service + c.Name = name +} + +// CallMethodInfoUnary returns CallMethodInfo structure +// initialized for the unary RPC. +func CallMethodInfoUnary(service, name string) (info CallMethodInfo) { + info.setCommon(service, name) + info.t = callUnary + + return +} + +// CallMethodInfoClientStream returns CallMethodInfo structure +// initialized for the client-side streaming RPC. +func CallMethodInfoClientStream(service, name string) (info CallMethodInfo) { + info.setCommon(service, name) + info.t = callClientStream + + return +} + +// CallMethodInfoServerStream returns CallMethodInfo structure +// initialized for the server-side streaming RPC. +func CallMethodInfoServerStream(service, name string) (info CallMethodInfo) { + info.setCommon(service, name) + info.t = callServerStream + + return +} + +// CallMethodInfoBidirectionalStream returns CallMethodInfo structure +// initialized for the bidirectional streaming RPC. +func CallMethodInfoBidirectionalStream(service, name string) (info CallMethodInfo) { + info.setCommon(service, name) + info.t = callBidirStream + + return +} diff --git a/api/rpc/common/call_test.go b/api/rpc/common/call_test.go new file mode 100644 index 00000000..eb88b694 --- /dev/null +++ b/api/rpc/common/call_test.go @@ -0,0 +1,49 @@ +package common_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" + "github.com/stretchr/testify/require" +) + +const ( + testServiceName = "test service" + testRPCName = "test RPC" +) + +func TestCallMethodInfoUnary(t *testing.T) { + i := common.CallMethodInfoUnary(testServiceName, testRPCName) + + require.Equal(t, testServiceName, i.Service) + require.Equal(t, testRPCName, i.Name) + require.False(t, i.ClientStream()) + require.False(t, i.ServerStream()) +} + +func TestCallMethodInfoServerStream(t *testing.T) { + i := common.CallMethodInfoServerStream(testServiceName, testRPCName) + + require.Equal(t, testServiceName, i.Service) + require.Equal(t, testRPCName, i.Name) + require.False(t, i.ClientStream()) + require.True(t, i.ServerStream()) +} + +func TestCallMethodInfoClientStream(t *testing.T) { + i := common.CallMethodInfoClientStream(testServiceName, testRPCName) + + require.Equal(t, testServiceName, i.Service) + require.Equal(t, testRPCName, i.Name) + require.True(t, i.ClientStream()) + require.False(t, i.ServerStream()) +} + +func TestCallMethodInfoBidirectionalStream(t *testing.T) { + i := common.CallMethodInfoBidirectionalStream(testServiceName, testRPCName) + + require.Equal(t, testServiceName, i.Service) + require.Equal(t, testRPCName, i.Name) + require.True(t, i.ClientStream()) + require.True(t, i.ServerStream()) +} diff --git a/api/rpc/container.go b/api/rpc/container.go new file mode 100644 index 00000000..a759bd5a --- /dev/null +++ b/api/rpc/container.go @@ -0,0 +1,107 @@ +package rpc + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" +) + +const serviceContainer = serviceNamePrefix + "container.ContainerService" + +const ( + rpcContainerPut = "Put" + rpcContainerGet = "Get" + rpcContainerDel = "Delete" + rpcContainerList = "List" + rpcContainerStream = "ListStream" + rpcContainerGetEACL = "GetExtendedACL" + rpcContainerUsedSpace = "AnnounceUsedSpace" +) + +// PutContainer executes ContainerService.Put RPC. +func PutContainer( + cli *client.Client, + req *container.PutRequest, + opts ...client.CallOption, +) (*container.PutResponse, error) { + resp := new(container.PutResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerPut), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// GetContainer executes ContainerService.Get RPC. +func GetContainer( + cli *client.Client, + req *container.GetRequest, + opts ...client.CallOption, +) (*container.GetResponse, error) { + resp := new(container.GetResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerGet), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// DeleteContainer executes ContainerService.Delete RPC. +func DeleteContainer( + cli *client.Client, + req *container.DeleteRequest, + opts ...client.CallOption, +) (*container.PutResponse, error) { + resp := new(container.PutResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerDel), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// ListContainers executes ContainerService.List RPC. +func ListContainers( + cli *client.Client, + req *container.ListRequest, + opts ...client.CallOption, +) (*container.ListResponse, error) { + resp := new(container.ListResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerList), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +type ListStreamResponseReader struct { + r client.MessageReader +} + +func (r *ListStreamResponseReader) Read(resp *container.ListStreamResponse) error { + return r.r.ReadMessage(resp) +} + +// ListContainersStream executes ContainerService.ListStream RPC. +func ListContainersStream( + cli *client.Client, + req *container.ListStreamRequest, + opts ...client.CallOption, +) (*ListStreamResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceContainer, rpcContainerStream), req, opts...) + if err != nil { + return nil, err + } + + return &ListStreamResponseReader{ + r: wc, + }, nil +} diff --git a/api/rpc/grpc/init.go b/api/rpc/grpc/init.go new file mode 100644 index 00000000..0092d395 --- /dev/null +++ b/api/rpc/grpc/init.go @@ -0,0 +1,4 @@ +package grpc + +// Message represents raw gRPC message. +type Message any diff --git a/api/rpc/message/encoding.go b/api/rpc/message/encoding.go new file mode 100644 index 00000000..b802a6f2 --- /dev/null +++ b/api/rpc/message/encoding.go @@ -0,0 +1,48 @@ +package message + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" +) + +// GRPCConvertedMessage is an interface +// of the gRPC message that is used +// for Message encoding/decoding. +type GRPCConvertedMessage interface { + grpc.Message + proto.Message +} + +// Unmarshal decodes m from its Protobuf binary representation +// via related gRPC message. +// +// gm should be tof the same type as the m.ToGRPCMessage() return. +func Unmarshal(m Message, data []byte, gm GRPCConvertedMessage) error { + if err := proto.Unmarshal(data, gm); err != nil { + return err + } + + return m.FromGRPCMessage(gm) +} + +// MarshalJSON encodes m to Protobuf JSON representation. +func MarshalJSON(m Message) ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal( + m.ToGRPCMessage().(proto.Message), + ) +} + +// UnmarshalJSON decodes m from its Protobuf JSON representation +// via related gRPC message. +// +// gm should be tof the same type as the m.ToGRPCMessage() return. +func UnmarshalJSON(m Message, data []byte, gm GRPCConvertedMessage) error { + if err := protojson.Unmarshal(data, gm); err != nil { + return err + } + + return m.FromGRPCMessage(gm) +} diff --git a/api/rpc/message/message.go b/api/rpc/message/message.go new file mode 100644 index 00000000..793351f9 --- /dev/null +++ b/api/rpc/message/message.go @@ -0,0 +1,43 @@ +package message + +import ( + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" +) + +// Message represents raw Protobuf message +// that can be transmitted via several +// transport protocols. +type Message interface { + // Must return gRPC message that can + // be used for gRPC protocol transmission. + ToGRPCMessage() grpc.Message + + // Must restore the message from related + // gRPC message. + // + // If gRPC message is not a related one, + // ErrUnexpectedMessageType can be returned + // to indicate this. + FromGRPCMessage(grpc.Message) error +} + +// ErrUnexpectedMessageType is an error that +// is used to indicate message mismatch. +type ErrUnexpectedMessageType struct { + exp, act any +} + +// NewUnexpectedMessageType initializes an error about message mismatch +// between act and exp. +func NewUnexpectedMessageType(act, exp any) ErrUnexpectedMessageType { + return ErrUnexpectedMessageType{ + exp: exp, + act: act, + } +} + +func (e ErrUnexpectedMessageType) Error() string { + return fmt.Sprintf("unexpected message type %T: expected %T", e.act, e.exp) +} diff --git a/api/rpc/message/test/message.go b/api/rpc/message/test/message.go new file mode 100644 index 00000000..69abb68f --- /dev/null +++ b/api/rpc/message/test/message.go @@ -0,0 +1,127 @@ +package messagetest + +import ( + "encoding/json" + "errors" + "fmt" + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding" + "github.com/stretchr/testify/require" +) + +type jsonMessage interface { + json.Marshaler + json.Unmarshaler +} + +type binaryMessage interface { + StableMarshal([]byte) []byte + StableSize() int + Unmarshal([]byte) error +} + +func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) { + for _, msgGen := range msgGens { + msg := msgGen(false) + + t.Run(fmt.Sprintf("convert_%T", msg), func(t *testing.T) { + msg := msgGen(false) + + err := msg.FromGRPCMessage(100) + + require.True(t, errors.As(err, new(message.ErrUnexpectedMessageType))) + + msg2 := msgGen(true) + + err = msg2.FromGRPCMessage(msg.ToGRPCMessage()) + require.NoError(t, err) + + require.Equal(t, msg, msg2) + }) + + t.Run("encoding", func(t *testing.T) { + if jm, ok := msg.(jsonMessage); ok { + t.Run(fmt.Sprintf("JSON_%T", msg), func(t *testing.T) { + data, err := jm.MarshalJSON() + require.NoError(t, err) + + jm2 := msgGen(true).(jsonMessage) + require.NoError(t, jm2.UnmarshalJSON(data)) + + require.Equal(t, jm, jm2) + }) + } + + if bm, ok := msg.(binaryMessage); ok { + t.Run(fmt.Sprintf("%T.StableSize() does no allocations", bm), func(t *testing.T) { + require.Zero(t, testing.AllocsPerRun(1000, func() { + _ = bm.StableSize() + })) + }) + t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { + data := bm.StableMarshal(nil) + + bm2 := msgGen(true).(binaryMessage) + require.NoError(t, bm2.Unmarshal(data)) + + require.Equal(t, bm, bm2) + }) + } + t.Run("compatibility", func(t *testing.T) { + t.Skip() + testCompatibility(t, msgGen) + }) + }) + } +} + +func testCompatibility(t *testing.T, msgGen func(empty bool) message.Message) { + compareBinary := func(t *testing.T, msg message.Message) { + am, ok := msg.(binaryMessage) + if !ok { + t.Skip() + } + + a := am.StableMarshal(nil) + b := msg.ToGRPCMessage().(encoding.ProtoMarshaler).MarshalProtobuf(nil) + if len(a) == 0 { + require.Empty(t, b) + } else { + require.Equal(t, a, b) + } + } + compareJSON := func(t *testing.T, msg message.Message) { + am, ok := msg.(jsonMessage) + if !ok { + t.Skip() + } + + a, err := am.MarshalJSON() + require.NoError(t, err) + + b, err := json.Marshal(msg.ToGRPCMessage()) + require.NoError(t, err) + + require.JSONEq(t, string(a), string(b)) + } + t.Run("empty", func(t *testing.T) { + msg := msgGen(true) + t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { + compareBinary(t, msg) + }) + t.Run(fmt.Sprintf("JSON_%T", msg), func(t *testing.T) { + compareJSON(t, msg) + }) + }) + t.Run("not empty", func(t *testing.T) { + msg := msgGen(false) + t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { + compareBinary(t, msg) + }) + t.Run(fmt.Sprintf("JSON_%T", msg), func(t *testing.T) { + compareJSON(t, msg) + }) + }) +} diff --git a/api/rpc/netmap.go b/api/rpc/netmap.go new file mode 100644 index 00000000..fe52b2ed --- /dev/null +++ b/api/rpc/netmap.go @@ -0,0 +1,62 @@ +package rpc + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" +) + +const serviceNetmap = serviceNamePrefix + "netmap.NetmapService" + +const ( + rpcNetmapNodeInfo = "LocalNodeInfo" + rpcNetmapNetInfo = "NetworkInfo" + rpcNetmapSnapshot = "NetmapSnapshot" +) + +// LocalNodeInfo executes NetmapService.LocalNodeInfo RPC. +func LocalNodeInfo( + cli *client.Client, + req *netmap.LocalNodeInfoRequest, + opts ...client.CallOption, +) (*netmap.LocalNodeInfoResponse, error) { + resp := new(netmap.LocalNodeInfoResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapNodeInfo), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// NetworkInfo executes NetmapService.NetworkInfo RPC. +func NetworkInfo( + cli *client.Client, + req *netmap.NetworkInfoRequest, + opts ...client.CallOption, +) (*netmap.NetworkInfoResponse, error) { + resp := new(netmap.NetworkInfoResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapNetInfo), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// NetMapSnapshot executes NetmapService.NetmapSnapshot RPC. +func NetMapSnapshot( + cli *client.Client, + req *netmap.SnapshotRequest, + opts ...client.CallOption, +) (*netmap.SnapshotResponse, error) { + resp := new(netmap.SnapshotResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceNetmap, rpcNetmapSnapshot), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/api/rpc/object.go b/api/rpc/object.go new file mode 100644 index 00000000..b6792f06 --- /dev/null +++ b/api/rpc/object.go @@ -0,0 +1,243 @@ +package rpc + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" +) + +const serviceObject = serviceNamePrefix + "object.ObjectService" + +const ( + rpcObjectPut = "Put" + rpcObjectGet = "Get" + rpcObjectSearch = "Search" + rpcObjectRange = "GetRange" + rpcObjectHash = "GetRangeHash" + rpcObjectHead = "Head" + rpcObjectDelete = "Delete" + rpcObjectPutSingle = "PutSingle" + rpcObjectPatch = "Patch" +) + +// PutRequestWriter is an object.PutRequest +// message streaming component. +type PutRequestWriter struct { + wc client.MessageWriterCloser + + resp message.Message +} + +// Write writes req to the stream. +func (w *PutRequestWriter) Write(req *object.PutRequest) error { + return w.wc.WriteMessage(req) +} + +// Close closes the stream. +func (w *PutRequestWriter) Close() error { + return w.wc.Close() +} + +// PutObject executes ObjectService.Put RPC. +func PutObject( + cli *client.Client, + resp *object.PutResponse, + opts ...client.CallOption, +) (*PutRequestWriter, error) { + wc, err := client.OpenClientStream(cli, common.CallMethodInfoClientStream(serviceObject, rpcObjectPut), resp, opts...) + if err != nil { + return nil, err + } + + return &PutRequestWriter{ + wc: wc, + resp: resp, + }, nil +} + +// GetResponseReader is an object.GetResponse +// stream reader. +type GetResponseReader struct { + r client.MessageReader +} + +// Read reads response from the stream. +// +// Returns io.EOF of streaming is finished. +func (r *GetResponseReader) Read(resp *object.GetResponse) error { + return r.r.ReadMessage(resp) +} + +// GetObject executes ObjectService.Get RPC. +func GetObject( + cli *client.Client, + req *object.GetRequest, + opts ...client.CallOption, +) (*GetResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceObject, rpcObjectGet), req, opts...) + if err != nil { + return nil, err + } + + return &GetResponseReader{ + r: wc, + }, nil +} + +// GetResponseReader is an object.SearchResponse +// stream reader. +type SearchResponseReader struct { + r client.MessageReader +} + +// Read reads response from the stream. +// +// Returns io.EOF of streaming is finished. +func (r *SearchResponseReader) Read(resp *object.SearchResponse) error { + return r.r.ReadMessage(resp) +} + +// SearchObjects executes ObjectService.Search RPC. +func SearchObjects( + cli *client.Client, + req *object.SearchRequest, + opts ...client.CallOption, +) (*SearchResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceObject, rpcObjectSearch), req, opts...) + if err != nil { + return nil, err + } + + return &SearchResponseReader{ + r: wc, + }, nil +} + +// GetResponseReader is an object.GetRangeResponse +// stream reader. +type ObjectRangeResponseReader struct { + r client.MessageReader +} + +// Read reads response from the stream. +// +// Returns io.EOF of streaming is finished. +func (r *ObjectRangeResponseReader) Read(resp *object.GetRangeResponse) error { + return r.r.ReadMessage(resp) +} + +// GetObjectRange executes ObjectService.GetRange RPC. +func GetObjectRange( + cli *client.Client, + req *object.GetRangeRequest, + opts ...client.CallOption, +) (*ObjectRangeResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceObject, rpcObjectRange), req, opts...) + if err != nil { + return nil, err + } + + return &ObjectRangeResponseReader{ + r: wc, + }, nil +} + +// HeadObject executes ObjectService.Head RPC. +func HeadObject( + cli *client.Client, + req *object.HeadRequest, + opts ...client.CallOption, +) (*object.HeadResponse, error) { + resp := new(object.HeadResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectHead), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// DeleteObject executes ObjectService.Delete RPC. +func DeleteObject( + cli *client.Client, + req *object.DeleteRequest, + opts ...client.CallOption, +) (*object.DeleteResponse, error) { + resp := new(object.DeleteResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectDelete), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// HashObjectRange executes ObjectService.GetRangeHash RPC. +func HashObjectRange( + cli *client.Client, + req *object.GetRangeHashRequest, + opts ...client.CallOption, +) (*object.GetRangeHashResponse, error) { + resp := new(object.GetRangeHashResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectHash), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// PutSingleObject executes ObjectService.PutSingle RPC. +func PutSingleObject( + cli *client.Client, + req *object.PutSingleRequest, + opts ...client.CallOption, +) (*object.PutSingleResponse, error) { + resp := new(object.PutSingleResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceObject, rpcObjectPutSingle), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +// PatchRequestWriter is an object.PatchRequest +// message streaming component. +type PatchRequestWriter struct { + wc client.MessageWriterCloser + + resp message.Message +} + +// Write writes req to the stream. +func (w *PatchRequestWriter) Write(req *object.PatchRequest) error { + return w.wc.WriteMessage(req) +} + +// Close closes the stream. +func (w *PatchRequestWriter) Close() error { + return w.wc.Close() +} + +// Patch executes ObjectService.Patch RPC. +func Patch( + cli *client.Client, + resp *object.PatchResponse, + opts ...client.CallOption, +) (*PatchRequestWriter, error) { + wc, err := client.OpenClientStream(cli, common.CallMethodInfoClientStream(serviceObject, rpcObjectPatch), resp, opts...) + if err != nil { + return nil, err + } + + return &PatchRequestWriter{ + wc: wc, + resp: resp, + }, nil +} diff --git a/api/rpc/session.go b/api/rpc/session.go new file mode 100644 index 00000000..2477029d --- /dev/null +++ b/api/rpc/session.go @@ -0,0 +1,28 @@ +package rpc + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" +) + +const serviceSession = serviceNamePrefix + "session.SessionService" + +const ( + rpcSessionCreate = "Create" +) + +func CreateSession( + cli *client.Client, + req *session.CreateRequest, + opts ...client.CallOption, +) (*session.CreateResponse, error) { + resp := new(session.CreateResponse) + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceSession, rpcSessionCreate), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/api/rpc/tree.go b/api/rpc/tree.go new file mode 100644 index 00000000..8f5bf0a7 --- /dev/null +++ b/api/rpc/tree.go @@ -0,0 +1,178 @@ +package rpc + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tree" +) + +const serviceTree = "tree.TreeService" + +const ( + rpcTreeAdd = "Add" + rpcTreeAddByPath = "AddByPath" + rpcTreeRemove = "Remove" + rpcTreeMove = "Move" + rpcTreeGetNodeByPath = "GetNodeByPath" + rpcTreeGetSubTree = "GetSubTree" + rpcTreeList = "TreeList" + rpcTreeApply = "Apply" + rpcTreeGetOpLog = "GetOpLog" + rpcTreeHealthcheck = "Healthcheck" +) + +func Add( + cli *client.Client, + req *tree.AddRequest, + opts ...client.CallOption, +) (*tree.AddResponse, error) { + resp := new(tree.AddResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeAdd), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func AddByPath( + cli *client.Client, + req *tree.AddByPathRequest, + opts ...client.CallOption, +) (*tree.AddByPathResponse, error) { + resp := new(tree.AddByPathResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeAddByPath), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func Remove(cli *client.Client, + req *tree.RemoveRequest, + opts ...client.CallOption, +) (*tree.RemoveResponse, error) { + resp := new(tree.RemoveResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeRemove), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func Move(cli *client.Client, + req *tree.MoveRequest, + opts ...client.CallOption, +) (*tree.MoveResponse, error) { + resp := new(tree.MoveResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeMove), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func GetNodeByPath(cli *client.Client, + req *tree.GetNodeByPathRequest, + opts ...client.CallOption, +) (*tree.GetNodeByPathResponse, error) { + resp := new(tree.GetNodeByPathResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeGetNodeByPath), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +type GetSubTreeResponseReader struct { + r client.MessageReader +} + +// Read reads response from the stream. +// +// Returns io.EOF of streaming is finished. +func (r *GetSubTreeResponseReader) Read(resp *tree.GetSubTreeResponse) error { + return r.r.ReadMessage(resp) +} + +func GetSubTree(cli *client.Client, + req *tree.GetSubTreeRequest, + opts ...client.CallOption, +) (*GetSubTreeResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceTree, rpcTreeGetSubTree), req, opts...) + if err != nil { + return nil, err + } + + return &GetSubTreeResponseReader{ + r: wc, + }, nil +} + +func TreeList(cli *client.Client, + req *tree.ListRequest, + opts ...client.CallOption, +) (*tree.ListResponse, error) { + resp := new(tree.ListResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeList), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +func Apply(cli *client.Client, + req *tree.ApplyRequest, + opts ...client.CallOption, +) (*tree.ApplyResponse, error) { + resp := new(tree.ApplyResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeApply), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} + +type TreeServiceGetOpLogResponseReader struct { + r client.MessageReader +} + +// Read reads response from the stream. +// +// Returns io.EOF of streaming is finished. +func (r *TreeServiceGetOpLogResponseReader) Read(resp *tree.GetOpLogResponse) error { + return r.r.ReadMessage(resp) +} + +func GetOpLog(cli *client.Client, + req *tree.GetOpLogRequest, + opts ...client.CallOption, +) (*TreeServiceGetOpLogResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceTree, rpcTreeGetOpLog), req, opts...) + if err != nil { + return nil, err + } + + return &TreeServiceGetOpLogResponseReader{ + r: wc, + }, nil +} + +func Healthcheck(cli *client.Client, + req *tree.HealthcheckRequest, + opts ...client.CallOption, +) (*tree.HealthcheckResponse, error) { + resp := new(tree.HealthcheckResponse) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeHealthcheck), req, resp, opts...) + if err != nil { + return nil, err + } + + return resp, nil +} diff --git a/api/session/convert.go b/api/session/convert.go new file mode 100644 index 00000000..cfa97edc --- /dev/null +++ b/api/session/convert.go @@ -0,0 +1,898 @@ +package session + +import ( + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + aclGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" + statusGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" +) + +func (c *CreateRequestBody) ToGRPCMessage() grpc.Message { + var m *session.CreateRequest_Body + + if c != nil { + m = new(session.CreateRequest_Body) + + m.SetOwnerId(c.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetExpiration(c.expiration) + } + + return m +} + +func (c *CreateRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.CreateRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + ownerID := v.GetOwnerId() + if ownerID == nil { + c.ownerID = nil + } else { + if c.ownerID == nil { + c.ownerID = new(refs.OwnerID) + } + + err = c.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + c.expiration = v.GetExpiration() + + return nil +} + +func (c *CreateRequest) ToGRPCMessage() grpc.Message { + var m *session.CreateRequest + + if c != nil { + m = new(session.CreateRequest) + + m.SetBody(c.body.ToGRPCMessage().(*session.CreateRequest_Body)) + c.RequestHeaders.ToMessage(m) + } + + return m +} + +func (c *CreateRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.CreateRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + c.body = nil + } else { + if c.body == nil { + c.body = new(CreateRequestBody) + } + + err = c.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return c.RequestHeaders.FromMessage(v) +} + +func (c *CreateResponseBody) ToGRPCMessage() grpc.Message { + var m *session.CreateResponse_Body + + if c != nil { + m = new(session.CreateResponse_Body) + + m.SetSessionKey(c.sessionKey) + m.SetId(c.id) + } + + return m +} + +func (c *CreateResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.CreateResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + c.sessionKey = v.GetSessionKey() + c.id = v.GetId() + + return nil +} + +func (c *CreateResponse) ToGRPCMessage() grpc.Message { + var m *session.CreateResponse + + if c != nil { + m = new(session.CreateResponse) + + m.SetBody(c.body.ToGRPCMessage().(*session.CreateResponse_Body)) + c.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (c *CreateResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.CreateResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + c.body = nil + } else { + if c.body == nil { + c.body = new(CreateResponseBody) + } + + err = c.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return c.ResponseHeaders.FromMessage(v) +} + +func (l *TokenLifetime) ToGRPCMessage() grpc.Message { + var m *session.SessionToken_Body_TokenLifetime + + if l != nil { + m = new(session.SessionToken_Body_TokenLifetime) + + m.SetExp(l.exp) + m.SetIat(l.iat) + m.SetNbf(l.nbf) + } + + return m +} + +func (l *TokenLifetime) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.SessionToken_Body_TokenLifetime) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + l.exp = v.GetExp() + l.iat = v.GetIat() + l.nbf = v.GetNbf() + + return nil +} + +func (x *XHeader) ToGRPCMessage() grpc.Message { + var m *session.XHeader + + if x != nil { + m = new(session.XHeader) + + m.SetKey(x.key) + m.SetValue(x.val) + } + + return m +} + +func (x *XHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.XHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + x.key = v.GetKey() + x.val = v.GetValue() + + return nil +} + +func XHeadersToGRPC(xs []XHeader) (res []*session.XHeader) { + if xs != nil { + res = make([]*session.XHeader, 0, len(xs)) + + for i := range xs { + res = append(res, xs[i].ToGRPCMessage().(*session.XHeader)) + } + } + + return +} + +func XHeadersFromGRPC(xs []*session.XHeader) (res []XHeader, err error) { + if xs != nil { + res = make([]XHeader, len(xs)) + + for i := range xs { + err = res[i].FromGRPCMessage(xs[i]) + if err != nil { + return + } + } + } + + return +} + +func (t *Token) ToGRPCMessage() grpc.Message { + var m *session.SessionToken + + if t != nil { + m = new(session.SessionToken) + + m.SetBody(t.body.ToGRPCMessage().(*session.SessionToken_Body)) + m.SetSignature(t.sig.ToGRPCMessage().(*refsGRPC.Signature)) + } + + return m +} + +func (t *Token) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.SessionToken) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + t.body = nil + } else { + if t.body == nil { + t.body = new(TokenBody) + } + + err = t.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + t.sig = nil + } else { + if t.sig == nil { + t.sig = new(refs.Signature) + } + + err = t.sig.FromGRPCMessage(sig) + if err != nil { + return err + } + } + + return nil +} + +func (r *RequestVerificationHeader) ToGRPCMessage() grpc.Message { + var m *session.RequestVerificationHeader + + if r != nil { + m = new(session.RequestVerificationHeader) + + m.SetBodySignature(r.bodySig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetMetaSignature(r.metaSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetOriginSignature(r.originSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestVerificationHeader)) + } + + return m +} + +func (r *RequestVerificationHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.RequestVerificationHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + originSig := v.GetOriginSignature() + if originSig == nil { + r.originSig = nil + } else { + if r.originSig == nil { + r.originSig = new(refs.Signature) + } + + err = r.originSig.FromGRPCMessage(originSig) + if err != nil { + return err + } + } + + metaSig := v.GetMetaSignature() + if metaSig == nil { + r.metaSig = nil + } else { + if r.metaSig == nil { + r.metaSig = new(refs.Signature) + } + + err = r.metaSig.FromGRPCMessage(metaSig) + if err != nil { + return err + } + } + + bodySig := v.GetBodySignature() + if bodySig == nil { + r.bodySig = nil + } else { + if r.bodySig == nil { + r.bodySig = new(refs.Signature) + } + + err = r.bodySig.FromGRPCMessage(bodySig) + if err != nil { + return err + } + } + + origin := v.GetOrigin() + if origin == nil { + r.origin = nil + } else { + if r.origin == nil { + r.origin = new(RequestVerificationHeader) + } + + err = r.origin.FromGRPCMessage(origin) + if err != nil { + return err + } + } + + return nil +} + +func (r *RequestMetaHeader) ToGRPCMessage() grpc.Message { + var m *session.RequestMetaHeader + + if r != nil { + m = new(session.RequestMetaHeader) + + m.SetVersion(r.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetSessionToken(r.sessionToken.ToGRPCMessage().(*session.SessionToken)) + m.SetBearerToken(r.bearerToken.ToGRPCMessage().(*aclGRPC.BearerToken)) + m.SetXHeaders(XHeadersToGRPC(r.xHeaders)) + m.SetEpoch(r.epoch) + m.SetTtl(r.ttl) + m.SetOrigin(r.origin.ToGRPCMessage().(*session.RequestMetaHeader)) + m.SetMagicNumber(r.netMagic) + } + + return m +} + +func (r *RequestMetaHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.RequestMetaHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + version := v.GetVersion() + if version == nil { + r.version = nil + } else { + if r.version == nil { + r.version = new(refs.Version) + } + + err = r.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + sessionToken := v.GetSessionToken() + if sessionToken == nil { + r.sessionToken = nil + } else { + if r.sessionToken == nil { + r.sessionToken = new(Token) + } + + err = r.sessionToken.FromGRPCMessage(sessionToken) + if err != nil { + return err + } + } + + bearerToken := v.GetBearerToken() + if bearerToken == nil { + r.bearerToken = nil + } else { + if r.bearerToken == nil { + r.bearerToken = new(acl.BearerToken) + } + + err = r.bearerToken.FromGRPCMessage(bearerToken) + if err != nil { + return err + } + } + + origin := v.GetOrigin() + if origin == nil { + r.origin = nil + } else { + if r.origin == nil { + r.origin = new(RequestMetaHeader) + } + + err = r.origin.FromGRPCMessage(origin) + if err != nil { + return err + } + } + + r.xHeaders, err = XHeadersFromGRPC(v.GetXHeaders()) + if err != nil { + return err + } + + r.epoch = v.GetEpoch() + r.ttl = v.GetTtl() + r.netMagic = v.GetMagicNumber() + + return nil +} + +func (r *ResponseVerificationHeader) ToGRPCMessage() grpc.Message { + var m *session.ResponseVerificationHeader + + if r != nil { + m = new(session.ResponseVerificationHeader) + + m.SetBodySignature(r.bodySig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetMetaSignature(r.metaSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetOriginSignature(r.originSig.ToGRPCMessage().(*refsGRPC.Signature)) + m.SetOrigin(r.origin.ToGRPCMessage().(*session.ResponseVerificationHeader)) + } + + return m +} + +func (r *ResponseVerificationHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.ResponseVerificationHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + originSig := v.GetOriginSignature() + if originSig == nil { + r.originSig = nil + } else { + if r.originSig == nil { + r.originSig = new(refs.Signature) + } + + err = r.originSig.FromGRPCMessage(originSig) + if err != nil { + return err + } + } + + metaSig := v.GetMetaSignature() + if metaSig == nil { + r.metaSig = nil + } else { + if r.metaSig == nil { + r.metaSig = new(refs.Signature) + } + + err = r.metaSig.FromGRPCMessage(metaSig) + if err != nil { + return err + } + } + + bodySig := v.GetBodySignature() + if bodySig == nil { + r.bodySig = nil + } else { + if r.bodySig == nil { + r.bodySig = new(refs.Signature) + } + + err = r.bodySig.FromGRPCMessage(bodySig) + if err != nil { + return err + } + } + + origin := v.GetOrigin() + if origin == nil { + r.origin = nil + } else { + if r.origin == nil { + r.origin = new(ResponseVerificationHeader) + } + + err = r.origin.FromGRPCMessage(origin) + if err != nil { + return err + } + } + + return nil +} + +func (r *ResponseMetaHeader) ToGRPCMessage() grpc.Message { + var m *session.ResponseMetaHeader + + if r != nil { + m = new(session.ResponseMetaHeader) + + m.SetVersion(r.version.ToGRPCMessage().(*refsGRPC.Version)) + m.SetXHeaders(XHeadersToGRPC(r.xHeaders)) + m.SetEpoch(r.epoch) + m.SetTtl(r.ttl) + m.SetOrigin(r.origin.ToGRPCMessage().(*session.ResponseMetaHeader)) + m.SetStatus(r.status.ToGRPCMessage().(*statusGRPC.Status)) + } + + return m +} + +func (r *ResponseMetaHeader) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.ResponseMetaHeader) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + version := v.GetVersion() + if version == nil { + r.version = nil + } else { + if r.version == nil { + r.version = new(refs.Version) + } + + err = r.version.FromGRPCMessage(version) + if err != nil { + return err + } + } + + origin := v.GetOrigin() + if origin == nil { + r.origin = nil + } else { + if r.origin == nil { + r.origin = new(ResponseMetaHeader) + } + + err = r.origin.FromGRPCMessage(origin) + if err != nil { + return err + } + } + + st := v.GetStatus() + if st == nil { + r.status = nil + } else { + if r.status == nil { + r.status = new(status.Status) + } + + err = r.status.FromGRPCMessage(st) + if err != nil { + return err + } + } + + r.xHeaders, err = XHeadersFromGRPC(v.GetXHeaders()) + if err != nil { + return err + } + + r.epoch = v.GetEpoch() + r.ttl = v.GetTtl() + + return nil +} + +func ObjectSessionVerbToGRPCField(v ObjectSessionVerb) session.ObjectSessionContext_Verb { + switch v { + case ObjectVerbPut: + return session.ObjectSessionContext_PUT + case ObjectVerbGet: + return session.ObjectSessionContext_GET + case ObjectVerbHead: + return session.ObjectSessionContext_HEAD + case ObjectVerbSearch: + return session.ObjectSessionContext_SEARCH + case ObjectVerbDelete: + return session.ObjectSessionContext_DELETE + case ObjectVerbRange: + return session.ObjectSessionContext_RANGE + case ObjectVerbRangeHash: + return session.ObjectSessionContext_RANGEHASH + case ObjectVerbPatch: + return session.ObjectSessionContext_PATCH + default: + return session.ObjectSessionContext_VERB_UNSPECIFIED + } +} + +func ObjectSessionVerbFromGRPCField(v session.ObjectSessionContext_Verb) ObjectSessionVerb { + switch v { + case session.ObjectSessionContext_PUT: + return ObjectVerbPut + case session.ObjectSessionContext_GET: + return ObjectVerbGet + case session.ObjectSessionContext_HEAD: + return ObjectVerbHead + case session.ObjectSessionContext_SEARCH: + return ObjectVerbSearch + case session.ObjectSessionContext_DELETE: + return ObjectVerbDelete + case session.ObjectSessionContext_RANGE: + return ObjectVerbRange + case session.ObjectSessionContext_RANGEHASH: + return ObjectVerbRangeHash + case session.ObjectSessionContext_PATCH: + return ObjectVerbPatch + default: + return ObjectVerbUnknown + } +} + +func (c *ObjectSessionContext) ToGRPCMessage() grpc.Message { + var m *session.ObjectSessionContext + + if c != nil { + m = new(session.ObjectSessionContext) + + m.SetVerb(ObjectSessionVerbToGRPCField(c.verb)) + m.SetTarget(&session.ObjectSessionContext_Target{ + Container: c.cnr.ToGRPCMessage().(*refsGRPC.ContainerID), + Objects: refs.ObjectIDListToGRPCMessage(c.objs), + }) + } + + return m +} + +func (c *ObjectSessionContext) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.ObjectSessionContext) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cnr := v.GetTarget().GetContainer() + if cnr == nil { + c.cnr = nil + } else { + if c.cnr == nil { + c.cnr = new(refs.ContainerID) + } + + err = c.cnr.FromGRPCMessage(cnr) + if err != nil { + return err + } + } + + c.objs, err = refs.ObjectIDListFromGRPCMessage(v.GetTarget().GetObjects()) + if err != nil { + return err + } + + c.verb = ObjectSessionVerbFromGRPCField(v.GetVerb()) + + return nil +} + +func (t *TokenBody) ToGRPCMessage() grpc.Message { + var m *session.SessionToken_Body + + if t != nil { + m = new(session.SessionToken_Body) + + switch typ := t.ctx.(type) { + default: + panic(fmt.Sprintf("unknown session context %T", typ)) + case nil: + m.Context = nil + case *ObjectSessionContext: + m.SetObject(typ.ToGRPCMessage().(*session.ObjectSessionContext)) + case *ContainerSessionContext: + m.SetContainer(typ.ToGRPCMessage().(*session.ContainerSessionContext)) + } + + m.SetOwnerId(t.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + m.SetId(t.id) + m.SetSessionKey(t.sessionKey) + m.SetLifetime(t.lifetime.ToGRPCMessage().(*session.SessionToken_Body_TokenLifetime)) + } + + return m +} + +func (t *TokenBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.SessionToken_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + t.ctx = nil + + switch val := v.GetContext().(type) { + default: + err = fmt.Errorf("unknown session context %T", val) + case nil: + case *session.SessionToken_Body_Object: + ctx, ok := t.ctx.(*ObjectSessionContext) + if !ok { + ctx = new(ObjectSessionContext) + t.ctx = ctx + } + + err = ctx.FromGRPCMessage(val.Object) + case *session.SessionToken_Body_Container: + ctx, ok := t.ctx.(*ContainerSessionContext) + if !ok { + ctx = new(ContainerSessionContext) + t.ctx = ctx + } + + err = ctx.FromGRPCMessage(val.Container) + } + + if err != nil { + return err + } + + ownerID := v.GetOwnerId() + if ownerID == nil { + t.ownerID = nil + } else { + if t.ownerID == nil { + t.ownerID = new(refs.OwnerID) + } + + err = t.ownerID.FromGRPCMessage(ownerID) + if err != nil { + return err + } + } + + lifetime := v.GetLifetime() + if lifetime == nil { + t.lifetime = nil + } else { + if t.lifetime == nil { + t.lifetime = new(TokenLifetime) + } + + err = t.lifetime.FromGRPCMessage(lifetime) + if err != nil { + return err + } + } + + t.id = v.GetId() + t.sessionKey = v.GetSessionKey() + + return nil +} + +// ContainerSessionVerbToGRPCField converts ContainerSessionVerb +// to gRPC-generated session.ContainerSessionContext_Verb. +// +// If v is outside of the ContainerSessionVerb enum, +// session.ContainerSessionContext_VERB_UNSPECIFIED is returned. +func ContainerSessionVerbToGRPCField(v ContainerSessionVerb) session.ContainerSessionContext_Verb { + switch v { + default: + return session.ContainerSessionContext_VERB_UNSPECIFIED + case ContainerVerbPut: + return session.ContainerSessionContext_PUT + case ContainerVerbDelete: + return session.ContainerSessionContext_DELETE + case ContainerVerbSetEACL: + return session.ContainerSessionContext_SETEACL + } +} + +// ContainerSessionVerbFromGRPCField converts gRPC-generated +// session.ContainerSessionContext_Verb to ContainerSessionVerb. +// +// If v is outside of the session.ContainerSessionContext_Verb enum, +// ContainerVerbUnknown is returned. +func ContainerSessionVerbFromGRPCField(v session.ContainerSessionContext_Verb) ContainerSessionVerb { + switch v { + default: + return ContainerVerbUnknown + case session.ContainerSessionContext_PUT: + return ContainerVerbPut + case session.ContainerSessionContext_DELETE: + return ContainerVerbDelete + case session.ContainerSessionContext_SETEACL: + return ContainerVerbSetEACL + } +} + +// ToGRPCMessage converts ContainerSessionContext to gRPC-generated +// session.ContainerSessionContext message. +func (x *ContainerSessionContext) ToGRPCMessage() grpc.Message { + var m *session.ContainerSessionContext + + if x != nil { + m = new(session.ContainerSessionContext) + + m.SetVerb(ContainerSessionVerbToGRPCField(x.verb)) + m.SetWildcard(x.wildcard) + m.SetContainerId(x.cid.ToGRPCMessage().(*refsGRPC.ContainerID)) + } + + return m +} + +// FromGRPCMessage tries to restore ContainerSessionContext from grpc.Message. +// +// Returns message.ErrUnexpectedMessageType if m is not +// a gRPC-generated session.ContainerSessionContext message. +func (x *ContainerSessionContext) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*session.ContainerSessionContext) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + cid := v.GetContainerId() + if cid == nil { + x.cid = nil + } else { + if x.cid == nil { + x.cid = new(refs.ContainerID) + } + + err = x.cid.FromGRPCMessage(cid) + if err != nil { + return err + } + } + + x.verb = ContainerSessionVerbFromGRPCField(v.GetVerb()) + x.wildcard = v.GetWildcard() + + return nil +} diff --git a/api/session/grpc/service.pb.go b/api/session/grpc/service.pb.go new file mode 100644 index 00000000..bafe06f6 --- /dev/null +++ b/api/session/grpc/service.pb.go @@ -0,0 +1,606 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/session/grpc/service.proto + +//go:build !protoopaque + +package session + +import ( + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Information necessary for opening a session. +type CreateRequest struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of a create session token request message. + Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateRequest) Reset() { + *x = CreateRequest{} + mi := &file_api_session_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRequest) ProtoMessage() {} + +func (x *CreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateRequest) GetBody() *CreateRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *CreateRequest) GetMetaHeader() *RequestMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *CreateRequest) GetVerifyHeader() *RequestVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *CreateRequest) SetBody(v *CreateRequest_Body) { + x.Body = v +} + +func (x *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { + x.MetaHeader = v +} + +func (x *CreateRequest) SetVerifyHeader(v *RequestVerificationHeader) { + x.VerifyHeader = v +} + +func (x *CreateRequest) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *CreateRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *CreateRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *CreateRequest) ClearBody() { + x.Body = nil +} + +func (x *CreateRequest) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *CreateRequest) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type CreateRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of a create session token request message. + Body *CreateRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *RequestVerificationHeader +} + +func (b0 CreateRequest_builder) Build() *CreateRequest { + m0 := &CreateRequest{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Information about the opened session. +type CreateResponse struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Body of create session token response message. + Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateResponse) Reset() { + *x = CreateResponse{} + mi := &file_api_session_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateResponse) ProtoMessage() {} + +func (x *CreateResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateResponse) GetBody() *CreateResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *CreateResponse) GetMetaHeader() *ResponseMetaHeader { + if x != nil { + return x.MetaHeader + } + return nil +} + +func (x *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader { + if x != nil { + return x.VerifyHeader + } + return nil +} + +func (x *CreateResponse) SetBody(v *CreateResponse_Body) { + x.Body = v +} + +func (x *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { + x.MetaHeader = v +} + +func (x *CreateResponse) SetVerifyHeader(v *ResponseVerificationHeader) { + x.VerifyHeader = v +} + +func (x *CreateResponse) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *CreateResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.MetaHeader != nil +} + +func (x *CreateResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.VerifyHeader != nil +} + +func (x *CreateResponse) ClearBody() { + x.Body = nil +} + +func (x *CreateResponse) ClearMetaHeader() { + x.MetaHeader = nil +} + +func (x *CreateResponse) ClearVerifyHeader() { + x.VerifyHeader = nil +} + +type CreateResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of create session token response message. + Body *CreateResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *ResponseVerificationHeader +} + +func (b0 CreateResponse_builder) Build() *CreateResponse { + m0 := &CreateResponse{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.MetaHeader = b.MetaHeader + x.VerifyHeader = b.VerifyHeader + return m0 +} + +// Session creation request body +type CreateRequest_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Session initiating user's or node's key derived `OwnerID` + OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"` + // Session expiration `Epoch` + Expiration *uint64 `protobuf:"varint,2,opt,name=expiration" json:"expiration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateRequest_Body) Reset() { + *x = CreateRequest_Body{} + mi := &file_api_session_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRequest_Body) ProtoMessage() {} + +func (x *CreateRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateRequest_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *CreateRequest_Body) GetExpiration() uint64 { + if x != nil && x.Expiration != nil { + return *x.Expiration + } + return 0 +} + +func (x *CreateRequest_Body) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} + +func (x *CreateRequest_Body) SetExpiration(v uint64) { + x.Expiration = &v +} + +func (x *CreateRequest_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *CreateRequest_Body) HasExpiration() bool { + if x == nil { + return false + } + return x.Expiration != nil +} + +func (x *CreateRequest_Body) ClearOwnerId() { + x.OwnerId = nil +} + +func (x *CreateRequest_Body) ClearExpiration() { + x.Expiration = nil +} + +type CreateRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Session initiating user's or node's key derived `OwnerID` + OwnerId *grpc.OwnerID + // Session expiration `Epoch` + Expiration *uint64 +} + +func (b0 CreateRequest_Body_builder) Build() *CreateRequest_Body { + m0 := &CreateRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.OwnerId = b.OwnerId + x.Expiration = b.Expiration + return m0 +} + +// Session creation response body +type CreateResponse_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Identifier of a newly created session + Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + // Public key used for session + SessionKey []byte `protobuf:"bytes,2,opt,name=session_key,json=sessionKey" json:"session_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateResponse_Body) Reset() { + *x = CreateResponse_Body{} + mi := &file_api_session_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateResponse_Body) ProtoMessage() {} + +func (x *CreateResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateResponse_Body) GetId() []byte { + if x != nil { + return x.Id + } + return nil +} + +func (x *CreateResponse_Body) GetSessionKey() []byte { + if x != nil { + return x.SessionKey + } + return nil +} + +func (x *CreateResponse_Body) SetId(v []byte) { + if v == nil { + v = []byte{} + } + x.Id = v +} + +func (x *CreateResponse_Body) SetSessionKey(v []byte) { + if v == nil { + v = []byte{} + } + x.SessionKey = v +} + +func (x *CreateResponse_Body) HasId() bool { + if x == nil { + return false + } + return x.Id != nil +} + +func (x *CreateResponse_Body) HasSessionKey() bool { + if x == nil { + return false + } + return x.SessionKey != nil +} + +func (x *CreateResponse_Body) ClearId() { + x.Id = nil +} + +func (x *CreateResponse_Body) ClearSessionKey() { + x.SessionKey = nil +} + +type CreateResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of a newly created session + Id []byte + // Public key used for session + SessionKey []byte +} + +func (b0 CreateResponse_Body_builder) Build() *CreateResponse_Body { + m0 := &CreateResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Id = b.Id + x.SessionKey = b.SessionKey + return m0 +} + +var File_api_session_grpc_service_proto protoreflect.FileDescriptor + +var file_api_session_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x11, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, + 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc0, 0x02, 0x0a, + 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x1a, 0x5a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0xa1, 0x02, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, + 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x37, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x4b, 0x65, 0x79, 0x32, 0x5f, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x65, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, + 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, + 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1b, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x08, 0x65, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_session_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_api_session_grpc_service_proto_goTypes = []any{ + (*CreateRequest)(nil), // 0: neo.fs.v2.session.CreateRequest + (*CreateResponse)(nil), // 1: neo.fs.v2.session.CreateResponse + (*CreateRequest_Body)(nil), // 2: neo.fs.v2.session.CreateRequest.Body + (*CreateResponse_Body)(nil), // 3: neo.fs.v2.session.CreateResponse.Body + (*RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader + (*RequestVerificationHeader)(nil), // 5: neo.fs.v2.session.RequestVerificationHeader + (*ResponseMetaHeader)(nil), // 6: neo.fs.v2.session.ResponseMetaHeader + (*ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader + (*grpc.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID +} +var file_api_session_grpc_service_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.session.CreateRequest.body:type_name -> neo.fs.v2.session.CreateRequest.Body + 4, // 1: neo.fs.v2.session.CreateRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 5, // 2: neo.fs.v2.session.CreateRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 3, // 3: neo.fs.v2.session.CreateResponse.body:type_name -> neo.fs.v2.session.CreateResponse.Body + 6, // 4: neo.fs.v2.session.CreateResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 7, // 5: neo.fs.v2.session.CreateResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.session.CreateRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 0, // 7: neo.fs.v2.session.SessionService.Create:input_type -> neo.fs.v2.session.CreateRequest + 1, // 8: neo.fs.v2.session.SessionService.Create:output_type -> neo.fs.v2.session.CreateResponse + 8, // [8:9] is the sub-list for method output_type + 7, // [7:8] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_api_session_grpc_service_proto_init() } +func file_api_session_grpc_service_proto_init() { + if File_api_session_grpc_service_proto != nil { + return + } + file_api_session_grpc_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_session_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_session_grpc_service_proto_goTypes, + DependencyIndexes: file_api_session_grpc_service_proto_depIdxs, + MessageInfos: file_api_session_grpc_service_proto_msgTypes, + }.Build() + File_api_session_grpc_service_proto = out.File + file_api_session_grpc_service_proto_rawDesc = nil + file_api_session_grpc_service_proto_goTypes = nil + file_api_session_grpc_service_proto_depIdxs = nil +} diff --git a/api/session/grpc/service_grpc.pb.go b/api/session/grpc/service_grpc.pb.go new file mode 100644 index 00000000..5f473dcc --- /dev/null +++ b/api/session/grpc/service_grpc.pb.go @@ -0,0 +1,141 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.2 +// source: api/session/grpc/service.proto + +package session + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SessionService_Create_FullMethodName = "/neo.fs.v2.session.SessionService/Create" +) + +// SessionServiceClient is the client API for SessionService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// `SessionService` allows to establish a temporary trust relationship between +// two peer nodes and generate a `SessionToken` as the proof of trust to be +// attached in requests for further verification. Please see corresponding +// section of FrostFS Technical Specification for details. +type SessionServiceClient interface { + // Open a new session between two peers. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // session has been successfully opened; + // - Common failures (SECTION_FAILURE_COMMON). + Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) +} + +type sessionServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSessionServiceClient(cc grpc.ClientConnInterface) SessionServiceClient { + return &sessionServiceClient{cc} +} + +func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateResponse) + err := c.cc.Invoke(ctx, SessionService_Create_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SessionServiceServer is the server API for SessionService service. +// All implementations should embed UnimplementedSessionServiceServer +// for forward compatibility. +// +// `SessionService` allows to establish a temporary trust relationship between +// two peer nodes and generate a `SessionToken` as the proof of trust to be +// attached in requests for further verification. Please see corresponding +// section of FrostFS Technical Specification for details. +type SessionServiceServer interface { + // Open a new session between two peers. + // + // Statuses: + // - **OK** (0, SECTION_SUCCESS): + // session has been successfully opened; + // - Common failures (SECTION_FAILURE_COMMON). + Create(context.Context, *CreateRequest) (*CreateResponse, error) +} + +// UnimplementedSessionServiceServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSessionServiceServer struct{} + +func (UnimplementedSessionServiceServer) Create(context.Context, *CreateRequest) (*CreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (UnimplementedSessionServiceServer) testEmbeddedByValue() {} + +// UnsafeSessionServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SessionServiceServer will +// result in compilation errors. +type UnsafeSessionServiceServer interface { + mustEmbedUnimplementedSessionServiceServer() +} + +func RegisterSessionServiceServer(s grpc.ServiceRegistrar, srv SessionServiceServer) { + // If the following call pancis, it indicates UnimplementedSessionServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SessionService_ServiceDesc, srv) +} + +func _SessionService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServiceServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SessionService_Create_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServiceServer).Create(ctx, req.(*CreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SessionService_ServiceDesc is the grpc.ServiceDesc for SessionService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SessionService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "neo.fs.v2.session.SessionService", + HandlerType: (*SessionServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _SessionService_Create_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/session/grpc/service.proto", +} diff --git a/api/session/grpc/service_protoopaque.pb.go b/api/session/grpc/service_protoopaque.pb.go new file mode 100644 index 00000000..6d6811af --- /dev/null +++ b/api/session/grpc/service_protoopaque.pb.go @@ -0,0 +1,609 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/session/grpc/service.proto + +//go:build protoopaque + +package session + +import ( + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Information necessary for opening a session. +type CreateRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateRequest) Reset() { + *x = CreateRequest{} + mi := &file_api_session_grpc_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRequest) ProtoMessage() {} + +func (x *CreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateRequest) GetBody() *CreateRequest_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *CreateRequest) GetMetaHeader() *RequestMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *CreateRequest) GetVerifyHeader() *RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *CreateRequest) SetBody(v *CreateRequest_Body) { + x.xxx_hidden_Body = v +} + +func (x *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *CreateRequest) SetVerifyHeader(v *RequestVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *CreateRequest) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *CreateRequest) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *CreateRequest) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *CreateRequest) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *CreateRequest) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *CreateRequest) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type CreateRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of a create session token request message. + Body *CreateRequest_Body + // Carries request meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *RequestMetaHeader + // Carries request verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *RequestVerificationHeader +} + +func (b0 CreateRequest_builder) Build() *CreateRequest { + m0 := &CreateRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Information about the opened session. +type CreateResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_MetaHeader *ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"` + xxx_hidden_VerifyHeader *ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateResponse) Reset() { + *x = CreateResponse{} + mi := &file_api_session_grpc_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateResponse) ProtoMessage() {} + +func (x *CreateResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateResponse) GetBody() *CreateResponse_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *CreateResponse) GetMetaHeader() *ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_MetaHeader + } + return nil +} + +func (x *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_VerifyHeader + } + return nil +} + +func (x *CreateResponse) SetBody(v *CreateResponse_Body) { + x.xxx_hidden_Body = v +} + +func (x *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { + x.xxx_hidden_MetaHeader = v +} + +func (x *CreateResponse) SetVerifyHeader(v *ResponseVerificationHeader) { + x.xxx_hidden_VerifyHeader = v +} + +func (x *CreateResponse) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *CreateResponse) HasMetaHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaHeader != nil +} + +func (x *CreateResponse) HasVerifyHeader() bool { + if x == nil { + return false + } + return x.xxx_hidden_VerifyHeader != nil +} + +func (x *CreateResponse) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *CreateResponse) ClearMetaHeader() { + x.xxx_hidden_MetaHeader = nil +} + +func (x *CreateResponse) ClearVerifyHeader() { + x.xxx_hidden_VerifyHeader = nil +} + +type CreateResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Body of create session token response message. + Body *CreateResponse_Body + // Carries response meta information. Header data is used only to regulate + // message transport and does not affect request execution. + MetaHeader *ResponseMetaHeader + // Carries response verification information. This header is used to + // authenticate the nodes of the message route and check the correctness of + // transmission. + VerifyHeader *ResponseVerificationHeader +} + +func (b0 CreateResponse_builder) Build() *CreateResponse { + m0 := &CreateResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_MetaHeader = b.MetaHeader + x.xxx_hidden_VerifyHeader = b.VerifyHeader + return m0 +} + +// Session creation request body +type CreateRequest_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"` + xxx_hidden_Expiration uint64 `protobuf:"varint,2,opt,name=expiration" json:"expiration,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateRequest_Body) Reset() { + *x = CreateRequest_Body{} + mi := &file_api_session_grpc_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRequest_Body) ProtoMessage() {} + +func (x *CreateRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateRequest_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *CreateRequest_Body) GetExpiration() uint64 { + if x != nil { + return x.xxx_hidden_Expiration + } + return 0 +} + +func (x *CreateRequest_Body) SetOwnerId(v *grpc.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *CreateRequest_Body) SetExpiration(v uint64) { + x.xxx_hidden_Expiration = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *CreateRequest_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *CreateRequest_Body) HasExpiration() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CreateRequest_Body) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +func (x *CreateRequest_Body) ClearExpiration() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Expiration = 0 +} + +type CreateRequest_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Session initiating user's or node's key derived `OwnerID` + OwnerId *grpc.OwnerID + // Session expiration `Epoch` + Expiration *uint64 +} + +func (b0 CreateRequest_Body_builder) Build() *CreateRequest_Body { + m0 := &CreateRequest_Body{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_OwnerId = b.OwnerId + if b.Expiration != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Expiration = *b.Expiration + } + return m0 +} + +// Session creation response body +type CreateResponse_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + xxx_hidden_SessionKey []byte `protobuf:"bytes,2,opt,name=session_key,json=sessionKey" json:"session_key,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateResponse_Body) Reset() { + *x = CreateResponse_Body{} + mi := &file_api_session_grpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateResponse_Body) ProtoMessage() {} + +func (x *CreateResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateResponse_Body) GetId() []byte { + if x != nil { + return x.xxx_hidden_Id + } + return nil +} + +func (x *CreateResponse_Body) GetSessionKey() []byte { + if x != nil { + return x.xxx_hidden_SessionKey + } + return nil +} + +func (x *CreateResponse_Body) SetId(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Id = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *CreateResponse_Body) SetSessionKey(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_SessionKey = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *CreateResponse_Body) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *CreateResponse_Body) HasSessionKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CreateResponse_Body) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +func (x *CreateResponse_Body) ClearSessionKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_SessionKey = nil +} + +type CreateResponse_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Identifier of a newly created session + Id []byte + // Public key used for session + SessionKey []byte +} + +func (b0 CreateResponse_Body_builder) Build() *CreateResponse_Body { + m0 := &CreateResponse_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Id = b.Id + } + if b.SessionKey != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_SessionKey = b.SessionKey + } + return m0 +} + +var File_api_session_grpc_service_proto protoreflect.FileDescriptor + +var file_api_session_grpc_service_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x11, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, + 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc0, 0x02, 0x0a, + 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, + 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x1a, 0x5a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, 0x6f, + 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, + 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0xa1, 0x02, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, + 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x37, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x4b, 0x65, 0x79, 0x32, 0x5f, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, + 0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x65, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, + 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, + 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1b, + 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x41, 0x50, 0x49, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x08, 0x65, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_session_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_api_session_grpc_service_proto_goTypes = []any{ + (*CreateRequest)(nil), // 0: neo.fs.v2.session.CreateRequest + (*CreateResponse)(nil), // 1: neo.fs.v2.session.CreateResponse + (*CreateRequest_Body)(nil), // 2: neo.fs.v2.session.CreateRequest.Body + (*CreateResponse_Body)(nil), // 3: neo.fs.v2.session.CreateResponse.Body + (*RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader + (*RequestVerificationHeader)(nil), // 5: neo.fs.v2.session.RequestVerificationHeader + (*ResponseMetaHeader)(nil), // 6: neo.fs.v2.session.ResponseMetaHeader + (*ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader + (*grpc.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID +} +var file_api_session_grpc_service_proto_depIdxs = []int32{ + 2, // 0: neo.fs.v2.session.CreateRequest.body:type_name -> neo.fs.v2.session.CreateRequest.Body + 4, // 1: neo.fs.v2.session.CreateRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader + 5, // 2: neo.fs.v2.session.CreateRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader + 3, // 3: neo.fs.v2.session.CreateResponse.body:type_name -> neo.fs.v2.session.CreateResponse.Body + 6, // 4: neo.fs.v2.session.CreateResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader + 7, // 5: neo.fs.v2.session.CreateResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 8, // 6: neo.fs.v2.session.CreateRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 0, // 7: neo.fs.v2.session.SessionService.Create:input_type -> neo.fs.v2.session.CreateRequest + 1, // 8: neo.fs.v2.session.SessionService.Create:output_type -> neo.fs.v2.session.CreateResponse + 8, // [8:9] is the sub-list for method output_type + 7, // [7:8] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_api_session_grpc_service_proto_init() } +func file_api_session_grpc_service_proto_init() { + if File_api_session_grpc_service_proto != nil { + return + } + file_api_session_grpc_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_session_grpc_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_session_grpc_service_proto_goTypes, + DependencyIndexes: file_api_session_grpc_service_proto_depIdxs, + MessageInfos: file_api_session_grpc_service_proto_msgTypes, + }.Build() + File_api_session_grpc_service_proto = out.File + file_api_session_grpc_service_proto_rawDesc = nil + file_api_session_grpc_service_proto_goTypes = nil + file_api_session_grpc_service_proto_depIdxs = nil +} diff --git a/api/session/grpc/types.pb.go b/api/session/grpc/types.pb.go new file mode 100644 index 00000000..5adf2dab --- /dev/null +++ b/api/session/grpc/types.pb.go @@ -0,0 +1,2145 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/session/grpc/types.proto + +//go:build !protoopaque + +package session + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Object request verbs +type ObjectSessionContext_Verb int32 + +const ( + // Unknown verb + ObjectSessionContext_VERB_UNSPECIFIED ObjectSessionContext_Verb = 0 + // Refers to object.Put RPC call + ObjectSessionContext_PUT ObjectSessionContext_Verb = 1 + // Refers to object.Get RPC call + ObjectSessionContext_GET ObjectSessionContext_Verb = 2 + // Refers to object.Head RPC call + ObjectSessionContext_HEAD ObjectSessionContext_Verb = 3 + // Refers to object.Search RPC call + ObjectSessionContext_SEARCH ObjectSessionContext_Verb = 4 + // Refers to object.Delete RPC call + ObjectSessionContext_DELETE ObjectSessionContext_Verb = 5 + // Refers to object.GetRange RPC call + ObjectSessionContext_RANGE ObjectSessionContext_Verb = 6 + // Refers to object.GetRangeHash RPC call + ObjectSessionContext_RANGEHASH ObjectSessionContext_Verb = 7 + // Refers to object.Patch RPC call + ObjectSessionContext_PATCH ObjectSessionContext_Verb = 8 +) + +// Enum value maps for ObjectSessionContext_Verb. +var ( + ObjectSessionContext_Verb_name = map[int32]string{ + 0: "VERB_UNSPECIFIED", + 1: "PUT", + 2: "GET", + 3: "HEAD", + 4: "SEARCH", + 5: "DELETE", + 6: "RANGE", + 7: "RANGEHASH", + 8: "PATCH", + } + ObjectSessionContext_Verb_value = map[string]int32{ + "VERB_UNSPECIFIED": 0, + "PUT": 1, + "GET": 2, + "HEAD": 3, + "SEARCH": 4, + "DELETE": 5, + "RANGE": 6, + "RANGEHASH": 7, + "PATCH": 8, + } +) + +func (x ObjectSessionContext_Verb) Enum() *ObjectSessionContext_Verb { + p := new(ObjectSessionContext_Verb) + *p = x + return p +} + +func (x ObjectSessionContext_Verb) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ObjectSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { + return file_api_session_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (ObjectSessionContext_Verb) Type() protoreflect.EnumType { + return &file_api_session_grpc_types_proto_enumTypes[0] +} + +func (x ObjectSessionContext_Verb) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Container request verbs +type ContainerSessionContext_Verb int32 + +const ( + // Unknown verb + ContainerSessionContext_VERB_UNSPECIFIED ContainerSessionContext_Verb = 0 + // Refers to container.Put RPC call + ContainerSessionContext_PUT ContainerSessionContext_Verb = 1 + // Refers to container.Delete RPC call + ContainerSessionContext_DELETE ContainerSessionContext_Verb = 2 + // Refers to container.SetExtendedACL RPC call + ContainerSessionContext_SETEACL ContainerSessionContext_Verb = 3 +) + +// Enum value maps for ContainerSessionContext_Verb. +var ( + ContainerSessionContext_Verb_name = map[int32]string{ + 0: "VERB_UNSPECIFIED", + 1: "PUT", + 2: "DELETE", + 3: "SETEACL", + } + ContainerSessionContext_Verb_value = map[string]int32{ + "VERB_UNSPECIFIED": 0, + "PUT": 1, + "DELETE": 2, + "SETEACL": 3, + } +) + +func (x ContainerSessionContext_Verb) Enum() *ContainerSessionContext_Verb { + p := new(ContainerSessionContext_Verb) + *p = x + return p +} + +func (x ContainerSessionContext_Verb) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ContainerSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { + return file_api_session_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (ContainerSessionContext_Verb) Type() protoreflect.EnumType { + return &file_api_session_grpc_types_proto_enumTypes[1] +} + +func (x ContainerSessionContext_Verb) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Context information for Session Tokens related to ObjectService requests +type ObjectSessionContext struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Type of request for which the token is issued + Verb *ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,enum=neo.fs.v2.session.ObjectSessionContext_Verb" json:"verb,omitempty"` + // Object session target. MUST be correctly formed and set. If `objects` + // field is not empty, then the session applies only to these elements, + // otherwise, to all objects from the specified container. + Target *ObjectSessionContext_Target `protobuf:"bytes,2,opt,name=target" json:"target,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectSessionContext) Reset() { + *x = ObjectSessionContext{} + mi := &file_api_session_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectSessionContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectSessionContext) ProtoMessage() {} + +func (x *ObjectSessionContext) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { + if x != nil && x.Verb != nil { + return *x.Verb + } + return ObjectSessionContext_VERB_UNSPECIFIED +} + +func (x *ObjectSessionContext) GetTarget() *ObjectSessionContext_Target { + if x != nil { + return x.Target + } + return nil +} + +func (x *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) { + x.Verb = &v +} + +func (x *ObjectSessionContext) SetTarget(v *ObjectSessionContext_Target) { + x.Target = v +} + +func (x *ObjectSessionContext) HasVerb() bool { + if x == nil { + return false + } + return x.Verb != nil +} + +func (x *ObjectSessionContext) HasTarget() bool { + if x == nil { + return false + } + return x.Target != nil +} + +func (x *ObjectSessionContext) ClearVerb() { + x.Verb = nil +} + +func (x *ObjectSessionContext) ClearTarget() { + x.Target = nil +} + +type ObjectSessionContext_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Type of request for which the token is issued + Verb *ObjectSessionContext_Verb + // Object session target. MUST be correctly formed and set. If `objects` + // field is not empty, then the session applies only to these elements, + // otherwise, to all objects from the specified container. + Target *ObjectSessionContext_Target +} + +func (b0 ObjectSessionContext_builder) Build() *ObjectSessionContext { + m0 := &ObjectSessionContext{} + b, x := &b0, m0 + _, _ = b, x + x.Verb = b.Verb + x.Target = b.Target + return m0 +} + +// Context information for Session Tokens related to ContainerService requests. +type ContainerSessionContext struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Type of request for which the token is issued + Verb *ContainerSessionContext_Verb `protobuf:"varint,1,opt,name=verb,enum=neo.fs.v2.session.ContainerSessionContext_Verb" json:"verb,omitempty"` + // Spreads the action to all owner containers. + // If set, container_id field is ignored. + Wildcard *bool `protobuf:"varint,2,opt,name=wildcard" json:"wildcard,omitempty"` + // Particular container to which the action applies. + // Ignored if wildcard flag is set. + ContainerId *grpc.ContainerID `protobuf:"bytes,3,opt,name=container_id,json=containerID" json:"container_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ContainerSessionContext) Reset() { + *x = ContainerSessionContext{} + mi := &file_api_session_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ContainerSessionContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContainerSessionContext) ProtoMessage() {} + +func (x *ContainerSessionContext) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ContainerSessionContext) GetVerb() ContainerSessionContext_Verb { + if x != nil && x.Verb != nil { + return *x.Verb + } + return ContainerSessionContext_VERB_UNSPECIFIED +} + +func (x *ContainerSessionContext) GetWildcard() bool { + if x != nil && x.Wildcard != nil { + return *x.Wildcard + } + return false +} + +func (x *ContainerSessionContext) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.ContainerId + } + return nil +} + +func (x *ContainerSessionContext) SetVerb(v ContainerSessionContext_Verb) { + x.Verb = &v +} + +func (x *ContainerSessionContext) SetWildcard(v bool) { + x.Wildcard = &v +} + +func (x *ContainerSessionContext) SetContainerId(v *grpc.ContainerID) { + x.ContainerId = v +} + +func (x *ContainerSessionContext) HasVerb() bool { + if x == nil { + return false + } + return x.Verb != nil +} + +func (x *ContainerSessionContext) HasWildcard() bool { + if x == nil { + return false + } + return x.Wildcard != nil +} + +func (x *ContainerSessionContext) HasContainerId() bool { + if x == nil { + return false + } + return x.ContainerId != nil +} + +func (x *ContainerSessionContext) ClearVerb() { + x.Verb = nil +} + +func (x *ContainerSessionContext) ClearWildcard() { + x.Wildcard = nil +} + +func (x *ContainerSessionContext) ClearContainerId() { + x.ContainerId = nil +} + +type ContainerSessionContext_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Type of request for which the token is issued + Verb *ContainerSessionContext_Verb + // Spreads the action to all owner containers. + // If set, container_id field is ignored. + Wildcard *bool + // Particular container to which the action applies. + // Ignored if wildcard flag is set. + ContainerId *grpc.ContainerID +} + +func (b0 ContainerSessionContext_builder) Build() *ContainerSessionContext { + m0 := &ContainerSessionContext{} + b, x := &b0, m0 + _, _ = b, x + x.Verb = b.Verb + x.Wildcard = b.Wildcard + x.ContainerId = b.ContainerId + return m0 +} + +// FrostFS Session Token. +type SessionToken struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Session Token contains the proof of trust between peers to be attached in + // requests for further verification. Please see corresponding section of + // FrostFS Technical Specification for details. + Body *SessionToken_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + // Signature of `SessionToken` information + Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionToken) Reset() { + *x = SessionToken{} + mi := &file_api_session_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionToken) ProtoMessage() {} + +func (x *SessionToken) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SessionToken) GetBody() *SessionToken_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *SessionToken) GetSignature() *grpc.Signature { + if x != nil { + return x.Signature + } + return nil +} + +func (x *SessionToken) SetBody(v *SessionToken_Body) { + x.Body = v +} + +func (x *SessionToken) SetSignature(v *grpc.Signature) { + x.Signature = v +} + +func (x *SessionToken) HasBody() bool { + if x == nil { + return false + } + return x.Body != nil +} + +func (x *SessionToken) HasSignature() bool { + if x == nil { + return false + } + return x.Signature != nil +} + +func (x *SessionToken) ClearBody() { + x.Body = nil +} + +func (x *SessionToken) ClearSignature() { + x.Signature = nil +} + +type SessionToken_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Session Token contains the proof of trust between peers to be attached in + // requests for further verification. Please see corresponding section of + // FrostFS Technical Specification for details. + Body *SessionToken_Body + // Signature of `SessionToken` information + Signature *grpc.Signature +} + +func (b0 SessionToken_builder) Build() *SessionToken { + m0 := &SessionToken{} + b, x := &b0, m0 + _, _ = b, x + x.Body = b.Body + x.Signature = b.Signature + return m0 +} + +// Extended headers for Request/Response. They may contain any user-defined +// headers to be interpreted on application level. +// +// Key name must be a unique valid UTF-8 string. Value can't be empty. Requests +// or Responses with duplicated header names or headers with empty values will +// be considered invalid. +// +// There are some "well-known" headers starting with `__SYSTEM__` (`__NEOFS__` +// is deprecated) prefix that affect system behaviour: +// +// - [ __SYSTEM__NETMAP_EPOCH ] \ +// (`__NEOFS__NETMAP_EPOCH` is deprecated) \ +// Netmap epoch to use for object placement calculation. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, the +// current epoch only will be used. +// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ +// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ +// If object can't be found using current epoch's netmap, this header limits +// how many past epochs the node can look up through. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, only +// the current epoch will be used. +type XHeader struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Key of the X-Header + Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + // Value of the X-Header + Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *XHeader) Reset() { + *x = XHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *XHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*XHeader) ProtoMessage() {} + +func (x *XHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *XHeader) GetKey() string { + if x != nil && x.Key != nil { + return *x.Key + } + return "" +} + +func (x *XHeader) GetValue() string { + if x != nil && x.Value != nil { + return *x.Value + } + return "" +} + +func (x *XHeader) SetKey(v string) { + x.Key = &v +} + +func (x *XHeader) SetValue(v string) { + x.Value = &v +} + +func (x *XHeader) HasKey() bool { + if x == nil { + return false + } + return x.Key != nil +} + +func (x *XHeader) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *XHeader) ClearKey() { + x.Key = nil +} + +func (x *XHeader) ClearValue() { + x.Value = nil +} + +type XHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Key of the X-Header + Key *string + // Value of the X-Header + Value *string +} + +func (b0 XHeader_builder) Build() *XHeader { + m0 := &XHeader{} + b, x := &b0, m0 + _, _ = b, x + x.Key = b.Key + x.Value = b.Value + return m0 +} + +// Meta information attached to the request. When forwarded between peers, +// request meta headers are folded in matryoshka style. +type RequestMetaHeader struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Peer's API version used + Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + // Peer's local epoch number. Set to 0 if unknown. + Epoch *uint64 `protobuf:"varint,2,opt,name=epoch" json:"epoch,omitempty"` + // Maximum number of intermediate nodes in the request route + Ttl *uint32 `protobuf:"varint,3,opt,name=ttl" json:"ttl,omitempty"` + // Request X-Headers + XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders" json:"x_headers,omitempty"` + // Session token within which the request is sent + SessionToken *SessionToken `protobuf:"bytes,5,opt,name=session_token,json=sessionToken" json:"session_token,omitempty"` + // `BearerToken` with eACL overrides for the request + BearerToken *grpc1.BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken" json:"bearer_token,omitempty"` + // `RequestMetaHeader` of the origin request + Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin" json:"origin,omitempty"` + // FrostFS network magic. Must match the value for the network + // that the server belongs to. + MagicNumber *uint64 `protobuf:"varint,8,opt,name=magic_number,json=magicNumber" json:"magic_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RequestMetaHeader) Reset() { + *x = RequestMetaHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RequestMetaHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestMetaHeader) ProtoMessage() {} + +func (x *RequestMetaHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RequestMetaHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} + +func (x *RequestMetaHeader) GetEpoch() uint64 { + if x != nil && x.Epoch != nil { + return *x.Epoch + } + return 0 +} + +func (x *RequestMetaHeader) GetTtl() uint32 { + if x != nil && x.Ttl != nil { + return *x.Ttl + } + return 0 +} + +func (x *RequestMetaHeader) GetXHeaders() []*XHeader { + if x != nil { + return x.XHeaders + } + return nil +} + +func (x *RequestMetaHeader) GetSessionToken() *SessionToken { + if x != nil { + return x.SessionToken + } + return nil +} + +func (x *RequestMetaHeader) GetBearerToken() *grpc1.BearerToken { + if x != nil { + return x.BearerToken + } + return nil +} + +func (x *RequestMetaHeader) GetOrigin() *RequestMetaHeader { + if x != nil { + return x.Origin + } + return nil +} + +func (x *RequestMetaHeader) GetMagicNumber() uint64 { + if x != nil && x.MagicNumber != nil { + return *x.MagicNumber + } + return 0 +} + +func (x *RequestMetaHeader) SetVersion(v *grpc.Version) { + x.Version = v +} + +func (x *RequestMetaHeader) SetEpoch(v uint64) { + x.Epoch = &v +} + +func (x *RequestMetaHeader) SetTtl(v uint32) { + x.Ttl = &v +} + +func (x *RequestMetaHeader) SetXHeaders(v []*XHeader) { + x.XHeaders = v +} + +func (x *RequestMetaHeader) SetSessionToken(v *SessionToken) { + x.SessionToken = v +} + +func (x *RequestMetaHeader) SetBearerToken(v *grpc1.BearerToken) { + x.BearerToken = v +} + +func (x *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { + x.Origin = v +} + +func (x *RequestMetaHeader) SetMagicNumber(v uint64) { + x.MagicNumber = &v +} + +func (x *RequestMetaHeader) HasVersion() bool { + if x == nil { + return false + } + return x.Version != nil +} + +func (x *RequestMetaHeader) HasEpoch() bool { + if x == nil { + return false + } + return x.Epoch != nil +} + +func (x *RequestMetaHeader) HasTtl() bool { + if x == nil { + return false + } + return x.Ttl != nil +} + +func (x *RequestMetaHeader) HasSessionToken() bool { + if x == nil { + return false + } + return x.SessionToken != nil +} + +func (x *RequestMetaHeader) HasBearerToken() bool { + if x == nil { + return false + } + return x.BearerToken != nil +} + +func (x *RequestMetaHeader) HasOrigin() bool { + if x == nil { + return false + } + return x.Origin != nil +} + +func (x *RequestMetaHeader) HasMagicNumber() bool { + if x == nil { + return false + } + return x.MagicNumber != nil +} + +func (x *RequestMetaHeader) ClearVersion() { + x.Version = nil +} + +func (x *RequestMetaHeader) ClearEpoch() { + x.Epoch = nil +} + +func (x *RequestMetaHeader) ClearTtl() { + x.Ttl = nil +} + +func (x *RequestMetaHeader) ClearSessionToken() { + x.SessionToken = nil +} + +func (x *RequestMetaHeader) ClearBearerToken() { + x.BearerToken = nil +} + +func (x *RequestMetaHeader) ClearOrigin() { + x.Origin = nil +} + +func (x *RequestMetaHeader) ClearMagicNumber() { + x.MagicNumber = nil +} + +type RequestMetaHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Peer's API version used + Version *grpc.Version + // Peer's local epoch number. Set to 0 if unknown. + Epoch *uint64 + // Maximum number of intermediate nodes in the request route + Ttl *uint32 + // Request X-Headers + XHeaders []*XHeader + // Session token within which the request is sent + SessionToken *SessionToken + // `BearerToken` with eACL overrides for the request + BearerToken *grpc1.BearerToken + // `RequestMetaHeader` of the origin request + Origin *RequestMetaHeader + // FrostFS network magic. Must match the value for the network + // that the server belongs to. + MagicNumber *uint64 +} + +func (b0 RequestMetaHeader_builder) Build() *RequestMetaHeader { + m0 := &RequestMetaHeader{} + b, x := &b0, m0 + _, _ = b, x + x.Version = b.Version + x.Epoch = b.Epoch + x.Ttl = b.Ttl + x.XHeaders = b.XHeaders + x.SessionToken = b.SessionToken + x.BearerToken = b.BearerToken + x.Origin = b.Origin + x.MagicNumber = b.MagicNumber + return m0 +} + +// Information about the response +type ResponseMetaHeader struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Peer's API version used + Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + // Peer's local epoch number + Epoch *uint64 `protobuf:"varint,2,opt,name=epoch" json:"epoch,omitempty"` + // Maximum number of intermediate nodes in the request route + Ttl *uint32 `protobuf:"varint,3,opt,name=ttl" json:"ttl,omitempty"` + // Response X-Headers + XHeaders []*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders" json:"x_headers,omitempty"` + // `ResponseMetaHeader` of the origin request + Origin *ResponseMetaHeader `protobuf:"bytes,5,opt,name=origin" json:"origin,omitempty"` + // Status return + Status *grpc2.Status `protobuf:"bytes,6,opt,name=status" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResponseMetaHeader) Reset() { + *x = ResponseMetaHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResponseMetaHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseMetaHeader) ProtoMessage() {} + +func (x *ResponseMetaHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResponseMetaHeader) GetVersion() *grpc.Version { + if x != nil { + return x.Version + } + return nil +} + +func (x *ResponseMetaHeader) GetEpoch() uint64 { + if x != nil && x.Epoch != nil { + return *x.Epoch + } + return 0 +} + +func (x *ResponseMetaHeader) GetTtl() uint32 { + if x != nil && x.Ttl != nil { + return *x.Ttl + } + return 0 +} + +func (x *ResponseMetaHeader) GetXHeaders() []*XHeader { + if x != nil { + return x.XHeaders + } + return nil +} + +func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { + if x != nil { + return x.Origin + } + return nil +} + +func (x *ResponseMetaHeader) GetStatus() *grpc2.Status { + if x != nil { + return x.Status + } + return nil +} + +func (x *ResponseMetaHeader) SetVersion(v *grpc.Version) { + x.Version = v +} + +func (x *ResponseMetaHeader) SetEpoch(v uint64) { + x.Epoch = &v +} + +func (x *ResponseMetaHeader) SetTtl(v uint32) { + x.Ttl = &v +} + +func (x *ResponseMetaHeader) SetXHeaders(v []*XHeader) { + x.XHeaders = v +} + +func (x *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { + x.Origin = v +} + +func (x *ResponseMetaHeader) SetStatus(v *grpc2.Status) { + x.Status = v +} + +func (x *ResponseMetaHeader) HasVersion() bool { + if x == nil { + return false + } + return x.Version != nil +} + +func (x *ResponseMetaHeader) HasEpoch() bool { + if x == nil { + return false + } + return x.Epoch != nil +} + +func (x *ResponseMetaHeader) HasTtl() bool { + if x == nil { + return false + } + return x.Ttl != nil +} + +func (x *ResponseMetaHeader) HasOrigin() bool { + if x == nil { + return false + } + return x.Origin != nil +} + +func (x *ResponseMetaHeader) HasStatus() bool { + if x == nil { + return false + } + return x.Status != nil +} + +func (x *ResponseMetaHeader) ClearVersion() { + x.Version = nil +} + +func (x *ResponseMetaHeader) ClearEpoch() { + x.Epoch = nil +} + +func (x *ResponseMetaHeader) ClearTtl() { + x.Ttl = nil +} + +func (x *ResponseMetaHeader) ClearOrigin() { + x.Origin = nil +} + +func (x *ResponseMetaHeader) ClearStatus() { + x.Status = nil +} + +type ResponseMetaHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Peer's API version used + Version *grpc.Version + // Peer's local epoch number + Epoch *uint64 + // Maximum number of intermediate nodes in the request route + Ttl *uint32 + // Response X-Headers + XHeaders []*XHeader + // `ResponseMetaHeader` of the origin request + Origin *ResponseMetaHeader + // Status return + Status *grpc2.Status +} + +func (b0 ResponseMetaHeader_builder) Build() *ResponseMetaHeader { + m0 := &ResponseMetaHeader{} + b, x := &b0, m0 + _, _ = b, x + x.Version = b.Version + x.Epoch = b.Epoch + x.Ttl = b.Ttl + x.XHeaders = b.XHeaders + x.Origin = b.Origin + x.Status = b.Status + return m0 +} + +// Verification info for the request signed by all intermediate nodes. +type RequestVerificationHeader struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Request Body signature. Should be generated once by the request initiator. + BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature" json:"body_signature,omitempty"` + // Request Meta signature is added and signed by each intermediate node + MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature" json:"meta_signature,omitempty"` + // Signature of previous hops + OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature" json:"origin_signature,omitempty"` + // Chain of previous hops signatures + Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin" json:"origin,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RequestVerificationHeader) Reset() { + *x = RequestVerificationHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RequestVerificationHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestVerificationHeader) ProtoMessage() {} + +func (x *RequestVerificationHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RequestVerificationHeader) GetBodySignature() *grpc.Signature { + if x != nil { + return x.BodySignature + } + return nil +} + +func (x *RequestVerificationHeader) GetMetaSignature() *grpc.Signature { + if x != nil { + return x.MetaSignature + } + return nil +} + +func (x *RequestVerificationHeader) GetOriginSignature() *grpc.Signature { + if x != nil { + return x.OriginSignature + } + return nil +} + +func (x *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if x != nil { + return x.Origin + } + return nil +} + +func (x *RequestVerificationHeader) SetBodySignature(v *grpc.Signature) { + x.BodySignature = v +} + +func (x *RequestVerificationHeader) SetMetaSignature(v *grpc.Signature) { + x.MetaSignature = v +} + +func (x *RequestVerificationHeader) SetOriginSignature(v *grpc.Signature) { + x.OriginSignature = v +} + +func (x *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { + x.Origin = v +} + +func (x *RequestVerificationHeader) HasBodySignature() bool { + if x == nil { + return false + } + return x.BodySignature != nil +} + +func (x *RequestVerificationHeader) HasMetaSignature() bool { + if x == nil { + return false + } + return x.MetaSignature != nil +} + +func (x *RequestVerificationHeader) HasOriginSignature() bool { + if x == nil { + return false + } + return x.OriginSignature != nil +} + +func (x *RequestVerificationHeader) HasOrigin() bool { + if x == nil { + return false + } + return x.Origin != nil +} + +func (x *RequestVerificationHeader) ClearBodySignature() { + x.BodySignature = nil +} + +func (x *RequestVerificationHeader) ClearMetaSignature() { + x.MetaSignature = nil +} + +func (x *RequestVerificationHeader) ClearOriginSignature() { + x.OriginSignature = nil +} + +func (x *RequestVerificationHeader) ClearOrigin() { + x.Origin = nil +} + +type RequestVerificationHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Request Body signature. Should be generated once by the request initiator. + BodySignature *grpc.Signature + // Request Meta signature is added and signed by each intermediate node + MetaSignature *grpc.Signature + // Signature of previous hops + OriginSignature *grpc.Signature + // Chain of previous hops signatures + Origin *RequestVerificationHeader +} + +func (b0 RequestVerificationHeader_builder) Build() *RequestVerificationHeader { + m0 := &RequestVerificationHeader{} + b, x := &b0, m0 + _, _ = b, x + x.BodySignature = b.BodySignature + x.MetaSignature = b.MetaSignature + x.OriginSignature = b.OriginSignature + x.Origin = b.Origin + return m0 +} + +// Verification info for the response signed by all intermediate nodes +type ResponseVerificationHeader struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Response Body signature. Should be generated once by an answering node. + BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature" json:"body_signature,omitempty"` + // Response Meta signature is added and signed by each intermediate node + MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature" json:"meta_signature,omitempty"` + // Signature of previous hops + OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature" json:"origin_signature,omitempty"` + // Chain of previous hops signatures + Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin" json:"origin,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResponseVerificationHeader) Reset() { + *x = ResponseVerificationHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResponseVerificationHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseVerificationHeader) ProtoMessage() {} + +func (x *ResponseVerificationHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { + if x != nil { + return x.BodySignature + } + return nil +} + +func (x *ResponseVerificationHeader) GetMetaSignature() *grpc.Signature { + if x != nil { + return x.MetaSignature + } + return nil +} + +func (x *ResponseVerificationHeader) GetOriginSignature() *grpc.Signature { + if x != nil { + return x.OriginSignature + } + return nil +} + +func (x *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if x != nil { + return x.Origin + } + return nil +} + +func (x *ResponseVerificationHeader) SetBodySignature(v *grpc.Signature) { + x.BodySignature = v +} + +func (x *ResponseVerificationHeader) SetMetaSignature(v *grpc.Signature) { + x.MetaSignature = v +} + +func (x *ResponseVerificationHeader) SetOriginSignature(v *grpc.Signature) { + x.OriginSignature = v +} + +func (x *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { + x.Origin = v +} + +func (x *ResponseVerificationHeader) HasBodySignature() bool { + if x == nil { + return false + } + return x.BodySignature != nil +} + +func (x *ResponseVerificationHeader) HasMetaSignature() bool { + if x == nil { + return false + } + return x.MetaSignature != nil +} + +func (x *ResponseVerificationHeader) HasOriginSignature() bool { + if x == nil { + return false + } + return x.OriginSignature != nil +} + +func (x *ResponseVerificationHeader) HasOrigin() bool { + if x == nil { + return false + } + return x.Origin != nil +} + +func (x *ResponseVerificationHeader) ClearBodySignature() { + x.BodySignature = nil +} + +func (x *ResponseVerificationHeader) ClearMetaSignature() { + x.MetaSignature = nil +} + +func (x *ResponseVerificationHeader) ClearOriginSignature() { + x.OriginSignature = nil +} + +func (x *ResponseVerificationHeader) ClearOrigin() { + x.Origin = nil +} + +type ResponseVerificationHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Response Body signature. Should be generated once by an answering node. + BodySignature *grpc.Signature + // Response Meta signature is added and signed by each intermediate node + MetaSignature *grpc.Signature + // Signature of previous hops + OriginSignature *grpc.Signature + // Chain of previous hops signatures + Origin *ResponseVerificationHeader +} + +func (b0 ResponseVerificationHeader_builder) Build() *ResponseVerificationHeader { + m0 := &ResponseVerificationHeader{} + b, x := &b0, m0 + _, _ = b, x + x.BodySignature = b.BodySignature + x.MetaSignature = b.MetaSignature + x.OriginSignature = b.OriginSignature + x.Origin = b.Origin + return m0 +} + +// Carries objects involved in the object session. +type ObjectSessionContext_Target struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Indicates which container the session is spread to. Field MUST be set + // and correct. + Container *grpc.ContainerID `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"` + // Indicates which objects the session is spread to. Objects are expected + // to be stored in the FrostFS container referenced by `container` field. + // Each element MUST have correct format. + Objects []*grpc.ObjectID `protobuf:"bytes,2,rep,name=objects" json:"objects,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectSessionContext_Target) Reset() { + *x = ObjectSessionContext_Target{} + mi := &file_api_session_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectSessionContext_Target) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectSessionContext_Target) ProtoMessage() {} + +func (x *ObjectSessionContext_Target) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ObjectSessionContext_Target) GetContainer() *grpc.ContainerID { + if x != nil { + return x.Container + } + return nil +} + +func (x *ObjectSessionContext_Target) GetObjects() []*grpc.ObjectID { + if x != nil { + return x.Objects + } + return nil +} + +func (x *ObjectSessionContext_Target) SetContainer(v *grpc.ContainerID) { + x.Container = v +} + +func (x *ObjectSessionContext_Target) SetObjects(v []*grpc.ObjectID) { + x.Objects = v +} + +func (x *ObjectSessionContext_Target) HasContainer() bool { + if x == nil { + return false + } + return x.Container != nil +} + +func (x *ObjectSessionContext_Target) ClearContainer() { + x.Container = nil +} + +type ObjectSessionContext_Target_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Indicates which container the session is spread to. Field MUST be set + // and correct. + Container *grpc.ContainerID + // Indicates which objects the session is spread to. Objects are expected + // to be stored in the FrostFS container referenced by `container` field. + // Each element MUST have correct format. + Objects []*grpc.ObjectID +} + +func (b0 ObjectSessionContext_Target_builder) Build() *ObjectSessionContext_Target { + m0 := &ObjectSessionContext_Target{} + b, x := &b0, m0 + _, _ = b, x + x.Container = b.Container + x.Objects = b.Objects + return m0 +} + +// Session Token body +type SessionToken_Body struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Token identifier is a valid UUIDv4 in binary form + Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + // Identifier of the session initiator + OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + // Lifetime of the session + Lifetime *SessionToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime" json:"lifetime,omitempty"` + // Public key used in session + SessionKey []byte `protobuf:"bytes,4,opt,name=session_key,json=sessionKey" json:"session_key,omitempty"` + // Session Context information + // + // Types that are valid to be assigned to Context: + // + // *SessionToken_Body_Object + // *SessionToken_Body_Container + Context isSessionToken_Body_Context `protobuf_oneof:"context"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionToken_Body) Reset() { + *x = SessionToken_Body{} + mi := &file_api_session_grpc_types_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionToken_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionToken_Body) ProtoMessage() {} + +func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SessionToken_Body) GetId() []byte { + if x != nil { + return x.Id + } + return nil +} + +func (x *SessionToken_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.OwnerId + } + return nil +} + +func (x *SessionToken_Body) GetLifetime() *SessionToken_Body_TokenLifetime { + if x != nil { + return x.Lifetime + } + return nil +} + +func (x *SessionToken_Body) GetSessionKey() []byte { + if x != nil { + return x.SessionKey + } + return nil +} + +func (x *SessionToken_Body) GetContext() isSessionToken_Body_Context { + if x != nil { + return x.Context + } + return nil +} + +func (x *SessionToken_Body) GetObject() *ObjectSessionContext { + if x != nil { + if x, ok := x.Context.(*SessionToken_Body_Object); ok { + return x.Object + } + } + return nil +} + +func (x *SessionToken_Body) GetContainer() *ContainerSessionContext { + if x != nil { + if x, ok := x.Context.(*SessionToken_Body_Container); ok { + return x.Container + } + } + return nil +} + +func (x *SessionToken_Body) SetId(v []byte) { + if v == nil { + v = []byte{} + } + x.Id = v +} + +func (x *SessionToken_Body) SetOwnerId(v *grpc.OwnerID) { + x.OwnerId = v +} + +func (x *SessionToken_Body) SetLifetime(v *SessionToken_Body_TokenLifetime) { + x.Lifetime = v +} + +func (x *SessionToken_Body) SetSessionKey(v []byte) { + if v == nil { + v = []byte{} + } + x.SessionKey = v +} + +func (x *SessionToken_Body) SetObject(v *ObjectSessionContext) { + if v == nil { + x.Context = nil + return + } + x.Context = &SessionToken_Body_Object{v} +} + +func (x *SessionToken_Body) SetContainer(v *ContainerSessionContext) { + if v == nil { + x.Context = nil + return + } + x.Context = &SessionToken_Body_Container{v} +} + +func (x *SessionToken_Body) HasId() bool { + if x == nil { + return false + } + return x.Id != nil +} + +func (x *SessionToken_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.OwnerId != nil +} + +func (x *SessionToken_Body) HasLifetime() bool { + if x == nil { + return false + } + return x.Lifetime != nil +} + +func (x *SessionToken_Body) HasSessionKey() bool { + if x == nil { + return false + } + return x.SessionKey != nil +} + +func (x *SessionToken_Body) HasContext() bool { + if x == nil { + return false + } + return x.Context != nil +} + +func (x *SessionToken_Body) HasObject() bool { + if x == nil { + return false + } + _, ok := x.Context.(*SessionToken_Body_Object) + return ok +} + +func (x *SessionToken_Body) HasContainer() bool { + if x == nil { + return false + } + _, ok := x.Context.(*SessionToken_Body_Container) + return ok +} + +func (x *SessionToken_Body) ClearId() { + x.Id = nil +} + +func (x *SessionToken_Body) ClearOwnerId() { + x.OwnerId = nil +} + +func (x *SessionToken_Body) ClearLifetime() { + x.Lifetime = nil +} + +func (x *SessionToken_Body) ClearSessionKey() { + x.SessionKey = nil +} + +func (x *SessionToken_Body) ClearContext() { + x.Context = nil +} + +func (x *SessionToken_Body) ClearObject() { + if _, ok := x.Context.(*SessionToken_Body_Object); ok { + x.Context = nil + } +} + +func (x *SessionToken_Body) ClearContainer() { + if _, ok := x.Context.(*SessionToken_Body_Container); ok { + x.Context = nil + } +} + +const SessionToken_Body_Context_not_set_case case_SessionToken_Body_Context = 0 +const SessionToken_Body_Object_case case_SessionToken_Body_Context = 5 +const SessionToken_Body_Container_case case_SessionToken_Body_Context = 6 + +func (x *SessionToken_Body) WhichContext() case_SessionToken_Body_Context { + if x == nil { + return SessionToken_Body_Context_not_set_case + } + switch x.Context.(type) { + case *SessionToken_Body_Object: + return SessionToken_Body_Object_case + case *SessionToken_Body_Container: + return SessionToken_Body_Container_case + default: + return SessionToken_Body_Context_not_set_case + } +} + +type SessionToken_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Token identifier is a valid UUIDv4 in binary form + Id []byte + // Identifier of the session initiator + OwnerId *grpc.OwnerID + // Lifetime of the session + Lifetime *SessionToken_Body_TokenLifetime + // Public key used in session + SessionKey []byte + // Session Context information + + // Fields of oneof Context: + // ObjectService session context + Object *ObjectSessionContext + // ContainerService session context + Container *ContainerSessionContext + // -- end of Context +} + +func (b0 SessionToken_Body_builder) Build() *SessionToken_Body { + m0 := &SessionToken_Body{} + b, x := &b0, m0 + _, _ = b, x + x.Id = b.Id + x.OwnerId = b.OwnerId + x.Lifetime = b.Lifetime + x.SessionKey = b.SessionKey + if b.Object != nil { + x.Context = &SessionToken_Body_Object{b.Object} + } + if b.Container != nil { + x.Context = &SessionToken_Body_Container{b.Container} + } + return m0 +} + +type case_SessionToken_Body_Context protoreflect.FieldNumber + +func (x case_SessionToken_Body_Context) String() string { + md := file_api_session_grpc_types_proto_msgTypes[9].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isSessionToken_Body_Context interface { + isSessionToken_Body_Context() +} + +type SessionToken_Body_Object struct { + // ObjectService session context + Object *ObjectSessionContext `protobuf:"bytes,5,opt,name=object,oneof"` +} + +type SessionToken_Body_Container struct { + // ContainerService session context + Container *ContainerSessionContext `protobuf:"bytes,6,opt,name=container,oneof"` +} + +func (*SessionToken_Body_Object) isSessionToken_Body_Context() {} + +func (*SessionToken_Body_Container) isSessionToken_Body_Context() {} + +// Lifetime parameters of the token. Field names taken from rfc7519. +type SessionToken_Body_TokenLifetime struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Expiration Epoch + Exp *uint64 `protobuf:"varint,1,opt,name=exp" json:"exp,omitempty"` + // Not valid before Epoch + Nbf *uint64 `protobuf:"varint,2,opt,name=nbf" json:"nbf,omitempty"` + // Issued at Epoch + Iat *uint64 `protobuf:"varint,3,opt,name=iat" json:"iat,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionToken_Body_TokenLifetime) Reset() { + *x = SessionToken_Body_TokenLifetime{} + mi := &file_api_session_grpc_types_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionToken_Body_TokenLifetime) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} + +func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SessionToken_Body_TokenLifetime) GetExp() uint64 { + if x != nil && x.Exp != nil { + return *x.Exp + } + return 0 +} + +func (x *SessionToken_Body_TokenLifetime) GetNbf() uint64 { + if x != nil && x.Nbf != nil { + return *x.Nbf + } + return 0 +} + +func (x *SessionToken_Body_TokenLifetime) GetIat() uint64 { + if x != nil && x.Iat != nil { + return *x.Iat + } + return 0 +} + +func (x *SessionToken_Body_TokenLifetime) SetExp(v uint64) { + x.Exp = &v +} + +func (x *SessionToken_Body_TokenLifetime) SetNbf(v uint64) { + x.Nbf = &v +} + +func (x *SessionToken_Body_TokenLifetime) SetIat(v uint64) { + x.Iat = &v +} + +func (x *SessionToken_Body_TokenLifetime) HasExp() bool { + if x == nil { + return false + } + return x.Exp != nil +} + +func (x *SessionToken_Body_TokenLifetime) HasNbf() bool { + if x == nil { + return false + } + return x.Nbf != nil +} + +func (x *SessionToken_Body_TokenLifetime) HasIat() bool { + if x == nil { + return false + } + return x.Iat != nil +} + +func (x *SessionToken_Body_TokenLifetime) ClearExp() { + x.Exp = nil +} + +func (x *SessionToken_Body_TokenLifetime) ClearNbf() { + x.Nbf = nil +} + +func (x *SessionToken_Body_TokenLifetime) ClearIat() { + x.Iat = nil +} + +type SessionToken_Body_TokenLifetime_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Expiration Epoch + Exp *uint64 + // Not valid before Epoch + Nbf *uint64 + // Issued at Epoch + Iat *uint64 +} + +func (b0 SessionToken_Body_TokenLifetime_builder) Build() *SessionToken_Body_TokenLifetime { + m0 := &SessionToken_Body_TokenLifetime{} + b, x := &b0, m0 + _, _ = b, x + x.Exp = b.Exp + x.Nbf = b.Nbf + x.Iat = b.Iat + return m0 +} + +var File_api_session_grpc_types_proto protoreflect.FileDescriptor + +var file_api_session_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x03, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, + 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x46, + 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x1a, 0x77, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x12, 0x39, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, + 0x75, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, + 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x02, 0x12, + 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, + 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, + 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, + 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x50, + 0x41, 0x54, 0x43, 0x48, 0x10, 0x08, 0x22, 0xfa, 0x01, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, + 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, + 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, + 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, + 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, + 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x54, 0x45, 0x41, 0x43, + 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x49, 0x44, 0x12, 0x4e, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, + 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x03, 0x0a, 0x11, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, + 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, + 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, + 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, + 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x99, 0x02, 0x0a, 0x12, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, + 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x42, 0x65, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1b, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_api_session_grpc_types_proto_goTypes = []any{ + (ObjectSessionContext_Verb)(0), // 0: neo.fs.v2.session.ObjectSessionContext.Verb + (ContainerSessionContext_Verb)(0), // 1: neo.fs.v2.session.ContainerSessionContext.Verb + (*ObjectSessionContext)(nil), // 2: neo.fs.v2.session.ObjectSessionContext + (*ContainerSessionContext)(nil), // 3: neo.fs.v2.session.ContainerSessionContext + (*SessionToken)(nil), // 4: neo.fs.v2.session.SessionToken + (*XHeader)(nil), // 5: neo.fs.v2.session.XHeader + (*RequestMetaHeader)(nil), // 6: neo.fs.v2.session.RequestMetaHeader + (*ResponseMetaHeader)(nil), // 7: neo.fs.v2.session.ResponseMetaHeader + (*RequestVerificationHeader)(nil), // 8: neo.fs.v2.session.RequestVerificationHeader + (*ResponseVerificationHeader)(nil), // 9: neo.fs.v2.session.ResponseVerificationHeader + (*ObjectSessionContext_Target)(nil), // 10: neo.fs.v2.session.ObjectSessionContext.Target + (*SessionToken_Body)(nil), // 11: neo.fs.v2.session.SessionToken.Body + (*SessionToken_Body_TokenLifetime)(nil), // 12: neo.fs.v2.session.SessionToken.Body.TokenLifetime + (*grpc.ContainerID)(nil), // 13: neo.fs.v2.refs.ContainerID + (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature + (*grpc.Version)(nil), // 15: neo.fs.v2.refs.Version + (*grpc1.BearerToken)(nil), // 16: neo.fs.v2.acl.BearerToken + (*grpc2.Status)(nil), // 17: neo.fs.v2.status.Status + (*grpc.ObjectID)(nil), // 18: neo.fs.v2.refs.ObjectID + (*grpc.OwnerID)(nil), // 19: neo.fs.v2.refs.OwnerID +} +var file_api_session_grpc_types_proto_depIdxs = []int32{ + 0, // 0: neo.fs.v2.session.ObjectSessionContext.verb:type_name -> neo.fs.v2.session.ObjectSessionContext.Verb + 10, // 1: neo.fs.v2.session.ObjectSessionContext.target:type_name -> neo.fs.v2.session.ObjectSessionContext.Target + 1, // 2: neo.fs.v2.session.ContainerSessionContext.verb:type_name -> neo.fs.v2.session.ContainerSessionContext.Verb + 13, // 3: neo.fs.v2.session.ContainerSessionContext.container_id:type_name -> neo.fs.v2.refs.ContainerID + 11, // 4: neo.fs.v2.session.SessionToken.body:type_name -> neo.fs.v2.session.SessionToken.Body + 14, // 5: neo.fs.v2.session.SessionToken.signature:type_name -> neo.fs.v2.refs.Signature + 15, // 6: neo.fs.v2.session.RequestMetaHeader.version:type_name -> neo.fs.v2.refs.Version + 5, // 7: neo.fs.v2.session.RequestMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader + 4, // 8: neo.fs.v2.session.RequestMetaHeader.session_token:type_name -> neo.fs.v2.session.SessionToken + 16, // 9: neo.fs.v2.session.RequestMetaHeader.bearer_token:type_name -> neo.fs.v2.acl.BearerToken + 6, // 10: neo.fs.v2.session.RequestMetaHeader.origin:type_name -> neo.fs.v2.session.RequestMetaHeader + 15, // 11: neo.fs.v2.session.ResponseMetaHeader.version:type_name -> neo.fs.v2.refs.Version + 5, // 12: neo.fs.v2.session.ResponseMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader + 7, // 13: neo.fs.v2.session.ResponseMetaHeader.origin:type_name -> neo.fs.v2.session.ResponseMetaHeader + 17, // 14: neo.fs.v2.session.ResponseMetaHeader.status:type_name -> neo.fs.v2.status.Status + 14, // 15: neo.fs.v2.session.RequestVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 16: neo.fs.v2.session.RequestVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 17: neo.fs.v2.session.RequestVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 8, // 18: neo.fs.v2.session.RequestVerificationHeader.origin:type_name -> neo.fs.v2.session.RequestVerificationHeader + 14, // 19: neo.fs.v2.session.ResponseVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 20: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 21: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 9, // 22: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 13, // 23: neo.fs.v2.session.ObjectSessionContext.Target.container:type_name -> neo.fs.v2.refs.ContainerID + 18, // 24: neo.fs.v2.session.ObjectSessionContext.Target.objects:type_name -> neo.fs.v2.refs.ObjectID + 19, // 25: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 12, // 26: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime + 2, // 27: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext + 3, // 28: neo.fs.v2.session.SessionToken.Body.container:type_name -> neo.fs.v2.session.ContainerSessionContext + 29, // [29:29] is the sub-list for method output_type + 29, // [29:29] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name +} + +func init() { file_api_session_grpc_types_proto_init() } +func file_api_session_grpc_types_proto_init() { + if File_api_session_grpc_types_proto != nil { + return + } + file_api_session_grpc_types_proto_msgTypes[9].OneofWrappers = []any{ + (*SessionToken_Body_Object)(nil), + (*SessionToken_Body_Container)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_session_grpc_types_proto_rawDesc, + NumEnums: 2, + NumMessages: 11, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_session_grpc_types_proto_goTypes, + DependencyIndexes: file_api_session_grpc_types_proto_depIdxs, + EnumInfos: file_api_session_grpc_types_proto_enumTypes, + MessageInfos: file_api_session_grpc_types_proto_msgTypes, + }.Build() + File_api_session_grpc_types_proto = out.File + file_api_session_grpc_types_proto_rawDesc = nil + file_api_session_grpc_types_proto_goTypes = nil + file_api_session_grpc_types_proto_depIdxs = nil +} diff --git a/api/session/grpc/types_protoopaque.pb.go b/api/session/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..a0085675 --- /dev/null +++ b/api/session/grpc/types_protoopaque.pb.go @@ -0,0 +1,2187 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/session/grpc/types.proto + +//go:build protoopaque + +package session + +import ( + grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc" + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + grpc2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Object request verbs +type ObjectSessionContext_Verb int32 + +const ( + // Unknown verb + ObjectSessionContext_VERB_UNSPECIFIED ObjectSessionContext_Verb = 0 + // Refers to object.Put RPC call + ObjectSessionContext_PUT ObjectSessionContext_Verb = 1 + // Refers to object.Get RPC call + ObjectSessionContext_GET ObjectSessionContext_Verb = 2 + // Refers to object.Head RPC call + ObjectSessionContext_HEAD ObjectSessionContext_Verb = 3 + // Refers to object.Search RPC call + ObjectSessionContext_SEARCH ObjectSessionContext_Verb = 4 + // Refers to object.Delete RPC call + ObjectSessionContext_DELETE ObjectSessionContext_Verb = 5 + // Refers to object.GetRange RPC call + ObjectSessionContext_RANGE ObjectSessionContext_Verb = 6 + // Refers to object.GetRangeHash RPC call + ObjectSessionContext_RANGEHASH ObjectSessionContext_Verb = 7 + // Refers to object.Patch RPC call + ObjectSessionContext_PATCH ObjectSessionContext_Verb = 8 +) + +// Enum value maps for ObjectSessionContext_Verb. +var ( + ObjectSessionContext_Verb_name = map[int32]string{ + 0: "VERB_UNSPECIFIED", + 1: "PUT", + 2: "GET", + 3: "HEAD", + 4: "SEARCH", + 5: "DELETE", + 6: "RANGE", + 7: "RANGEHASH", + 8: "PATCH", + } + ObjectSessionContext_Verb_value = map[string]int32{ + "VERB_UNSPECIFIED": 0, + "PUT": 1, + "GET": 2, + "HEAD": 3, + "SEARCH": 4, + "DELETE": 5, + "RANGE": 6, + "RANGEHASH": 7, + "PATCH": 8, + } +) + +func (x ObjectSessionContext_Verb) Enum() *ObjectSessionContext_Verb { + p := new(ObjectSessionContext_Verb) + *p = x + return p +} + +func (x ObjectSessionContext_Verb) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ObjectSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { + return file_api_session_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (ObjectSessionContext_Verb) Type() protoreflect.EnumType { + return &file_api_session_grpc_types_proto_enumTypes[0] +} + +func (x ObjectSessionContext_Verb) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Container request verbs +type ContainerSessionContext_Verb int32 + +const ( + // Unknown verb + ContainerSessionContext_VERB_UNSPECIFIED ContainerSessionContext_Verb = 0 + // Refers to container.Put RPC call + ContainerSessionContext_PUT ContainerSessionContext_Verb = 1 + // Refers to container.Delete RPC call + ContainerSessionContext_DELETE ContainerSessionContext_Verb = 2 + // Refers to container.SetExtendedACL RPC call + ContainerSessionContext_SETEACL ContainerSessionContext_Verb = 3 +) + +// Enum value maps for ContainerSessionContext_Verb. +var ( + ContainerSessionContext_Verb_name = map[int32]string{ + 0: "VERB_UNSPECIFIED", + 1: "PUT", + 2: "DELETE", + 3: "SETEACL", + } + ContainerSessionContext_Verb_value = map[string]int32{ + "VERB_UNSPECIFIED": 0, + "PUT": 1, + "DELETE": 2, + "SETEACL": 3, + } +) + +func (x ContainerSessionContext_Verb) Enum() *ContainerSessionContext_Verb { + p := new(ContainerSessionContext_Verb) + *p = x + return p +} + +func (x ContainerSessionContext_Verb) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ContainerSessionContext_Verb) Descriptor() protoreflect.EnumDescriptor { + return file_api_session_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (ContainerSessionContext_Verb) Type() protoreflect.EnumType { + return &file_api_session_grpc_types_proto_enumTypes[1] +} + +func (x ContainerSessionContext_Verb) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Context information for Session Tokens related to ObjectService requests +type ObjectSessionContext struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Verb ObjectSessionContext_Verb `protobuf:"varint,1,opt,name=verb,enum=neo.fs.v2.session.ObjectSessionContext_Verb" json:"verb,omitempty"` + xxx_hidden_Target *ObjectSessionContext_Target `protobuf:"bytes,2,opt,name=target" json:"target,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectSessionContext) Reset() { + *x = ObjectSessionContext{} + mi := &file_api_session_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectSessionContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectSessionContext) ProtoMessage() {} + +func (x *ObjectSessionContext) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ObjectSessionContext) GetVerb() ObjectSessionContext_Verb { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_Verb + } + } + return ObjectSessionContext_VERB_UNSPECIFIED +} + +func (x *ObjectSessionContext) GetTarget() *ObjectSessionContext_Target { + if x != nil { + return x.xxx_hidden_Target + } + return nil +} + +func (x *ObjectSessionContext) SetVerb(v ObjectSessionContext_Verb) { + x.xxx_hidden_Verb = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *ObjectSessionContext) SetTarget(v *ObjectSessionContext_Target) { + x.xxx_hidden_Target = v +} + +func (x *ObjectSessionContext) HasVerb() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *ObjectSessionContext) HasTarget() bool { + if x == nil { + return false + } + return x.xxx_hidden_Target != nil +} + +func (x *ObjectSessionContext) ClearVerb() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Verb = ObjectSessionContext_VERB_UNSPECIFIED +} + +func (x *ObjectSessionContext) ClearTarget() { + x.xxx_hidden_Target = nil +} + +type ObjectSessionContext_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Type of request for which the token is issued + Verb *ObjectSessionContext_Verb + // Object session target. MUST be correctly formed and set. If `objects` + // field is not empty, then the session applies only to these elements, + // otherwise, to all objects from the specified container. + Target *ObjectSessionContext_Target +} + +func (b0 ObjectSessionContext_builder) Build() *ObjectSessionContext { + m0 := &ObjectSessionContext{} + b, x := &b0, m0 + _, _ = b, x + if b.Verb != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Verb = *b.Verb + } + x.xxx_hidden_Target = b.Target + return m0 +} + +// Context information for Session Tokens related to ContainerService requests. +type ContainerSessionContext struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Verb ContainerSessionContext_Verb `protobuf:"varint,1,opt,name=verb,enum=neo.fs.v2.session.ContainerSessionContext_Verb" json:"verb,omitempty"` + xxx_hidden_Wildcard bool `protobuf:"varint,2,opt,name=wildcard" json:"wildcard,omitempty"` + xxx_hidden_ContainerId *grpc.ContainerID `protobuf:"bytes,3,opt,name=container_id,json=containerID" json:"container_id,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ContainerSessionContext) Reset() { + *x = ContainerSessionContext{} + mi := &file_api_session_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ContainerSessionContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContainerSessionContext) ProtoMessage() {} + +func (x *ContainerSessionContext) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ContainerSessionContext) GetVerb() ContainerSessionContext_Verb { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 0) { + return x.xxx_hidden_Verb + } + } + return ContainerSessionContext_VERB_UNSPECIFIED +} + +func (x *ContainerSessionContext) GetWildcard() bool { + if x != nil { + return x.xxx_hidden_Wildcard + } + return false +} + +func (x *ContainerSessionContext) GetContainerId() *grpc.ContainerID { + if x != nil { + return x.xxx_hidden_ContainerId + } + return nil +} + +func (x *ContainerSessionContext) SetVerb(v ContainerSessionContext_Verb) { + x.xxx_hidden_Verb = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *ContainerSessionContext) SetWildcard(v bool) { + x.xxx_hidden_Wildcard = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *ContainerSessionContext) SetContainerId(v *grpc.ContainerID) { + x.xxx_hidden_ContainerId = v +} + +func (x *ContainerSessionContext) HasVerb() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *ContainerSessionContext) HasWildcard() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *ContainerSessionContext) HasContainerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ContainerId != nil +} + +func (x *ContainerSessionContext) ClearVerb() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Verb = ContainerSessionContext_VERB_UNSPECIFIED +} + +func (x *ContainerSessionContext) ClearWildcard() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Wildcard = false +} + +func (x *ContainerSessionContext) ClearContainerId() { + x.xxx_hidden_ContainerId = nil +} + +type ContainerSessionContext_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Type of request for which the token is issued + Verb *ContainerSessionContext_Verb + // Spreads the action to all owner containers. + // If set, container_id field is ignored. + Wildcard *bool + // Particular container to which the action applies. + // Ignored if wildcard flag is set. + ContainerId *grpc.ContainerID +} + +func (b0 ContainerSessionContext_builder) Build() *ContainerSessionContext { + m0 := &ContainerSessionContext{} + b, x := &b0, m0 + _, _ = b, x + if b.Verb != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_Verb = *b.Verb + } + if b.Wildcard != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Wildcard = *b.Wildcard + } + x.xxx_hidden_ContainerId = b.ContainerId + return m0 +} + +// FrostFS Session Token. +type SessionToken struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Body *SessionToken_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + xxx_hidden_Signature *grpc.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionToken) Reset() { + *x = SessionToken{} + mi := &file_api_session_grpc_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionToken) ProtoMessage() {} + +func (x *SessionToken) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SessionToken) GetBody() *SessionToken_Body { + if x != nil { + return x.xxx_hidden_Body + } + return nil +} + +func (x *SessionToken) GetSignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_Signature + } + return nil +} + +func (x *SessionToken) SetBody(v *SessionToken_Body) { + x.xxx_hidden_Body = v +} + +func (x *SessionToken) SetSignature(v *grpc.Signature) { + x.xxx_hidden_Signature = v +} + +func (x *SessionToken) HasBody() bool { + if x == nil { + return false + } + return x.xxx_hidden_Body != nil +} + +func (x *SessionToken) HasSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_Signature != nil +} + +func (x *SessionToken) ClearBody() { + x.xxx_hidden_Body = nil +} + +func (x *SessionToken) ClearSignature() { + x.xxx_hidden_Signature = nil +} + +type SessionToken_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Session Token contains the proof of trust between peers to be attached in + // requests for further verification. Please see corresponding section of + // FrostFS Technical Specification for details. + Body *SessionToken_Body + // Signature of `SessionToken` information + Signature *grpc.Signature +} + +func (b0 SessionToken_builder) Build() *SessionToken { + m0 := &SessionToken{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Body = b.Body + x.xxx_hidden_Signature = b.Signature + return m0 +} + +// Extended headers for Request/Response. They may contain any user-defined +// headers to be interpreted on application level. +// +// Key name must be a unique valid UTF-8 string. Value can't be empty. Requests +// or Responses with duplicated header names or headers with empty values will +// be considered invalid. +// +// There are some "well-known" headers starting with `__SYSTEM__` (`__NEOFS__` +// is deprecated) prefix that affect system behaviour: +// +// - [ __SYSTEM__NETMAP_EPOCH ] \ +// (`__NEOFS__NETMAP_EPOCH` is deprecated) \ +// Netmap epoch to use for object placement calculation. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, the +// current epoch only will be used. +// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \ +// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \ +// If object can't be found using current epoch's netmap, this header limits +// how many past epochs the node can look up through. The `value` is string +// encoded `uint64` in decimal presentation. If set to '0' or not set, only +// the current epoch will be used. +type XHeader struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + xxx_hidden_Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *XHeader) Reset() { + *x = XHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *XHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*XHeader) ProtoMessage() {} + +func (x *XHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *XHeader) GetKey() string { + if x != nil { + if x.xxx_hidden_Key != nil { + return *x.xxx_hidden_Key + } + return "" + } + return "" +} + +func (x *XHeader) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *XHeader) SetKey(v string) { + x.xxx_hidden_Key = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *XHeader) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *XHeader) HasKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *XHeader) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *XHeader) ClearKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Key = nil +} + +func (x *XHeader) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Value = nil +} + +type XHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Key of the X-Header + Key *string + // Value of the X-Header + Value *string +} + +func (b0 XHeader_builder) Build() *XHeader { + m0 := &XHeader{} + b, x := &b0, m0 + _, _ = b, x + if b.Key != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Key = b.Key + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Meta information attached to the request. When forwarded between peers, +// request meta headers are folded in matryoshka style. +type RequestMetaHeader struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + xxx_hidden_Epoch uint64 `protobuf:"varint,2,opt,name=epoch" json:"epoch,omitempty"` + xxx_hidden_Ttl uint32 `protobuf:"varint,3,opt,name=ttl" json:"ttl,omitempty"` + xxx_hidden_XHeaders *[]*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders" json:"x_headers,omitempty"` + xxx_hidden_SessionToken *SessionToken `protobuf:"bytes,5,opt,name=session_token,json=sessionToken" json:"session_token,omitempty"` + xxx_hidden_BearerToken *grpc1.BearerToken `protobuf:"bytes,6,opt,name=bearer_token,json=bearerToken" json:"bearer_token,omitempty"` + xxx_hidden_Origin *RequestMetaHeader `protobuf:"bytes,7,opt,name=origin" json:"origin,omitempty"` + xxx_hidden_MagicNumber uint64 `protobuf:"varint,8,opt,name=magic_number,json=magicNumber" json:"magic_number,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RequestMetaHeader) Reset() { + *x = RequestMetaHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RequestMetaHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestMetaHeader) ProtoMessage() {} + +func (x *RequestMetaHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RequestMetaHeader) GetVersion() *grpc.Version { + if x != nil { + return x.xxx_hidden_Version + } + return nil +} + +func (x *RequestMetaHeader) GetEpoch() uint64 { + if x != nil { + return x.xxx_hidden_Epoch + } + return 0 +} + +func (x *RequestMetaHeader) GetTtl() uint32 { + if x != nil { + return x.xxx_hidden_Ttl + } + return 0 +} + +func (x *RequestMetaHeader) GetXHeaders() []*XHeader { + if x != nil { + if x.xxx_hidden_XHeaders != nil { + return *x.xxx_hidden_XHeaders + } + } + return nil +} + +func (x *RequestMetaHeader) GetSessionToken() *SessionToken { + if x != nil { + return x.xxx_hidden_SessionToken + } + return nil +} + +func (x *RequestMetaHeader) GetBearerToken() *grpc1.BearerToken { + if x != nil { + return x.xxx_hidden_BearerToken + } + return nil +} + +func (x *RequestMetaHeader) GetOrigin() *RequestMetaHeader { + if x != nil { + return x.xxx_hidden_Origin + } + return nil +} + +func (x *RequestMetaHeader) GetMagicNumber() uint64 { + if x != nil { + return x.xxx_hidden_MagicNumber + } + return 0 +} + +func (x *RequestMetaHeader) SetVersion(v *grpc.Version) { + x.xxx_hidden_Version = v +} + +func (x *RequestMetaHeader) SetEpoch(v uint64) { + x.xxx_hidden_Epoch = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 8) +} + +func (x *RequestMetaHeader) SetTtl(v uint32) { + x.xxx_hidden_Ttl = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 8) +} + +func (x *RequestMetaHeader) SetXHeaders(v []*XHeader) { + x.xxx_hidden_XHeaders = &v +} + +func (x *RequestMetaHeader) SetSessionToken(v *SessionToken) { + x.xxx_hidden_SessionToken = v +} + +func (x *RequestMetaHeader) SetBearerToken(v *grpc1.BearerToken) { + x.xxx_hidden_BearerToken = v +} + +func (x *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { + x.xxx_hidden_Origin = v +} + +func (x *RequestMetaHeader) SetMagicNumber(v uint64) { + x.xxx_hidden_MagicNumber = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 7, 8) +} + +func (x *RequestMetaHeader) HasVersion() bool { + if x == nil { + return false + } + return x.xxx_hidden_Version != nil +} + +func (x *RequestMetaHeader) HasEpoch() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *RequestMetaHeader) HasTtl() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *RequestMetaHeader) HasSessionToken() bool { + if x == nil { + return false + } + return x.xxx_hidden_SessionToken != nil +} + +func (x *RequestMetaHeader) HasBearerToken() bool { + if x == nil { + return false + } + return x.xxx_hidden_BearerToken != nil +} + +func (x *RequestMetaHeader) HasOrigin() bool { + if x == nil { + return false + } + return x.xxx_hidden_Origin != nil +} + +func (x *RequestMetaHeader) HasMagicNumber() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 7) +} + +func (x *RequestMetaHeader) ClearVersion() { + x.xxx_hidden_Version = nil +} + +func (x *RequestMetaHeader) ClearEpoch() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Epoch = 0 +} + +func (x *RequestMetaHeader) ClearTtl() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Ttl = 0 +} + +func (x *RequestMetaHeader) ClearSessionToken() { + x.xxx_hidden_SessionToken = nil +} + +func (x *RequestMetaHeader) ClearBearerToken() { + x.xxx_hidden_BearerToken = nil +} + +func (x *RequestMetaHeader) ClearOrigin() { + x.xxx_hidden_Origin = nil +} + +func (x *RequestMetaHeader) ClearMagicNumber() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 7) + x.xxx_hidden_MagicNumber = 0 +} + +type RequestMetaHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Peer's API version used + Version *grpc.Version + // Peer's local epoch number. Set to 0 if unknown. + Epoch *uint64 + // Maximum number of intermediate nodes in the request route + Ttl *uint32 + // Request X-Headers + XHeaders []*XHeader + // Session token within which the request is sent + SessionToken *SessionToken + // `BearerToken` with eACL overrides for the request + BearerToken *grpc1.BearerToken + // `RequestMetaHeader` of the origin request + Origin *RequestMetaHeader + // FrostFS network magic. Must match the value for the network + // that the server belongs to. + MagicNumber *uint64 +} + +func (b0 RequestMetaHeader_builder) Build() *RequestMetaHeader { + m0 := &RequestMetaHeader{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Version = b.Version + if b.Epoch != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 8) + x.xxx_hidden_Epoch = *b.Epoch + } + if b.Ttl != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 8) + x.xxx_hidden_Ttl = *b.Ttl + } + x.xxx_hidden_XHeaders = &b.XHeaders + x.xxx_hidden_SessionToken = b.SessionToken + x.xxx_hidden_BearerToken = b.BearerToken + x.xxx_hidden_Origin = b.Origin + if b.MagicNumber != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 7, 8) + x.xxx_hidden_MagicNumber = *b.MagicNumber + } + return m0 +} + +// Information about the response +type ResponseMetaHeader struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + xxx_hidden_Epoch uint64 `protobuf:"varint,2,opt,name=epoch" json:"epoch,omitempty"` + xxx_hidden_Ttl uint32 `protobuf:"varint,3,opt,name=ttl" json:"ttl,omitempty"` + xxx_hidden_XHeaders *[]*XHeader `protobuf:"bytes,4,rep,name=x_headers,json=xHeaders" json:"x_headers,omitempty"` + xxx_hidden_Origin *ResponseMetaHeader `protobuf:"bytes,5,opt,name=origin" json:"origin,omitempty"` + xxx_hidden_Status *grpc2.Status `protobuf:"bytes,6,opt,name=status" json:"status,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResponseMetaHeader) Reset() { + *x = ResponseMetaHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResponseMetaHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseMetaHeader) ProtoMessage() {} + +func (x *ResponseMetaHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResponseMetaHeader) GetVersion() *grpc.Version { + if x != nil { + return x.xxx_hidden_Version + } + return nil +} + +func (x *ResponseMetaHeader) GetEpoch() uint64 { + if x != nil { + return x.xxx_hidden_Epoch + } + return 0 +} + +func (x *ResponseMetaHeader) GetTtl() uint32 { + if x != nil { + return x.xxx_hidden_Ttl + } + return 0 +} + +func (x *ResponseMetaHeader) GetXHeaders() []*XHeader { + if x != nil { + if x.xxx_hidden_XHeaders != nil { + return *x.xxx_hidden_XHeaders + } + } + return nil +} + +func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { + if x != nil { + return x.xxx_hidden_Origin + } + return nil +} + +func (x *ResponseMetaHeader) GetStatus() *grpc2.Status { + if x != nil { + return x.xxx_hidden_Status + } + return nil +} + +func (x *ResponseMetaHeader) SetVersion(v *grpc.Version) { + x.xxx_hidden_Version = v +} + +func (x *ResponseMetaHeader) SetEpoch(v uint64) { + x.xxx_hidden_Epoch = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 6) +} + +func (x *ResponseMetaHeader) SetTtl(v uint32) { + x.xxx_hidden_Ttl = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 6) +} + +func (x *ResponseMetaHeader) SetXHeaders(v []*XHeader) { + x.xxx_hidden_XHeaders = &v +} + +func (x *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { + x.xxx_hidden_Origin = v +} + +func (x *ResponseMetaHeader) SetStatus(v *grpc2.Status) { + x.xxx_hidden_Status = v +} + +func (x *ResponseMetaHeader) HasVersion() bool { + if x == nil { + return false + } + return x.xxx_hidden_Version != nil +} + +func (x *ResponseMetaHeader) HasEpoch() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *ResponseMetaHeader) HasTtl() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *ResponseMetaHeader) HasOrigin() bool { + if x == nil { + return false + } + return x.xxx_hidden_Origin != nil +} + +func (x *ResponseMetaHeader) HasStatus() bool { + if x == nil { + return false + } + return x.xxx_hidden_Status != nil +} + +func (x *ResponseMetaHeader) ClearVersion() { + x.xxx_hidden_Version = nil +} + +func (x *ResponseMetaHeader) ClearEpoch() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Epoch = 0 +} + +func (x *ResponseMetaHeader) ClearTtl() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Ttl = 0 +} + +func (x *ResponseMetaHeader) ClearOrigin() { + x.xxx_hidden_Origin = nil +} + +func (x *ResponseMetaHeader) ClearStatus() { + x.xxx_hidden_Status = nil +} + +type ResponseMetaHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Peer's API version used + Version *grpc.Version + // Peer's local epoch number + Epoch *uint64 + // Maximum number of intermediate nodes in the request route + Ttl *uint32 + // Response X-Headers + XHeaders []*XHeader + // `ResponseMetaHeader` of the origin request + Origin *ResponseMetaHeader + // Status return + Status *grpc2.Status +} + +func (b0 ResponseMetaHeader_builder) Build() *ResponseMetaHeader { + m0 := &ResponseMetaHeader{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Version = b.Version + if b.Epoch != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 6) + x.xxx_hidden_Epoch = *b.Epoch + } + if b.Ttl != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 6) + x.xxx_hidden_Ttl = *b.Ttl + } + x.xxx_hidden_XHeaders = &b.XHeaders + x.xxx_hidden_Origin = b.Origin + x.xxx_hidden_Status = b.Status + return m0 +} + +// Verification info for the request signed by all intermediate nodes. +type RequestVerificationHeader struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature" json:"body_signature,omitempty"` + xxx_hidden_MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature" json:"meta_signature,omitempty"` + xxx_hidden_OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature" json:"origin_signature,omitempty"` + xxx_hidden_Origin *RequestVerificationHeader `protobuf:"bytes,4,opt,name=origin" json:"origin,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RequestVerificationHeader) Reset() { + *x = RequestVerificationHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RequestVerificationHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestVerificationHeader) ProtoMessage() {} + +func (x *RequestVerificationHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RequestVerificationHeader) GetBodySignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_BodySignature + } + return nil +} + +func (x *RequestVerificationHeader) GetMetaSignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_MetaSignature + } + return nil +} + +func (x *RequestVerificationHeader) GetOriginSignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_OriginSignature + } + return nil +} + +func (x *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if x != nil { + return x.xxx_hidden_Origin + } + return nil +} + +func (x *RequestVerificationHeader) SetBodySignature(v *grpc.Signature) { + x.xxx_hidden_BodySignature = v +} + +func (x *RequestVerificationHeader) SetMetaSignature(v *grpc.Signature) { + x.xxx_hidden_MetaSignature = v +} + +func (x *RequestVerificationHeader) SetOriginSignature(v *grpc.Signature) { + x.xxx_hidden_OriginSignature = v +} + +func (x *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { + x.xxx_hidden_Origin = v +} + +func (x *RequestVerificationHeader) HasBodySignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_BodySignature != nil +} + +func (x *RequestVerificationHeader) HasMetaSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaSignature != nil +} + +func (x *RequestVerificationHeader) HasOriginSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_OriginSignature != nil +} + +func (x *RequestVerificationHeader) HasOrigin() bool { + if x == nil { + return false + } + return x.xxx_hidden_Origin != nil +} + +func (x *RequestVerificationHeader) ClearBodySignature() { + x.xxx_hidden_BodySignature = nil +} + +func (x *RequestVerificationHeader) ClearMetaSignature() { + x.xxx_hidden_MetaSignature = nil +} + +func (x *RequestVerificationHeader) ClearOriginSignature() { + x.xxx_hidden_OriginSignature = nil +} + +func (x *RequestVerificationHeader) ClearOrigin() { + x.xxx_hidden_Origin = nil +} + +type RequestVerificationHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Request Body signature. Should be generated once by the request initiator. + BodySignature *grpc.Signature + // Request Meta signature is added and signed by each intermediate node + MetaSignature *grpc.Signature + // Signature of previous hops + OriginSignature *grpc.Signature + // Chain of previous hops signatures + Origin *RequestVerificationHeader +} + +func (b0 RequestVerificationHeader_builder) Build() *RequestVerificationHeader { + m0 := &RequestVerificationHeader{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_BodySignature = b.BodySignature + x.xxx_hidden_MetaSignature = b.MetaSignature + x.xxx_hidden_OriginSignature = b.OriginSignature + x.xxx_hidden_Origin = b.Origin + return m0 +} + +// Verification info for the response signed by all intermediate nodes +type ResponseVerificationHeader struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_BodySignature *grpc.Signature `protobuf:"bytes,1,opt,name=body_signature,json=bodySignature" json:"body_signature,omitempty"` + xxx_hidden_MetaSignature *grpc.Signature `protobuf:"bytes,2,opt,name=meta_signature,json=metaSignature" json:"meta_signature,omitempty"` + xxx_hidden_OriginSignature *grpc.Signature `protobuf:"bytes,3,opt,name=origin_signature,json=originSignature" json:"origin_signature,omitempty"` + xxx_hidden_Origin *ResponseVerificationHeader `protobuf:"bytes,4,opt,name=origin" json:"origin,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResponseVerificationHeader) Reset() { + *x = ResponseVerificationHeader{} + mi := &file_api_session_grpc_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResponseVerificationHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseVerificationHeader) ProtoMessage() {} + +func (x *ResponseVerificationHeader) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResponseVerificationHeader) GetBodySignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_BodySignature + } + return nil +} + +func (x *ResponseVerificationHeader) GetMetaSignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_MetaSignature + } + return nil +} + +func (x *ResponseVerificationHeader) GetOriginSignature() *grpc.Signature { + if x != nil { + return x.xxx_hidden_OriginSignature + } + return nil +} + +func (x *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if x != nil { + return x.xxx_hidden_Origin + } + return nil +} + +func (x *ResponseVerificationHeader) SetBodySignature(v *grpc.Signature) { + x.xxx_hidden_BodySignature = v +} + +func (x *ResponseVerificationHeader) SetMetaSignature(v *grpc.Signature) { + x.xxx_hidden_MetaSignature = v +} + +func (x *ResponseVerificationHeader) SetOriginSignature(v *grpc.Signature) { + x.xxx_hidden_OriginSignature = v +} + +func (x *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { + x.xxx_hidden_Origin = v +} + +func (x *ResponseVerificationHeader) HasBodySignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_BodySignature != nil +} + +func (x *ResponseVerificationHeader) HasMetaSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_MetaSignature != nil +} + +func (x *ResponseVerificationHeader) HasOriginSignature() bool { + if x == nil { + return false + } + return x.xxx_hidden_OriginSignature != nil +} + +func (x *ResponseVerificationHeader) HasOrigin() bool { + if x == nil { + return false + } + return x.xxx_hidden_Origin != nil +} + +func (x *ResponseVerificationHeader) ClearBodySignature() { + x.xxx_hidden_BodySignature = nil +} + +func (x *ResponseVerificationHeader) ClearMetaSignature() { + x.xxx_hidden_MetaSignature = nil +} + +func (x *ResponseVerificationHeader) ClearOriginSignature() { + x.xxx_hidden_OriginSignature = nil +} + +func (x *ResponseVerificationHeader) ClearOrigin() { + x.xxx_hidden_Origin = nil +} + +type ResponseVerificationHeader_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Response Body signature. Should be generated once by an answering node. + BodySignature *grpc.Signature + // Response Meta signature is added and signed by each intermediate node + MetaSignature *grpc.Signature + // Signature of previous hops + OriginSignature *grpc.Signature + // Chain of previous hops signatures + Origin *ResponseVerificationHeader +} + +func (b0 ResponseVerificationHeader_builder) Build() *ResponseVerificationHeader { + m0 := &ResponseVerificationHeader{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_BodySignature = b.BodySignature + x.xxx_hidden_MetaSignature = b.MetaSignature + x.xxx_hidden_OriginSignature = b.OriginSignature + x.xxx_hidden_Origin = b.Origin + return m0 +} + +// Carries objects involved in the object session. +type ObjectSessionContext_Target struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Container *grpc.ContainerID `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"` + xxx_hidden_Objects *[]*grpc.ObjectID `protobuf:"bytes,2,rep,name=objects" json:"objects,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectSessionContext_Target) Reset() { + *x = ObjectSessionContext_Target{} + mi := &file_api_session_grpc_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectSessionContext_Target) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectSessionContext_Target) ProtoMessage() {} + +func (x *ObjectSessionContext_Target) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ObjectSessionContext_Target) GetContainer() *grpc.ContainerID { + if x != nil { + return x.xxx_hidden_Container + } + return nil +} + +func (x *ObjectSessionContext_Target) GetObjects() []*grpc.ObjectID { + if x != nil { + if x.xxx_hidden_Objects != nil { + return *x.xxx_hidden_Objects + } + } + return nil +} + +func (x *ObjectSessionContext_Target) SetContainer(v *grpc.ContainerID) { + x.xxx_hidden_Container = v +} + +func (x *ObjectSessionContext_Target) SetObjects(v []*grpc.ObjectID) { + x.xxx_hidden_Objects = &v +} + +func (x *ObjectSessionContext_Target) HasContainer() bool { + if x == nil { + return false + } + return x.xxx_hidden_Container != nil +} + +func (x *ObjectSessionContext_Target) ClearContainer() { + x.xxx_hidden_Container = nil +} + +type ObjectSessionContext_Target_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Indicates which container the session is spread to. Field MUST be set + // and correct. + Container *grpc.ContainerID + // Indicates which objects the session is spread to. Objects are expected + // to be stored in the FrostFS container referenced by `container` field. + // Each element MUST have correct format. + Objects []*grpc.ObjectID +} + +func (b0 ObjectSessionContext_Target_builder) Build() *ObjectSessionContext_Target { + m0 := &ObjectSessionContext_Target{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Container = b.Container + x.xxx_hidden_Objects = &b.Objects + return m0 +} + +// Session Token body +type SessionToken_Body struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + xxx_hidden_OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"` + xxx_hidden_Lifetime *SessionToken_Body_TokenLifetime `protobuf:"bytes,3,opt,name=lifetime" json:"lifetime,omitempty"` + xxx_hidden_SessionKey []byte `protobuf:"bytes,4,opt,name=session_key,json=sessionKey" json:"session_key,omitempty"` + xxx_hidden_Context isSessionToken_Body_Context `protobuf_oneof:"context"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionToken_Body) Reset() { + *x = SessionToken_Body{} + mi := &file_api_session_grpc_types_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionToken_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionToken_Body) ProtoMessage() {} + +func (x *SessionToken_Body) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SessionToken_Body) GetId() []byte { + if x != nil { + return x.xxx_hidden_Id + } + return nil +} + +func (x *SessionToken_Body) GetOwnerId() *grpc.OwnerID { + if x != nil { + return x.xxx_hidden_OwnerId + } + return nil +} + +func (x *SessionToken_Body) GetLifetime() *SessionToken_Body_TokenLifetime { + if x != nil { + return x.xxx_hidden_Lifetime + } + return nil +} + +func (x *SessionToken_Body) GetSessionKey() []byte { + if x != nil { + return x.xxx_hidden_SessionKey + } + return nil +} + +func (x *SessionToken_Body) GetObject() *ObjectSessionContext { + if x != nil { + if x, ok := x.xxx_hidden_Context.(*sessionToken_Body_Object); ok { + return x.Object + } + } + return nil +} + +func (x *SessionToken_Body) GetContainer() *ContainerSessionContext { + if x != nil { + if x, ok := x.xxx_hidden_Context.(*sessionToken_Body_Container); ok { + return x.Container + } + } + return nil +} + +func (x *SessionToken_Body) SetId(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Id = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 5) +} + +func (x *SessionToken_Body) SetOwnerId(v *grpc.OwnerID) { + x.xxx_hidden_OwnerId = v +} + +func (x *SessionToken_Body) SetLifetime(v *SessionToken_Body_TokenLifetime) { + x.xxx_hidden_Lifetime = v +} + +func (x *SessionToken_Body) SetSessionKey(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_SessionKey = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 5) +} + +func (x *SessionToken_Body) SetObject(v *ObjectSessionContext) { + if v == nil { + x.xxx_hidden_Context = nil + return + } + x.xxx_hidden_Context = &sessionToken_Body_Object{v} +} + +func (x *SessionToken_Body) SetContainer(v *ContainerSessionContext) { + if v == nil { + x.xxx_hidden_Context = nil + return + } + x.xxx_hidden_Context = &sessionToken_Body_Container{v} +} + +func (x *SessionToken_Body) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *SessionToken_Body) HasOwnerId() bool { + if x == nil { + return false + } + return x.xxx_hidden_OwnerId != nil +} + +func (x *SessionToken_Body) HasLifetime() bool { + if x == nil { + return false + } + return x.xxx_hidden_Lifetime != nil +} + +func (x *SessionToken_Body) HasSessionKey() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *SessionToken_Body) HasContext() bool { + if x == nil { + return false + } + return x.xxx_hidden_Context != nil +} + +func (x *SessionToken_Body) HasObject() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Context.(*sessionToken_Body_Object) + return ok +} + +func (x *SessionToken_Body) HasContainer() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Context.(*sessionToken_Body_Container) + return ok +} + +func (x *SessionToken_Body) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = nil +} + +func (x *SessionToken_Body) ClearOwnerId() { + x.xxx_hidden_OwnerId = nil +} + +func (x *SessionToken_Body) ClearLifetime() { + x.xxx_hidden_Lifetime = nil +} + +func (x *SessionToken_Body) ClearSessionKey() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_SessionKey = nil +} + +func (x *SessionToken_Body) ClearContext() { + x.xxx_hidden_Context = nil +} + +func (x *SessionToken_Body) ClearObject() { + if _, ok := x.xxx_hidden_Context.(*sessionToken_Body_Object); ok { + x.xxx_hidden_Context = nil + } +} + +func (x *SessionToken_Body) ClearContainer() { + if _, ok := x.xxx_hidden_Context.(*sessionToken_Body_Container); ok { + x.xxx_hidden_Context = nil + } +} + +const SessionToken_Body_Context_not_set_case case_SessionToken_Body_Context = 0 +const SessionToken_Body_Object_case case_SessionToken_Body_Context = 5 +const SessionToken_Body_Container_case case_SessionToken_Body_Context = 6 + +func (x *SessionToken_Body) WhichContext() case_SessionToken_Body_Context { + if x == nil { + return SessionToken_Body_Context_not_set_case + } + switch x.xxx_hidden_Context.(type) { + case *sessionToken_Body_Object: + return SessionToken_Body_Object_case + case *sessionToken_Body_Container: + return SessionToken_Body_Container_case + default: + return SessionToken_Body_Context_not_set_case + } +} + +type SessionToken_Body_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Token identifier is a valid UUIDv4 in binary form + Id []byte + // Identifier of the session initiator + OwnerId *grpc.OwnerID + // Lifetime of the session + Lifetime *SessionToken_Body_TokenLifetime + // Public key used in session + SessionKey []byte + // Session Context information + + // Fields of oneof xxx_hidden_Context: + // ObjectService session context + Object *ObjectSessionContext + // ContainerService session context + Container *ContainerSessionContext + // -- end of xxx_hidden_Context +} + +func (b0 SessionToken_Body_builder) Build() *SessionToken_Body { + m0 := &SessionToken_Body{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 5) + x.xxx_hidden_Id = b.Id + } + x.xxx_hidden_OwnerId = b.OwnerId + x.xxx_hidden_Lifetime = b.Lifetime + if b.SessionKey != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 5) + x.xxx_hidden_SessionKey = b.SessionKey + } + if b.Object != nil { + x.xxx_hidden_Context = &sessionToken_Body_Object{b.Object} + } + if b.Container != nil { + x.xxx_hidden_Context = &sessionToken_Body_Container{b.Container} + } + return m0 +} + +type case_SessionToken_Body_Context protoreflect.FieldNumber + +func (x case_SessionToken_Body_Context) String() string { + md := file_api_session_grpc_types_proto_msgTypes[9].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isSessionToken_Body_Context interface { + isSessionToken_Body_Context() +} + +type sessionToken_Body_Object struct { + // ObjectService session context + Object *ObjectSessionContext `protobuf:"bytes,5,opt,name=object,oneof"` +} + +type sessionToken_Body_Container struct { + // ContainerService session context + Container *ContainerSessionContext `protobuf:"bytes,6,opt,name=container,oneof"` +} + +func (*sessionToken_Body_Object) isSessionToken_Body_Context() {} + +func (*sessionToken_Body_Container) isSessionToken_Body_Context() {} + +// Lifetime parameters of the token. Field names taken from rfc7519. +type SessionToken_Body_TokenLifetime struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Exp uint64 `protobuf:"varint,1,opt,name=exp" json:"exp,omitempty"` + xxx_hidden_Nbf uint64 `protobuf:"varint,2,opt,name=nbf" json:"nbf,omitempty"` + xxx_hidden_Iat uint64 `protobuf:"varint,3,opt,name=iat" json:"iat,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionToken_Body_TokenLifetime) Reset() { + *x = SessionToken_Body_TokenLifetime{} + mi := &file_api_session_grpc_types_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionToken_Body_TokenLifetime) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionToken_Body_TokenLifetime) ProtoMessage() {} + +func (x *SessionToken_Body_TokenLifetime) ProtoReflect() protoreflect.Message { + mi := &file_api_session_grpc_types_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SessionToken_Body_TokenLifetime) GetExp() uint64 { + if x != nil { + return x.xxx_hidden_Exp + } + return 0 +} + +func (x *SessionToken_Body_TokenLifetime) GetNbf() uint64 { + if x != nil { + return x.xxx_hidden_Nbf + } + return 0 +} + +func (x *SessionToken_Body_TokenLifetime) GetIat() uint64 { + if x != nil { + return x.xxx_hidden_Iat + } + return 0 +} + +func (x *SessionToken_Body_TokenLifetime) SetExp(v uint64) { + x.xxx_hidden_Exp = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *SessionToken_Body_TokenLifetime) SetNbf(v uint64) { + x.xxx_hidden_Nbf = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *SessionToken_Body_TokenLifetime) SetIat(v uint64) { + x.xxx_hidden_Iat = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *SessionToken_Body_TokenLifetime) HasExp() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *SessionToken_Body_TokenLifetime) HasNbf() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *SessionToken_Body_TokenLifetime) HasIat() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *SessionToken_Body_TokenLifetime) ClearExp() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Exp = 0 +} + +func (x *SessionToken_Body_TokenLifetime) ClearNbf() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Nbf = 0 +} + +func (x *SessionToken_Body_TokenLifetime) ClearIat() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Iat = 0 +} + +type SessionToken_Body_TokenLifetime_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Expiration Epoch + Exp *uint64 + // Not valid before Epoch + Nbf *uint64 + // Issued at Epoch + Iat *uint64 +} + +func (b0 SessionToken_Body_TokenLifetime_builder) Build() *SessionToken_Body_TokenLifetime { + m0 := &SessionToken_Body_TokenLifetime{} + b, x := &b0, m0 + _, _ = b, x + if b.Exp != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_Exp = *b.Exp + } + if b.Nbf != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Nbf = *b.Nbf + } + if b.Iat != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Iat = *b.Iat + } + return m0 +} + +var File_api_session_grpc_types_proto protoreflect.FileDescriptor + +var file_api_session_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, + 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x63, 0x6c, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x03, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x40, 0x0a, 0x04, + 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x46, + 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x1a, 0x77, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x12, 0x39, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, + 0x75, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x45, 0x52, 0x42, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, + 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x02, 0x12, + 0x08, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x45, 0x41, + 0x52, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, + 0x05, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, + 0x52, 0x41, 0x4e, 0x47, 0x45, 0x48, 0x41, 0x53, 0x48, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x50, + 0x41, 0x54, 0x43, 0x48, 0x10, 0x08, 0x22, 0xfa, 0x01, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x78, 0x74, 0x12, 0x43, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x56, 0x65, 0x72, + 0x62, 0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, + 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x77, 0x69, 0x6c, 0x64, 0x63, + 0x61, 0x72, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x04, 0x56, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x10, 0x56, + 0x45, 0x52, 0x42, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x55, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, + 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x54, 0x45, 0x41, 0x43, + 0x4c, 0x10, 0x03, 0x22, 0xa0, 0x04, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x9c, 0x03, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, + 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x49, 0x44, 0x12, 0x4e, 0x0a, 0x08, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x08, 0x6c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, + 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x45, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x69, 0x66, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x62, 0x66, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6e, 0x62, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x61, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x03, 0x0a, 0x11, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, 0x62, 0x65, 0x61, + 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x6c, 0x2e, + 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0b, 0x62, 0x65, 0x61, + 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3c, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, + 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x99, 0x02, 0x0a, 0x12, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x78, + 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x58, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x08, 0x78, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xab, 0x02, 0x0a, 0x19, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, + 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, + 0x6e, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, + 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x22, 0xad, 0x02, 0x0a, 0x1a, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0e, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, + 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x62, 0x6f, 0x64, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, + 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x45, 0x0a, 0x06, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x6f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x42, 0x65, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1b, 0x4e, + 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, + 0x50, 0x49, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_session_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_session_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_api_session_grpc_types_proto_goTypes = []any{ + (ObjectSessionContext_Verb)(0), // 0: neo.fs.v2.session.ObjectSessionContext.Verb + (ContainerSessionContext_Verb)(0), // 1: neo.fs.v2.session.ContainerSessionContext.Verb + (*ObjectSessionContext)(nil), // 2: neo.fs.v2.session.ObjectSessionContext + (*ContainerSessionContext)(nil), // 3: neo.fs.v2.session.ContainerSessionContext + (*SessionToken)(nil), // 4: neo.fs.v2.session.SessionToken + (*XHeader)(nil), // 5: neo.fs.v2.session.XHeader + (*RequestMetaHeader)(nil), // 6: neo.fs.v2.session.RequestMetaHeader + (*ResponseMetaHeader)(nil), // 7: neo.fs.v2.session.ResponseMetaHeader + (*RequestVerificationHeader)(nil), // 8: neo.fs.v2.session.RequestVerificationHeader + (*ResponseVerificationHeader)(nil), // 9: neo.fs.v2.session.ResponseVerificationHeader + (*ObjectSessionContext_Target)(nil), // 10: neo.fs.v2.session.ObjectSessionContext.Target + (*SessionToken_Body)(nil), // 11: neo.fs.v2.session.SessionToken.Body + (*SessionToken_Body_TokenLifetime)(nil), // 12: neo.fs.v2.session.SessionToken.Body.TokenLifetime + (*grpc.ContainerID)(nil), // 13: neo.fs.v2.refs.ContainerID + (*grpc.Signature)(nil), // 14: neo.fs.v2.refs.Signature + (*grpc.Version)(nil), // 15: neo.fs.v2.refs.Version + (*grpc1.BearerToken)(nil), // 16: neo.fs.v2.acl.BearerToken + (*grpc2.Status)(nil), // 17: neo.fs.v2.status.Status + (*grpc.ObjectID)(nil), // 18: neo.fs.v2.refs.ObjectID + (*grpc.OwnerID)(nil), // 19: neo.fs.v2.refs.OwnerID +} +var file_api_session_grpc_types_proto_depIdxs = []int32{ + 0, // 0: neo.fs.v2.session.ObjectSessionContext.verb:type_name -> neo.fs.v2.session.ObjectSessionContext.Verb + 10, // 1: neo.fs.v2.session.ObjectSessionContext.target:type_name -> neo.fs.v2.session.ObjectSessionContext.Target + 1, // 2: neo.fs.v2.session.ContainerSessionContext.verb:type_name -> neo.fs.v2.session.ContainerSessionContext.Verb + 13, // 3: neo.fs.v2.session.ContainerSessionContext.container_id:type_name -> neo.fs.v2.refs.ContainerID + 11, // 4: neo.fs.v2.session.SessionToken.body:type_name -> neo.fs.v2.session.SessionToken.Body + 14, // 5: neo.fs.v2.session.SessionToken.signature:type_name -> neo.fs.v2.refs.Signature + 15, // 6: neo.fs.v2.session.RequestMetaHeader.version:type_name -> neo.fs.v2.refs.Version + 5, // 7: neo.fs.v2.session.RequestMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader + 4, // 8: neo.fs.v2.session.RequestMetaHeader.session_token:type_name -> neo.fs.v2.session.SessionToken + 16, // 9: neo.fs.v2.session.RequestMetaHeader.bearer_token:type_name -> neo.fs.v2.acl.BearerToken + 6, // 10: neo.fs.v2.session.RequestMetaHeader.origin:type_name -> neo.fs.v2.session.RequestMetaHeader + 15, // 11: neo.fs.v2.session.ResponseMetaHeader.version:type_name -> neo.fs.v2.refs.Version + 5, // 12: neo.fs.v2.session.ResponseMetaHeader.x_headers:type_name -> neo.fs.v2.session.XHeader + 7, // 13: neo.fs.v2.session.ResponseMetaHeader.origin:type_name -> neo.fs.v2.session.ResponseMetaHeader + 17, // 14: neo.fs.v2.session.ResponseMetaHeader.status:type_name -> neo.fs.v2.status.Status + 14, // 15: neo.fs.v2.session.RequestVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 16: neo.fs.v2.session.RequestVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 17: neo.fs.v2.session.RequestVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 8, // 18: neo.fs.v2.session.RequestVerificationHeader.origin:type_name -> neo.fs.v2.session.RequestVerificationHeader + 14, // 19: neo.fs.v2.session.ResponseVerificationHeader.body_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 20: neo.fs.v2.session.ResponseVerificationHeader.meta_signature:type_name -> neo.fs.v2.refs.Signature + 14, // 21: neo.fs.v2.session.ResponseVerificationHeader.origin_signature:type_name -> neo.fs.v2.refs.Signature + 9, // 22: neo.fs.v2.session.ResponseVerificationHeader.origin:type_name -> neo.fs.v2.session.ResponseVerificationHeader + 13, // 23: neo.fs.v2.session.ObjectSessionContext.Target.container:type_name -> neo.fs.v2.refs.ContainerID + 18, // 24: neo.fs.v2.session.ObjectSessionContext.Target.objects:type_name -> neo.fs.v2.refs.ObjectID + 19, // 25: neo.fs.v2.session.SessionToken.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID + 12, // 26: neo.fs.v2.session.SessionToken.Body.lifetime:type_name -> neo.fs.v2.session.SessionToken.Body.TokenLifetime + 2, // 27: neo.fs.v2.session.SessionToken.Body.object:type_name -> neo.fs.v2.session.ObjectSessionContext + 3, // 28: neo.fs.v2.session.SessionToken.Body.container:type_name -> neo.fs.v2.session.ContainerSessionContext + 29, // [29:29] is the sub-list for method output_type + 29, // [29:29] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name +} + +func init() { file_api_session_grpc_types_proto_init() } +func file_api_session_grpc_types_proto_init() { + if File_api_session_grpc_types_proto != nil { + return + } + file_api_session_grpc_types_proto_msgTypes[9].OneofWrappers = []any{ + (*sessionToken_Body_Object)(nil), + (*sessionToken_Body_Container)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_session_grpc_types_proto_rawDesc, + NumEnums: 2, + NumMessages: 11, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_session_grpc_types_proto_goTypes, + DependencyIndexes: file_api_session_grpc_types_proto_depIdxs, + EnumInfos: file_api_session_grpc_types_proto_enumTypes, + MessageInfos: file_api_session_grpc_types_proto_msgTypes, + }.Build() + File_api_session_grpc_types_proto = out.File + file_api_session_grpc_types_proto_rawDesc = nil + file_api_session_grpc_types_proto_goTypes = nil + file_api_session_grpc_types_proto_depIdxs = nil +} diff --git a/api/session/json.go b/api/session/json.go new file mode 100644 index 00000000..92602ead --- /dev/null +++ b/api/session/json.go @@ -0,0 +1,86 @@ +package session + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" +) + +func (c *ObjectSessionContext) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(c) +} + +func (c *ObjectSessionContext) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(c, data, new(session.ObjectSessionContext)) +} + +func (l *TokenLifetime) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(l) +} + +func (l *TokenLifetime) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(l, data, new(session.SessionToken_Body_TokenLifetime)) +} + +func (t *TokenBody) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(t) +} + +func (t *TokenBody) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(t, data, new(session.SessionToken_Body)) +} + +func (t *Token) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(t) +} + +func (t *Token) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(t, data, new(session.SessionToken)) +} + +func (x *XHeader) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(x) +} + +func (x *XHeader) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(x, data, new(session.XHeader)) +} + +func (r *RequestMetaHeader) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(r) +} + +func (r *RequestMetaHeader) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(r, data, new(session.RequestMetaHeader)) +} + +func (r *RequestVerificationHeader) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(r) +} + +func (r *RequestVerificationHeader) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(r, data, new(session.RequestVerificationHeader)) +} + +func (r *ResponseMetaHeader) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(r) +} + +func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(r, data, new(session.ResponseMetaHeader)) +} + +func (r *ResponseVerificationHeader) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(r) +} + +func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(r, data, new(session.ResponseVerificationHeader)) +} + +func (x *ContainerSessionContext) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(x) +} + +func (x *ContainerSessionContext) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(x, data, new(session.ContainerSessionContext)) +} diff --git a/api/session/marshal.go b/api/session/marshal.go new file mode 100644 index 00000000..d4838b21 --- /dev/null +++ b/api/session/marshal.go @@ -0,0 +1,536 @@ +package session + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + createReqBodyOwnerField = 1 + createReqBodyExpirationField = 2 + + createRespBodyIDField = 1 + createRespBodyKeyField = 2 + + xheaderKeyField = 1 + xheaderValueField = 2 + + lifetimeExpirationField = 1 + lifetimeNotValidBeforeField = 2 + lifetimeIssuedAtField = 3 + + objectCtxVerbField = 1 + objectCtxTargetField = 2 + + sessionTokenBodyIDField = 1 + sessionTokenBodyOwnerField = 2 + sessionTokenBodyLifetimeField = 3 + sessionTokenBodyKeyField = 4 + sessionTokenBodyObjectCtxField = 5 + sessionTokenBodyCnrCtxField = 6 + + sessionTokenBodyField = 1 + sessionTokenSignatureField = 2 + + reqMetaHeaderVersionField = 1 + reqMetaHeaderEpochField = 2 + reqMetaHeaderTTLField = 3 + reqMetaHeaderXHeadersField = 4 + reqMetaHeaderSessionTokenField = 5 + reqMetaHeaderBearerTokenField = 6 + reqMetaHeaderOriginField = 7 + reqMetaHeaderNetMagicField = 8 + + reqVerifHeaderBodySignatureField = 1 + reqVerifHeaderMetaSignatureField = 2 + reqVerifHeaderOriginSignatureField = 3 + reqVerifHeaderOriginField = 4 + + respMetaHeaderVersionField = 1 + respMetaHeaderEpochField = 2 + respMetaHeaderTTLField = 3 + respMetaHeaderXHeadersField = 4 + respMetaHeaderOriginField = 5 + respMetaHeaderStatusField = 6 + + respVerifHeaderBodySignatureField = 1 + respVerifHeaderMetaSignatureField = 2 + respVerifHeaderOriginSignatureField = 3 + respVerifHeaderOriginField = 4 +) + +func (c *CreateRequestBody) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(createReqBodyOwnerField, buf[offset:], c.ownerID) + proto.UInt64Marshal(createReqBodyExpirationField, buf[offset:], c.expiration) + + return buf +} + +func (c *CreateRequestBody) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.NestedStructureSize(createReqBodyOwnerField, c.ownerID) + size += proto.UInt64Size(createReqBodyExpirationField, c.expiration) + + return size +} + +func (c *CreateRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(session.CreateRequest_Body)) +} + +func (c *CreateResponseBody) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + var offset int + + offset += proto.BytesMarshal(createRespBodyIDField, buf[offset:], c.id) + proto.BytesMarshal(createRespBodyKeyField, buf[offset:], c.sessionKey) + + return buf +} + +func (c *CreateResponseBody) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.BytesSize(createRespBodyIDField, c.id) + size += proto.BytesSize(createRespBodyKeyField, c.sessionKey) + + return size +} + +func (c *CreateResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(session.CreateResponse_Body)) +} + +func (x *XHeader) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var offset int + + offset += proto.StringMarshal(xheaderKeyField, buf[offset:], x.key) + proto.StringMarshal(xheaderValueField, buf[offset:], x.val) + + return buf +} + +func (x *XHeader) StableSize() (size int) { + if x == nil { + return 0 + } + + size += proto.StringSize(xheaderKeyField, x.key) + size += proto.StringSize(xheaderValueField, x.val) + + return size +} + +func (x *XHeader) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(session.XHeader)) +} + +func (l *TokenLifetime) StableMarshal(buf []byte) []byte { + if l == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, l.StableSize()) + } + + var offset int + + offset += proto.UInt64Marshal(lifetimeExpirationField, buf[offset:], l.exp) + offset += proto.UInt64Marshal(lifetimeNotValidBeforeField, buf[offset:], l.nbf) + proto.UInt64Marshal(lifetimeIssuedAtField, buf[offset:], l.iat) + + return buf +} + +func (l *TokenLifetime) StableSize() (size int) { + if l == nil { + return 0 + } + + size += proto.UInt64Size(lifetimeExpirationField, l.exp) + size += proto.UInt64Size(lifetimeNotValidBeforeField, l.nbf) + size += proto.UInt64Size(lifetimeIssuedAtField, l.iat) + + return size +} + +func (l *TokenLifetime) Unmarshal(data []byte) error { + return message.Unmarshal(l, data, new(session.SessionToken_Body_TokenLifetime)) +} + +func (c *ObjectSessionContext) StableMarshal(buf []byte) []byte { + if c == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, c.StableSize()) + } + + offset := proto.EnumMarshal(objectCtxVerbField, buf, int32(c.verb)) + proto.NestedStructureMarshalUnchecked(objectCtxTargetField, buf[offset:], objectSessionContextTarget{ + cnr: c.cnr, + objs: c.objs, + }) + + return buf +} + +func (c *ObjectSessionContext) StableSize() (size int) { + if c == nil { + return 0 + } + + size += proto.EnumSize(objectCtxVerbField, int32(c.verb)) + size += proto.NestedStructureSizeUnchecked(objectCtxTargetField, objectSessionContextTarget{ + cnr: c.cnr, + objs: c.objs, + }) + + return size +} + +func (c *ObjectSessionContext) Unmarshal(data []byte) error { + return message.Unmarshal(c, data, new(session.ObjectSessionContext)) +} + +const ( + _ = iota + cnrCtxVerbFNum + cnrCtxWildcardFNum + cnrCtxCidFNum +) + +func (x *ContainerSessionContext) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var offset int + + offset += proto.EnumMarshal(cnrCtxVerbFNum, buf[offset:], int32(ContainerSessionVerbToGRPCField(x.verb))) + offset += proto.BoolMarshal(cnrCtxWildcardFNum, buf[offset:], x.wildcard) + proto.NestedStructureMarshal(cnrCtxCidFNum, buf[offset:], x.cid) + + return buf +} + +func (x *ContainerSessionContext) StableSize() (size int) { + if x == nil { + return 0 + } + + size += proto.EnumSize(cnrCtxVerbFNum, int32(ContainerSessionVerbToGRPCField(x.verb))) + size += proto.BoolSize(cnrCtxWildcardFNum, x.wildcard) + size += proto.NestedStructureSize(cnrCtxCidFNum, x.cid) + + return size +} + +func (x *ContainerSessionContext) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(session.ContainerSessionContext)) +} + +func (t *TokenBody) StableMarshal(buf []byte) []byte { + if t == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var offset int + + offset += proto.BytesMarshal(sessionTokenBodyIDField, buf[offset:], t.id) + offset += proto.NestedStructureMarshal(sessionTokenBodyOwnerField, buf[offset:], t.ownerID) + offset += proto.NestedStructureMarshal(sessionTokenBodyLifetimeField, buf[offset:], t.lifetime) + offset += proto.BytesMarshal(sessionTokenBodyKeyField, buf[offset:], t.sessionKey) + + if t.ctx != nil { + switch v := t.ctx.(type) { + case *ObjectSessionContext: + proto.NestedStructureMarshal(sessionTokenBodyObjectCtxField, buf[offset:], v) + case *ContainerSessionContext: + proto.NestedStructureMarshal(sessionTokenBodyCnrCtxField, buf[offset:], v) + default: + panic("cannot marshal unknown session token context") + } + } + + return buf +} + +func (t *TokenBody) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.BytesSize(sessionTokenBodyIDField, t.id) + size += proto.NestedStructureSize(sessionTokenBodyOwnerField, t.ownerID) + size += proto.NestedStructureSize(sessionTokenBodyLifetimeField, t.lifetime) + size += proto.BytesSize(sessionTokenBodyKeyField, t.sessionKey) + + if t.ctx != nil { + switch v := t.ctx.(type) { + case *ObjectSessionContext: + size += proto.NestedStructureSize(sessionTokenBodyObjectCtxField, v) + case *ContainerSessionContext: + size += proto.NestedStructureSize(sessionTokenBodyCnrCtxField, v) + default: + panic("cannot marshal unknown session token context") + } + } + + return size +} + +func (t *TokenBody) Unmarshal(data []byte) error { + return message.Unmarshal(t, data, new(session.SessionToken_Body)) +} + +func (t *Token) StableMarshal(buf []byte) []byte { + if t == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, t.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(sessionTokenBodyField, buf[offset:], t.body) + proto.NestedStructureMarshal(sessionTokenSignatureField, buf[offset:], t.sig) + + return buf +} + +func (t *Token) StableSize() (size int) { + if t == nil { + return 0 + } + + size += proto.NestedStructureSize(sessionTokenBodyField, t.body) + size += proto.NestedStructureSize(sessionTokenSignatureField, t.sig) + + return size +} + +func (t *Token) Unmarshal(data []byte) error { + return message.Unmarshal(t, data, new(session.SessionToken)) +} + +func (r *RequestMetaHeader) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(reqMetaHeaderVersionField, buf[offset:], r.version) + offset += proto.UInt64Marshal(reqMetaHeaderEpochField, buf[offset:], r.epoch) + offset += proto.UInt32Marshal(reqMetaHeaderTTLField, buf[offset:], r.ttl) + + for i := range r.xHeaders { + offset += proto.NestedStructureMarshal(reqMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) + } + + offset += proto.NestedStructureMarshal(reqMetaHeaderSessionTokenField, buf[offset:], r.sessionToken) + offset += proto.NestedStructureMarshal(reqMetaHeaderBearerTokenField, buf[offset:], r.bearerToken) + offset += proto.NestedStructureMarshal(reqMetaHeaderOriginField, buf[offset:], r.origin) + proto.UInt64Marshal(reqMetaHeaderNetMagicField, buf[offset:], r.netMagic) + + return buf +} + +func (r *RequestMetaHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.version != nil { + size += proto.NestedStructureSize(reqMetaHeaderVersionField, r.version) + } + + size += proto.UInt64Size(reqMetaHeaderEpochField, r.epoch) + size += proto.UInt32Size(reqMetaHeaderTTLField, r.ttl) + + for i := range r.xHeaders { + size += proto.NestedStructureSize(reqMetaHeaderXHeadersField, &r.xHeaders[i]) + } + + size += proto.NestedStructureSize(reqMetaHeaderSessionTokenField, r.sessionToken) + size += proto.NestedStructureSize(reqMetaHeaderBearerTokenField, r.bearerToken) + size += proto.NestedStructureSize(reqMetaHeaderOriginField, r.origin) + size += proto.UInt64Size(reqMetaHeaderNetMagicField, r.netMagic) + + return size +} + +func (r *RequestMetaHeader) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(session.RequestMetaHeader)) +} + +func (r *RequestVerificationHeader) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(reqVerifHeaderBodySignatureField, buf[offset:], r.bodySig) + offset += proto.NestedStructureMarshal(reqVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) + offset += proto.NestedStructureMarshal(reqVerifHeaderOriginSignatureField, buf[offset:], r.originSig) + proto.NestedStructureMarshal(reqVerifHeaderOriginField, buf[offset:], r.origin) + + return buf +} + +func (r *RequestVerificationHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(reqVerifHeaderBodySignatureField, r.bodySig) + size += proto.NestedStructureSize(reqVerifHeaderMetaSignatureField, r.metaSig) + size += proto.NestedStructureSize(reqVerifHeaderOriginSignatureField, r.originSig) + size += proto.NestedStructureSize(reqVerifHeaderOriginField, r.origin) + + return size +} + +func (r *RequestVerificationHeader) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(session.RequestVerificationHeader)) +} + +func (r *ResponseMetaHeader) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(respMetaHeaderVersionField, buf[offset:], r.version) + offset += proto.UInt64Marshal(respMetaHeaderEpochField, buf[offset:], r.epoch) + offset += proto.UInt32Marshal(respMetaHeaderTTLField, buf[offset:], r.ttl) + + for i := range r.xHeaders { + offset += proto.NestedStructureMarshal(respMetaHeaderXHeadersField, buf[offset:], &r.xHeaders[i]) + } + + offset += proto.NestedStructureMarshal(respMetaHeaderOriginField, buf[offset:], r.origin) + proto.NestedStructureMarshal(respMetaHeaderStatusField, buf[offset:], r.status) + + return buf +} + +func (r *ResponseMetaHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + if r.version != nil { + size += proto.NestedStructureSize(respMetaHeaderVersionField, r.version) + } + + size += proto.UInt64Size(respMetaHeaderEpochField, r.epoch) + size += proto.UInt32Size(respMetaHeaderTTLField, r.ttl) + + for i := range r.xHeaders { + size += proto.NestedStructureSize(respMetaHeaderXHeadersField, &r.xHeaders[i]) + } + + size += proto.NestedStructureSize(respMetaHeaderOriginField, r.origin) + size += proto.NestedStructureSize(respMetaHeaderStatusField, r.status) + + return size +} + +func (r *ResponseMetaHeader) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(session.ResponseMetaHeader)) +} + +func (r *ResponseVerificationHeader) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + offset += proto.NestedStructureMarshal(respVerifHeaderBodySignatureField, buf[offset:], r.bodySig) + offset += proto.NestedStructureMarshal(respVerifHeaderMetaSignatureField, buf[offset:], r.metaSig) + offset += proto.NestedStructureMarshal(respVerifHeaderOriginSignatureField, buf[offset:], r.originSig) + proto.NestedStructureMarshal(respVerifHeaderOriginField, buf[offset:], r.origin) + + return buf +} + +func (r *ResponseVerificationHeader) StableSize() (size int) { + if r == nil { + return 0 + } + + size += proto.NestedStructureSize(respVerifHeaderBodySignatureField, r.bodySig) + size += proto.NestedStructureSize(respVerifHeaderMetaSignatureField, r.metaSig) + size += proto.NestedStructureSize(respVerifHeaderOriginSignatureField, r.originSig) + size += proto.NestedStructureSize(respVerifHeaderOriginField, r.origin) + + return size +} + +func (r *ResponseVerificationHeader) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(session.ResponseVerificationHeader)) +} diff --git a/api/session/message_test.go b/api/session/message_test.go new file mode 100644 index 00000000..7e5844ab --- /dev/null +++ b/api/session/message_test.go @@ -0,0 +1,27 @@ +package session_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + rpctest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" + sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/test" +) + +func TestMessageConvert(t *testing.T) { + rpctest.TestRPCMessage(t, + func(empty bool) message.Message { return sessiontest.GenerateCreateRequestBody(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateCreateRequest(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateCreateResponseBody(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateCreateResponse(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateTokenLifetime(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateXHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateSessionTokenBody(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateSessionToken(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateRequestMetaHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateRequestVerificationHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateResponseMetaHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateResponseVerificationHeader(empty) }, + func(empty bool) message.Message { return sessiontest.GenerateContainerSessionContext(empty) }, + ) +} diff --git a/api/session/status.go b/api/session/status.go new file mode 100644 index 00000000..229a4597 --- /dev/null +++ b/api/session/status.go @@ -0,0 +1,32 @@ +package session + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" + statusgrpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" +) + +// LocalizeFailStatus checks if passed global status.Code is related to session failure and: +// +// then localizes the code and returns true, +// else leaves the code unchanged and returns false. +// +// Arg must not be nil. +func LocalizeFailStatus(c *status.Code) bool { + return status.LocalizeIfInSection(c, uint32(statusgrpc.Section_SECTION_SESSION)) +} + +// GlobalizeFail globalizes local code of session failure. +// +// Arg must not be nil. +func GlobalizeFail(c *status.Code) { + c.GlobalizeSection(uint32(statusgrpc.Section_SECTION_SESSION)) +} + +const ( + // StatusTokenNotFound is a local status.Code value for + // TOKEN_NOT_FOUND session failure. + StatusTokenNotFound status.Code = iota + // StatusTokenExpired is a local status.Code value for + // TOKEN_EXPIRED session failure. + StatusTokenExpired +) diff --git a/api/session/status_test.go b/api/session/status_test.go new file mode 100644 index 00000000..c984e6f4 --- /dev/null +++ b/api/session/status_test.go @@ -0,0 +1,15 @@ +package session_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + statustest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/test" +) + +func TestStatusCodes(t *testing.T) { + statustest.TestCodes(t, session.LocalizeFailStatus, session.GlobalizeFail, + session.StatusTokenNotFound, 4096, + session.StatusTokenExpired, 4097, + ) +} diff --git a/api/session/string.go b/api/session/string.go new file mode 100644 index 00000000..83c3fa2b --- /dev/null +++ b/api/session/string.go @@ -0,0 +1,43 @@ +package session + +import ( + session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" +) + +// String returns string representation of ObjectSessionVerb. +func (x ObjectSessionVerb) String() string { + return ObjectSessionVerbToGRPCField(x).String() +} + +// FromString parses ObjectSessionVerb from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *ObjectSessionVerb) FromString(s string) bool { + g, ok := session.ObjectSessionContext_Verb_value[s] + + if ok { + *x = ObjectSessionVerbFromGRPCField(session.ObjectSessionContext_Verb(g)) + } + + return ok +} + +// String returns string representation of ContainerSessionVerb. +func (x ContainerSessionVerb) String() string { + return ContainerSessionVerbToGRPCField(x).String() +} + +// FromString parses ContainerSessionVerb from a string representation. +// It is a reverse action to String(). +// +// Returns true if s was parsed successfully. +func (x *ContainerSessionVerb) FromString(s string) bool { + g, ok := session.ContainerSessionContext_Verb_value[s] + + if ok { + *x = ContainerSessionVerbFromGRPCField(session.ContainerSessionContext_Verb(g)) + } + + return ok +} diff --git a/api/session/test/generate.go b/api/session/test/generate.go new file mode 100644 index 00000000..b35fe07b --- /dev/null +++ b/api/session/test/generate.go @@ -0,0 +1,251 @@ +package sessiontest + +import ( + crand "crypto/rand" + "math/rand" + "time" + + acltest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/test" + refstest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + statustest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/test" +) + +func GenerateCreateRequestBody(empty bool) *session.CreateRequestBody { + m := new(session.CreateRequestBody) + + if !empty { + m.SetExpiration(555) + m.SetOwnerID(refstest.GenerateOwnerID(false)) + } + + return m +} + +func GenerateCreateRequest(empty bool) *session.CreateRequest { + m := new(session.CreateRequest) + + if !empty { + m.SetBody(GenerateCreateRequestBody(false)) + } + + m.SetMetaHeader(GenerateRequestMetaHeader(empty)) + m.SetVerificationHeader(GenerateRequestVerificationHeader(empty)) + + return m +} + +func GenerateCreateResponseBody(empty bool) *session.CreateResponseBody { + m := new(session.CreateResponseBody) + + if !empty { + id := make([]byte, 16) + _, _ = crand.Read(id) + + m.SetID(id) + m.SetSessionKey([]byte{4, 5, 6}) + } + + return m +} + +func GenerateCreateResponse(empty bool) *session.CreateResponse { + m := new(session.CreateResponse) + + if !empty { + m.SetBody(GenerateCreateResponseBody(false)) + } + + m.SetMetaHeader(GenerateResponseMetaHeader(empty)) + m.SetVerificationHeader(GenerateResponseVerificationHeader(empty)) + + return m +} + +func GenerateResponseVerificationHeader(empty bool) *session.ResponseVerificationHeader { + return generateResponseVerificationHeader(empty, true) +} + +func generateResponseVerificationHeader(empty, withOrigin bool) *session.ResponseVerificationHeader { + m := new(session.ResponseVerificationHeader) + + if !empty { + m.SetBodySignature(refstest.GenerateSignature(false)) + } + + m.SetMetaSignature(refstest.GenerateSignature(empty)) + m.SetOriginSignature(refstest.GenerateSignature(empty)) + + if withOrigin { + m.SetOrigin(generateResponseVerificationHeader(empty, false)) + } + + return m +} + +func GenerateResponseMetaHeader(empty bool) *session.ResponseMetaHeader { + return generateResponseMetaHeader(empty, true) +} + +func generateResponseMetaHeader(empty, withOrigin bool) *session.ResponseMetaHeader { + m := new(session.ResponseMetaHeader) + + if !empty { + m.SetEpoch(13) + m.SetTTL(100) + } + + m.SetXHeaders(GenerateXHeaders(empty)) + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetStatus(statustest.Status(empty)) + + if withOrigin { + m.SetOrigin(generateResponseMetaHeader(empty, false)) + } + + return m +} + +func GenerateRequestVerificationHeader(empty bool) *session.RequestVerificationHeader { + return generateRequestVerificationHeader(empty, true) +} + +func generateRequestVerificationHeader(empty, withOrigin bool) *session.RequestVerificationHeader { + m := new(session.RequestVerificationHeader) + + if !empty { + m.SetBodySignature(refstest.GenerateSignature(false)) + } + + m.SetMetaSignature(refstest.GenerateSignature(empty)) + m.SetOriginSignature(refstest.GenerateSignature(empty)) + + if withOrigin { + m.SetOrigin(generateRequestVerificationHeader(empty, false)) + } + + return m +} + +func GenerateRequestMetaHeader(empty bool) *session.RequestMetaHeader { + return generateRequestMetaHeader(empty, true) +} + +func generateRequestMetaHeader(empty, withOrigin bool) *session.RequestMetaHeader { + m := new(session.RequestMetaHeader) + + if !empty { + m.SetEpoch(13) + m.SetTTL(100) + m.SetNetworkMagic(1337) + } + + m.SetXHeaders(GenerateXHeaders(empty)) + m.SetVersion(refstest.GenerateVersion(empty)) + m.SetSessionToken(GenerateSessionToken(empty)) + m.SetBearerToken(acltest.GenerateBearerToken(empty)) + + if withOrigin { + m.SetOrigin(generateRequestMetaHeader(empty, false)) + } + + return m +} + +func GenerateSessionToken(empty bool) *session.Token { + m := new(session.Token) + + if !empty { + m.SetBody(GenerateSessionTokenBody(false)) + } + + m.SetSignature(refstest.GenerateSignature(empty)) + + return m +} + +func GenerateSessionTokenBody(empty bool) *session.TokenBody { + m := new(session.TokenBody) + + if !empty { + id := make([]byte, 16) + _, _ = crand.Read(id) + + m.SetID(id) + m.SetSessionKey([]byte{2}) + m.SetOwnerID(refstest.GenerateOwnerID(false)) + m.SetLifetime(GenerateTokenLifetime(false)) + + switch randomInt(2) { + case 0: + m.SetContext(GenerateObjectSessionContext(false)) + case 1: + m.SetContext(GenerateContainerSessionContext(false)) + } + } + + return m +} + +func GenerateTokenLifetime(empty bool) *session.TokenLifetime { + m := new(session.TokenLifetime) + + if !empty { + m.SetExp(1) + m.SetIat(2) + m.SetExp(3) + } + + return m +} + +func GenerateObjectSessionContext(empty bool) *session.ObjectSessionContext { + m := new(session.ObjectSessionContext) + + if !empty { + m.SetVerb(session.ObjectVerbHead) + m.SetTarget(refstest.GenerateContainerID(false), refstest.GenerateObjectIDs(false)...) + } + + return m +} + +func GenerateContainerSessionContext(empty bool) *session.ContainerSessionContext { + m := new(session.ContainerSessionContext) + + if !empty { + m.SetVerb(session.ContainerVerbDelete) + m.SetWildcard(true) + m.SetContainerID(refstest.GenerateContainerID(false)) + } + + return m +} + +func GenerateXHeader(empty bool) *session.XHeader { + m := new(session.XHeader) + + if !empty { + m.SetKey("key") + m.SetValue("val") + } + + return m +} + +func GenerateXHeaders(empty bool) []session.XHeader { + var xs []session.XHeader + + if !empty { + xs = append(xs, + *GenerateXHeader(false), + *GenerateXHeader(false), + ) + } + + return xs +} + +func randomInt(n int) int { + return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(n) +} diff --git a/api/session/types.go b/api/session/types.go new file mode 100644 index 00000000..838024f8 --- /dev/null +++ b/api/session/types.go @@ -0,0 +1,836 @@ +package session + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +type CreateRequestBody struct { + ownerID *refs.OwnerID + + expiration uint64 +} + +type CreateRequest struct { + body *CreateRequestBody + + RequestHeaders +} + +type CreateResponseBody struct { + id []byte + + sessionKey []byte +} + +type CreateResponse struct { + body *CreateResponseBody + + ResponseHeaders +} + +type XHeader struct { + key, val string +} + +type TokenLifetime struct { + exp, nbf, iat uint64 +} + +type ObjectSessionVerb uint32 + +type objectSessionContextTarget struct { + cnr *refs.ContainerID + + objs []refs.ObjectID +} + +const ( + _ = iota + fNumObjectTargetContainer + fNumObjectTargetObjects +) + +func (x objectSessionContextTarget) StableMarshal(buf []byte) []byte { + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + offset := proto.NestedStructureMarshal(fNumObjectTargetContainer, buf, x.cnr) + + for i := range x.objs { + offset += proto.NestedStructureMarshal(fNumObjectTargetObjects, buf[offset:], &x.objs[i]) + } + + return buf +} + +func (x objectSessionContextTarget) StableSize() (size int) { + size += proto.NestedStructureSize(fNumObjectTargetContainer, x.cnr) + + for i := range x.objs { + size += proto.NestedStructureSize(fNumObjectTargetObjects, &x.objs[i]) + } + + return size +} + +type ObjectSessionContext struct { + verb ObjectSessionVerb + + cnr *refs.ContainerID + + objs []refs.ObjectID +} + +type TokenContext interface { + sessionTokenContext() +} + +// Deprecated: use TokenContext instead. +// +//nolint:revive +type SessionTokenContext = TokenContext + +type TokenBody struct { + id []byte + + ownerID *refs.OwnerID + + lifetime *TokenLifetime + + sessionKey []byte + + ctx TokenContext +} + +// Deprecated: use TokenBody instead. +// +//nolint:revive +type SessionTokenBody = TokenBody + +type Token struct { + body *TokenBody + + sig *refs.Signature +} + +// Deprecated: use Token instead. +// +//nolint:revive +type SessionToken = Token + +type RequestVerificationHeader struct { + bodySig, metaSig, originSig *refs.Signature + + origin *RequestVerificationHeader +} + +type RequestMetaHeader struct { + version *refs.Version + + ttl uint32 + + epoch uint64 + + xHeaders []XHeader + + sessionToken *Token + + bearerToken *acl.BearerToken + + origin *RequestMetaHeader + + netMagic uint64 +} + +type ResponseVerificationHeader struct { + bodySig, metaSig, originSig *refs.Signature + + origin *ResponseVerificationHeader +} + +type ResponseMetaHeader struct { + version *refs.Version + + ttl uint32 + + epoch uint64 + + xHeaders []XHeader + + origin *ResponseMetaHeader + + status *status.Status +} + +const ( + ObjectVerbUnknown ObjectSessionVerb = iota + ObjectVerbPut + ObjectVerbGet + ObjectVerbHead + ObjectVerbSearch + ObjectVerbDelete + ObjectVerbRange + ObjectVerbRangeHash + ObjectVerbPatch +) + +func (c *CreateRequestBody) GetOwnerID() *refs.OwnerID { + if c != nil { + return c.ownerID + } + + return nil +} + +func (c *CreateRequestBody) SetOwnerID(v *refs.OwnerID) { + c.ownerID = v +} + +func (c *CreateRequestBody) GetExpiration() uint64 { + if c != nil { + return c.expiration + } + + return 0 +} + +func (c *CreateRequestBody) SetExpiration(v uint64) { + c.expiration = v +} + +func (c *CreateRequest) GetBody() *CreateRequestBody { + if c != nil { + return c.body + } + + return nil +} + +func (c *CreateRequest) SetBody(v *CreateRequestBody) { + c.body = v +} + +func (c *CreateRequest) GetMetaHeader() *RequestMetaHeader { + if c != nil { + return c.metaHeader + } + + return nil +} + +func (c *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { + c.metaHeader = v +} + +func (c *CreateRequest) GetVerificationHeader() *RequestVerificationHeader { + if c != nil { + return c.verifyHeader + } + + return nil +} + +func (c *CreateRequest) SetVerificationHeader(v *RequestVerificationHeader) { + c.verifyHeader = v +} + +func (c *CreateResponseBody) GetID() []byte { + if c != nil { + return c.id + } + + return nil +} + +func (c *CreateResponseBody) SetID(v []byte) { + c.id = v +} + +func (c *CreateResponseBody) GetSessionKey() []byte { + if c != nil { + return c.sessionKey + } + + return nil +} + +func (c *CreateResponseBody) SetSessionKey(v []byte) { + c.sessionKey = v +} + +func (c *CreateResponse) GetBody() *CreateResponseBody { + if c != nil { + return c.body + } + + return nil +} + +func (c *CreateResponse) SetBody(v *CreateResponseBody) { + c.body = v +} + +func (c *CreateResponse) GetMetaHeader() *ResponseMetaHeader { + if c != nil { + return c.metaHeader + } + + return nil +} + +func (c *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { + c.metaHeader = v +} + +func (c *CreateResponse) GetVerificationHeader() *ResponseVerificationHeader { + if c != nil { + return c.verifyHeader + } + + return nil +} + +func (c *CreateResponse) SetVerificationHeader(v *ResponseVerificationHeader) { + c.verifyHeader = v +} + +func (x *XHeader) GetKey() string { + if x != nil { + return x.key + } + + return "" +} + +func (x *XHeader) SetKey(v string) { + x.key = v +} + +func (x *XHeader) GetValue() string { + if x != nil { + return x.val + } + + return "" +} + +func (x *XHeader) SetValue(v string) { + x.val = v +} + +func (r *RequestVerificationHeader) GetBodySignature() *refs.Signature { + if r != nil { + return r.bodySig + } + + return nil +} + +func (r *RequestVerificationHeader) SetBodySignature(v *refs.Signature) { + r.bodySig = v +} + +func (r *RequestVerificationHeader) GetMetaSignature() *refs.Signature { + if r != nil { + return r.metaSig + } + + return nil +} + +func (r *RequestVerificationHeader) SetMetaSignature(v *refs.Signature) { + r.metaSig = v +} + +func (r *RequestVerificationHeader) GetOriginSignature() *refs.Signature { + if r != nil { + return r.originSig + } + + return nil +} + +func (r *RequestVerificationHeader) SetOriginSignature(v *refs.Signature) { + r.originSig = v +} + +func (r *RequestVerificationHeader) GetOrigin() *RequestVerificationHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) { + r.origin = v +} + +func (r *RequestMetaHeader) GetVersion() *refs.Version { + if r != nil { + return r.version + } + + return nil +} + +func (r *RequestMetaHeader) SetVersion(v *refs.Version) { + r.version = v +} + +func (r *RequestMetaHeader) GetTTL() uint32 { + if r != nil { + return r.ttl + } + + return 0 +} + +func (r *RequestMetaHeader) SetTTL(v uint32) { + r.ttl = v +} + +func (r *RequestMetaHeader) GetEpoch() uint64 { + if r != nil { + return r.epoch + } + + return 0 +} + +func (r *RequestMetaHeader) SetEpoch(v uint64) { + r.epoch = v +} + +func (r *RequestMetaHeader) GetXHeaders() []XHeader { + if r != nil { + return r.xHeaders + } + + return nil +} + +func (r *RequestMetaHeader) SetXHeaders(v []XHeader) { + r.xHeaders = v +} + +func (r *RequestMetaHeader) GetSessionToken() *Token { + if r != nil { + return r.sessionToken + } + + return nil +} + +func (r *RequestMetaHeader) SetSessionToken(v *Token) { + r.sessionToken = v +} + +func (r *RequestMetaHeader) GetBearerToken() *acl.BearerToken { + if r != nil { + return r.bearerToken + } + + return nil +} + +func (r *RequestMetaHeader) SetBearerToken(v *acl.BearerToken) { + r.bearerToken = v +} + +func (r *RequestMetaHeader) GetOrigin() *RequestMetaHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) { + r.origin = v +} + +// GetNetworkMagic returns NeoFS network magic. +func (r *RequestMetaHeader) GetNetworkMagic() uint64 { + if r != nil { + return r.netMagic + } + + return 0 +} + +// SetNetworkMagic sets NeoFS network magic. +func (r *RequestMetaHeader) SetNetworkMagic(v uint64) { + r.netMagic = v +} + +func (l *TokenLifetime) GetExp() uint64 { + if l != nil { + return l.exp + } + + return 0 +} + +func (l *TokenLifetime) SetExp(v uint64) { + l.exp = v +} + +func (l *TokenLifetime) GetNbf() uint64 { + if l != nil { + return l.nbf + } + + return 0 +} + +func (l *TokenLifetime) SetNbf(v uint64) { + l.nbf = v +} + +func (l *TokenLifetime) GetIat() uint64 { + if l != nil { + return l.iat + } + + return 0 +} + +func (l *TokenLifetime) SetIat(v uint64) { + l.iat = v +} + +func (r *ResponseVerificationHeader) GetBodySignature() *refs.Signature { + if r != nil { + return r.bodySig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetBodySignature(v *refs.Signature) { + r.bodySig = v +} + +func (r *ResponseVerificationHeader) GetMetaSignature() *refs.Signature { + if r != nil { + return r.metaSig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetMetaSignature(v *refs.Signature) { + r.metaSig = v +} + +func (r *ResponseVerificationHeader) GetOriginSignature() *refs.Signature { + if r != nil { + return r.originSig + } + + return nil +} + +func (r *ResponseVerificationHeader) SetOriginSignature(v *refs.Signature) { + r.originSig = v +} + +func (r *ResponseVerificationHeader) GetOrigin() *ResponseVerificationHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) { + r.origin = v +} + +func (r *ResponseMetaHeader) GetVersion() *refs.Version { + if r != nil { + return r.version + } + + return nil +} + +func (r *ResponseMetaHeader) SetVersion(v *refs.Version) { + r.version = v +} + +func (r *ResponseMetaHeader) GetTTL() uint32 { + if r != nil { + return r.ttl + } + + return 0 +} + +func (r *ResponseMetaHeader) SetTTL(v uint32) { + r.ttl = v +} + +func (r *ResponseMetaHeader) GetEpoch() uint64 { + if r != nil { + return r.epoch + } + + return 0 +} + +func (r *ResponseMetaHeader) SetEpoch(v uint64) { + r.epoch = v +} + +func (r *ResponseMetaHeader) GetXHeaders() []XHeader { + if r != nil { + return r.xHeaders + } + + return nil +} + +func (r *ResponseMetaHeader) SetXHeaders(v []XHeader) { + r.xHeaders = v +} + +func (r *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader { + if r != nil { + return r.origin + } + + return nil +} + +func (r *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) { + r.origin = v +} + +// GetStatus returns response status. +func (r *ResponseMetaHeader) GetStatus() *status.Status { + if r != nil { + return r.status + } + + return nil +} + +// SetStatus sets response status. +func (r *ResponseMetaHeader) SetStatus(v *status.Status) { + r.status = v +} + +// SetStatus sets status of the message which can carry ResponseMetaHeader. +// +// Sets status field on the "highest" level of meta headers. +// If meta header is missing in message, it is allocated. +func SetStatus(msg interface { + GetMetaHeader() *ResponseMetaHeader + SetMetaHeader(*ResponseMetaHeader) +}, st *status.Status, +) { + meta := msg.GetMetaHeader() + if meta == nil { + meta = new(ResponseMetaHeader) + msg.SetMetaHeader(meta) + } + + meta.SetStatus(st) +} + +func (c *ObjectSessionContext) sessionTokenContext() {} + +func (c *ObjectSessionContext) GetVerb() ObjectSessionVerb { + if c != nil { + return c.verb + } + + return ObjectVerbUnknown +} + +func (c *ObjectSessionContext) SetVerb(v ObjectSessionVerb) { + c.verb = v +} + +func (c *ObjectSessionContext) GetContainer() *refs.ContainerID { + if c != nil { + return c.cnr + } + + return nil +} + +func (c *ObjectSessionContext) GetObjects() []refs.ObjectID { + if c != nil { + return c.objs + } + + return nil +} + +func (c *ObjectSessionContext) SetTarget(cnr *refs.ContainerID, objs ...refs.ObjectID) { + c.cnr = cnr + c.objs = objs +} + +func (t *TokenBody) GetID() []byte { + if t != nil { + return t.id + } + + return nil +} + +func (t *TokenBody) SetID(v []byte) { + t.id = v +} + +func (t *TokenBody) GetOwnerID() *refs.OwnerID { + if t != nil { + return t.ownerID + } + + return nil +} + +func (t *TokenBody) SetOwnerID(v *refs.OwnerID) { + t.ownerID = v +} + +func (t *TokenBody) GetLifetime() *TokenLifetime { + if t != nil { + return t.lifetime + } + + return nil +} + +func (t *TokenBody) SetLifetime(v *TokenLifetime) { + t.lifetime = v +} + +func (t *TokenBody) GetSessionKey() []byte { + if t != nil { + return t.sessionKey + } + + return nil +} + +func (t *TokenBody) SetSessionKey(v []byte) { + t.sessionKey = v +} + +func (t *TokenBody) GetContext() TokenContext { + if t != nil { + return t.ctx + } + + return nil +} + +func (t *TokenBody) SetContext(v TokenContext) { + t.ctx = v +} + +func (t *Token) GetBody() *TokenBody { + if t != nil { + return t.body + } + + return nil +} + +func (t *Token) SetBody(v *TokenBody) { + t.body = v +} + +func (t *Token) GetSignature() *refs.Signature { + if t != nil { + return t.sig + } + + return nil +} + +func (t *Token) SetSignature(v *refs.Signature) { + t.sig = v +} + +// ContainerSessionVerb represents NeoFS API v2 +// session.ContainerSessionContext.Verb enumeration. +type ContainerSessionVerb uint32 + +const ( + // ContainerVerbUnknown corresponds to VERB_UNSPECIFIED enum value. + ContainerVerbUnknown ContainerSessionVerb = iota + + // ContainerVerbPut corresponds to PUT enum value. + ContainerVerbPut + + // ContainerVerbDelete corresponds to DELETE enum value. + ContainerVerbDelete + + // ContainerVerbSetEACL corresponds to SETEACL enum value. + ContainerVerbSetEACL +) + +// ContainerSessionContext represents structure of the +// NeoFS API v2 session.ContainerSessionContext message. +type ContainerSessionContext struct { + verb ContainerSessionVerb + + wildcard bool + + cid *refs.ContainerID +} + +func (x *ContainerSessionContext) sessionTokenContext() {} + +// Verb returns type of request for which the token is issued. +func (x *ContainerSessionContext) Verb() ContainerSessionVerb { + if x != nil { + return x.verb + } + + return ContainerVerbUnknown +} + +// SetVerb sets type of request for which the token is issued. +func (x *ContainerSessionContext) SetVerb(v ContainerSessionVerb) { + x.verb = v +} + +// Wildcard returns wildcard flag of the container session. +func (x *ContainerSessionContext) Wildcard() bool { + if x != nil { + return x.wildcard + } + + return false +} + +// SetWildcard sets wildcard flag of the container session. +func (x *ContainerSessionContext) SetWildcard(v bool) { + x.wildcard = v +} + +// ContainerID returns identifier of the container related to the session. +func (x *ContainerSessionContext) ContainerID() *refs.ContainerID { + if x != nil { + return x.cid + } + + return nil +} + +// SetContainerID sets identifier of the container related to the session. +func (x *ContainerSessionContext) SetContainerID(v *refs.ContainerID) { + x.cid = v +} diff --git a/api/session/util.go b/api/session/util.go new file mode 100644 index 00000000..ea5aff07 --- /dev/null +++ b/api/session/util.go @@ -0,0 +1,167 @@ +package session + +import ( + session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc" +) + +// RequestHeaders represents common part of +// all NeoFS requests including headers. +type RequestHeaders struct { + metaHeader *RequestMetaHeader + + verifyHeader *RequestVerificationHeader +} + +// GetMetaHeader returns meta header of the request. +func (c *RequestHeaders) GetMetaHeader() *RequestMetaHeader { + if c != nil { + return c.metaHeader + } + + return nil +} + +// SetMetaHeader sets meta header of the request. +func (c *RequestHeaders) SetMetaHeader(v *RequestMetaHeader) { + c.metaHeader = v +} + +// GetVerificationHeader returns verification header of the request. +func (c *RequestHeaders) GetVerificationHeader() *RequestVerificationHeader { + if c != nil { + return c.verifyHeader + } + + return nil +} + +// SetVerificationHeader sets verification header of the request. +func (c *RequestHeaders) SetVerificationHeader(v *RequestVerificationHeader) { + c.verifyHeader = v +} + +func (c *RequestHeaders) ToMessage(m interface { + SetMetaHeader(*session.RequestMetaHeader) + SetVerifyHeader(*session.RequestVerificationHeader) +}, +) { + m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.RequestMetaHeader)) + m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.RequestVerificationHeader)) +} + +func (c *RequestHeaders) FromMessage(m interface { + GetMetaHeader() *session.RequestMetaHeader + GetVerifyHeader() *session.RequestVerificationHeader +}, +) error { + metaHdr := m.GetMetaHeader() + if metaHdr == nil { + c.metaHeader = nil + } else { + if c.metaHeader == nil { + c.metaHeader = new(RequestMetaHeader) + } + + err := c.metaHeader.FromGRPCMessage(metaHdr) + if err != nil { + return err + } + } + + verifyHdr := m.GetVerifyHeader() + if verifyHdr == nil { + c.verifyHeader = nil + } else { + if c.verifyHeader == nil { + c.verifyHeader = new(RequestVerificationHeader) + } + + err := c.verifyHeader.FromGRPCMessage(verifyHdr) + if err != nil { + return err + } + } + + return nil +} + +// ResponseHeaders represents common part of +// all NeoFS responses including headers. +type ResponseHeaders struct { + metaHeader *ResponseMetaHeader + + verifyHeader *ResponseVerificationHeader +} + +// GetMetaHeader returns meta header of the response. +func (c *ResponseHeaders) GetMetaHeader() *ResponseMetaHeader { + if c != nil { + return c.metaHeader + } + + return nil +} + +// SetMetaHeader sets meta header of the response. +func (c *ResponseHeaders) SetMetaHeader(v *ResponseMetaHeader) { + c.metaHeader = v +} + +// GetVerificationHeader returns verification header of the response. +func (c *ResponseHeaders) GetVerificationHeader() *ResponseVerificationHeader { + if c != nil { + return c.verifyHeader + } + + return nil +} + +// SetVerificationHeader sets verification header of the response. +func (c *ResponseHeaders) SetVerificationHeader(v *ResponseVerificationHeader) { + c.verifyHeader = v +} + +func (c *ResponseHeaders) ToMessage(m interface { + SetMetaHeader(*session.ResponseMetaHeader) + SetVerifyHeader(*session.ResponseVerificationHeader) +}, +) { + m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.ResponseMetaHeader)) + m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.ResponseVerificationHeader)) +} + +func (c *ResponseHeaders) FromMessage(m interface { + GetMetaHeader() *session.ResponseMetaHeader + GetVerifyHeader() *session.ResponseVerificationHeader +}, +) error { + metaHdr := m.GetMetaHeader() + if metaHdr == nil { + c.metaHeader = nil + } else { + if c.metaHeader == nil { + c.metaHeader = new(ResponseMetaHeader) + } + + err := c.metaHeader.FromGRPCMessage(metaHdr) + if err != nil { + return err + } + } + + verifyHdr := m.GetVerifyHeader() + if verifyHdr == nil { + c.verifyHeader = nil + } else { + if c.verifyHeader == nil { + c.verifyHeader = new(ResponseVerificationHeader) + } + + err := c.verifyHeader.FromGRPCMessage(verifyHdr) + if err != nil { + return err + } + } + + return nil +} diff --git a/api/session/xheaders.go b/api/session/xheaders.go new file mode 100644 index 00000000..c575d5f7 --- /dev/null +++ b/api/session/xheaders.go @@ -0,0 +1,34 @@ +package session + +// ReservedXHeaderPrefix is a prefix of keys to "well-known" X-headers. +const ReservedXHeaderPrefix = "__SYSTEM__" + +const ( + // XHeaderNetmapEpoch is a key to the reserved X-header that specifies netmap epoch + // to use for object placement calculation. If set to '0' or not set, the current + // epoch only will be used. + XHeaderNetmapEpoch = ReservedXHeaderPrefix + "NETMAP_EPOCH" + + // XHeaderNetmapLookupDepth is a key to the reserved X-header that limits + // how many past epochs back the node will can lookup. If set to '0' or not + // set, the current epoch only will be used. + XHeaderNetmapLookupDepth = ReservedXHeaderPrefix + "NETMAP_LOOKUP_DEPTH" +) + +// ReservedXHeaderPrefixNeoFS is a prefix of keys to "well-known" X-headers. +// Deprecated: use ReservedXHeaderPrefix. +const ReservedXHeaderPrefixNeoFS = "__NEOFS__" + +const ( + // XHeaderNetmapEpochNeoFS is a key to the reserved X-header that specifies netmap epoch + // to use for object placement calculation. If set to '0' or not set, the current + // epoch only will be used. + // Deprecated: use XHeaderNetmapEpoch. + XHeaderNetmapEpochNeoFS = ReservedXHeaderPrefixNeoFS + "NETMAP_EPOCH" + + // XHeaderNetmapLookupDepthNeoFS is a key to the reserved X-header that limits + // how many past epochs back the node will can lookup. If set to '0' or not + // set, the current epoch only will be used. + // Deprecated: use XHeaderNetmapLookupDepth. + XHeaderNetmapLookupDepthNeoFS = ReservedXHeaderPrefixNeoFS + "NETMAP_LOOKUP_DEPTH" +) diff --git a/api/signature/body.go b/api/signature/body.go new file mode 100644 index 00000000..2467dc09 --- /dev/null +++ b/api/signature/body.go @@ -0,0 +1,120 @@ +package signature + +import ( + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" +) + +// nolint:funlen +func serviceMessageBody(req any) stableMarshaler { + switch v := req.(type) { + default: + panic(fmt.Sprintf("unsupported session message %T", req)) + + /* Accounting */ + case *accounting.BalanceRequest: + return v.GetBody() + case *accounting.BalanceResponse: + return v.GetBody() + + /* Session */ + case *session.CreateRequest: + return v.GetBody() + case *session.CreateResponse: + return v.GetBody() + + /* Container */ + case *container.PutRequest: + return v.GetBody() + case *container.PutResponse: + return v.GetBody() + case *container.DeleteRequest: + return v.GetBody() + case *container.DeleteResponse: + return v.GetBody() + case *container.GetRequest: + return v.GetBody() + case *container.GetResponse: + return v.GetBody() + case *container.ListRequest: + return v.GetBody() + case *container.ListResponse: + return v.GetBody() + case *container.ListStreamRequest: + return v.GetBody() + case *container.ListStreamResponse: + return v.GetBody() + + /* Object */ + case *object.PutRequest: + return v.GetBody() + case *object.PutResponse: + return v.GetBody() + case *object.GetRequest: + return v.GetBody() + case *object.GetResponse: + return v.GetBody() + case *object.HeadRequest: + return v.GetBody() + case *object.HeadResponse: + return v.GetBody() + case *object.SearchRequest: + return v.GetBody() + case *object.SearchResponse: + return v.GetBody() + case *object.DeleteRequest: + return v.GetBody() + case *object.DeleteResponse: + return v.GetBody() + case *object.GetRangeRequest: + return v.GetBody() + case *object.GetRangeResponse: + return v.GetBody() + case *object.GetRangeHashRequest: + return v.GetBody() + case *object.GetRangeHashResponse: + return v.GetBody() + case *object.PutSingleRequest: + return v.GetBody() + case *object.PutSingleResponse: + return v.GetBody() + case *object.PatchRequest: + return v.GetBody() + case *object.PatchResponse: + return v.GetBody() + + /* Netmap */ + case *netmap.LocalNodeInfoRequest: + return v.GetBody() + case *netmap.LocalNodeInfoResponse: + return v.GetBody() + case *netmap.NetworkInfoRequest: + return v.GetBody() + case *netmap.NetworkInfoResponse: + return v.GetBody() + case *netmap.SnapshotRequest: + return v.GetBody() + case *netmap.SnapshotResponse: + return v.GetBody() + + /* APEManager */ + case *apemanager.AddChainRequest: + return v.GetBody() + case *apemanager.AddChainResponse: + return v.GetBody() + case *apemanager.RemoveChainRequest: + return v.GetBody() + case *apemanager.RemoveChainResponse: + return v.GetBody() + case *apemanager.ListChainsRequest: + return v.GetBody() + case *apemanager.ListChainsResponse: + return v.GetBody() + } +} diff --git a/api/signature/marshaller.go b/api/signature/marshaller.go new file mode 100644 index 00000000..ff9beb39 --- /dev/null +++ b/api/signature/marshaller.go @@ -0,0 +1,26 @@ +package signature + +type stableMarshaler interface { + StableMarshal([]byte) []byte + StableSize() int +} + +type StableMarshalerWrapper struct { + SM stableMarshaler +} + +func (s StableMarshalerWrapper) ReadSignedData(buf []byte) ([]byte, error) { + if s.SM != nil { + return s.SM.StableMarshal(buf), nil + } + + return nil, nil +} + +func (s StableMarshalerWrapper) SignedDataSize() int { + if s.SM != nil { + return s.SM.StableSize() + } + + return 0 +} diff --git a/api/signature/sign.go b/api/signature/sign.go new file mode 100644 index 00000000..04b8d369 --- /dev/null +++ b/api/signature/sign.go @@ -0,0 +1,122 @@ +package signature + +import ( + "crypto/ecdsa" + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/signature" + "golang.org/x/sync/errgroup" +) + +type serviceRequest interface { + GetMetaHeader() *session.RequestMetaHeader + GetVerificationHeader() *session.RequestVerificationHeader + SetVerificationHeader(*session.RequestVerificationHeader) +} + +type serviceResponse interface { + GetMetaHeader() *session.ResponseMetaHeader + GetVerificationHeader() *session.ResponseVerificationHeader + SetVerificationHeader(*session.ResponseVerificationHeader) +} + +type signatureReceiver interface { + SetBodySignature(*refs.Signature) + SetMetaSignature(*refs.Signature) + SetOriginSignature(*refs.Signature) +} + +// SignServiceMessage signes service message with key. +func SignServiceMessage(key *ecdsa.PrivateKey, msg any) error { + switch v := msg.(type) { + case nil: + return nil + case serviceRequest: + return signServiceRequest(key, v) + case serviceResponse: + return signServiceResponse(key, v) + default: + panic(fmt.Sprintf("unsupported session message %T", v)) + } +} + +func signServiceRequest(key *ecdsa.PrivateKey, v serviceRequest) error { + result := &session.RequestVerificationHeader{} + body := serviceMessageBody(v) + meta := v.GetMetaHeader() + header := v.GetVerificationHeader() + if err := signMessageParts(key, body, meta, header, header != nil, result); err != nil { + return err + } + result.SetOrigin(header) + v.SetVerificationHeader(result) + return nil +} + +func signServiceResponse(key *ecdsa.PrivateKey, v serviceResponse) error { + result := &session.ResponseVerificationHeader{} + body := serviceMessageBody(v) + meta := v.GetMetaHeader() + header := v.GetVerificationHeader() + if err := signMessageParts(key, body, meta, header, header != nil, result); err != nil { + return err + } + result.SetOrigin(header) + v.SetVerificationHeader(result) + return nil +} + +func signMessageParts(key *ecdsa.PrivateKey, body, meta, header stableMarshaler, hasHeader bool, result signatureReceiver) error { + eg := &errgroup.Group{} + if !hasHeader { + // sign session message body + eg.Go(func() error { + if err := signServiceMessagePart(key, body, result.SetBodySignature); err != nil { + return fmt.Errorf("could not sign body: %w", err) + } + return nil + }) + } + + // sign meta header + eg.Go(func() error { + if err := signServiceMessagePart(key, meta, result.SetMetaSignature); err != nil { + return fmt.Errorf("could not sign meta header: %w", err) + } + return nil + }) + + // sign verification header origin + eg.Go(func() error { + if err := signServiceMessagePart(key, header, result.SetOriginSignature); err != nil { + return fmt.Errorf("could not sign origin of verification header: %w", err) + } + return nil + }) + return eg.Wait() +} + +func signServiceMessagePart(key *ecdsa.PrivateKey, part stableMarshaler, sigWrite func(*refs.Signature)) error { + var sig *refs.Signature + + wrapper := StableMarshalerWrapper{ + SM: part, + } + // sign part + if err := signature.SignDataWithHandler( + key, + wrapper, + func(s *refs.Signature) { + sig = s + }, + ); err != nil { + return err + } + + // write part signature + sigWrite(sig) + + return nil +} diff --git a/api/signature/sign_test.go b/api/signature/sign_test.go new file mode 100644 index 00000000..23779c43 --- /dev/null +++ b/api/signature/sign_test.go @@ -0,0 +1,125 @@ +package signature + +import ( + "testing" + + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "github.com/stretchr/testify/require" +) + +func TestBalanceResponse(t *testing.T) { + dec := new(accounting.Decimal) + dec.SetValue(100) + + body := new(accounting.BalanceResponseBody) + body.SetBalance(dec) + + meta := new(session.ResponseMetaHeader) + meta.SetTTL(1) + + req := new(accounting.BalanceResponse) + req.SetBody(body) + req.SetMetaHeader(meta) + + // verify unsigned request + require.Error(t, VerifyServiceMessage(req)) + + key, err := crypto.LoadPrivateKey("Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s") + require.NoError(t, err) + + // sign request + require.NoError(t, SignServiceMessage(key, req)) + + // verification must pass + require.NoError(t, VerifyServiceMessage(req)) + + // add level to meta header matryoshka + meta = new(session.ResponseMetaHeader) + meta.SetOrigin(req.GetMetaHeader()) + req.SetMetaHeader(meta) + + // sign request + require.NoError(t, SignServiceMessage(key, req)) + + // verification must pass + require.NoError(t, VerifyServiceMessage(req)) + + // corrupt body + dec.SetValue(dec.GetValue() + 1) + + // verification must fail + require.Error(t, VerifyServiceMessage(req)) + + // restore body + dec.SetValue(dec.GetValue() - 1) + + // corrupt meta header + meta.SetTTL(meta.GetTTL() + 1) + + // verification must fail + require.Error(t, VerifyServiceMessage(req)) + + // restore meta header + meta.SetTTL(meta.GetTTL() - 1) + + // corrupt origin verification header + req.GetVerificationHeader().SetOrigin(nil) + + // verification must fail + require.Error(t, VerifyServiceMessage(req)) +} + +func BenchmarkSignRequest(b *testing.B) { + key, _ := crypto.LoadPrivateKey("Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s") + + b.ResetTimer() + b.ReportAllocs() + + for range b.N { + b.StopTimer() + dec := new(accounting.Decimal) + dec.SetValue(100) + + body := new(accounting.BalanceResponseBody) + body.SetBalance(dec) + + meta := new(session.ResponseMetaHeader) + meta.SetTTL(1) + + resp := new(accounting.BalanceResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + + b.StartTimer() + SignServiceMessage(key, resp) + } +} + +func BenchmarkVerifyRequest(b *testing.B) { + key, _ := crypto.LoadPrivateKey("Kwk6k2eC3L3QuPvD8aiaNyoSXgQ2YL1bwS5CP1oKoA9waeAze97s") + + b.ResetTimer() + b.ReportAllocs() + + for range b.N { + b.StopTimer() + dec := new(accounting.Decimal) + dec.SetValue(100) + + body := new(accounting.BalanceResponseBody) + body.SetBalance(dec) + + meta := new(session.ResponseMetaHeader) + meta.SetTTL(1) + + resp := new(accounting.BalanceResponse) + resp.SetBody(body) + resp.SetMetaHeader(meta) + SignServiceMessage(key, resp) + b.StartTimer() + + VerifyServiceMessage(resp) + } +} diff --git a/api/signature/verify.go b/api/signature/verify.go new file mode 100644 index 00000000..26dda83f --- /dev/null +++ b/api/signature/verify.go @@ -0,0 +1,127 @@ +package signature + +import ( + "errors" + "fmt" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/signature" + "golang.org/x/sync/errgroup" +) + +type signatureProvider interface { + GetBodySignature() *refs.Signature + GetMetaSignature() *refs.Signature + GetOriginSignature() *refs.Signature +} + +// VerifyServiceMessage verifies service message. +func VerifyServiceMessage(msg any) error { + switch v := msg.(type) { + case nil: + return nil + case serviceRequest: + return verifyServiceRequest(v) + case serviceResponse: + return verifyServiceResponse(v) + default: + panic(fmt.Sprintf("unsupported session message %T", v)) + } +} + +func verifyServiceRequest(v serviceRequest) error { + meta := v.GetMetaHeader() + verificationHeader := v.GetVerificationHeader() + body := serviceMessageBody(v) + return verifyServiceRequestRecursive(body, meta, verificationHeader) +} + +func verifyServiceRequestRecursive(body stableMarshaler, meta *session.RequestMetaHeader, verify *session.RequestVerificationHeader) error { + verificationHeaderOrigin := verify.GetOrigin() + metaOrigin := meta.GetOrigin() + + stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify) + if err != nil { + return err + } + if stop { + return nil + } + + return verifyServiceRequestRecursive(body, metaOrigin, verificationHeaderOrigin) +} + +func verifyMessageParts(body, meta, originHeader stableMarshaler, hasOriginHeader bool, sigProvider signatureProvider) (stop bool, err error) { + eg := &errgroup.Group{} + + eg.Go(func() error { + if err := verifyServiceMessagePart(meta, sigProvider.GetMetaSignature); err != nil { + return fmt.Errorf("could not verify meta header: %w", err) + } + return nil + }) + + eg.Go(func() error { + if err := verifyServiceMessagePart(originHeader, sigProvider.GetOriginSignature); err != nil { + return fmt.Errorf("could not verify origin of verification header: %w", err) + } + return nil + }) + + if !hasOriginHeader { + eg.Go(func() error { + if err := verifyServiceMessagePart(body, sigProvider.GetBodySignature); err != nil { + return fmt.Errorf("could not verify body: %w", err) + } + return nil + }) + } + + if err := eg.Wait(); err != nil { + return false, err + } + + if !hasOriginHeader { + return true, nil + } + + if sigProvider.GetBodySignature() != nil { + return false, errors.New("body signature misses at the matryoshka upper level") + } + + return false, nil +} + +func verifyServiceResponse(v serviceResponse) error { + meta := v.GetMetaHeader() + verificationHeader := v.GetVerificationHeader() + body := serviceMessageBody(v) + return verifyServiceResponseRecursive(body, meta, verificationHeader) +} + +func verifyServiceResponseRecursive(body stableMarshaler, meta *session.ResponseMetaHeader, verify *session.ResponseVerificationHeader) error { + verificationHeaderOrigin := verify.GetOrigin() + metaOrigin := meta.GetOrigin() + + stop, err := verifyMessageParts(body, meta, verificationHeaderOrigin, verificationHeaderOrigin != nil, verify) + if err != nil { + return err + } + if stop { + return nil + } + + return verifyServiceResponseRecursive(body, metaOrigin, verificationHeaderOrigin) +} + +func verifyServiceMessagePart(part stableMarshaler, sigRdr func() *refs.Signature) error { + wrapper := StableMarshalerWrapper{ + SM: part, + } + + return signature.VerifyDataWithSource( + wrapper, + sigRdr, + ) +} diff --git a/api/status/convert.go b/api/status/convert.go new file mode 100644 index 00000000..9b273dde --- /dev/null +++ b/api/status/convert.go @@ -0,0 +1,95 @@ +package status + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + status "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" +) + +func (x *Detail) ToGRPCMessage() grpc.Message { + var m *status.Status_Detail + + if x != nil { + m = new(status.Status_Detail) + + m.SetId(x.id) + m.SetValue(x.val) + } + + return m +} + +func (x *Detail) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*status.Status_Detail) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + x.id = v.GetId() + x.val = v.GetValue() + + return nil +} + +func CodeFromGRPC(v uint32) Code { + return Code(v) +} + +func CodeToGRPC(v Code) uint32 { + return uint32(v) +} + +func (x *Status) ToGRPCMessage() grpc.Message { + var m *status.Status + + if x != nil { + m = new(status.Status) + + m.SetCode(CodeToGRPC(x.code)) + m.SetMessage(x.msg) + + var ds []*status.Status_Detail + + if ln := len(x.details); ln > 0 { + ds = make([]*status.Status_Detail, 0, ln) + + for i := range ln { + ds = append(ds, x.details[i].ToGRPCMessage().(*status.Status_Detail)) + } + } + + m.SetDetails(ds) + } + + return m +} + +func (x *Status) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*status.Status) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var ( + ds []Detail + dsV2 = v.GetDetails() + ) + + if dsV2 != nil { + ln := len(dsV2) + + ds = make([]Detail, ln) + + for i := range ln { + if err := ds[i].FromGRPCMessage(dsV2[i]); err != nil { + return err + } + } + } + + x.details = ds + x.msg = v.GetMessage() + x.code = CodeFromGRPC(v.GetCode()) + + return nil +} diff --git a/api/status/details.go b/api/status/details.go new file mode 100644 index 00000000..5b8f4603 --- /dev/null +++ b/api/status/details.go @@ -0,0 +1,8 @@ +package status + +// details for WrongMagicNumber code. +const ( + // DetailIDCorrectMagic is an identifier of details with correct network magic + // which can be attached to WrongMagicNumber code. + DetailIDCorrectMagic = iota +) diff --git a/api/status/grpc/types.pb.go b/api/status/grpc/types.pb.go new file mode 100644 index 00000000..a23fc090 --- /dev/null +++ b/api/status/grpc/types.pb.go @@ -0,0 +1,748 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/status/grpc/types.proto + +//go:build !protoopaque + +package status + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Section identifiers. +type Section int32 + +const ( + // Successful return codes. + Section_SECTION_SUCCESS Section = 0 + // Failure codes regardless of the operation. + Section_SECTION_FAILURE_COMMON Section = 1 + // Object service-specific errors. + Section_SECTION_OBJECT Section = 2 + // Container service-specific errors. + Section_SECTION_CONTAINER Section = 3 + // Session service-specific errors. + Section_SECTION_SESSION Section = 4 + // Session service-specific errors. + Section_SECTION_APE_MANAGER Section = 5 +) + +// Enum value maps for Section. +var ( + Section_name = map[int32]string{ + 0: "SECTION_SUCCESS", + 1: "SECTION_FAILURE_COMMON", + 2: "SECTION_OBJECT", + 3: "SECTION_CONTAINER", + 4: "SECTION_SESSION", + 5: "SECTION_APE_MANAGER", + } + Section_value = map[string]int32{ + "SECTION_SUCCESS": 0, + "SECTION_FAILURE_COMMON": 1, + "SECTION_OBJECT": 2, + "SECTION_CONTAINER": 3, + "SECTION_SESSION": 4, + "SECTION_APE_MANAGER": 5, + } +) + +func (x Section) Enum() *Section { + p := new(Section) + *p = x + return p +} + +func (x Section) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Section) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Section) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[0] +} + +func (x Section) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of FrostFS successful return codes. +type Success int32 + +const ( + // [**0**] Default success. Not detailed. + // If the server cannot match successful outcome to the code, it should + // use this code. + Success_OK Success = 0 +) + +// Enum value maps for Success. +var ( + Success_name = map[int32]string{ + 0: "OK", + } + Success_value = map[string]int32{ + "OK": 0, + } +) + +func (x Success) Enum() *Success { + p := new(Success) + *p = x + return p +} + +func (x Success) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Success) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (Success) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[1] +} + +func (x Success) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of failed statuses independent of the operation. +type CommonFail int32 + +const ( + // [**1024**] Internal server error, default failure. Not detailed. + // If the server cannot match failed outcome to the code, it should + // use this code. + CommonFail_INTERNAL CommonFail = 0 + // [**1025**] Wrong magic of the FrostFS network. + // Details: + // - [**0**] Magic number of the served FrostFS network (big-endian 64-bit + // unsigned integer). + CommonFail_WRONG_MAGIC_NUMBER CommonFail = 1 + // [**1026**] Signature verification failure. + CommonFail_SIGNATURE_VERIFICATION_FAIL CommonFail = 2 + // [**1027**] Node is under maintenance. + CommonFail_NODE_UNDER_MAINTENANCE CommonFail = 3 + // [**1028**] Invalid argument error. If the server fails on validation of a + // request parameter as the client sent it incorrectly, then this code should + // be used. + CommonFail_INVALID_ARGUMENT CommonFail = 4 + // [**1029**] Resource exhausted failure. If the operation cannot be performed + // due to a lack of resources. + CommonFail_RESOURCE_EXHAUSTED CommonFail = 5 +) + +// Enum value maps for CommonFail. +var ( + CommonFail_name = map[int32]string{ + 0: "INTERNAL", + 1: "WRONG_MAGIC_NUMBER", + 2: "SIGNATURE_VERIFICATION_FAIL", + 3: "NODE_UNDER_MAINTENANCE", + 4: "INVALID_ARGUMENT", + 5: "RESOURCE_EXHAUSTED", + } + CommonFail_value = map[string]int32{ + "INTERNAL": 0, + "WRONG_MAGIC_NUMBER": 1, + "SIGNATURE_VERIFICATION_FAIL": 2, + "NODE_UNDER_MAINTENANCE": 3, + "INVALID_ARGUMENT": 4, + "RESOURCE_EXHAUSTED": 5, + } +) + +func (x CommonFail) Enum() *CommonFail { + p := new(CommonFail) + *p = x + return p +} + +func (x CommonFail) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CommonFail) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (CommonFail) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[2] +} + +func (x CommonFail) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of statuses for object-related operations. +type Object int32 + +const ( + // [**2048**] Access denied by ACL. + // Details: + // - [**0**] Human-readable description (UTF-8 encoded string). + Object_ACCESS_DENIED Object = 0 + // [**2049**] Object not found. + Object_OBJECT_NOT_FOUND Object = 1 + // [**2050**] Operation rejected by the object lock. + Object_LOCKED Object = 2 + // [**2051**] Locking an object with a non-REGULAR type rejected. + Object_LOCK_NON_REGULAR_OBJECT Object = 3 + // [**2052**] Object has been marked deleted. + Object_OBJECT_ALREADY_REMOVED Object = 4 + // [**2053**] Invalid range has been requested for an object. + Object_OUT_OF_RANGE Object = 5 +) + +// Enum value maps for Object. +var ( + Object_name = map[int32]string{ + 0: "ACCESS_DENIED", + 1: "OBJECT_NOT_FOUND", + 2: "LOCKED", + 3: "LOCK_NON_REGULAR_OBJECT", + 4: "OBJECT_ALREADY_REMOVED", + 5: "OUT_OF_RANGE", + } + Object_value = map[string]int32{ + "ACCESS_DENIED": 0, + "OBJECT_NOT_FOUND": 1, + "LOCKED": 2, + "LOCK_NON_REGULAR_OBJECT": 3, + "OBJECT_ALREADY_REMOVED": 4, + "OUT_OF_RANGE": 5, + } +) + +func (x Object) Enum() *Object { + p := new(Object) + *p = x + return p +} + +func (x Object) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Object) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[3].Descriptor() +} + +func (Object) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[3] +} + +func (x Object) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of statuses for container-related operations. +type Container int32 + +const ( + // [**3072**] Container not found. + Container_CONTAINER_NOT_FOUND Container = 0 + // [**3073**] eACL table not found. + Container_EACL_NOT_FOUND Container = 1 + // [**3074**] Container access denied. + Container_CONTAINER_ACCESS_DENIED Container = 2 +) + +// Enum value maps for Container. +var ( + Container_name = map[int32]string{ + 0: "CONTAINER_NOT_FOUND", + 1: "EACL_NOT_FOUND", + 2: "CONTAINER_ACCESS_DENIED", + } + Container_value = map[string]int32{ + "CONTAINER_NOT_FOUND": 0, + "EACL_NOT_FOUND": 1, + "CONTAINER_ACCESS_DENIED": 2, + } +) + +func (x Container) Enum() *Container { + p := new(Container) + *p = x + return p +} + +func (x Container) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Container) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[4].Descriptor() +} + +func (Container) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[4] +} + +func (x Container) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of statuses for session-related operations. +type Session int32 + +const ( + // [**4096**] Token not found. + Session_TOKEN_NOT_FOUND Session = 0 + // [**4097**] Token has expired. + Session_TOKEN_EXPIRED Session = 1 +) + +// Enum value maps for Session. +var ( + Session_name = map[int32]string{ + 0: "TOKEN_NOT_FOUND", + 1: "TOKEN_EXPIRED", + } + Session_value = map[string]int32{ + "TOKEN_NOT_FOUND": 0, + "TOKEN_EXPIRED": 1, + } +) + +func (x Session) Enum() *Session { + p := new(Session) + *p = x + return p +} + +func (x Session) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Session) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[5].Descriptor() +} + +func (Session) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[5] +} + +func (x Session) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of status for APE manager related operations. +type APEManager int32 + +const ( + // [**5120**] The operation is denied by APE manager. + APEManager_APE_MANAGER_ACCESS_DENIED APEManager = 0 +) + +// Enum value maps for APEManager. +var ( + APEManager_name = map[int32]string{ + 0: "APE_MANAGER_ACCESS_DENIED", + } + APEManager_value = map[string]int32{ + "APE_MANAGER_ACCESS_DENIED": 0, + } +) + +func (x APEManager) Enum() *APEManager { + p := new(APEManager) + *p = x + return p +} + +func (x APEManager) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (APEManager) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[6].Descriptor() +} + +func (APEManager) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[6] +} + +func (x APEManager) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Declares the general format of the status returns of the FrostFS RPC +// protocol. Status is present in all response messages. Each RPC of FrostFS +// protocol describes the possible outcomes and details of the operation. +// +// Each status is assigned a one-to-one numeric code. Any unique result of an +// operation in FrostFS is unambiguously associated with the code value. +// +// Numerical set of codes is split into 1024-element sections. An enumeration +// is defined for each section. Values can be referred to in the following ways: +// +// * numerical value ranging from 0 to 4,294,967,295 (global code); +// +// - values from enumeration (local code). The formula for the ratio of the +// local code (`L`) of a defined section (`S`) to the global one (`G`): +// `G = 1024 * S + L`. +// +// All outcomes are divided into successful and failed, which corresponds +// to the success or failure of the operation. The definition of success +// follows the semantics of RPC and the description of its purpose. +// The server must not attach code that is the opposite of the outcome type. +// +// See the set of return codes in the description for calls. +// +// Each status can carry a developer-facing error message. It should be a human +// readable text in English. The server should not transmit (and the client +// should not expect) useful information in the message. Field `details` +// should make the return more detailed. +type Status struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The status code + Code *uint32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` + // Developer-facing error message + Message *string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + // Data detailing the outcome of the operation. Must be unique by ID. + Details []*Status_Detail `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Status) Reset() { + *x = Status{} + mi := &file_api_status_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_api_status_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Status) GetCode() uint32 { + if x != nil && x.Code != nil { + return *x.Code + } + return 0 +} + +func (x *Status) GetMessage() string { + if x != nil && x.Message != nil { + return *x.Message + } + return "" +} + +func (x *Status) GetDetails() []*Status_Detail { + if x != nil { + return x.Details + } + return nil +} + +func (x *Status) SetCode(v uint32) { + x.Code = &v +} + +func (x *Status) SetMessage(v string) { + x.Message = &v +} + +func (x *Status) SetDetails(v []*Status_Detail) { + x.Details = v +} + +func (x *Status) HasCode() bool { + if x == nil { + return false + } + return x.Code != nil +} + +func (x *Status) HasMessage() bool { + if x == nil { + return false + } + return x.Message != nil +} + +func (x *Status) ClearCode() { + x.Code = nil +} + +func (x *Status) ClearMessage() { + x.Message = nil +} + +type Status_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The status code + Code *uint32 + // Developer-facing error message + Message *string + // Data detailing the outcome of the operation. Must be unique by ID. + Details []*Status_Detail +} + +func (b0 Status_builder) Build() *Status { + m0 := &Status{} + b, x := &b0, m0 + _, _ = b, x + x.Code = b.Code + x.Message = b.Message + x.Details = b.Details + return m0 +} + +// Return detail. It contains additional information that can be used to +// analyze the response. Each code defines a set of details that can be +// attached to a status. Client should not handle details that are not +// covered by the code. +type Status_Detail struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // Detail ID. The identifier is required to determine the binary format + // of the detail and how to decode it. + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + // Binary status detail. Must follow the format associated with ID. + // The possibility of missing a value must be explicitly allowed. + Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Status_Detail) Reset() { + *x = Status_Detail{} + mi := &file_api_status_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Status_Detail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status_Detail) ProtoMessage() {} + +func (x *Status_Detail) ProtoReflect() protoreflect.Message { + mi := &file_api_status_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Status_Detail) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *Status_Detail) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *Status_Detail) SetId(v uint32) { + x.Id = &v +} + +func (x *Status_Detail) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.Value = v +} + +func (x *Status_Detail) HasId() bool { + if x == nil { + return false + } + return x.Id != nil +} + +func (x *Status_Detail) HasValue() bool { + if x == nil { + return false + } + return x.Value != nil +} + +func (x *Status_Detail) ClearId() { + x.Id = nil +} + +func (x *Status_Detail) ClearValue() { + x.Value = nil +} + +type Status_Detail_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Detail ID. The identifier is required to determine the binary format + // of the detail and how to decode it. + Id *uint32 + // Binary status detail. Must follow the format associated with ID. + // The possibility of missing a value must be explicitly allowed. + Value []byte +} + +func (b0 Status_Detail_builder) Build() *Status_Detail { + m0 := &Status_Detail{} + b, x := &b0, m0 + _, _ = b, x + x.Id = b.Id + x.Value = b.Value + return m0 +} + +var File_api_status_grpc_types_proto protoreflect.FileDescriptor + +var file_api_status_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0xa1, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x1a, 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x2a, 0x93, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, + 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x42, 0x4a, 0x45, + 0x43, 0x54, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, + 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, + 0x12, 0x17, 0x0a, 0x13, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x50, 0x45, 0x5f, + 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x52, 0x10, 0x05, 0x2a, 0x11, 0x0a, 0x07, 0x53, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x9d, 0x01, 0x0a, + 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, + 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, + 0x4e, 0x47, 0x5f, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, + 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x56, + 0x45, 0x52, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, + 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x52, + 0x5f, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x14, + 0x0a, 0x10, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x41, 0x52, 0x47, 0x55, 0x4d, 0x45, + 0x4e, 0x54, 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, + 0x5f, 0x45, 0x58, 0x48, 0x41, 0x55, 0x53, 0x54, 0x45, 0x44, 0x10, 0x05, 0x2a, 0x88, 0x01, 0x0a, + 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, + 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x42, + 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, + 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, + 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, + 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, + 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, + 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, + 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x55, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, + 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, + 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, + 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x41, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x31, + 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, + 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, + 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, + 0x01, 0x2a, 0x2b, 0x0a, 0x0a, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, + 0x1d, 0x0a, 0x19, 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x52, 0x5f, 0x41, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x42, 0x62, + 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, + 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 7) +var file_api_status_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_status_grpc_types_proto_goTypes = []any{ + (Section)(0), // 0: neo.fs.v2.status.Section + (Success)(0), // 1: neo.fs.v2.status.Success + (CommonFail)(0), // 2: neo.fs.v2.status.CommonFail + (Object)(0), // 3: neo.fs.v2.status.Object + (Container)(0), // 4: neo.fs.v2.status.Container + (Session)(0), // 5: neo.fs.v2.status.Session + (APEManager)(0), // 6: neo.fs.v2.status.APEManager + (*Status)(nil), // 7: neo.fs.v2.status.Status + (*Status_Detail)(nil), // 8: neo.fs.v2.status.Status.Detail +} +var file_api_status_grpc_types_proto_depIdxs = []int32{ + 8, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_status_grpc_types_proto_init() } +func file_api_status_grpc_types_proto_init() { + if File_api_status_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_status_grpc_types_proto_rawDesc, + NumEnums: 7, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_status_grpc_types_proto_goTypes, + DependencyIndexes: file_api_status_grpc_types_proto_depIdxs, + EnumInfos: file_api_status_grpc_types_proto_enumTypes, + MessageInfos: file_api_status_grpc_types_proto_msgTypes, + }.Build() + File_api_status_grpc_types_proto = out.File + file_api_status_grpc_types_proto_rawDesc = nil + file_api_status_grpc_types_proto_goTypes = nil + file_api_status_grpc_types_proto_depIdxs = nil +} diff --git a/api/status/grpc/types_protoopaque.pb.go b/api/status/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..16ae0e94 --- /dev/null +++ b/api/status/grpc/types_protoopaque.pb.go @@ -0,0 +1,770 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/status/grpc/types.proto + +//go:build protoopaque + +package status + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Section identifiers. +type Section int32 + +const ( + // Successful return codes. + Section_SECTION_SUCCESS Section = 0 + // Failure codes regardless of the operation. + Section_SECTION_FAILURE_COMMON Section = 1 + // Object service-specific errors. + Section_SECTION_OBJECT Section = 2 + // Container service-specific errors. + Section_SECTION_CONTAINER Section = 3 + // Session service-specific errors. + Section_SECTION_SESSION Section = 4 + // Session service-specific errors. + Section_SECTION_APE_MANAGER Section = 5 +) + +// Enum value maps for Section. +var ( + Section_name = map[int32]string{ + 0: "SECTION_SUCCESS", + 1: "SECTION_FAILURE_COMMON", + 2: "SECTION_OBJECT", + 3: "SECTION_CONTAINER", + 4: "SECTION_SESSION", + 5: "SECTION_APE_MANAGER", + } + Section_value = map[string]int32{ + "SECTION_SUCCESS": 0, + "SECTION_FAILURE_COMMON": 1, + "SECTION_OBJECT": 2, + "SECTION_CONTAINER": 3, + "SECTION_SESSION": 4, + "SECTION_APE_MANAGER": 5, + } +) + +func (x Section) Enum() *Section { + p := new(Section) + *p = x + return p +} + +func (x Section) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Section) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[0].Descriptor() +} + +func (Section) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[0] +} + +func (x Section) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of FrostFS successful return codes. +type Success int32 + +const ( + // [**0**] Default success. Not detailed. + // If the server cannot match successful outcome to the code, it should + // use this code. + Success_OK Success = 0 +) + +// Enum value maps for Success. +var ( + Success_name = map[int32]string{ + 0: "OK", + } + Success_value = map[string]int32{ + "OK": 0, + } +) + +func (x Success) Enum() *Success { + p := new(Success) + *p = x + return p +} + +func (x Success) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Success) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[1].Descriptor() +} + +func (Success) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[1] +} + +func (x Success) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of failed statuses independent of the operation. +type CommonFail int32 + +const ( + // [**1024**] Internal server error, default failure. Not detailed. + // If the server cannot match failed outcome to the code, it should + // use this code. + CommonFail_INTERNAL CommonFail = 0 + // [**1025**] Wrong magic of the FrostFS network. + // Details: + // - [**0**] Magic number of the served FrostFS network (big-endian 64-bit + // unsigned integer). + CommonFail_WRONG_MAGIC_NUMBER CommonFail = 1 + // [**1026**] Signature verification failure. + CommonFail_SIGNATURE_VERIFICATION_FAIL CommonFail = 2 + // [**1027**] Node is under maintenance. + CommonFail_NODE_UNDER_MAINTENANCE CommonFail = 3 + // [**1028**] Invalid argument error. If the server fails on validation of a + // request parameter as the client sent it incorrectly, then this code should + // be used. + CommonFail_INVALID_ARGUMENT CommonFail = 4 + // [**1029**] Resource exhausted failure. If the operation cannot be performed + // due to a lack of resources. + CommonFail_RESOURCE_EXHAUSTED CommonFail = 5 +) + +// Enum value maps for CommonFail. +var ( + CommonFail_name = map[int32]string{ + 0: "INTERNAL", + 1: "WRONG_MAGIC_NUMBER", + 2: "SIGNATURE_VERIFICATION_FAIL", + 3: "NODE_UNDER_MAINTENANCE", + 4: "INVALID_ARGUMENT", + 5: "RESOURCE_EXHAUSTED", + } + CommonFail_value = map[string]int32{ + "INTERNAL": 0, + "WRONG_MAGIC_NUMBER": 1, + "SIGNATURE_VERIFICATION_FAIL": 2, + "NODE_UNDER_MAINTENANCE": 3, + "INVALID_ARGUMENT": 4, + "RESOURCE_EXHAUSTED": 5, + } +) + +func (x CommonFail) Enum() *CommonFail { + p := new(CommonFail) + *p = x + return p +} + +func (x CommonFail) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CommonFail) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[2].Descriptor() +} + +func (CommonFail) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[2] +} + +func (x CommonFail) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of statuses for object-related operations. +type Object int32 + +const ( + // [**2048**] Access denied by ACL. + // Details: + // - [**0**] Human-readable description (UTF-8 encoded string). + Object_ACCESS_DENIED Object = 0 + // [**2049**] Object not found. + Object_OBJECT_NOT_FOUND Object = 1 + // [**2050**] Operation rejected by the object lock. + Object_LOCKED Object = 2 + // [**2051**] Locking an object with a non-REGULAR type rejected. + Object_LOCK_NON_REGULAR_OBJECT Object = 3 + // [**2052**] Object has been marked deleted. + Object_OBJECT_ALREADY_REMOVED Object = 4 + // [**2053**] Invalid range has been requested for an object. + Object_OUT_OF_RANGE Object = 5 +) + +// Enum value maps for Object. +var ( + Object_name = map[int32]string{ + 0: "ACCESS_DENIED", + 1: "OBJECT_NOT_FOUND", + 2: "LOCKED", + 3: "LOCK_NON_REGULAR_OBJECT", + 4: "OBJECT_ALREADY_REMOVED", + 5: "OUT_OF_RANGE", + } + Object_value = map[string]int32{ + "ACCESS_DENIED": 0, + "OBJECT_NOT_FOUND": 1, + "LOCKED": 2, + "LOCK_NON_REGULAR_OBJECT": 3, + "OBJECT_ALREADY_REMOVED": 4, + "OUT_OF_RANGE": 5, + } +) + +func (x Object) Enum() *Object { + p := new(Object) + *p = x + return p +} + +func (x Object) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Object) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[3].Descriptor() +} + +func (Object) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[3] +} + +func (x Object) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of statuses for container-related operations. +type Container int32 + +const ( + // [**3072**] Container not found. + Container_CONTAINER_NOT_FOUND Container = 0 + // [**3073**] eACL table not found. + Container_EACL_NOT_FOUND Container = 1 + // [**3074**] Container access denied. + Container_CONTAINER_ACCESS_DENIED Container = 2 +) + +// Enum value maps for Container. +var ( + Container_name = map[int32]string{ + 0: "CONTAINER_NOT_FOUND", + 1: "EACL_NOT_FOUND", + 2: "CONTAINER_ACCESS_DENIED", + } + Container_value = map[string]int32{ + "CONTAINER_NOT_FOUND": 0, + "EACL_NOT_FOUND": 1, + "CONTAINER_ACCESS_DENIED": 2, + } +) + +func (x Container) Enum() *Container { + p := new(Container) + *p = x + return p +} + +func (x Container) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Container) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[4].Descriptor() +} + +func (Container) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[4] +} + +func (x Container) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of statuses for session-related operations. +type Session int32 + +const ( + // [**4096**] Token not found. + Session_TOKEN_NOT_FOUND Session = 0 + // [**4097**] Token has expired. + Session_TOKEN_EXPIRED Session = 1 +) + +// Enum value maps for Session. +var ( + Session_name = map[int32]string{ + 0: "TOKEN_NOT_FOUND", + 1: "TOKEN_EXPIRED", + } + Session_value = map[string]int32{ + "TOKEN_NOT_FOUND": 0, + "TOKEN_EXPIRED": 1, + } +) + +func (x Session) Enum() *Session { + p := new(Session) + *p = x + return p +} + +func (x Session) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Session) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[5].Descriptor() +} + +func (Session) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[5] +} + +func (x Session) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Section of status for APE manager related operations. +type APEManager int32 + +const ( + // [**5120**] The operation is denied by APE manager. + APEManager_APE_MANAGER_ACCESS_DENIED APEManager = 0 +) + +// Enum value maps for APEManager. +var ( + APEManager_name = map[int32]string{ + 0: "APE_MANAGER_ACCESS_DENIED", + } + APEManager_value = map[string]int32{ + "APE_MANAGER_ACCESS_DENIED": 0, + } +) + +func (x APEManager) Enum() *APEManager { + p := new(APEManager) + *p = x + return p +} + +func (x APEManager) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (APEManager) Descriptor() protoreflect.EnumDescriptor { + return file_api_status_grpc_types_proto_enumTypes[6].Descriptor() +} + +func (APEManager) Type() protoreflect.EnumType { + return &file_api_status_grpc_types_proto_enumTypes[6] +} + +func (x APEManager) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Declares the general format of the status returns of the FrostFS RPC +// protocol. Status is present in all response messages. Each RPC of FrostFS +// protocol describes the possible outcomes and details of the operation. +// +// Each status is assigned a one-to-one numeric code. Any unique result of an +// operation in FrostFS is unambiguously associated with the code value. +// +// Numerical set of codes is split into 1024-element sections. An enumeration +// is defined for each section. Values can be referred to in the following ways: +// +// * numerical value ranging from 0 to 4,294,967,295 (global code); +// +// - values from enumeration (local code). The formula for the ratio of the +// local code (`L`) of a defined section (`S`) to the global one (`G`): +// `G = 1024 * S + L`. +// +// All outcomes are divided into successful and failed, which corresponds +// to the success or failure of the operation. The definition of success +// follows the semantics of RPC and the description of its purpose. +// The server must not attach code that is the opposite of the outcome type. +// +// See the set of return codes in the description for calls. +// +// Each status can carry a developer-facing error message. It should be a human +// readable text in English. The server should not transmit (and the client +// should not expect) useful information in the message. Field `details` +// should make the return more detailed. +type Status struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Code uint32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` + xxx_hidden_Message *string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + xxx_hidden_Details *[]*Status_Detail `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Status) Reset() { + *x = Status{} + mi := &file_api_status_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_api_status_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Status) GetCode() uint32 { + if x != nil { + return x.xxx_hidden_Code + } + return 0 +} + +func (x *Status) GetMessage() string { + if x != nil { + if x.xxx_hidden_Message != nil { + return *x.xxx_hidden_Message + } + return "" + } + return "" +} + +func (x *Status) GetDetails() []*Status_Detail { + if x != nil { + if x.xxx_hidden_Details != nil { + return *x.xxx_hidden_Details + } + } + return nil +} + +func (x *Status) SetCode(v uint32) { + x.xxx_hidden_Code = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *Status) SetMessage(v string) { + x.xxx_hidden_Message = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *Status) SetDetails(v []*Status_Detail) { + x.xxx_hidden_Details = &v +} + +func (x *Status) HasCode() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Status) HasMessage() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Status) ClearCode() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Code = 0 +} + +func (x *Status) ClearMessage() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Message = nil +} + +type Status_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The status code + Code *uint32 + // Developer-facing error message + Message *string + // Data detailing the outcome of the operation. Must be unique by ID. + Details []*Status_Detail +} + +func (b0 Status_builder) Build() *Status { + m0 := &Status{} + b, x := &b0, m0 + _, _ = b, x + if b.Code != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_Code = *b.Code + } + if b.Message != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Message = b.Message + } + x.xxx_hidden_Details = &b.Details + return m0 +} + +// Return detail. It contains additional information that can be used to +// analyze the response. Each code defines a set of details that can be +// attached to a status. Client should not handle details that are not +// covered by the code. +type Status_Detail struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + xxx_hidden_Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Status_Detail) Reset() { + *x = Status_Detail{} + mi := &file_api_status_grpc_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Status_Detail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status_Detail) ProtoMessage() {} + +func (x *Status_Detail) ProtoReflect() protoreflect.Message { + mi := &file_api_status_grpc_types_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Status_Detail) GetId() uint32 { + if x != nil { + return x.xxx_hidden_Id + } + return 0 +} + +func (x *Status_Detail) GetValue() []byte { + if x != nil { + return x.xxx_hidden_Value + } + return nil +} + +func (x *Status_Detail) SetId(v uint32) { + x.xxx_hidden_Id = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2) +} + +func (x *Status_Detail) SetValue(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_Value = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *Status_Detail) HasId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Status_Detail) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Status_Detail) ClearId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_Id = 0 +} + +func (x *Status_Detail) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Value = nil +} + +type Status_Detail_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Detail ID. The identifier is required to determine the binary format + // of the detail and how to decode it. + Id *uint32 + // Binary status detail. Must follow the format associated with ID. + // The possibility of missing a value must be explicitly allowed. + Value []byte +} + +func (b0 Status_Detail_builder) Build() *Status_Detail { + m0 := &Status_Detail{} + b, x := &b0, m0 + _, _ = b, x + if b.Id != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2) + x.xxx_hidden_Id = *b.Id + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +var File_api_status_grpc_types_proto protoreflect.FileDescriptor + +var file_api_status_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, + 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0xa1, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, + 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x2e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x1a, 0x2e, 0x0a, 0x06, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x2a, 0x93, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x4f, 0x4e, 0x10, 0x01, + 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x42, 0x4a, 0x45, + 0x43, 0x54, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x53, + 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x04, + 0x12, 0x17, 0x0a, 0x13, 0x53, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x50, 0x45, 0x5f, + 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x52, 0x10, 0x05, 0x2a, 0x11, 0x0a, 0x07, 0x53, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x2a, 0x9d, 0x01, 0x0a, + 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x12, 0x0c, 0x0a, 0x08, 0x49, + 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x57, 0x52, 0x4f, + 0x4e, 0x47, 0x5f, 0x4d, 0x41, 0x47, 0x49, 0x43, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, + 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x56, + 0x45, 0x52, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, + 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4e, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x52, + 0x5f, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x14, + 0x0a, 0x10, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x41, 0x52, 0x47, 0x55, 0x4d, 0x45, + 0x4e, 0x54, 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, + 0x5f, 0x45, 0x58, 0x48, 0x41, 0x55, 0x53, 0x54, 0x45, 0x44, 0x10, 0x05, 0x2a, 0x88, 0x01, 0x0a, + 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, + 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x42, + 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, + 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, + 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4e, 0x4f, 0x4e, 0x5f, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, + 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x42, 0x4a, + 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x52, 0x45, 0x4d, 0x4f, + 0x56, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, + 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x05, 0x2a, 0x55, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, + 0x69, 0x6e, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, + 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, + 0x0e, 0x45, 0x41, 0x43, 0x4c, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, + 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x41, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x31, + 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x4f, 0x4b, + 0x45, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x11, + 0x0a, 0x0d, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, 0x45, 0x44, 0x10, + 0x01, 0x2a, 0x2b, 0x0a, 0x0a, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, + 0x1d, 0x0a, 0x19, 0x41, 0x50, 0x45, 0x5f, 0x4d, 0x41, 0x4e, 0x41, 0x47, 0x45, 0x52, 0x5f, 0x41, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x00, 0x42, 0x62, + 0x5a, 0x43, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, + 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0xaa, 0x02, 0x1a, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07, +} + +var file_api_status_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 7) +var file_api_status_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_status_grpc_types_proto_goTypes = []any{ + (Section)(0), // 0: neo.fs.v2.status.Section + (Success)(0), // 1: neo.fs.v2.status.Success + (CommonFail)(0), // 2: neo.fs.v2.status.CommonFail + (Object)(0), // 3: neo.fs.v2.status.Object + (Container)(0), // 4: neo.fs.v2.status.Container + (Session)(0), // 5: neo.fs.v2.status.Session + (APEManager)(0), // 6: neo.fs.v2.status.APEManager + (*Status)(nil), // 7: neo.fs.v2.status.Status + (*Status_Detail)(nil), // 8: neo.fs.v2.status.Status.Detail +} +var file_api_status_grpc_types_proto_depIdxs = []int32{ + 8, // 0: neo.fs.v2.status.Status.details:type_name -> neo.fs.v2.status.Status.Detail + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_status_grpc_types_proto_init() } +func file_api_status_grpc_types_proto_init() { + if File_api_status_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_status_grpc_types_proto_rawDesc, + NumEnums: 7, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_status_grpc_types_proto_goTypes, + DependencyIndexes: file_api_status_grpc_types_proto_depIdxs, + EnumInfos: file_api_status_grpc_types_proto_enumTypes, + MessageInfos: file_api_status_grpc_types_proto_msgTypes, + }.Build() + File_api_status_grpc_types_proto = out.File + file_api_status_grpc_types_proto_rawDesc = nil + file_api_status_grpc_types_proto_goTypes = nil + file_api_status_grpc_types_proto_depIdxs = nil +} diff --git a/api/status/marshal.go b/api/status/marshal.go new file mode 100644 index 00000000..663ead7c --- /dev/null +++ b/api/status/marshal.go @@ -0,0 +1,92 @@ +package status + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + status "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/grpc" + protoutil "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + _ = iota + detailIDFNum + detailValueFNum +) + +func (x *Detail) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var offset int + + offset += protoutil.UInt32Marshal(detailIDFNum, buf[offset:], x.id) + protoutil.BytesMarshal(detailValueFNum, buf[offset:], x.val) + + return buf +} + +func (x *Detail) StableSize() (size int) { + if x == nil { + return 0 + } + + size += protoutil.UInt32Size(detailIDFNum, x.id) + size += protoutil.BytesSize(detailValueFNum, x.val) + + return size +} + +func (x *Detail) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(status.Status_Detail)) +} + +const ( + _ = iota + statusCodeFNum + statusMsgFNum + statusDetailsFNum +) + +func (x *Status) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, x.StableSize()) + } + + var offset int + + offset += protoutil.UInt32Marshal(statusCodeFNum, buf[offset:], CodeToGRPC(x.code)) + offset += protoutil.StringMarshal(statusMsgFNum, buf[offset:], x.msg) + + for i := range x.details { + offset += protoutil.NestedStructureMarshal(statusDetailsFNum, buf[offset:], &x.details[i]) + } + + return buf +} + +func (x *Status) StableSize() (size int) { + if x == nil { + return 0 + } + + size += protoutil.UInt32Size(statusCodeFNum, CodeToGRPC(x.code)) + size += protoutil.StringSize(statusMsgFNum, x.msg) + + for i := range x.details { + size += protoutil.NestedStructureSize(statusDetailsFNum, &x.details[i]) + } + + return size +} + +func (x *Status) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(status.Status)) +} diff --git a/api/status/message_test.go b/api/status/message_test.go new file mode 100644 index 00000000..01850322 --- /dev/null +++ b/api/status/message_test.go @@ -0,0 +1,16 @@ +package status_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" + statustest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return statustest.Detail(empty) }, + func(empty bool) message.Message { return statustest.Status(empty) }, + ) +} diff --git a/api/status/status.go b/api/status/status.go new file mode 100644 index 00000000..7fe91114 --- /dev/null +++ b/api/status/status.go @@ -0,0 +1,105 @@ +package status + +const sectionBitSize = 10 + +// InSections checks if the Code is in [i,j] section list. +func (x Code) InSections(i, j uint32) bool { + return uint32(x) >= i< neo.fs.v2.refs.ObjectID + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_tombstone_grpc_types_proto_init() } +func file_api_tombstone_grpc_types_proto_init() { + if File_api_tombstone_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_tombstone_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_tombstone_grpc_types_proto_goTypes, + DependencyIndexes: file_api_tombstone_grpc_types_proto_depIdxs, + MessageInfos: file_api_tombstone_grpc_types_proto_msgTypes, + }.Build() + File_api_tombstone_grpc_types_proto = out.File + file_api_tombstone_grpc_types_proto_rawDesc = nil + file_api_tombstone_grpc_types_proto_goTypes = nil + file_api_tombstone_grpc_types_proto_depIdxs = nil +} diff --git a/api/tombstone/grpc/types_protoopaque.pb.go b/api/tombstone/grpc/types_protoopaque.pb.go new file mode 100644 index 00000000..7caeef25 --- /dev/null +++ b/api/tombstone/grpc/types_protoopaque.pb.go @@ -0,0 +1,224 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/tombstone/grpc/types.proto + +//go:build protoopaque + +package tombstone + +import ( + grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Tombstone keeps record of deleted objects for a few epochs until they are +// purged from the FrostFS network. +type Tombstone struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ExpirationEpoch uint64 `protobuf:"varint,1,opt,name=expiration_epoch,json=expirationEpoch" json:"expiration_epoch,omitempty"` + xxx_hidden_SplitId []byte `protobuf:"bytes,2,opt,name=split_id,json=splitID" json:"split_id,omitempty"` + xxx_hidden_Members *[]*grpc.ObjectID `protobuf:"bytes,3,rep,name=members" json:"members,omitempty"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Tombstone) Reset() { + *x = Tombstone{} + mi := &file_api_tombstone_grpc_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Tombstone) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Tombstone) ProtoMessage() {} + +func (x *Tombstone) ProtoReflect() protoreflect.Message { + mi := &file_api_tombstone_grpc_types_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Tombstone) GetExpirationEpoch() uint64 { + if x != nil { + return x.xxx_hidden_ExpirationEpoch + } + return 0 +} + +func (x *Tombstone) GetSplitId() []byte { + if x != nil { + return x.xxx_hidden_SplitId + } + return nil +} + +func (x *Tombstone) GetMembers() []*grpc.ObjectID { + if x != nil { + if x.xxx_hidden_Members != nil { + return *x.xxx_hidden_Members + } + } + return nil +} + +func (x *Tombstone) SetExpirationEpoch(v uint64) { + x.xxx_hidden_ExpirationEpoch = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 3) +} + +func (x *Tombstone) SetSplitId(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_SplitId = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *Tombstone) SetMembers(v []*grpc.ObjectID) { + x.xxx_hidden_Members = &v +} + +func (x *Tombstone) HasExpirationEpoch() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *Tombstone) HasSplitId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *Tombstone) ClearExpirationEpoch() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_ExpirationEpoch = 0 +} + +func (x *Tombstone) ClearSplitId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_SplitId = nil +} + +type Tombstone_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Last FrostFS epoch number of the tombstone lifetime. It's set by the + // tombstone creator depending on the current FrostFS network settings. A + // tombstone object must have the same expiration epoch value in + // `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated) + // attribute. Otherwise, the tombstone will be rejected by a storage node. + ExpirationEpoch *uint64 + // 16 byte UUID used to identify the split object hierarchy parts. Must be + // unique inside a container. All objects participating in the split must + // have the same `split_id` value. + SplitId []byte + // List of objects to be deleted. + Members []*grpc.ObjectID +} + +func (b0 Tombstone_builder) Build() *Tombstone { + m0 := &Tombstone{} + b, x := &b0, m0 + _, _ = b, x + if b.ExpirationEpoch != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 3) + x.xxx_hidden_ExpirationEpoch = *b.ExpirationEpoch + } + if b.SplitId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_SplitId = b.SplitId + } + x.xxx_hidden_Members = &b.Members + return m0 +} + +var File_api_tombstone_grpc_types_proto protoreflect.FileDescriptor + +var file_api_tombstone_grpc_types_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x13, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x74, 0x6f, 0x6d, 0x62, + 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, + 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x85, 0x01, 0x0a, 0x09, 0x54, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x12, 0x29, + 0x0a, 0x10, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, + 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x6c, + 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x70, 0x6c, + 0x69, 0x74, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, + 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x6b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x2e, + 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, + 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x74, 0x6f, 0x6d, + 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x74, 0x6f, 0x6d, 0x62, + 0x73, 0x74, 0x6f, 0x6e, 0x65, 0xaa, 0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x54, 0x6f, 0x6d, 0x62, + 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, + 0xe8, 0x07, +} + +var file_api_tombstone_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_api_tombstone_grpc_types_proto_goTypes = []any{ + (*Tombstone)(nil), // 0: neo.fs.v2.tombstone.Tombstone + (*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID +} +var file_api_tombstone_grpc_types_proto_depIdxs = []int32{ + 1, // 0: neo.fs.v2.tombstone.Tombstone.members:type_name -> neo.fs.v2.refs.ObjectID + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_api_tombstone_grpc_types_proto_init() } +func file_api_tombstone_grpc_types_proto_init() { + if File_api_tombstone_grpc_types_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_tombstone_grpc_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_tombstone_grpc_types_proto_goTypes, + DependencyIndexes: file_api_tombstone_grpc_types_proto_depIdxs, + MessageInfos: file_api_tombstone_grpc_types_proto_msgTypes, + }.Build() + File_api_tombstone_grpc_types_proto = out.File + file_api_tombstone_grpc_types_proto_rawDesc = nil + file_api_tombstone_grpc_types_proto_goTypes = nil + file_api_tombstone_grpc_types_proto_depIdxs = nil +} diff --git a/api/tombstone/json.go b/api/tombstone/json.go new file mode 100644 index 00000000..9b816fed --- /dev/null +++ b/api/tombstone/json.go @@ -0,0 +1,14 @@ +package tombstone + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + tombstone "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tombstone/grpc" +) + +func (s *Tombstone) MarshalJSON() ([]byte, error) { + return message.MarshalJSON(s) +} + +func (s *Tombstone) UnmarshalJSON(data []byte) error { + return message.UnmarshalJSON(s, data, new(tombstone.Tombstone)) +} diff --git a/api/tombstone/marshal.go b/api/tombstone/marshal.go new file mode 100644 index 00000000..dda94697 --- /dev/null +++ b/api/tombstone/marshal.go @@ -0,0 +1,56 @@ +package tombstone + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + tombstone "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tombstone/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" +) + +const ( + expFNum = 1 + splitIDFNum = 2 + membersFNum = 3 +) + +// StableMarshal marshals unified tombstone message in a protobuf +// compatible way without field order shuffle. +func (s *Tombstone) StableMarshal(buf []byte) []byte { + if s == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, s.StableSize()) + } + + var offset int + + offset += proto.UInt64Marshal(expFNum, buf[offset:], s.exp) + offset += proto.BytesMarshal(splitIDFNum, buf[offset:], s.splitID) + + for i := range s.members { + offset += proto.NestedStructureMarshal(membersFNum, buf[offset:], &s.members[i]) + } + + return buf +} + +// StableSize returns size of tombstone message marshalled by StableMarshal function. +func (s *Tombstone) StableSize() (size int) { + if s == nil { + return 0 + } + + size += proto.UInt64Size(expFNum, s.exp) + size += proto.BytesSize(splitIDFNum, s.splitID) + for i := range s.members { + size += proto.NestedStructureSize(membersFNum, &s.members[i]) + } + + return size +} + +// Unmarshal unmarshal tombstone message from its binary representation. +func (s *Tombstone) Unmarshal(data []byte) error { + return message.Unmarshal(s, data, new(tombstone.Tombstone)) +} diff --git a/api/tombstone/message_test.go b/api/tombstone/message_test.go new file mode 100644 index 00000000..dec17cc9 --- /dev/null +++ b/api/tombstone/message_test.go @@ -0,0 +1,15 @@ +package tombstone_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + messagetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message/test" + tombstonetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tombstone/test" +) + +func TestMessageConvert(t *testing.T) { + messagetest.TestRPCMessage(t, + func(empty bool) message.Message { return tombstonetest.GenerateTombstone(empty) }, + ) +} diff --git a/api/tombstone/test/generate.go b/api/tombstone/test/generate.go new file mode 100644 index 00000000..c71bd813 --- /dev/null +++ b/api/tombstone/test/generate.go @@ -0,0 +1,23 @@ +package tombstonetest + +import ( + "crypto/rand" + + refstest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tombstone" +) + +func GenerateTombstone(empty bool) *tombstone.Tombstone { + m := new(tombstone.Tombstone) + + if !empty { + id := make([]byte, 16) + _, _ = rand.Read(id) + + m.SetExpirationEpoch(89) + m.SetSplitID(id) + m.SetMembers(refstest.GenerateObjectIDs(false)) + } + + return m +} diff --git a/api/tombstone/types.go b/api/tombstone/types.go new file mode 100644 index 00000000..f28c69db --- /dev/null +++ b/api/tombstone/types.go @@ -0,0 +1,57 @@ +package tombstone + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" +) + +// Tombstone is a unified structure of Tombstone +// message from proto definition. +type Tombstone struct { + exp uint64 + + splitID []byte + + members []refs.ObjectID +} + +// GetExpirationEpoch returns number of tombstone expiration epoch. +func (s *Tombstone) GetExpirationEpoch() uint64 { + if s != nil { + return s.exp + } + + return 0 +} + +// SetExpirationEpoch sets number of tombstone expiration epoch. +func (s *Tombstone) SetExpirationEpoch(v uint64) { + s.exp = v +} + +// GetSplitID returns identifier of split object hierarchy. +func (s *Tombstone) GetSplitID() []byte { + if s != nil { + return s.splitID + } + + return nil +} + +// SetSplitID sets identifier of split object hierarchy. +func (s *Tombstone) SetSplitID(v []byte) { + s.splitID = v +} + +// GetMembers returns list of objects to be deleted. +func (s *Tombstone) GetMembers() []refs.ObjectID { + if s != nil { + return s.members + } + + return nil +} + +// SetMembers sets list of objects to be deleted. +func (s *Tombstone) SetMembers(v []refs.ObjectID) { + s.members = v +} diff --git a/api/tree/convert.go b/api/tree/convert.go new file mode 100644 index 00000000..1611504d --- /dev/null +++ b/api/tree/convert.go @@ -0,0 +1,1591 @@ +package tree + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message" + tree "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" +) + +func metaToGRPC(m []*KeyValue) (res []*tree.KeyValue) { + if m != nil { + res = make([]*tree.KeyValue, 0, len(m)) + + for i := range m { + res = append(res, m[i].ToGRPCMessage().(*tree.KeyValue)) + } + } + + return +} + +func metaFromGRPC(m []*tree.KeyValue) (res []*KeyValue, err error) { + if m != nil { + res = make([]*KeyValue, len(m)) + + for i := range m { + res[i] = new(KeyValue) + err = res[i].FromGRPCMessage(m[i]) + if err != nil { + return + } + } + } + + return +} + +func (r *AddResponse) ToGRPCMessage() grpc.Message { + var m *tree.AddResponse + + if r != nil { + m = new(tree.AddResponse) + + m.Body = r.body.ToGRPCMessage().(*tree.AddResponse_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *AddResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.AddResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(AddResponseBody) + } + + err = r.body.FromGRPCMessage(body) + } + + return err +} + +func (r *AddResponseBody) ToGRPCMessage() grpc.Message { + var m *tree.AddResponse_Body + + if r != nil { + m = new(tree.AddResponse_Body) + m.NodeId = r.nodeID + } + + return m +} + +func (r *AddResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.AddResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.nodeID = v.GetNodeId() + + return nil +} + +func (r *AddByPathRequest) ToGRPCMessage() grpc.Message { + var m *tree.AddByPathRequest + + if r != nil { + m = new(tree.AddByPathRequest) + + m.Body = r.body.ToGRPCMessage().(*tree.AddByPathRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *AddByPathRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.AddByPathRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(AddByPathRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *AddByPathRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.AddByPathRequest_Body + + if r != nil { + m = new(tree.AddByPathRequest_Body) + m.ContainerId = r.containerID + m.Path = r.path + m.BearerToken = r.bearerToken + m.PathAttribute = r.pathAttribute + m.TreeId = r.treeID + m.Meta = metaToGRPC(r.meta) + } + + return m +} + +func (r *AddByPathRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.AddByPathRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + meta := v.GetMeta() + if meta == nil { + r.meta = nil + } else { + r.meta, err = metaFromGRPC(meta) + if err != nil { + return err + } + } + + r.containerID = v.GetContainerId() + r.bearerToken = v.GetBearerToken() + r.path = v.GetPath() + r.pathAttribute = v.GetPathAttribute() + r.treeID = v.GetTreeId() + + return err +} + +func (r *MoveResponse) ToGRPCMessage() grpc.Message { + var m *tree.MoveResponse + + if r != nil { + m = new(tree.MoveResponse) + + m.Body = r.body.ToGRPCMessage().(*tree.MoveResponse_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *MoveResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.MoveResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(MoveResponseBody) + } + + err = r.body.FromGRPCMessage(body) + } + + return err +} + +func (r *MoveResponseBody) ToGRPCMessage() grpc.Message { + return new(tree.MoveResponse_Body) +} + +func (r *MoveResponseBody) FromGRPCMessage(grpc.Message) error { + return nil +} + +func (r *MoveRequest) ToGRPCMessage() grpc.Message { + var m *tree.MoveRequest + + if r != nil { + m = new(tree.MoveRequest) + m.Body = r.body.ToGRPCMessage().(*tree.MoveRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *MoveRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.MoveRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(MoveRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + + err = r.signature.FromGRPCMessage(sig) + if err != nil { + return err + } + } + + return nil +} + +func (r *MoveRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.MoveRequest_Body + + if r != nil { + m = new(tree.MoveRequest_Body) + + m.ContainerId = r.containerID + m.Meta = metaToGRPC(r.meta) + m.TreeId = r.treeID + m.ParentId = r.parentID + m.BearerToken = r.bearerToken + m.NodeId = r.nodeID + } + + return m +} + +func (r *MoveRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.MoveRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + r.meta, err = metaFromGRPC(v.GetMeta()) + if err != nil { + return err + } + r.treeID = v.GetTreeId() + r.nodeID = v.GetNodeId() + r.containerID = v.GetContainerId() + r.parentID = v.GetParentId() + r.bearerToken = v.GetBearerToken() + + return nil +} + +func (r *RemoveRequest) ToGRPCMessage() grpc.Message { + var m *tree.RemoveRequest + + if r != nil { + m = new(tree.RemoveRequest) + m.Body = r.body.ToGRPCMessage().(*tree.RemoveRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *RemoveRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.RemoveRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(RemoveRequestBody) + } + + err = r.body.FromGRPCMessage(body) + } + + return err +} + +func (r *RemoveRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.RemoveRequest_Body + + if r != nil { + m = new(tree.RemoveRequest_Body) + m.NodeId = r.nodeID + m.TreeId = r.treeID + m.BearerToken = r.bearerToken + m.ContainerId = r.containerID + } + + return m +} + +func (r *RemoveRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.RemoveRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.nodeID = v.GetNodeId() + r.treeID = v.GetTreeId() + r.containerID = v.GetContainerId() + r.bearerToken = v.GetBearerToken() + + return nil +} + +func (r *AddByPathResponse) ToGRPCMessage() grpc.Message { + var m *tree.AddByPathResponse + + if r != nil { + m = new(tree.AddByPathResponse) + m.Body = r.body.ToGRPCMessage().(*tree.AddByPathResponse_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *AddByPathResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.AddByPathResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(AddByPathResponseBody) + } + + err = r.body.FromGRPCMessage(body) + } + + return err +} + +func (r *AddByPathResponseBody) ToGRPCMessage() grpc.Message { + var m *tree.AddByPathResponse_Body + + if r != nil { + m = new(tree.AddByPathResponse_Body) + + m.ParentId = r.parentID + m.Nodes = r.nodes + } + + return m +} + +func (r *AddByPathResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.AddByPathResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + r.nodes = v.GetNodes() + r.parentID = v.GetParentId() + + return nil +} + +func (r *AddRequest) ToGRPCMessage() grpc.Message { + var m *tree.AddRequest + + if r != nil { + m = new(tree.AddRequest) + + m.Body = r.body.ToGRPCMessage().(*tree.AddRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *AddRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.AddRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(AddRequestBody) + } + + err = r.body.FromGRPCMessage(body) + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *AddRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.AddRequest_Body + + if r != nil { + m = new(tree.AddRequest_Body) + + m.Meta = metaToGRPC(r.meta) + m.TreeId = r.treeID + m.ParentId = r.parentID + m.ContainerId = r.containerID + m.BearerToken = r.bearerToken + } + + return m +} + +func (r *AddRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.AddRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.meta, err = metaFromGRPC(v.GetMeta()) + if err != nil { + return err + } + r.bearerToken = v.GetBearerToken() + r.treeID = v.GetTreeId() + r.containerID = v.GetContainerId() + r.parentID = v.GetParentId() + + return err +} + +func (r *RemoveResponse) ToGRPCMessage() grpc.Message { + var m *tree.RemoveResponse + + if r != nil { + m = new(tree.RemoveResponse) + m.Body = r.body.ToGRPCMessage().(*tree.RemoveResponse_Body) + } + + return m +} + +func (r *RemoveResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.RemoveResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(RemoveResponseBody) + } + + err = r.body.FromGRPCMessage(body) + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *RemoveResponseBody) ToGRPCMessage() grpc.Message { + return new(tree.RemoveResponse_Body) +} + +func (r *RemoveResponseBody) FromGRPCMessage(grpc.Message) error { + return nil +} + +func (r *GetNodeByPathRequest) ToGRPCMessage() grpc.Message { + var m *tree.GetNodeByPathRequest + + if r != nil { + m = new(tree.GetNodeByPathRequest) + + m.Body = r.body.ToGRPCMessage().(*tree.GetNodeByPathRequest_Body) + m.Signature = r.signature.ToGRPCMessage().(*tree.Signature) + } + + return m +} + +func (r *GetNodeByPathRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetNodeByPathRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetNodeByPathRequestBody) + } + + err = r.body.FromGRPCMessage(body) + } + + return err +} + +func (r *GetNodeByPathRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.GetNodeByPathRequest_Body + + if r != nil { + m = new(tree.GetNodeByPathRequest_Body) + + m.TreeId = r.treeID + m.Path = r.path + m.BearerToken = r.bearerToken + m.ContainerId = r.containerID + m.Attributes = r.attributes + m.PathAttribute = r.pathAttribute + m.AllAttributes = r.allAttributes + m.LatestOnly = r.latestOnly + } + + return m +} + +func (r *GetNodeByPathRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetNodeByPathRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.treeID = v.GetTreeId() + r.path = v.GetPath() + r.attributes = v.GetAttributes() + r.latestOnly = v.GetLatestOnly() + r.allAttributes = v.GetAllAttributes() + r.pathAttribute = v.GetPathAttribute() + r.containerID = v.GetContainerId() + r.bearerToken = v.GetBearerToken() + + return nil +} + +func (r *GetNodeByPathResponse) ToGRPCMessage() grpc.Message { + var m *tree.GetNodeByPathResponse + + if r != nil { + m = new(tree.GetNodeByPathResponse) + + m.Body = r.body.ToGRPCMessage().(*tree.GetNodeByPathResponse_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *GetNodeByPathResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetNodeByPathResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetNodeByPathResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *GetNodeByPathResponseBody) ToGRPCMessage() grpc.Message { + var m *tree.GetNodeByPathResponse_Body + + if r != nil { + m = new(tree.GetNodeByPathResponse_Body) + m.Nodes = GetNodeByPathInfoToGRPC(r.nodes) + } + + return m +} + +func (r *GetNodeByPathResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetNodeByPathResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.nodes, err = GetNodeByPathInfoFromGRPC(v.GetNodes()) + + return err +} + +func GetNodeByPathInfoToGRPC(m []*GetNodeByPathResponseInfo) (res []*tree.GetNodeByPathResponse_Info) { + if m != nil { + res = make([]*tree.GetNodeByPathResponse_Info, 0, len(m)) + + for i := range m { + res = append(res, m[i].ToGRPCMessage().(*tree.GetNodeByPathResponse_Info)) + } + } + + return +} + +func GetNodeByPathInfoFromGRPC(m []*tree.GetNodeByPathResponse_Info) (res []*GetNodeByPathResponseInfo, err error) { + if m != nil { + res = make([]*GetNodeByPathResponseInfo, len(m)) + + for i := range m { + res[i] = new(GetNodeByPathResponseInfo) + err = res[i].FromGRPCMessage(m[i]) + if err != nil { + return + } + } + } + + return +} + +func (r *GetNodeByPathResponseInfo) ToGRPCMessage() grpc.Message { + var m *tree.GetNodeByPathResponse_Info + + if r != nil { + m = new(tree.GetNodeByPathResponse_Info) + + m.Meta = metaToGRPC(r.meta) + m.NodeId = r.nodeID + m.Timestamp = r.timestamp + m.ParentId = r.parentID + } + + return m +} + +func (r *GetNodeByPathResponseInfo) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetNodeByPathResponse_Info) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.meta, err = metaFromGRPC(v.GetMeta()) + if err != nil { + return err + } + r.timestamp = v.GetTimestamp() + r.nodeID = v.GetNodeId() + r.parentID = v.GetParentId() + + return err +} + +func (r *ListRequest) ToGRPCMessage() grpc.Message { + var m *tree.TreeListRequest + + if r != nil { + m = new(tree.TreeListRequest) + + m.Body = r.body.ToGRPCMessage().(*tree.TreeListRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *ListRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.TreeListRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ListRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *ListRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.TreeListRequest_Body + + if r != nil { + m = new(tree.TreeListRequest_Body) + + m.ContainerId = r.containerID + } + + return m +} + +func (r *ListRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.TreeListRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + r.containerID = v.GetContainerId() + + return nil +} + +func (r *ListResponse) ToGRPCMessage() grpc.Message { + var m *tree.TreeListResponse + + if r != nil { + m = new(tree.TreeListResponse) + + m.Body = r.body.ToGRPCMessage().(*tree.TreeListResponse_Body) + m.Signature = r.signature.ToGRPCMessage().(*tree.Signature) + } + + return m +} + +func (r *ListResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.TreeListResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ListResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *ListResponseBody) ToGRPCMessage() grpc.Message { + var m *tree.TreeListResponse_Body + + if r != nil { + m = new(tree.TreeListResponse_Body) + m.Ids = r.ids + } + + return m +} + +func (r *ListResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.TreeListResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + r.ids = v.GetIds() + + return nil +} + +func (r *ApplyRequest) ToGRPCMessage() grpc.Message { + var m *tree.ApplyRequest + + if r != nil { + m = new(tree.ApplyRequest) + + m.Body = r.body.ToGRPCMessage().(*tree.ApplyRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *ApplyRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.ApplyRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ApplyRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *ApplyRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.ApplyRequest_Body + + if r != nil { + m = new(tree.ApplyRequest_Body) + + m.TreeId = r.treeID + m.ContainerId = r.containerID + m.Operation = r.operation.ToGRPCMessage().(*tree.LogMove) + } + + return m +} + +func (r *ApplyRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.ApplyRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + r.treeID = v.GetTreeId() + r.containerID = v.GetContainerId() + op := v.GetOperation() + if op == nil { + r.operation = nil + } else { + if r.operation == nil { + r.operation = new(LogMove) + } + err = r.operation.FromGRPCMessage(op) + } + + return err +} + +func (r *ApplyResponse) ToGRPCMessage() grpc.Message { + var m *tree.ApplyResponse + + if r != nil { + m = new(tree.ApplyResponse) + + m.Body = r.body.ToGRPCMessage().(*tree.ApplyResponse_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *ApplyResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.ApplyResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(ApplyResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *ApplyResponseBody) ToGRPCMessage() grpc.Message { + return new(tree.ApplyResponse_Body) +} + +func (r *ApplyResponseBody) FromGRPCMessage(grpc.Message) error { + return nil +} + +func (r *HealthcheckRequest) ToGRPCMessage() grpc.Message { + var m *tree.HealthcheckRequest + + if r != nil { + m = new(tree.HealthcheckRequest) + + m.Body = r.body.ToGRPCMessage().(*tree.HealthcheckRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *HealthcheckRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.HealthcheckRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(HealthcheckRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *HealthcheckRequestBody) ToGRPCMessage() grpc.Message { + return new(tree.HealthcheckRequest_Body) +} + +func (r *HealthcheckRequestBody) FromGRPCMessage(grpc.Message) error { + return nil +} + +func (r *HealthcheckResponse) ToGRPCMessage() grpc.Message { + var m *tree.HealthcheckResponse + + if r != nil { + m = new(tree.HealthcheckResponse) + + m.Body = r.body.ToGRPCMessage().(*tree.HealthcheckResponse_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *HealthcheckResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.HealthcheckResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(HealthcheckResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *HealthcheckResponseBody) ToGRPCMessage() grpc.Message { + return new(tree.HealthcheckResponse_Body) +} + +func (r *HealthcheckResponseBody) FromGRPCMessage(grpc.Message) error { + return nil +} + +func (r *GetSubTreeResponse) ToGRPCMessage() grpc.Message { + var m *tree.GetSubTreeResponse + + if r != nil { + m = new(tree.GetSubTreeResponse) + + m.Body = r.body.ToGRPCMessage().(*tree.GetSubTreeResponse_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *GetSubTreeResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetSubTreeResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetSubTreeResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *GetOpLogRequest) ToGRPCMessage() grpc.Message { + var m *tree.GetOpLogRequest + + if r != nil { + m = new(tree.GetOpLogRequest) + + m.Body = r.body.ToGRPCMessage().(*tree.GetOpLogRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *GetOpLogRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetOpLogRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetOpLogRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *GetOpLogRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.GetOpLogRequest_Body + + if r != nil { + m = new(tree.GetOpLogRequest_Body) + + m.TreeId = r.treeID + m.Count = r.count + m.ContainerId = r.containerID + m.Height = r.height + } + + return m +} + +func (r *GetOpLogRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetOpLogRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.count = v.GetCount() + r.containerID = v.GetContainerId() + r.height = v.GetHeight() + r.treeID = v.GetTreeId() + + return err +} + +func (r *GetOpLogResponse) ToGRPCMessage() grpc.Message { + var m *tree.GetOpLogResponse + + if r != nil { + m = new(tree.GetOpLogResponse) + + m.Body = r.body.ToGRPCMessage().(*tree.GetOpLogResponse_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *GetOpLogResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetOpLogResponse) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetOpLogResponseBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *GetOpLogResponseBody) ToGRPCMessage() grpc.Message { + var m *tree.GetOpLogResponse_Body + + if r != nil { + m = new(tree.GetOpLogResponse_Body) + + m.Operation = r.operation.ToGRPCMessage().(*tree.LogMove) + } + + return m +} + +func (r *GetOpLogResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetOpLogResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + oper := v.GetOperation() + if oper == nil { + r.operation = nil + } else { + if r.operation == nil { + r.operation = new(LogMove) + } + + err = r.operation.FromGRPCMessage(oper) + } + + return err +} + +func (s *Signature) ToGRPCMessage() grpc.Message { + var m *tree.Signature + + if s != nil { + m = new(tree.Signature) + + m.Sign = s.sign + m.Key = s.key + } + + return m +} + +func (s *Signature) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.Signature) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + s.sign = v.GetSign() + s.key = v.GetKey() + + return nil +} + +func (k *KeyValue) ToGRPCMessage() grpc.Message { + var m *tree.KeyValue + + if k != nil { + m = new(tree.KeyValue) + + m.Key = k.key + m.Value = k.value + } + + return m +} + +func (k *KeyValue) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.KeyValue) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + k.key = v.GetKey() + k.value = v.GetValue() + + return nil +} + +func (g *LogMove) ToGRPCMessage() grpc.Message { + var m *tree.LogMove + + if g != nil { + m = new(tree.LogMove) + + m.Meta = g.meta + m.ParentId = g.parentID + m.ChildId = g.childID + } + + return m +} + +func (g *LogMove) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.LogMove) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + g.meta = v.GetMeta() + g.parentID = v.GetParentId() + g.childID = v.GetChildId() + + return nil +} + +func (r *GetSubTreeRequest) ToGRPCMessage() grpc.Message { + var m *tree.GetSubTreeRequest + + if r != nil { + m = new(tree.GetSubTreeRequest) + + m.Body = r.body.ToGRPCMessage().(*tree.GetSubTreeRequest_Body) + m.SetSignature(r.signature.ToGRPCMessage().(*tree.Signature)) + } + + return m +} + +func (r *GetSubTreeRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetSubTreeRequest) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + body := v.GetBody() + if body == nil { + r.body = nil + } else { + if r.body == nil { + r.body = new(GetSubTreeRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + sig := v.GetSignature() + if sig == nil { + r.signature = nil + } else { + if r.signature == nil { + r.signature = new(Signature) + } + err = r.signature.FromGRPCMessage(sig) + } + + return err +} + +func (r *GetSubTreeRequestBody) ToGRPCMessage() grpc.Message { + var m *tree.GetSubTreeRequest_Body + + if r != nil { + m = new(tree.GetSubTreeRequest_Body) + + m.TreeId = r.treeID + m.BearerToken = r.bearerToken + m.Depth = r.depth + m.RootId = r.rootID + m.ContainerId = r.containerID + m.OrderBy = r.orderBy.ToGRPCMessage().(*tree.GetSubTreeRequest_Body_Order) + } + + return m +} + +func (r *GetSubTreeRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetSubTreeRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.rootID = v.GetRootId() + r.depth = v.GetDepth() + r.containerID = v.GetContainerId() + r.bearerToken = v.GetBearerToken() + r.treeID = v.GetTreeId() + + var err error + order := v.GetOrderBy() + if order == nil { + r.orderBy = nil + } else { + if r.orderBy == nil { + r.orderBy = new(GetSubTreeRequestBodyOrder) + } + + err = r.orderBy.FromGRPCMessage(order) + if err != nil { + return err + } + } + + return err +} +func (r *GetSubTreeRequestBodyOrder) ToGRPCMessage() grpc.Message { + var m *tree.GetSubTreeRequest_Body_Order + + if r != nil { + m = new(tree.GetSubTreeRequest_Body_Order) + + m.Direction = tree.GetSubTreeRequest_Body_Order_Direction(r.direction) + } + + return m +} + +func (r *GetSubTreeRequestBodyOrder) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetSubTreeRequest_Body_Order) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + r.direction = GetSubTreeRequestBodyOrderDirection(v.GetDirection()) + + return nil +} + +func (r *GetSubTreeResponseBody) ToGRPCMessage() grpc.Message { + var m *tree.GetSubTreeResponse_Body + + if r != nil { + m = new(tree.GetSubTreeResponse_Body) + + m.Meta = metaToGRPC(r.meta) + m.ParentId = r.parentID + m.NodeId = r.nodeID + m.Timestamp = r.timestamp + } + + return m +} + +func (r *GetSubTreeResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*tree.GetSubTreeResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + var err error + + r.nodeID = v.GetNodeId() + r.timestamp = v.GetTimestamp() + r.parentID = v.GetParentId() + r.meta, err = metaFromGRPC(v.GetMeta()) + + return err +} diff --git a/api/tree/types.go b/api/tree/types.go new file mode 100644 index 00000000..d20f946e --- /dev/null +++ b/api/tree/types.go @@ -0,0 +1,953 @@ +package tree + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + tree "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" +) + +type AddRequest struct { + body *AddRequestBody + signature *Signature +} + +func (r *AddRequest) GetBody() *AddRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *AddRequest) SetBody(v *AddRequestBody) { + r.body = v +} + +func (r *AddRequest) GetSignature() *tree.Signature { + return r.signature.ToGRPCMessage().(*tree.Signature) +} + +func (r *AddRequest) SetSignature(signature *tree.Signature) error { + if r.signature == nil { + r.signature = new(Signature) + } + + return r.signature.FromGRPCMessage(signature) +} + +func (r *AddRequest) SignedDataSize() int { + return r.body.ToGRPCMessage().(*tree.AddRequest_Body).StableSize() +} + +func (r *AddRequest) ReadSignedData(buf []byte) ([]byte, error) { + return r.body.ToGRPCMessage().(*tree.AddRequest_Body).StableMarshal(buf), nil +} + +type AddRequestBody struct { + containerID []byte + bearerToken []byte + treeID string + parentID uint64 + meta []*KeyValue +} + +func (r *AddRequestBody) SetContainerID(v []byte) { + r.containerID = v +} + +func (r *AddRequestBody) SetBearerToken(v []byte) { + r.bearerToken = v +} + +func (r *AddRequestBody) SetTreeID(v string) { + r.treeID = v +} + +func (r *AddRequestBody) SetParentID(v uint64) { + r.parentID = v +} + +func (r *AddRequestBody) SetMeta(v []*KeyValue) { + r.meta = v +} + +type AddResponse struct { + body *AddResponseBody + signature *Signature +} + +func (r *AddResponse) GetBody() *AddResponseBody { + if r != nil { + return r.body + } + + return nil +} + +type AddResponseBody struct { + nodeID uint64 +} + +func (r *AddResponseBody) GetNodeID() uint64 { + if r != nil { + return r.nodeID + } + + return 0 +} + +type AddByPathRequest struct { + body *AddByPathRequestBody + signature *Signature +} + +func (r *AddByPathRequest) SetBody(v *AddByPathRequestBody) { + r.body = v +} + +func (r *AddByPathRequest) GetSignature() *tree.Signature { + return r.signature.ToGRPCMessage().(*tree.Signature) +} + +func (r *AddByPathRequest) SetSignature(signature *tree.Signature) error { + if r.signature == nil { + r.signature = new(Signature) + } + + return r.signature.FromGRPCMessage(signature) +} + +func (r *AddByPathRequest) SignedDataSize() int { + return r.body.ToGRPCMessage().(*tree.AddByPathRequest_Body).StableSize() +} + +func (r *AddByPathRequest) ReadSignedData(bytes []byte) ([]byte, error) { + return r.body.ToGRPCMessage().(*tree.AddByPathRequest_Body).StableMarshal(bytes), nil +} + +type AddByPathRequestBody struct { + containerID []byte + treeID string + pathAttribute string + path []string + meta []*KeyValue + bearerToken []byte +} + +func (r *AddByPathRequestBody) SetContainerID(v []byte) { + r.containerID = v +} + +func (r *AddByPathRequestBody) SetBearerToken(v []byte) { + r.bearerToken = v +} + +func (r *AddByPathRequestBody) SetTreeID(v string) { + r.treeID = v +} + +func (r *AddByPathRequestBody) SetPathAttribute(v string) { + r.pathAttribute = v +} + +func (r *AddByPathRequestBody) SetPath(v []string) { + r.path = v +} + +func (r *AddByPathRequestBody) SetMeta(v []*KeyValue) { + r.meta = v +} + +type AddByPathResponse struct { + body *AddByPathResponseBody + signature *Signature +} + +func (r *AddByPathResponse) GetBody() *AddByPathResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *AddByPathResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + + return nil +} + +type AddByPathResponseBody struct { + nodes []uint64 + parentID uint64 +} + +func (r *AddByPathResponseBody) GetNodes() []uint64 { + if r != nil { + return r.nodes + } + + return nil +} + +func (r *AddByPathResponseBody) GetParentID() uint64 { + if r != nil { + return r.parentID + } + + return 0 +} + +type RemoveRequest struct { + body *RemoveRequestBody + signature *Signature +} + +func (r *RemoveRequest) SetBody(v *RemoveRequestBody) { + r.body = v +} + +func (r *RemoveRequest) GetSignature() *tree.Signature { + return r.signature.ToGRPCMessage().(*tree.Signature) +} + +func (r *RemoveRequest) SetSignature(signature *tree.Signature) error { + if r.signature == nil { + r.signature = new(Signature) + } + + return r.signature.FromGRPCMessage(signature) +} + +func (r *RemoveRequest) SignedDataSize() int { + return r.body.ToGRPCMessage().(*tree.RemoveRequest_Body).StableSize() +} + +func (r *RemoveRequest) ReadSignedData(bytes []byte) ([]byte, error) { + return r.body.ToGRPCMessage().(*tree.RemoveRequest_Body).StableMarshal(bytes), nil +} + +type RemoveRequestBody struct { + containerID []byte + treeID string + nodeID uint64 + bearerToken []byte +} + +func (r *RemoveRequestBody) SetContainerID(v []byte) { + r.containerID = v +} + +func (r *RemoveRequestBody) SetBearerToken(v []byte) { + r.bearerToken = v +} + +func (r *RemoveRequestBody) SetTreeID(v string) { + r.treeID = v +} + +func (r *RemoveRequestBody) SetNodeID(v uint64) { + r.nodeID = v +} + +type RemoveResponse struct { + body *RemoveResponseBody + signature *Signature +} + +func (r *RemoveResponse) GetBody() *RemoveResponseBody { + if r != nil { + return r.body + } + return nil +} + +func (r *RemoveResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + return nil +} + +type RemoveResponseBody struct{} + +type MoveRequest struct { + body *MoveRequestBody + signature *Signature +} + +func (r *MoveRequest) SetBody(v *MoveRequestBody) { + r.body = v +} + +func (r *MoveRequest) GetSignature() *tree.Signature { + return r.signature.ToGRPCMessage().(*tree.Signature) +} + +func (r *MoveRequest) SetSignature(signature *tree.Signature) error { + if r.signature == nil { + r.signature = new(Signature) + } + + return r.signature.FromGRPCMessage(signature) +} + +func (r *MoveRequest) SignedDataSize() int { + return r.body.ToGRPCMessage().(*tree.MoveRequest_Body).StableSize() +} + +func (r *MoveRequest) ReadSignedData(buf []byte) ([]byte, error) { + return r.body.ToGRPCMessage().(*tree.MoveRequest_Body).StableMarshal(buf), nil +} + +type MoveRequestBody struct { + containerID []byte + treeID string + parentID uint64 + nodeID uint64 + meta []*KeyValue + bearerToken []byte +} + +func (r *MoveRequestBody) SetContainerID(v []byte) { + r.containerID = v +} + +func (r *MoveRequestBody) SetBearerToken(v []byte) { + r.bearerToken = v +} + +func (r *MoveRequestBody) SetTreeID(v string) { + r.treeID = v +} + +func (r *MoveRequestBody) SetNodeID(v uint64) { + r.nodeID = v +} + +func (r *MoveRequestBody) SetMeta(v []*KeyValue) { + r.meta = v +} + +func (r *MoveRequestBody) SetParentID(v uint64) { + r.parentID = v +} + +type MoveResponse struct { + body *MoveResponseBody + signature *Signature +} + +func (r *MoveResponse) GetBody() *MoveResponseBody { + if r != nil { + return r.body + } + return nil +} + +func (r *MoveResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + + return nil +} + +type MoveResponseBody struct{} + +type GetNodeByPathRequest struct { + body *GetNodeByPathRequestBody + signature *Signature +} + +func (r *GetNodeByPathRequest) SetBody(v *GetNodeByPathRequestBody) { + r.body = v +} + +func (r *GetNodeByPathRequest) GetSignature() *tree.Signature { + return r.signature.ToGRPCMessage().(*tree.Signature) +} + +func (r *GetNodeByPathRequest) SetSignature(signature *tree.Signature) error { + if r.signature == nil { + r.signature = new(Signature) + } + return r.signature.FromGRPCMessage(signature) +} + +func (r *GetNodeByPathRequest) SignedDataSize() int { + return r.body.ToGRPCMessage().(*tree.GetNodeByPathRequest_Body).StableSize() +} + +func (r *GetNodeByPathRequest) ReadSignedData(buf []byte) ([]byte, error) { + return r.body.ToGRPCMessage().(*tree.GetNodeByPathRequest_Body).StableMarshal(buf), nil +} + +type GetNodeByPathRequestBody struct { + containerID []byte + treeID string + pathAttribute string + path []string + attributes []string + latestOnly bool + allAttributes bool + bearerToken []byte +} + +func (r *GetNodeByPathRequestBody) SetContainerID(v [32]byte) { + r.containerID = v[:] +} + +func (r *GetNodeByPathRequestBody) SetBearerToken(v []byte) { + r.bearerToken = v +} + +func (r *GetNodeByPathRequestBody) SetTreeID(v string) { + r.treeID = v +} + +func (r *GetNodeByPathRequestBody) SetPathAttribute(v string) { + r.pathAttribute = v +} + +func (r *GetNodeByPathRequestBody) SetParentID(v string) { + r.pathAttribute = v +} + +func (r *GetNodeByPathRequestBody) SetPath(v []string) { + r.path = v +} + +func (r *GetNodeByPathRequestBody) SetAttributes(v []string) { + r.attributes = v +} + +func (r *GetNodeByPathRequestBody) SetAllAttributes(v bool) { + r.allAttributes = v +} + +func (r *GetNodeByPathRequestBody) SetLatestOnly(v bool) { + r.latestOnly = v +} + +type GetNodeByPathResponse struct { + body *GetNodeByPathResponseBody + signature *Signature +} + +func (r *GetNodeByPathResponse) GetBody() *GetNodeByPathResponseBody { + if r != nil { + return r.body + } + return nil +} + +func (r *GetNodeByPathResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + + return nil +} + +type GetNodeByPathResponseBody struct { + nodes []*GetNodeByPathResponseInfo +} + +func (r *GetNodeByPathResponseBody) GetNodes() []*GetNodeByPathResponseInfo { + if r != nil { + return r.nodes + } + return nil +} + +type GetNodeByPathResponseInfo struct { + nodeID uint64 + timestamp uint64 + meta []*KeyValue + parentID uint64 +} + +func (r *GetNodeByPathResponseInfo) GetNodeID() uint64 { + if r != nil { + return r.nodeID + } + + return 0 +} + +func (r *GetNodeByPathResponseInfo) GetTimestamp() uint64 { + if r != nil { + return r.timestamp + } + + return 0 +} + +func (r *GetNodeByPathResponseInfo) GetParentID() uint64 { + if r != nil { + return r.parentID + } + + return 0 +} + +func (r *GetNodeByPathResponseInfo) GetMeta() []*KeyValue { + if r != nil { + return r.meta + } + + return nil +} + +type ListRequest struct { + body *ListRequestBody + signature *Signature +} + +func (r *ListRequest) SetBody(v *ListRequestBody) { + r.body = v +} + +type ListRequestBody struct { + containerID []byte +} + +func (r *ListRequestBody) SetContainerID(v []byte) { + r.containerID = v +} + +type ListResponse struct { + body *ListResponseBody + signature *Signature +} + +func (r *ListResponse) GetBody() *ListResponseBody { + if r != nil { + return r.body + } + return nil +} + +func (r *ListResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + + return nil +} + +type ListResponseBody struct { + ids []string +} + +func (r *ListResponseBody) GetIDs() []string { + if r != nil { + return r.ids + } + return nil +} + +type GetSubTreeRequest struct { + body *GetSubTreeRequestBody + signature *Signature +} + +func (r *GetSubTreeRequest) SetBody(v *GetSubTreeRequestBody) { + r.body = v +} + +func (r *GetSubTreeRequest) GetSignature() *tree.Signature { + return r.signature.ToGRPCMessage().(*tree.Signature) +} + +func (r *GetSubTreeRequest) SetSignature(signature *tree.Signature) error { + if r.signature == nil { + r.signature = new(Signature) + } + + return r.signature.FromGRPCMessage(signature) +} + +func (r *GetSubTreeRequest) SignedDataSize() int { + return r.body.ToGRPCMessage().(*tree.GetSubTreeRequest_Body).StableSize() +} + +func (r *GetSubTreeRequest) ReadSignedData(buf []byte) ([]byte, error) { + return r.body.ToGRPCMessage().(*tree.GetSubTreeRequest_Body).StableMarshal(buf), nil +} + +type GetSubTreeRequestBody struct { + containerID []byte + treeID string + rootID []uint64 + depth uint32 + bearerToken []byte + orderBy *GetSubTreeRequestBodyOrder +} + +func (r *GetSubTreeRequestBody) SetContainerID(v []byte) { + r.containerID = v +} + +func (r *GetSubTreeRequestBody) SetBearerToken(v []byte) { + r.bearerToken = v +} + +func (r *GetSubTreeRequestBody) SetTreeID(v string) { + r.treeID = v +} + +func (r *GetSubTreeRequestBody) SetRootID(v []uint64) { + r.rootID = v +} + +func (r *GetSubTreeRequestBody) SetDepth(v uint32) { + r.depth = v +} + +func (r *GetSubTreeRequestBody) SetOrderBy(v *GetSubTreeRequestBodyOrder) { + r.orderBy = v +} + +type GetSubTreeRequestBodyOrder struct { + direction GetSubTreeRequestBodyOrderDirection +} + +func (r *GetSubTreeRequestBodyOrder) SetDirection(v GetSubTreeRequestBodyOrderDirection) { + r.direction = v +} + +const ( + GetSubTreeRequestBodyOrderNone = GetSubTreeRequestBodyOrderDirection(tree.GetSubTreeRequest_Body_Order_None) + GetSubTreeRequestBodyOrderAsc = GetSubTreeRequestBodyOrderDirection(tree.GetSubTreeRequest_Body_Order_Asc) +) + +type GetSubTreeRequestBodyOrderDirection int32 + +type GetSubTreeResponse struct { + body *GetSubTreeResponseBody + signature *Signature +} + +func (r *GetSubTreeResponse) GetBody() *GetSubTreeResponseBody { + if r != nil { + return r.body + } + return nil +} + +func (r *GetSubTreeResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + + return nil +} + +type GetSubTreeResponseBody struct { + nodeID []uint64 + parentID []uint64 + timestamp []uint64 + meta []*KeyValue +} + +func (r *GetSubTreeResponseBody) GetNodeID() []uint64 { + if r != nil { + return r.nodeID + } + + return nil +} + +func (r *GetSubTreeResponseBody) GetParentID() []uint64 { + if r != nil { + return r.parentID + } + + return nil +} + +func (r *GetSubTreeResponseBody) GetTimestamp() []uint64 { + if r != nil { + return r.timestamp + } + + return nil +} + +func (r *GetSubTreeResponseBody) GetMeta() []*KeyValue { + if r != nil { + return r.meta + } + + return nil +} + +type ApplyRequest struct { + body *ApplyRequestBody + signature *Signature +} + +func (r *ApplyRequest) SetBody(v *ApplyRequestBody) { + r.body = v +} + +type ApplyRequestBody struct { + containerID []byte + treeID string + operation *LogMove +} + +func (r *ApplyRequestBody) SetContainerID(v []byte) { + r.containerID = v +} + +func (r *ApplyRequestBody) SetTreeID(v string) { + r.treeID = v +} + +func (r *ApplyRequestBody) SetOperation(v *LogMove) { + r.operation = v +} + +type ApplyResponse struct { + body *ApplyResponseBody + signature *Signature +} + +func (r *ApplyResponse) GetBody() *ApplyResponseBody { + if r != nil { + return r.body + } + return nil +} + +func (r *ApplyResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + + return nil +} + +type ApplyResponseBody struct{} + +type GetOpLogRequest struct { + body *GetOpLogRequestBody + signature *Signature +} + +func (r *GetOpLogRequest) SetBody(v *GetOpLogRequestBody) { + r.body = v +} + +func (r *GetOpLogRequest) GetSignature() *tree.Signature { + return r.signature.ToGRPCMessage().(*tree.Signature) +} + +func (r *GetOpLogRequest) SetSignature(signature *tree.Signature) error { + if r.signature == nil { + r.signature = new(Signature) + } + + return r.signature.FromGRPCMessage(signature) +} + +func (r *GetOpLogRequest) SignedDataSize() int { + return r.body.ToGRPCMessage().(*tree.GetSubTreeRequest_Body).StableSize() +} + +func (r *GetOpLogRequest) ReadSignedData(buf []byte) ([]byte, error) { + return r.body.ToGRPCMessage().(*tree.GetSubTreeRequest_Body).StableMarshal(buf), nil +} + +type GetOpLogRequestBody struct { + containerID []byte + treeID string + height uint64 + count uint64 +} + +func (r *GetOpLogRequestBody) SetTreeID(v string) { + r.treeID = v +} + +func (r *GetOpLogRequestBody) SetContainerID(v []byte) { + r.containerID = v +} + +func (r *GetOpLogRequestBody) SetHeight(v uint64) { + r.height = v +} + +func (r *GetOpLogRequestBody) SetCount(v uint64) { + r.count = v +} + +type GetOpLogResponse struct { + body *GetOpLogResponseBody + signature *Signature +} + +func (r *GetOpLogResponse) GetBody() *GetOpLogResponseBody { + if r != nil { + return r.body + } + return nil +} + +func (r *GetOpLogResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + + return nil +} + +type GetOpLogResponseBody struct { + operation *LogMove +} + +func (r *GetOpLogResponseBody) GetOperation() *LogMove { + if r != nil { + return r.operation + } + + return nil +} + +type HealthcheckRequest struct { + body *HealthcheckRequestBody + signature *Signature + + session.RequestHeaders +} + +func (r *HealthcheckRequest) SetBody(v *HealthcheckRequestBody) { + r.body = v +} + +type HealthcheckRequestBody struct{} + +type HealthcheckResponse struct { + body *HealthcheckResponseBody + signature *Signature +} + +func (r *HealthcheckResponse) GetBody() *HealthcheckResponseBody { + if r != nil { + return r.body + } + return nil +} + +func (r *HealthcheckResponse) GetSignature() *Signature { + if r != nil { + return r.signature + } + + return nil +} + +type HealthcheckResponseBody struct{} + +type LogMove struct { + parentID uint64 + meta []byte + childID uint64 +} + +func (g *LogMove) GetParentID() uint64 { + if g != nil { + return g.parentID + } + + return 0 +} + +func (g *LogMove) SetParentID(v uint64) { + g.parentID = v +} + +func (g *LogMove) GetMeta() []byte { + if g != nil { + return g.meta + } + + return nil +} + +func (g *LogMove) SetMeta(v []byte) { + g.meta = v +} + +func (g *LogMove) GetChildID() []byte { + if g != nil { + return g.meta + } + + return nil +} + +func (g *LogMove) SetChildID(v []byte) { + g.meta = v +} + +type Signature struct { + key []byte + sign []byte +} + +func (s *Signature) GetKey() []byte { + if s != nil { + return s.key + } + + return nil +} + +func (s *Signature) SetKey(v []byte) { + s.key = v +} + +func (s *Signature) GetSign() []byte { + if s != nil { + return s.sign + } + + return nil +} + +func (s *Signature) SetSign(v []byte) { + s.sign = v +} + +type KeyValue struct { + key string + value []byte +} + +func (k *KeyValue) GetKey() string { + if k != nil { + return k.key + } + + return "" +} + +func (k *KeyValue) SetKey(v string) { + k.key = v +} + +func (k *KeyValue) GetValue() []byte { + if k != nil { + return k.value + } + return nil +} + +func (k *KeyValue) SetValue(v []byte) { + k.value = v +} diff --git a/api/util/pool/buffer.go b/api/util/pool/buffer.go new file mode 100644 index 00000000..e0a7185a --- /dev/null +++ b/api/util/pool/buffer.go @@ -0,0 +1,54 @@ +package pool + +import ( + "sync" +) + +// Buffer contains a byte slice. +type Buffer struct { + Data []byte +} + +// BufferPool manages a pool of Buffers. +type BufferPool struct { + poolSliceSize uint32 // Size for the buffer slices in the pool. + buffersPool *sync.Pool +} + +// NewBufferPool creates a BufferPool with a specified size. +func NewBufferPool(poolSliceSize uint32) BufferPool { + pool := sync.Pool{ + New: func() any { + return new(Buffer) + }, + } + return BufferPool{poolSliceSize: poolSliceSize, buffersPool: &pool} +} + +// Get retrieves a Buffer from the pool or creates a new one if necessary. +// It ensures the buffer's capacity is at least the specified size. +func (pool BufferPool) Get(size uint32) *Buffer { + result := pool.buffersPool.Get().(*Buffer) + + if cap(result.Data) < int(size) { + result.Data = make([]byte, size) + } else { + result.Data = result.Data[:size] + } + return result +} + +// Put returns a Buffer to the pool if its capacity does not exceed poolSliceSize. +func (pool BufferPool) Put(buf *Buffer) { + if cap(buf.Data) > int(pool.poolSliceSize) { + return + } + + buf.Data = buf.Data[:0] + pool.buffersPool.Put(buf) +} + +// PoolSliceSize returns the size for buffer slices in the pool. +func (pool BufferPool) PoolSliceSize() uint32 { + return uint32(pool.poolSliceSize) +} diff --git a/api/util/pool/marshal.go b/api/util/pool/marshal.go new file mode 100644 index 00000000..107df282 --- /dev/null +++ b/api/util/pool/marshal.go @@ -0,0 +1,7 @@ +package pool + +import ( + "github.com/VictoriaMetrics/easyproto" +) + +var MarshalerPool easyproto.MarshalerPool diff --git a/api/util/proto/encoding/compat.go b/api/util/proto/encoding/compat.go new file mode 100644 index 00000000..09d45e63 --- /dev/null +++ b/api/util/proto/encoding/compat.go @@ -0,0 +1,22 @@ +package encoding + +import ( + _ "google.golang.org/grpc/encoding/proto" // Ensure default codec is registered before our one. + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" +) + +// messageV2Of converts v to a proto.Message. +// This is needed for this library to continue working in presence of external gRPC packages, +// such as opentelemetry gRPC exporter. +// Copied from https://github.com/grpc/grpc-go/blob/e524655becd8d4c7ba9e8687faef456e495e341e/encoding/proto/proto.go#L59. +func messageV2Of(v any) proto.Message { + switch v := v.(type) { + case protoadapt.MessageV1: + return protoadapt.MessageV2Of(v) + case protoadapt.MessageV2: + return v + } + + return nil +} diff --git a/api/util/proto/encoding/json.go b/api/util/proto/encoding/json.go new file mode 100644 index 00000000..3456a401 --- /dev/null +++ b/api/util/proto/encoding/json.go @@ -0,0 +1,48 @@ +package encoding + +import ( + "encoding/json" + "fmt" + + "google.golang.org/grpc/encoding" + "google.golang.org/protobuf/encoding/protojson" +) + +// JSONCodec is easyjson codec used for code generated by protogen. +// It is binary-level compatible with the standard protojson format, thus uses the same name. +type JSONCodec struct{} + +var _ encoding.Codec = JSONCodec{} + +func init() { + encoding.RegisterCodec(JSONCodec{}) +} + +// Name implements the encoding.Codec interface. +func (JSONCodec) Name() string { return "json" } + +// Marshal implements the encoding.Codec interface. +func (JSONCodec) Marshal(v any) ([]byte, error) { + switch v := v.(type) { + case json.Marshaler: + return json.Marshal(v) + default: + if v := messageV2Of(v); v != nil { + return protojson.Marshal(v) + } + return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) + } +} + +// Unmarshal implements the encoding.Codec interface. +func (JSONCodec) Unmarshal(data []byte, v any) error { + switch v := v.(type) { + case json.Unmarshaler: + return json.Unmarshal(data, v) + default: + if v := messageV2Of(v); v != nil { + return protojson.Unmarshal(data, v) + } + return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) + } +} diff --git a/api/util/proto/encoding/proto.go b/api/util/proto/encoding/proto.go new file mode 100644 index 00000000..5f3c5561 --- /dev/null +++ b/api/util/proto/encoding/proto.go @@ -0,0 +1,57 @@ +package encoding + +import ( + "fmt" + + "google.golang.org/grpc/encoding" + "google.golang.org/protobuf/proto" +) + +// ProtoCodec is easyproto codec used for code generated by protogen. +// It is binary-level compatible with the standard proto codec, thus uses the same name. +type ProtoCodec struct{} + +// ProtoMarshaler is an interface accepted by ProtoCodec.Marshal. +type ProtoMarshaler interface { + MarshalProtobuf([]byte) []byte +} + +// ProtoUnmarshaler is an interface accepted by ProtoCodec.Unmarshal. +type ProtoUnmarshaler interface { + UnmarshalProtobuf([]byte) error +} + +var _ encoding.Codec = ProtoCodec{} + +func init() { + encoding.RegisterCodec(ProtoCodec{}) +} + +// Name implements the encoding.Codec interface. +func (ProtoCodec) Name() string { return "proto" } + +// Marshal implements the encoding.Codec interface. +func (ProtoCodec) Marshal(v any) ([]byte, error) { + switch v := v.(type) { + case ProtoMarshaler: + return v.MarshalProtobuf(nil), nil + default: + if v := messageV2Of(v); v != nil { + return proto.Marshal(v) + } + return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) + } +} + +// Unmarshal implements the encoding.Codec interface. +func (ProtoCodec) Unmarshal(data []byte, v any) error { + switch v := v.(type) { + case ProtoUnmarshaler: + return v.UnmarshalProtobuf(data) + default: + if v := messageV2Of(v); v != nil { + return proto.Unmarshal(data, v) + } + return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) + } +} diff --git a/api/util/proto/marshal.go b/api/util/proto/marshal.go new file mode 100644 index 00000000..50162554 --- /dev/null +++ b/api/util/proto/marshal.go @@ -0,0 +1,413 @@ +/* +This package contains help functions for stable marshaller. Their usage is +totally optional. One can implement fast stable marshaller without these +runtime function calls. +*/ + +package proto + +import ( + "encoding/binary" + "math" + "math/bits" + + "google.golang.org/protobuf/encoding/protowire" +) + +type ( + stableMarshaler interface { + StableMarshal([]byte) []byte + stableSizer + } + + stableSizer interface { + StableSize() int + } + + setMarshalData[T any] interface { + SetMarshalData([]byte) + StableSize() int + ~*T + } +) + +func BytesMarshal(field int, buf, v []byte) int { + return bytesMarshal(field, buf, v) +} + +func BytesSize(field int, v []byte) int { + return bytesSize(field, v) +} + +func bytesMarshal[T ~[]byte | ~string](field int, buf []byte, v T) int { + if len(v) == 0 { + return 0 + } + return bytesMarshalNoCheck(field, buf, v) +} + +func bytesMarshalNoCheck[T ~[]byte | ~string](field int, buf []byte, v T) int { + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + i += binary.PutUvarint(buf[i:], uint64(len(v))) + i += copy(buf[i:], v) + + return i +} + +func bytesSize[T ~[]byte | ~string](field int, v T) int { + if len(v) == 0 { + return 0 + } + return bytesSizeNoCheck(field, v) +} + +func bytesSizeNoCheck[T ~[]byte | ~string](field int, v T) int { + return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(len(v))) +} + +func StringMarshal(field int, buf []byte, v string) int { + return bytesMarshal(field, buf, v) +} + +func StringSize(field int, v string) int { + return bytesSize(field, v) +} + +func BoolMarshal(field int, buf []byte, v bool) int { + if !v { + return 0 + } + + prefix := protowire.EncodeTag(protowire.Number(field), protowire.VarintType) + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + const boolTrueValue = 0x1 + buf[i] = boolTrueValue + + return i + 1 +} + +func BoolSize(field int, v bool) int { + if !v { + return 0 + } + const boolLength = 1 + return protowire.SizeGroup(protowire.Number(field), boolLength) +} + +func UInt64Marshal(field int, buf []byte, v uint64) int { + if v == 0 { + return 0 + } + + prefix := protowire.EncodeTag(protowire.Number(field), protowire.VarintType) + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + i += binary.PutUvarint(buf[i:], v) + + return i +} + +func UInt64Size(field int, v uint64) int { + if v == 0 { + return 0 + } + return protowire.SizeGroup(protowire.Number(field), protowire.SizeVarint(v)) +} + +func Int64Marshal(field int, buf []byte, v int64) int { + return UInt64Marshal(field, buf, uint64(v)) +} + +func Int64Size(field int, v int64) int { + return UInt64Size(field, uint64(v)) +} + +func UInt32Marshal(field int, buf []byte, v uint32) int { + return UInt64Marshal(field, buf, uint64(v)) +} + +func UInt32Size(field int, v uint32) int { + return UInt64Size(field, uint64(v)) +} + +func Int32Marshal(field int, buf []byte, v int32) int { + return UInt64Marshal(field, buf, uint64(uint32(v))) +} + +func Int32Size(field int, v int32) int { + return UInt64Size(field, uint64(uint32(v))) +} + +func EnumMarshal(field int, buf []byte, v int32) int { + return UInt64Marshal(field, buf, uint64(uint32(v))) +} + +func EnumSize(field int, v int32) int { + return UInt64Size(field, uint64(uint32(v))) +} + +func RepeatedBytesMarshal(field int, buf []byte, v [][]byte) int { + var offset int + + for i := range v { + offset += bytesMarshalNoCheck(field, buf[offset:], v[i]) + } + + return offset +} + +func RepeatedBytesSize(field int, v [][]byte) (size int) { + for i := range v { + size += bytesSizeNoCheck(field, v[i]) + } + + return size +} + +func RepeatedStringMarshal(field int, buf []byte, v []string) int { + var offset int + + for i := range v { + offset += bytesMarshalNoCheck(field, buf[offset:], v[i]) + } + + return offset +} + +func RepeatedStringSize(field int, v []string) (size int) { + for i := range v { + size += bytesSizeNoCheck(field, v[i]) + } + + return size +} + +func repeatedUIntSize[T ~uint64 | ~int64 | ~uint32 | ~int32](field int, v []T) (size, arraySize int) { + if len(v) == 0 { + return 0, 0 + } + + for i := range v { + arraySize += protowire.SizeVarint(uint64(v[i])) + } + + size = protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(arraySize)) + + return +} + +func repeatedUIntMarshal[T ~uint64 | ~int64 | ~uint32 | ~int32](field int, buf []byte, v []T) int { + if len(v) == 0 { + return 0 + } + + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) + offset := binary.PutUvarint(buf, uint64(prefix)) + + _, arrSize := repeatedUIntSize(field, v) + offset += binary.PutUvarint(buf[offset:], uint64(arrSize)) + for i := range v { + offset += binary.PutUvarint(buf[offset:], uint64(v[i])) + } + + return offset +} + +func RepeatedUInt64Marshal(field int, buf []byte, v []uint64) int { + return repeatedUIntMarshal(field, buf, v) +} + +func RepeatedUInt64Size(field int, v []uint64) (size, arraySize int) { + return repeatedUIntSize(field, v) +} + +func RepeatedInt64Marshal(field int, buf []byte, v []int64) int { + return repeatedUIntMarshal(field, buf, v) +} + +func RepeatedInt64Size(field int, v []int64) (size, arraySize int) { + return repeatedUIntSize(field, v) +} + +func RepeatedUInt32Marshal(field int, buf []byte, v []uint32) int { + return repeatedUIntMarshal(field, buf, v) +} + +func RepeatedUInt32Size(field int, v []uint32) (size, arraySize int) { + return repeatedUIntSize(field, v) +} + +func RepeatedInt32Marshal(field int, buf []byte, v []int32) int { + if len(v) == 0 { + return 0 + } + + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) + offset := binary.PutUvarint(buf, uint64(prefix)) + _, arrSize := RepeatedInt32Size(field, v) + offset += binary.PutUvarint(buf[offset:], uint64(arrSize)) + for i := range v { + offset += binary.PutUvarint(buf[offset:], uint64(uint32(v[i]))) + } + return offset +} + +func RepeatedInt32Size(field int, v []int32) (size, arraySize int) { + if len(v) == 0 { + return 0, 0 + } + for i := range v { + arraySize += protowire.SizeVarint(uint64(uint32(v[i]))) + } + return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(arraySize)), arraySize +} + +// VarUIntSize returns length of varint byte sequence for uint64 value 'x'. +func VarUIntSize(x uint64) int { + return (bits.Len64(x|1) + 6) / 7 +} + +type ptrStableMarshaler[T any] interface { + stableMarshaler + ~*T +} + +type ptrStableSizer[T any] interface { + stableSizer + ~*T +} + +func NestedStructureMarshal[T any, M ptrStableMarshaler[T]](field int64, buf []byte, v M) int { + if v == nil { + return 0 + } + + return NestedStructureMarshalUnchecked(field, buf, v) +} + +func NestedStructureMarshalUnchecked[T stableMarshaler](field int64, buf []byte, v T) int { + n := v.StableSize() + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) + offset := binary.PutUvarint(buf, prefix) + offset += binary.PutUvarint(buf[offset:], uint64(n)) + v.StableMarshal(buf[offset:]) + + return offset + n +} + +// NestedStructureSetMarshalData calculates offset for field in parentData +// and calls SetMarshalData for nested structure. +// +// Returns marshalled data length of nested structure. +func NestedStructureSetMarshalData[T any, M setMarshalData[T]](field int64, parentData []byte, v M) int { + if v == nil { + return 0 + } + + if parentData == nil { + v.SetMarshalData(nil) + return 0 + } + + n := v.StableSize() + buf := make([]byte, binary.MaxVarintLen64) + prefix := protowire.EncodeTag(protowire.Number(field), protowire.BytesType) + offset := binary.PutUvarint(buf, prefix) + offset += binary.PutUvarint(buf, uint64(n)) + + v.SetMarshalData(parentData[offset : offset+n]) + + return offset + n +} + +func NestedStructureSize[T any, M ptrStableSizer[T]](field int64, v M) (size int) { + if v == nil { + return 0 + } + + return NestedStructureSizeUnchecked(field, v) +} + +func NestedStructureSizeUnchecked[T stableSizer](field int64, v T) int { + n := v.StableSize() + return protowire.SizeGroup(protowire.Number(field), protowire.SizeBytes(n)) +} + +func Fixed64Marshal(field int, buf []byte, v uint64) int { + if v == 0 { + return 0 + } + + prefix := protowire.EncodeTag(protowire.Number(field), protowire.Fixed64Type) + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + binary.LittleEndian.PutUint64(buf[i:], v) + + return i + 8 +} + +func Fixed64Size(fNum int, v uint64) int { + if v == 0 { + return 0 + } + return protowire.SizeGroup(protowire.Number(fNum), protowire.SizeFixed64()) +} + +func Float64Marshal(field int, buf []byte, v float64) int { + if v == 0 { + return 0 + } + + prefix := protowire.EncodeTag(protowire.Number(field), protowire.Fixed64Type) + + i := binary.PutUvarint(buf, uint64(prefix)) + binary.LittleEndian.PutUint64(buf[i:], math.Float64bits(v)) + + return i + 8 +} + +func Float64Size(fNum int, v float64) int { + if v == 0 { + return 0 + } + return protowire.SizeGroup(protowire.Number(fNum), protowire.SizeFixed64()) +} + +// Fixed32Marshal encodes uint32 value to Protocol Buffers fixed32 field with specified number, +// and writes it to specified buffer. Returns number of bytes written. +// +// Panics if the buffer is undersized. +func Fixed32Marshal(field int, buf []byte, v uint32) int { + if v == 0 { + return 0 + } + + prefix := protowire.EncodeTag(protowire.Number(field), protowire.Fixed32Type) + + // buf length check can prevent panic at PutUvarint, but it will make + // marshaller a bit slower. + i := binary.PutUvarint(buf, uint64(prefix)) + binary.LittleEndian.PutUint32(buf[i:], v) + + return i + 4 +} + +// Fixed32Size returns number of bytes required to encode uint32 value to Protocol Buffers fixed32 field +// with specified number. +func Fixed32Size(fNum int, v uint32) int { + if v == 0 { + return 0 + } + return protowire.SizeGroup(protowire.Number(fNum), protowire.SizeFixed32()) +} diff --git a/api/util/proto/marshal_test.go b/api/util/proto/marshal_test.go new file mode 100644 index 00000000..a635bb64 --- /dev/null +++ b/api/util/proto/marshal_test.go @@ -0,0 +1,247 @@ +package proto_test + +import ( + "math" + "math/rand" + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/test" + generated "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/test/custom" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/encoding/protojson" + goproto "google.golang.org/protobuf/proto" +) + +type protoInt interface { + ~int32 | ~uint32 | ~int64 | ~uint64 +} + +func nonZero[T protoInt]() T { + var r T + for r == 0 { + r = T(rand.Uint64()) + } + return r +} + +func TestStableMarshalSingle(t *testing.T) { + t.Run("empty", func(t *testing.T) { + t.Run("proto", func(t *testing.T) { + input := &generated.Primitives{} + require.Zero(t, input.StableSize()) + + r := input.MarshalProtobuf(nil) + require.Empty(t, r) + }) + t.Run("json", func(t *testing.T) { + input := &generated.Primitives{} + r, err := input.MarshalJSON() + require.NoError(t, err) + require.NotEmpty(t, r) + + var actual test.Primitives + require.NoError(t, protojson.Unmarshal(r, &actual)) + + t.Run("protojson compatibility", func(t *testing.T) { + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(&actual) + require.NoError(t, err) + require.JSONEq(t, string(data), string(r)) + }) + + var actualFrostfs generated.Primitives + require.NoError(t, actualFrostfs.UnmarshalJSON(r)) + require.Equal(t, input, &actualFrostfs) + + primitivesEqual(t, input, &actual) + }) + }) + + marshalCases := []struct { + name string + input *generated.Primitives + }{ + {name: "bytes", input: &generated.Primitives{FieldA: []byte{1, 2, 3}}}, + {name: "string", input: &generated.Primitives{FieldB: "123"}}, + {name: "bool", input: &generated.Primitives{FieldC: true}}, + {name: "int32", input: &generated.Primitives{FieldD: -10}}, + {name: "uint32", input: &generated.Primitives{FieldE: nonZero[uint32]()}}, + {name: "int64", input: &generated.Primitives{FieldF: nonZero[int64]()}}, + {name: "uint64", input: &generated.Primitives{FieldG: nonZero[uint64]()}}, + {name: "uint64", input: &generated.Primitives{FieldI: nonZero[uint64]()}}, + {name: "float64", input: &generated.Primitives{FieldJ: math.Float64frombits(12345677890)}}, + {name: "fixed32", input: &generated.Primitives{FieldK: nonZero[uint32]()}}, + {name: "enum, positive", input: &generated.Primitives{FieldH: generated.Primitives_POSITIVE}}, + {name: "enum, negative", input: &generated.Primitives{FieldH: generated.Primitives_NEGATIVE}}, + {name: "oneof, first", input: &generated.Primitives{FieldM: &generated.Primitives_FieldMa{FieldMa: []byte{4, 2}}}}, + {name: "oneof, second", input: &generated.Primitives{FieldM: &generated.Primitives_FieldMe{FieldMe: nonZero[uint32]()}}}, + } + for _, tc := range marshalCases { + t.Run(tc.name, func(t *testing.T) { + t.Run("proto", func(t *testing.T) { + r := tc.input.MarshalProtobuf(nil) + require.Equal(t, len(r), tc.input.StableSize()) + require.NotEmpty(t, r) + + var actual test.Primitives + require.NoError(t, goproto.Unmarshal(r, &actual)) + + var actualFrostfs generated.Primitives + require.NoError(t, actualFrostfs.UnmarshalProtobuf(r)) + require.Equal(t, tc.input, &actualFrostfs) + + primitivesEqual(t, tc.input, &actual) + }) + t.Run("json", func(t *testing.T) { + r, err := tc.input.MarshalJSON() + require.NoError(t, err) + require.NotEmpty(t, r) + + var actual test.Primitives + require.NoError(t, protojson.Unmarshal(r, &actual)) + + t.Run("protojson compatibility", func(t *testing.T) { + data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(&actual) + require.NoError(t, err) + require.JSONEq(t, string(data), string(r)) + }) + + var actualFrostfs generated.Primitives + require.NoError(t, actualFrostfs.UnmarshalJSON(r)) + require.Equal(t, tc.input, &actualFrostfs) + + primitivesEqual(t, tc.input, &actual) + }) + }) + } +} + +func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) { + // Compare each field directly, because proto-generated code has private fields. + require.Equal(t, len(a.FieldA), len(b.FieldA)) + require.Equal(t, a.FieldA, b.FieldA) + require.Equal(t, a.FieldB, b.FieldB) + require.Equal(t, a.FieldC, b.FieldC) + require.Equal(t, a.FieldD, b.FieldD) + require.Equal(t, a.FieldE, b.FieldE) + require.Equal(t, a.FieldF, b.FieldF) + require.Equal(t, a.FieldG, b.FieldG) + require.Equal(t, a.FieldI, b.FieldI) + require.Equal(t, a.FieldJ, b.FieldJ) + require.Equal(t, a.FieldK, b.FieldK) + require.EqualValues(t, a.FieldH, b.FieldH) + require.Equal(t, a.GetFieldMa(), b.GetFieldMa()) + require.Equal(t, a.GetFieldMe(), b.GetFieldMe()) + require.Equal(t, a.GetFieldAux().GetInnerField(), b.GetFieldAux().GetInnerField()) +} + +func repPrimitivesEqual(t *testing.T, a *generated.RepPrimitives, b *test.RepPrimitives) { + // Compare each field directly, because proto-generated code has private fields. + require.Equal(t, a.FieldA, b.FieldA) + require.Equal(t, a.FieldB, b.FieldB) + require.Equal(t, a.FieldC, b.FieldC) + require.Equal(t, a.FieldD, b.FieldD) + require.Equal(t, a.FieldE, b.FieldE) + require.Equal(t, a.FieldF, b.FieldF) + require.Equal(t, a.FieldFu, b.FieldFu) + require.Equal(t, len(a.GetFieldAux()), len(b.GetFieldAux())) + for i := range a.FieldAux { + require.Equal(t, a.GetFieldAux()[i].GetInnerField(), b.GetFieldAux()[i].GetInnerField()) + } +} + +func randIntSlice[T protoInt](n int, includeZero bool) []T { + r := make([]T, n) + if n == 0 { + return r + } + for i := range r { + r[i] = T(rand.Uint64()) + } + if includeZero { + r[0] = 0 + } + return r +} + +func uint32SliceToAux(s []uint32) []generated.RepPrimitives_Aux { + r := make([]generated.RepPrimitives_Aux, len(s)) + for i := range s { + r[i] = generated.RepPrimitives_Aux{InnerField: s[i]} + } + return r +} + +func TestStableMarshalRep(t *testing.T) { + t.Run("empty", func(t *testing.T) { + marshalCases := []struct { + name string + input *generated.RepPrimitives + }{ + {name: "default", input: &generated.RepPrimitives{}}, + {name: "bytes", input: &generated.RepPrimitives{FieldA: [][]byte{}}}, + {name: "string", input: &generated.RepPrimitives{FieldB: []string{}}}, + {name: "int32", input: &generated.RepPrimitives{FieldC: []int32{}}}, + {name: "uint32", input: &generated.RepPrimitives{FieldD: []uint32{}}}, + {name: "int64", input: &generated.RepPrimitives{FieldE: []int64{}}}, + {name: "uint64", input: &generated.RepPrimitives{FieldF: []uint64{}}}, + {name: "uint64", input: &generated.RepPrimitives{FieldFu: []uint64{}}}, + } + + for _, tc := range marshalCases { + t.Run(tc.name, func(t *testing.T) { + require.Zero(t, tc.input.StableSize()) + + r := tc.input.MarshalProtobuf(nil) + require.Empty(t, r) + }) + } + }) + + marshalCases := []struct { + name string + input *generated.RepPrimitives + }{ + {name: "bytes", input: &generated.RepPrimitives{FieldA: [][]byte{{1, 2, 3}}}}, + {name: "string", input: &generated.RepPrimitives{FieldB: []string{"123"}}}, + {name: "int32", input: &generated.RepPrimitives{FieldC: randIntSlice[int32](1, true)}}, + {name: "int32", input: &generated.RepPrimitives{FieldC: randIntSlice[int32](2, true)}}, + {name: "int32", input: &generated.RepPrimitives{FieldC: randIntSlice[int32](2, false)}}, + {name: "uint32", input: &generated.RepPrimitives{FieldD: randIntSlice[uint32](1, true)}}, + {name: "uint32", input: &generated.RepPrimitives{FieldD: randIntSlice[uint32](2, true)}}, + {name: "uint32", input: &generated.RepPrimitives{FieldD: randIntSlice[uint32](2, false)}}, + {name: "int64", input: &generated.RepPrimitives{FieldE: randIntSlice[int64](1, true)}}, + {name: "int64", input: &generated.RepPrimitives{FieldE: randIntSlice[int64](2, true)}}, + {name: "int64", input: &generated.RepPrimitives{FieldE: randIntSlice[int64](2, false)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldF: randIntSlice[uint64](1, true)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldF: randIntSlice[uint64](2, true)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldF: randIntSlice[uint64](2, false)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](1, true)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, true)}}, + {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, false)}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](1, true))}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](2, true))}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](2, false))}}, + } + for _, tc := range marshalCases { + t.Run(tc.name, func(t *testing.T) { + t.Run("proto", func(t *testing.T) { + r := tc.input.MarshalProtobuf(nil) + require.Equal(t, len(r), tc.input.StableSize()) + require.NotEmpty(t, r) + + var actual test.RepPrimitives + require.NoError(t, goproto.Unmarshal(r, &actual)) + repPrimitivesEqual(t, tc.input, &actual) + }) + t.Run("json", func(t *testing.T) { + r, err := tc.input.MarshalJSON() + require.NoError(t, err) + require.NotEmpty(t, r) + + var actual test.RepPrimitives + require.NoError(t, protojson.Unmarshal(r, &actual)) + repPrimitivesEqual(t, tc.input, &actual) + }) + }) + } +} diff --git a/api/util/proto/test/custom/test_frostfs.pb.go b/api/util/proto/test/custom/test_frostfs.pb.go new file mode 100644 index 00000000..c9b26994 --- /dev/null +++ b/api/util/proto/test/custom/test_frostfs.pb.go @@ -0,0 +1,1687 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package test + +import ( + json "encoding/json" + fmt "fmt" + pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool" + proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" + encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding" + easyproto "github.com/VictoriaMetrics/easyproto" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" + protowire "google.golang.org/protobuf/encoding/protowire" + strconv "strconv" +) + +type Primitives_SomeEnum int32 + +const ( + Primitives_UNKNOWN Primitives_SomeEnum = 0 + Primitives_POSITIVE Primitives_SomeEnum = 1 + Primitives_NEGATIVE Primitives_SomeEnum = -1 +) + +var ( + Primitives_SomeEnum_name = map[int32]string{ + 0: "UNKNOWN", + 1: "POSITIVE", + -1: "NEGATIVE", + } + Primitives_SomeEnum_value = map[string]int32{ + "UNKNOWN": 0, + "POSITIVE": 1, + "NEGATIVE": -1, + } +) + +func (x Primitives_SomeEnum) String() string { + if v, ok := Primitives_SomeEnum_name[int32(x)]; ok { + return v + } + return strconv.FormatInt(int64(x), 10) +} +func (x *Primitives_SomeEnum) FromString(s string) bool { + if v, ok := Primitives_SomeEnum_value[s]; ok { + *x = Primitives_SomeEnum(v) + return true + } + return false +} + +type Primitives_Aux struct { + InnerField uint32 `json:"innerField"` +} + +var ( + _ encoding.ProtoMarshaler = (*Primitives_Aux)(nil) + _ encoding.ProtoUnmarshaler = (*Primitives_Aux)(nil) + _ json.Marshaler = (*Primitives_Aux)(nil) + _ json.Unmarshaler = (*Primitives_Aux)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Primitives_Aux) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt32Size(1, x.InnerField) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Primitives_Aux) MarshalProtobuf(dst []byte) []byte { + m := pool.MarshalerPool.Get() + defer pool.MarshalerPool.Put(m) + x.EmitProtobuf(m.MessageMarshaler()) + dst = m.Marshal(dst) + return dst +} + +func (x *Primitives_Aux) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.InnerField != 0 { + mm.AppendUint32(1, x.InnerField) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Primitives_Aux) UnmarshalProtobuf(src []byte) (err error) { + var fc easyproto.FieldContext + for len(src) > 0 { + src, err = fc.NextField(src) + if err != nil { + return fmt.Errorf("cannot read next field in %s", "Primitives_Aux") + } + switch fc.FieldNum { + case 1: // InnerField + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "InnerField") + } + x.InnerField = data + } + } + return nil +} +func (x *Primitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.InnerField + } + return 0 +} +func (x *Primitives_Aux) SetInnerField(v uint32) { + x.InnerField = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Primitives_Aux) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Primitives_Aux) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + first := true + out.RawByte('{') + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"innerField\":" + out.RawString(prefix) + out.Uint32(x.InnerField) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Primitives_Aux) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Primitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "innerField": + { + var f uint32 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := uint32(v) + f = pv + x.InnerField = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type Primitives struct { + FieldA []byte `json:"fieldA"` + FieldB string `json:"fieldB"` + FieldC bool `json:"fieldC"` + FieldD int32 `json:"fieldD"` + FieldE uint32 `json:"fieldE"` + FieldF int64 `json:"fieldF"` + FieldG uint64 `json:"fieldG"` + FieldI uint64 `json:"fieldI"` + FieldJ float64 `json:"fieldJ"` + FieldK uint32 `json:"fieldK"` + FieldH Primitives_SomeEnum `json:"fieldH"` + FieldM isPrimitives_FieldM +} + +var ( + _ encoding.ProtoMarshaler = (*Primitives)(nil) + _ encoding.ProtoUnmarshaler = (*Primitives)(nil) + _ json.Marshaler = (*Primitives)(nil) + _ json.Unmarshaler = (*Primitives)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Primitives) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.FieldA) + size += proto.StringSize(2, x.FieldB) + size += proto.BoolSize(200, x.FieldC) + size += proto.Int32Size(201, x.FieldD) + size += proto.UInt32Size(202, x.FieldE) + size += proto.Int64Size(203, x.FieldF) + size += proto.UInt64Size(204, x.FieldG) + size += proto.Fixed64Size(205, x.FieldI) + size += proto.Float64Size(206, x.FieldJ) + size += proto.Fixed32Size(207, x.FieldK) + size += proto.EnumSize(300, int32(x.FieldH)) + if inner, ok := x.FieldM.(*Primitives_FieldMa); ok { + size += proto.BytesSize(401, inner.FieldMa) + } + if inner, ok := x.FieldM.(*Primitives_FieldMe); ok { + size += proto.UInt32Size(402, inner.FieldMe) + } + if inner, ok := x.FieldM.(*Primitives_FieldAux); ok { + size += proto.NestedStructureSize(403, inner.FieldAux) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *Primitives) MarshalProtobuf(dst []byte) []byte { + m := pool.MarshalerPool.Get() + defer pool.MarshalerPool.Put(m) + x.EmitProtobuf(m.MessageMarshaler()) + dst = m.Marshal(dst) + return dst +} + +func (x *Primitives) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if len(x.FieldA) != 0 { + mm.AppendBytes(1, x.FieldA) + } + if len(x.FieldB) != 0 { + mm.AppendString(2, x.FieldB) + } + if x.FieldC { + mm.AppendBool(200, x.FieldC) + } + if x.FieldD != 0 { + mm.AppendInt32(201, x.FieldD) + } + if x.FieldE != 0 { + mm.AppendUint32(202, x.FieldE) + } + if x.FieldF != 0 { + mm.AppendInt64(203, x.FieldF) + } + if x.FieldG != 0 { + mm.AppendUint64(204, x.FieldG) + } + if x.FieldI != 0 { + mm.AppendFixed64(205, x.FieldI) + } + if x.FieldJ != 0 { + mm.AppendDouble(206, x.FieldJ) + } + if x.FieldK != 0 { + mm.AppendFixed32(207, x.FieldK) + } + if int32(x.FieldH) != 0 { + mm.AppendInt32(300, int32(x.FieldH)) + } + if inner, ok := x.FieldM.(*Primitives_FieldMa); ok { + if len(inner.FieldMa) != 0 { + mm.AppendBytes(401, inner.FieldMa) + } + } + if inner, ok := x.FieldM.(*Primitives_FieldMe); ok { + if inner.FieldMe != 0 { + mm.AppendUint32(402, inner.FieldMe) + } + } + if inner, ok := x.FieldM.(*Primitives_FieldAux); ok { + if inner.FieldAux != nil { + inner.FieldAux.EmitProtobuf(mm.AppendMessage(403)) + } + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *Primitives) UnmarshalProtobuf(src []byte) (err error) { + var fc easyproto.FieldContext + for len(src) > 0 { + src, err = fc.NextField(src) + if err != nil { + return fmt.Errorf("cannot read next field in %s", "Primitives") + } + switch fc.FieldNum { + case 1: // FieldA + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldA") + } + x.FieldA = data + case 2: // FieldB + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldB") + } + x.FieldB = data + case 200: // FieldC + data, ok := fc.Bool() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldC") + } + x.FieldC = data + case 201: // FieldD + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldD") + } + x.FieldD = data + case 202: // FieldE + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldE") + } + x.FieldE = data + case 203: // FieldF + data, ok := fc.Int64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldF") + } + x.FieldF = data + case 204: // FieldG + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldG") + } + x.FieldG = data + case 205: // FieldI + data, ok := fc.Fixed64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldI") + } + x.FieldI = data + case 206: // FieldJ + data, ok := fc.Double() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldJ") + } + x.FieldJ = data + case 207: // FieldK + data, ok := fc.Fixed32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldK") + } + x.FieldK = data + case 300: // FieldH + data, ok := fc.Int32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldH") + } + x.FieldH = Primitives_SomeEnum(data) + case 401: // FieldMa + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldMa") + } + x.FieldM = &Primitives_FieldMa{FieldMa: data} + case 402: // FieldMe + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldMe") + } + x.FieldM = &Primitives_FieldMe{FieldMe: data} + case 403: // FieldAux + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldAux") + } + oneofField := &Primitives_FieldAux{FieldAux: new(Primitives_Aux)} + if err := oneofField.FieldAux.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + x.FieldM = oneofField + } + } + return nil +} +func (x *Primitives) GetFieldA() []byte { + if x != nil { + return x.FieldA + } + return nil +} +func (x *Primitives) SetFieldA(v []byte) { + x.FieldA = v +} +func (x *Primitives) GetFieldB() string { + if x != nil { + return x.FieldB + } + return "" +} +func (x *Primitives) SetFieldB(v string) { + x.FieldB = v +} +func (x *Primitives) GetFieldC() bool { + if x != nil { + return x.FieldC + } + return false +} +func (x *Primitives) SetFieldC(v bool) { + x.FieldC = v +} +func (x *Primitives) GetFieldD() int32 { + if x != nil { + return x.FieldD + } + return 0 +} +func (x *Primitives) SetFieldD(v int32) { + x.FieldD = v +} +func (x *Primitives) GetFieldE() uint32 { + if x != nil { + return x.FieldE + } + return 0 +} +func (x *Primitives) SetFieldE(v uint32) { + x.FieldE = v +} +func (x *Primitives) GetFieldF() int64 { + if x != nil { + return x.FieldF + } + return 0 +} +func (x *Primitives) SetFieldF(v int64) { + x.FieldF = v +} +func (x *Primitives) GetFieldG() uint64 { + if x != nil { + return x.FieldG + } + return 0 +} +func (x *Primitives) SetFieldG(v uint64) { + x.FieldG = v +} +func (x *Primitives) GetFieldI() uint64 { + if x != nil { + return x.FieldI + } + return 0 +} +func (x *Primitives) SetFieldI(v uint64) { + x.FieldI = v +} +func (x *Primitives) GetFieldJ() float64 { + if x != nil { + return x.FieldJ + } + return 0 +} +func (x *Primitives) SetFieldJ(v float64) { + x.FieldJ = v +} +func (x *Primitives) GetFieldK() uint32 { + if x != nil { + return x.FieldK + } + return 0 +} +func (x *Primitives) SetFieldK(v uint32) { + x.FieldK = v +} +func (x *Primitives) GetFieldH() Primitives_SomeEnum { + if x != nil { + return x.FieldH + } + return 0 +} +func (x *Primitives) SetFieldH(v Primitives_SomeEnum) { + x.FieldH = v +} +func (x *Primitives) GetFieldM() isPrimitives_FieldM { + if x != nil { + return x.FieldM + } + return nil +} +func (x *Primitives) SetFieldM(v isPrimitives_FieldM) { + x.FieldM = v +} +func (x *Primitives) GetFieldMa() []byte { + if xx, ok := x.GetFieldM().(*Primitives_FieldMa); ok { + return xx.FieldMa + } + return nil +} +func (x *Primitives) SetFieldMa(v *Primitives_FieldMa) { + x.FieldM = v +} +func (x *Primitives_FieldMa) GetFieldMa() []byte { + if x != nil { + return x.FieldMa + } + return nil +} +func (x *Primitives_FieldMa) SetFieldMa(v []byte) { + x.FieldMa = v +} +func (x *Primitives) GetFieldMe() uint32 { + if xx, ok := x.GetFieldM().(*Primitives_FieldMe); ok { + return xx.FieldMe + } + return 0 +} +func (x *Primitives) SetFieldMe(v *Primitives_FieldMe) { + x.FieldM = v +} +func (x *Primitives_FieldMe) GetFieldMe() uint32 { + if x != nil { + return x.FieldMe + } + return 0 +} +func (x *Primitives_FieldMe) SetFieldMe(v uint32) { + x.FieldMe = v +} +func (x *Primitives) GetFieldAux() *Primitives_Aux { + if xx, ok := x.GetFieldM().(*Primitives_FieldAux); ok { + return xx.FieldAux + } + return nil +} +func (x *Primitives) SetFieldAux(v *Primitives_Aux) { + x.FieldM = &Primitives_FieldAux{FieldAux: v} +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *Primitives) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + first := true + out.RawByte('{') + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldA\":" + out.RawString(prefix) + if x.FieldA != nil { + out.Base64Bytes(x.FieldA) + } else { + out.String("") + } + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldB\":" + out.RawString(prefix) + out.String(x.FieldB) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldC\":" + out.RawString(prefix) + out.Bool(x.FieldC) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldD\":" + out.RawString(prefix) + out.Int32(x.FieldD) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldE\":" + out.RawString(prefix) + out.Uint32(x.FieldE) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldF\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldF, 10) + out.RawByte('"') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldG\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldG, 10) + out.RawByte('"') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldI\":" + out.RawString(prefix) + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldI, 10) + out.RawByte('"') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldJ\":" + out.RawString(prefix) + out.Float64(x.FieldJ) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldK\":" + out.RawString(prefix) + out.Uint32(x.FieldK) + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldH\":" + out.RawString(prefix) + v := int32(x.FieldH) + if vv, ok := Primitives_SomeEnum_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + } + } + switch xx := x.FieldM.(type) { + case *Primitives_FieldMa: + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldMa\":" + out.RawString(prefix) + if xx.FieldMa != nil { + out.Base64Bytes(xx.FieldMa) + } else { + out.String("") + } + } + case *Primitives_FieldMe: + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldMe\":" + out.RawString(prefix) + out.Uint32(xx.FieldMe) + } + case *Primitives_FieldAux: + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldAux\":" + out.RawString(prefix) + xx.FieldAux.MarshalEasyJSON(out) + } + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *Primitives) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "fieldA": + { + var f []byte + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } + x.FieldA = f + } + case "fieldB": + { + var f string + f = in.String() + x.FieldB = f + } + case "fieldC": + { + var f bool + f = in.Bool() + x.FieldC = f + } + case "fieldD": + { + var f int32 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseInt(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := int32(v) + f = pv + x.FieldD = f + } + case "fieldE": + { + var f uint32 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := uint32(v) + f = pv + x.FieldE = f + } + case "fieldF": + { + var f int64 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseInt(n, 10, 64) + if err != nil { + in.AddError(err) + return + } + pv := int64(v) + f = pv + x.FieldF = f + } + case "fieldG": + { + var f uint64 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 64) + if err != nil { + in.AddError(err) + return + } + pv := uint64(v) + f = pv + x.FieldG = f + } + case "fieldI": + { + var f uint64 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 64) + if err != nil { + in.AddError(err) + return + } + pv := uint64(v) + f = pv + x.FieldI = f + } + case "fieldJ": + { + var f float64 + f = in.Float64() + x.FieldJ = f + } + case "fieldK": + { + var f uint32 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := uint32(v) + f = pv + x.FieldK = f + } + case "fieldH": + { + var f Primitives_SomeEnum + var parsedValue Primitives_SomeEnum + switch v := in.Interface().(type) { + case string: + if vv, ok := Primitives_SomeEnum_value[v]; ok { + parsedValue = Primitives_SomeEnum(vv) + break + } + vv, err := strconv.ParseInt(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + parsedValue = Primitives_SomeEnum(vv) + case float64: + parsedValue = Primitives_SomeEnum(v) + } + f = parsedValue + x.FieldH = f + } + case "fieldMa": + xx := new(Primitives_FieldMa) + x.FieldM = xx + { + var f []byte + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } + xx.FieldMa = f + } + case "fieldMe": + xx := new(Primitives_FieldMe) + x.FieldM = xx + { + var f uint32 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := uint32(v) + f = pv + xx.FieldMe = f + } + case "fieldAux": + xx := new(Primitives_FieldAux) + x.FieldM = xx + { + var f *Primitives_Aux + f = new(Primitives_Aux) + f.UnmarshalEasyJSON(in) + xx.FieldAux = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type isPrimitives_FieldM interface { + isPrimitives_FieldM() +} + +type Primitives_FieldMa struct { + FieldMa []byte +} + +type Primitives_FieldMe struct { + FieldMe uint32 +} + +type Primitives_FieldAux struct { + FieldAux *Primitives_Aux +} + +func (*Primitives_FieldMa) isPrimitives_FieldM() {} + +func (*Primitives_FieldMe) isPrimitives_FieldM() {} + +func (*Primitives_FieldAux) isPrimitives_FieldM() {} + +type RepPrimitives_Aux struct { + InnerField uint32 `json:"innerField"` +} + +var ( + _ encoding.ProtoMarshaler = (*RepPrimitives_Aux)(nil) + _ encoding.ProtoUnmarshaler = (*RepPrimitives_Aux)(nil) + _ json.Marshaler = (*RepPrimitives_Aux)(nil) + _ json.Unmarshaler = (*RepPrimitives_Aux)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RepPrimitives_Aux) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt32Size(1, x.InnerField) + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RepPrimitives_Aux) MarshalProtobuf(dst []byte) []byte { + m := pool.MarshalerPool.Get() + defer pool.MarshalerPool.Put(m) + x.EmitProtobuf(m.MessageMarshaler()) + dst = m.Marshal(dst) + return dst +} + +func (x *RepPrimitives_Aux) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + if x.InnerField != 0 { + mm.AppendUint32(1, x.InnerField) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RepPrimitives_Aux) UnmarshalProtobuf(src []byte) (err error) { + var fc easyproto.FieldContext + for len(src) > 0 { + src, err = fc.NextField(src) + if err != nil { + return fmt.Errorf("cannot read next field in %s", "RepPrimitives_Aux") + } + switch fc.FieldNum { + case 1: // InnerField + data, ok := fc.Uint32() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "InnerField") + } + x.InnerField = data + } + } + return nil +} +func (x *RepPrimitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.InnerField + } + return 0 +} +func (x *RepPrimitives_Aux) SetInnerField(v uint32) { + x.InnerField = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RepPrimitives_Aux) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RepPrimitives_Aux) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + first := true + out.RawByte('{') + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"innerField\":" + out.RawString(prefix) + out.Uint32(x.InnerField) + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RepPrimitives_Aux) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RepPrimitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "innerField": + { + var f uint32 + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := uint32(v) + f = pv + x.InnerField = f + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} + +type RepPrimitives struct { + FieldA [][]byte `json:"fieldA"` + FieldB []string `json:"fieldB"` + FieldC []int32 `json:"fieldC"` + FieldD []uint32 `json:"fieldD"` + FieldE []int64 `json:"fieldE"` + FieldF []uint64 `json:"fieldF"` + FieldFu []uint64 `json:"fieldFu"` + FieldAux []RepPrimitives_Aux `json:"fieldAux"` +} + +var ( + _ encoding.ProtoMarshaler = (*RepPrimitives)(nil) + _ encoding.ProtoUnmarshaler = (*RepPrimitives)(nil) + _ json.Marshaler = (*RepPrimitives)(nil) + _ json.Unmarshaler = (*RepPrimitives)(nil) +) + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RepPrimitives) StableSize() (size int) { + if x == nil { + return 0 + } + var n int + size += proto.RepeatedBytesSize(1, x.FieldA) + size += proto.RepeatedStringSize(2, x.FieldB) + n, _ = proto.RepeatedInt32Size(3, x.FieldC) + size += n + n, _ = proto.RepeatedUInt32Size(4, x.FieldD) + size += n + n, _ = proto.RepeatedInt64Size(5, x.FieldE) + size += n + n, _ = proto.RepeatedUInt64Size(6, x.FieldF) + size += n + for i := range x.FieldFu { + size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i])) + } + for i := range x.FieldAux { + size += proto.NestedStructureSizeUnchecked(8, &x.FieldAux[i]) + } + return size +} + +// MarshalProtobuf implements the encoding.ProtoMarshaler interface. +func (x *RepPrimitives) MarshalProtobuf(dst []byte) []byte { + m := pool.MarshalerPool.Get() + defer pool.MarshalerPool.Put(m) + x.EmitProtobuf(m.MessageMarshaler()) + dst = m.Marshal(dst) + return dst +} + +func (x *RepPrimitives) EmitProtobuf(mm *easyproto.MessageMarshaler) { + if x == nil { + return + } + for j := range x.FieldA { + mm.AppendBytes(1, x.FieldA[j]) + } + for j := range x.FieldB { + mm.AppendString(2, x.FieldB[j]) + } + if len(x.FieldC) != 0 { + mm.AppendInt32s(3, x.FieldC) + } + if len(x.FieldD) != 0 { + mm.AppendUint32s(4, x.FieldD) + } + if len(x.FieldE) != 0 { + mm.AppendInt64s(5, x.FieldE) + } + if len(x.FieldF) != 0 { + mm.AppendUint64s(6, x.FieldF) + } + for j := range x.FieldFu { + mm.AppendUint64(7, x.FieldFu[j]) + } + for i := range x.FieldAux { + x.FieldAux[i].EmitProtobuf(mm.AppendMessage(8)) + } +} + +// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. +func (x *RepPrimitives) UnmarshalProtobuf(src []byte) (err error) { + var fc easyproto.FieldContext + for len(src) > 0 { + src, err = fc.NextField(src) + if err != nil { + return fmt.Errorf("cannot read next field in %s", "RepPrimitives") + } + switch fc.FieldNum { + case 1: // FieldA + data, ok := fc.Bytes() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldA") + } + x.FieldA = append(x.FieldA, data) + case 2: // FieldB + data, ok := fc.String() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldB") + } + x.FieldB = append(x.FieldB, data) + case 3: // FieldC + data, ok := fc.UnpackInt32s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldC") + } + x.FieldC = data + case 4: // FieldD + data, ok := fc.UnpackUint32s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldD") + } + x.FieldD = data + case 5: // FieldE + data, ok := fc.UnpackInt64s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldE") + } + x.FieldE = data + case 6: // FieldF + data, ok := fc.UnpackUint64s(nil) + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldF") + } + x.FieldF = data + case 7: // FieldFu + data, ok := fc.Uint64() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldFu") + } + x.FieldFu = append(x.FieldFu, data) + case 8: // FieldAux + data, ok := fc.MessageData() + if !ok { + return fmt.Errorf("cannot unmarshal field %s", "FieldAux") + } + x.FieldAux = append(x.FieldAux, RepPrimitives_Aux{}) + ff := &x.FieldAux[len(x.FieldAux)-1] + if err := ff.UnmarshalProtobuf(data); err != nil { + return fmt.Errorf("unmarshal: %w", err) + } + } + } + return nil +} +func (x *RepPrimitives) GetFieldA() [][]byte { + if x != nil { + return x.FieldA + } + return nil +} +func (x *RepPrimitives) SetFieldA(v [][]byte) { + x.FieldA = v +} +func (x *RepPrimitives) GetFieldB() []string { + if x != nil { + return x.FieldB + } + return nil +} +func (x *RepPrimitives) SetFieldB(v []string) { + x.FieldB = v +} +func (x *RepPrimitives) GetFieldC() []int32 { + if x != nil { + return x.FieldC + } + return nil +} +func (x *RepPrimitives) SetFieldC(v []int32) { + x.FieldC = v +} +func (x *RepPrimitives) GetFieldD() []uint32 { + if x != nil { + return x.FieldD + } + return nil +} +func (x *RepPrimitives) SetFieldD(v []uint32) { + x.FieldD = v +} +func (x *RepPrimitives) GetFieldE() []int64 { + if x != nil { + return x.FieldE + } + return nil +} +func (x *RepPrimitives) SetFieldE(v []int64) { + x.FieldE = v +} +func (x *RepPrimitives) GetFieldF() []uint64 { + if x != nil { + return x.FieldF + } + return nil +} +func (x *RepPrimitives) SetFieldF(v []uint64) { + x.FieldF = v +} +func (x *RepPrimitives) GetFieldFu() []uint64 { + if x != nil { + return x.FieldFu + } + return nil +} +func (x *RepPrimitives) SetFieldFu(v []uint64) { + x.FieldFu = v +} +func (x *RepPrimitives) GetFieldAux() []RepPrimitives_Aux { + if x != nil { + return x.FieldAux + } + return nil +} +func (x *RepPrimitives) SetFieldAux(v []RepPrimitives_Aux) { + x.FieldAux = v +} + +// MarshalJSON implements the json.Marshaler interface. +func (x *RepPrimitives) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + x.MarshalEasyJSON(&w) + return w.Buffer.BuildBytes(), w.Error +} +func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) { + if x == nil { + out.RawString("null") + return + } + first := true + out.RawByte('{') + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldA\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldA { + if i != 0 { + out.RawByte(',') + } + if x.FieldA[i] != nil { + out.Base64Bytes(x.FieldA[i]) + } else { + out.String("") + } + } + out.RawByte(']') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldB\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldB { + if i != 0 { + out.RawByte(',') + } + out.String(x.FieldB[i]) + } + out.RawByte(']') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldC\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldC { + if i != 0 { + out.RawByte(',') + } + out.Int32(x.FieldC[i]) + } + out.RawByte(']') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldD\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldD { + if i != 0 { + out.RawByte(',') + } + out.Uint32(x.FieldD[i]) + } + out.RawByte(']') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldE\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldE { + if i != 0 { + out.RawByte(',') + } + out.RawByte('"') + out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldE[i], 10) + out.RawByte('"') + } + out.RawByte(']') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldF\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldF { + if i != 0 { + out.RawByte(',') + } + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldF[i], 10) + out.RawByte('"') + } + out.RawByte(']') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldFu\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldFu { + if i != 0 { + out.RawByte(',') + } + out.RawByte('"') + out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldFu[i], 10) + out.RawByte('"') + } + out.RawByte(']') + } + { + if !first { + out.RawByte(',') + } else { + first = false + } + const prefix string = "\"fieldAux\":" + out.RawString(prefix) + out.RawByte('[') + for i := range x.FieldAux { + if i != 0 { + out.RawByte(',') + } + x.FieldAux[i].MarshalEasyJSON(out) + } + out.RawByte(']') + } + out.RawByte('}') +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (x *RepPrimitives) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + x.UnmarshalEasyJSON(&r) + return r.Error() +} +func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "fieldA": + { + var f []byte + var list [][]byte + in.Delim('[') + for !in.IsDelim(']') { + { + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + f = tmp + } + list = append(list, f) + in.WantComma() + } + x.FieldA = list + in.Delim(']') + } + case "fieldB": + { + var f string + var list []string + in.Delim('[') + for !in.IsDelim(']') { + f = in.String() + list = append(list, f) + in.WantComma() + } + x.FieldB = list + in.Delim(']') + } + case "fieldC": + { + var f int32 + var list []int32 + in.Delim('[') + for !in.IsDelim(']') { + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseInt(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := int32(v) + f = pv + list = append(list, f) + in.WantComma() + } + x.FieldC = list + in.Delim(']') + } + case "fieldD": + { + var f uint32 + var list []uint32 + in.Delim('[') + for !in.IsDelim(']') { + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 32) + if err != nil { + in.AddError(err) + return + } + pv := uint32(v) + f = pv + list = append(list, f) + in.WantComma() + } + x.FieldD = list + in.Delim(']') + } + case "fieldE": + { + var f int64 + var list []int64 + in.Delim('[') + for !in.IsDelim(']') { + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseInt(n, 10, 64) + if err != nil { + in.AddError(err) + return + } + pv := int64(v) + f = pv + list = append(list, f) + in.WantComma() + } + x.FieldE = list + in.Delim(']') + } + case "fieldF": + { + var f uint64 + var list []uint64 + in.Delim('[') + for !in.IsDelim(']') { + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 64) + if err != nil { + in.AddError(err) + return + } + pv := uint64(v) + f = pv + list = append(list, f) + in.WantComma() + } + x.FieldF = list + in.Delim(']') + } + case "fieldFu": + { + var f uint64 + var list []uint64 + in.Delim('[') + for !in.IsDelim(']') { + r := in.JsonNumber() + n := r.String() + v, err := strconv.ParseUint(n, 10, 64) + if err != nil { + in.AddError(err) + return + } + pv := uint64(v) + f = pv + list = append(list, f) + in.WantComma() + } + x.FieldFu = list + in.Delim(']') + } + case "fieldAux": + { + var f RepPrimitives_Aux + var list []RepPrimitives_Aux + in.Delim('[') + for !in.IsDelim(']') { + f = RepPrimitives_Aux{} + f.UnmarshalEasyJSON(in) + list = append(list, f) + in.WantComma() + } + x.FieldAux = list + in.Delim(']') + } + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} diff --git a/api/util/proto/test/test.pb.go b/api/util/proto/test/test.pb.go new file mode 100644 index 00000000..bbf13814 --- /dev/null +++ b/api/util/proto/test/test.pb.go @@ -0,0 +1,827 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/util/proto/test/test.proto + +//go:build !protoopaque + +package test + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Primitives_SomeEnum int32 + +const ( + Primitives_UNKNOWN Primitives_SomeEnum = 0 + Primitives_POSITIVE Primitives_SomeEnum = 1 + Primitives_NEGATIVE Primitives_SomeEnum = -1 +) + +// Enum value maps for Primitives_SomeEnum. +var ( + Primitives_SomeEnum_name = map[int32]string{ + 0: "UNKNOWN", + 1: "POSITIVE", + -1: "NEGATIVE", + } + Primitives_SomeEnum_value = map[string]int32{ + "UNKNOWN": 0, + "POSITIVE": 1, + "NEGATIVE": -1, + } +) + +func (x Primitives_SomeEnum) Enum() *Primitives_SomeEnum { + p := new(Primitives_SomeEnum) + *p = x + return p +} + +func (x Primitives_SomeEnum) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Primitives_SomeEnum) Descriptor() protoreflect.EnumDescriptor { + return file_api_util_proto_test_test_proto_enumTypes[0].Descriptor() +} + +func (Primitives_SomeEnum) Type() protoreflect.EnumType { + return &file_api_util_proto_test_test_proto_enumTypes[0] +} + +func (x Primitives_SomeEnum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +type Primitives struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC bool `protobuf:"varint,200,opt,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD int32 `protobuf:"varint,201,opt,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE uint32 `protobuf:"varint,202,opt,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` + FieldI uint64 `protobuf:"fixed64,205,opt,name=field_i,json=fieldI,proto3" json:"field_i,omitempty"` + FieldJ float64 `protobuf:"fixed64,206,opt,name=field_j,json=fieldJ,proto3" json:"field_j,omitempty"` + FieldK uint32 `protobuf:"fixed32,207,opt,name=field_k,json=fieldK,proto3" json:"field_k,omitempty"` + FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` + // Types that are valid to be assigned to FieldM: + // + // *Primitives_FieldMa + // *Primitives_FieldMe + // *Primitives_FieldAux + FieldM isPrimitives_FieldM `protobuf_oneof:"field_m"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Primitives) Reset() { + *x = Primitives{} + mi := &file_api_util_proto_test_test_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Primitives) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Primitives) ProtoMessage() {} + +func (x *Primitives) ProtoReflect() protoreflect.Message { + mi := &file_api_util_proto_test_test_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Primitives) GetFieldA() []byte { + if x != nil { + return x.FieldA + } + return nil +} + +func (x *Primitives) GetFieldB() string { + if x != nil { + return x.FieldB + } + return "" +} + +func (x *Primitives) GetFieldC() bool { + if x != nil { + return x.FieldC + } + return false +} + +func (x *Primitives) GetFieldD() int32 { + if x != nil { + return x.FieldD + } + return 0 +} + +func (x *Primitives) GetFieldE() uint32 { + if x != nil { + return x.FieldE + } + return 0 +} + +func (x *Primitives) GetFieldF() int64 { + if x != nil { + return x.FieldF + } + return 0 +} + +func (x *Primitives) GetFieldG() uint64 { + if x != nil { + return x.FieldG + } + return 0 +} + +func (x *Primitives) GetFieldI() uint64 { + if x != nil { + return x.FieldI + } + return 0 +} + +func (x *Primitives) GetFieldJ() float64 { + if x != nil { + return x.FieldJ + } + return 0 +} + +func (x *Primitives) GetFieldK() uint32 { + if x != nil { + return x.FieldK + } + return 0 +} + +func (x *Primitives) GetFieldH() Primitives_SomeEnum { + if x != nil { + return x.FieldH + } + return Primitives_UNKNOWN +} + +func (x *Primitives) GetFieldM() isPrimitives_FieldM { + if x != nil { + return x.FieldM + } + return nil +} + +func (x *Primitives) GetFieldMa() []byte { + if x != nil { + if x, ok := x.FieldM.(*Primitives_FieldMa); ok { + return x.FieldMa + } + } + return nil +} + +func (x *Primitives) GetFieldMe() uint32 { + if x != nil { + if x, ok := x.FieldM.(*Primitives_FieldMe); ok { + return x.FieldMe + } + } + return 0 +} + +func (x *Primitives) GetFieldAux() *Primitives_Aux { + if x != nil { + if x, ok := x.FieldM.(*Primitives_FieldAux); ok { + return x.FieldAux + } + } + return nil +} + +func (x *Primitives) SetFieldA(v []byte) { + if v == nil { + v = []byte{} + } + x.FieldA = v +} + +func (x *Primitives) SetFieldB(v string) { + x.FieldB = v +} + +func (x *Primitives) SetFieldC(v bool) { + x.FieldC = v +} + +func (x *Primitives) SetFieldD(v int32) { + x.FieldD = v +} + +func (x *Primitives) SetFieldE(v uint32) { + x.FieldE = v +} + +func (x *Primitives) SetFieldF(v int64) { + x.FieldF = v +} + +func (x *Primitives) SetFieldG(v uint64) { + x.FieldG = v +} + +func (x *Primitives) SetFieldI(v uint64) { + x.FieldI = v +} + +func (x *Primitives) SetFieldJ(v float64) { + x.FieldJ = v +} + +func (x *Primitives) SetFieldK(v uint32) { + x.FieldK = v +} + +func (x *Primitives) SetFieldH(v Primitives_SomeEnum) { + x.FieldH = v +} + +func (x *Primitives) SetFieldMa(v []byte) { + if v == nil { + v = []byte{} + } + x.FieldM = &Primitives_FieldMa{v} +} + +func (x *Primitives) SetFieldMe(v uint32) { + x.FieldM = &Primitives_FieldMe{v} +} + +func (x *Primitives) SetFieldAux(v *Primitives_Aux) { + if v == nil { + x.FieldM = nil + return + } + x.FieldM = &Primitives_FieldAux{v} +} + +func (x *Primitives) HasFieldM() bool { + if x == nil { + return false + } + return x.FieldM != nil +} + +func (x *Primitives) HasFieldMa() bool { + if x == nil { + return false + } + _, ok := x.FieldM.(*Primitives_FieldMa) + return ok +} + +func (x *Primitives) HasFieldMe() bool { + if x == nil { + return false + } + _, ok := x.FieldM.(*Primitives_FieldMe) + return ok +} + +func (x *Primitives) HasFieldAux() bool { + if x == nil { + return false + } + _, ok := x.FieldM.(*Primitives_FieldAux) + return ok +} + +func (x *Primitives) ClearFieldM() { + x.FieldM = nil +} + +func (x *Primitives) ClearFieldMa() { + if _, ok := x.FieldM.(*Primitives_FieldMa); ok { + x.FieldM = nil + } +} + +func (x *Primitives) ClearFieldMe() { + if _, ok := x.FieldM.(*Primitives_FieldMe); ok { + x.FieldM = nil + } +} + +func (x *Primitives) ClearFieldAux() { + if _, ok := x.FieldM.(*Primitives_FieldAux); ok { + x.FieldM = nil + } +} + +const Primitives_FieldM_not_set_case case_Primitives_FieldM = 0 +const Primitives_FieldMa_case case_Primitives_FieldM = 401 +const Primitives_FieldMe_case case_Primitives_FieldM = 402 +const Primitives_FieldAux_case case_Primitives_FieldM = 403 + +func (x *Primitives) WhichFieldM() case_Primitives_FieldM { + if x == nil { + return Primitives_FieldM_not_set_case + } + switch x.FieldM.(type) { + case *Primitives_FieldMa: + return Primitives_FieldMa_case + case *Primitives_FieldMe: + return Primitives_FieldMe_case + case *Primitives_FieldAux: + return Primitives_FieldAux_case + default: + return Primitives_FieldM_not_set_case + } +} + +type Primitives_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + FieldA []byte + FieldB string + FieldC bool + FieldD int32 + FieldE uint32 + FieldF int64 + FieldG uint64 + FieldI uint64 + FieldJ float64 + FieldK uint32 + FieldH Primitives_SomeEnum + // Fields of oneof FieldM: + FieldMa []byte + FieldMe *uint32 + FieldAux *Primitives_Aux + // -- end of FieldM +} + +func (b0 Primitives_builder) Build() *Primitives { + m0 := &Primitives{} + b, x := &b0, m0 + _, _ = b, x + x.FieldA = b.FieldA + x.FieldB = b.FieldB + x.FieldC = b.FieldC + x.FieldD = b.FieldD + x.FieldE = b.FieldE + x.FieldF = b.FieldF + x.FieldG = b.FieldG + x.FieldI = b.FieldI + x.FieldJ = b.FieldJ + x.FieldK = b.FieldK + x.FieldH = b.FieldH + if b.FieldMa != nil { + x.FieldM = &Primitives_FieldMa{b.FieldMa} + } + if b.FieldMe != nil { + x.FieldM = &Primitives_FieldMe{*b.FieldMe} + } + if b.FieldAux != nil { + x.FieldM = &Primitives_FieldAux{b.FieldAux} + } + return m0 +} + +type case_Primitives_FieldM protoreflect.FieldNumber + +func (x case_Primitives_FieldM) String() string { + md := file_api_util_proto_test_test_proto_msgTypes[0].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isPrimitives_FieldM interface { + isPrimitives_FieldM() +} + +type Primitives_FieldMa struct { + FieldMa []byte `protobuf:"bytes,401,opt,name=field_ma,json=fieldMa,proto3,oneof"` +} + +type Primitives_FieldMe struct { + FieldMe uint32 `protobuf:"varint,402,opt,name=field_me,json=fieldMe,proto3,oneof"` +} + +type Primitives_FieldAux struct { + FieldAux *Primitives_Aux `protobuf:"bytes,403,opt,name=field_aux,json=fieldAux,proto3,oneof"` +} + +func (*Primitives_FieldMa) isPrimitives_FieldM() {} + +func (*Primitives_FieldMe) isPrimitives_FieldM() {} + +func (*Primitives_FieldAux) isPrimitives_FieldM() {} + +type RepPrimitives struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + FieldFu []uint64 `protobuf:"varint,7,rep,name=field_fu,json=fieldFu,proto3" json:"field_fu,omitempty"` + FieldAux []*RepPrimitives_Aux `protobuf:"bytes,8,rep,name=field_aux,json=fieldAux,proto3" json:"field_aux,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepPrimitives) Reset() { + *x = RepPrimitives{} + mi := &file_api_util_proto_test_test_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepPrimitives) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepPrimitives) ProtoMessage() {} + +func (x *RepPrimitives) ProtoReflect() protoreflect.Message { + mi := &file_api_util_proto_test_test_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RepPrimitives) GetFieldA() [][]byte { + if x != nil { + return x.FieldA + } + return nil +} + +func (x *RepPrimitives) GetFieldB() []string { + if x != nil { + return x.FieldB + } + return nil +} + +func (x *RepPrimitives) GetFieldC() []int32 { + if x != nil { + return x.FieldC + } + return nil +} + +func (x *RepPrimitives) GetFieldD() []uint32 { + if x != nil { + return x.FieldD + } + return nil +} + +func (x *RepPrimitives) GetFieldE() []int64 { + if x != nil { + return x.FieldE + } + return nil +} + +func (x *RepPrimitives) GetFieldF() []uint64 { + if x != nil { + return x.FieldF + } + return nil +} + +func (x *RepPrimitives) GetFieldFu() []uint64 { + if x != nil { + return x.FieldFu + } + return nil +} + +func (x *RepPrimitives) GetFieldAux() []*RepPrimitives_Aux { + if x != nil { + return x.FieldAux + } + return nil +} + +func (x *RepPrimitives) SetFieldA(v [][]byte) { + x.FieldA = v +} + +func (x *RepPrimitives) SetFieldB(v []string) { + x.FieldB = v +} + +func (x *RepPrimitives) SetFieldC(v []int32) { + x.FieldC = v +} + +func (x *RepPrimitives) SetFieldD(v []uint32) { + x.FieldD = v +} + +func (x *RepPrimitives) SetFieldE(v []int64) { + x.FieldE = v +} + +func (x *RepPrimitives) SetFieldF(v []uint64) { + x.FieldF = v +} + +func (x *RepPrimitives) SetFieldFu(v []uint64) { + x.FieldFu = v +} + +func (x *RepPrimitives) SetFieldAux(v []*RepPrimitives_Aux) { + x.FieldAux = v +} + +type RepPrimitives_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + FieldA [][]byte + FieldB []string + FieldC []int32 + FieldD []uint32 + FieldE []int64 + FieldF []uint64 + FieldFu []uint64 + FieldAux []*RepPrimitives_Aux +} + +func (b0 RepPrimitives_builder) Build() *RepPrimitives { + m0 := &RepPrimitives{} + b, x := &b0, m0 + _, _ = b, x + x.FieldA = b.FieldA + x.FieldB = b.FieldB + x.FieldC = b.FieldC + x.FieldD = b.FieldD + x.FieldE = b.FieldE + x.FieldF = b.FieldF + x.FieldFu = b.FieldFu + x.FieldAux = b.FieldAux + return m0 +} + +type Primitives_Aux struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + InnerField uint32 `protobuf:"varint,1,opt,name=inner_field,json=innerField,proto3" json:"inner_field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Primitives_Aux) Reset() { + *x = Primitives_Aux{} + mi := &file_api_util_proto_test_test_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Primitives_Aux) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Primitives_Aux) ProtoMessage() {} + +func (x *Primitives_Aux) ProtoReflect() protoreflect.Message { + mi := &file_api_util_proto_test_test_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Primitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.InnerField + } + return 0 +} + +func (x *Primitives_Aux) SetInnerField(v uint32) { + x.InnerField = v +} + +type Primitives_Aux_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + InnerField uint32 +} + +func (b0 Primitives_Aux_builder) Build() *Primitives_Aux { + m0 := &Primitives_Aux{} + b, x := &b0, m0 + _, _ = b, x + x.InnerField = b.InnerField + return m0 +} + +type RepPrimitives_Aux struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + InnerField uint32 `protobuf:"varint,1,opt,name=inner_field,json=innerField,proto3" json:"inner_field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepPrimitives_Aux) Reset() { + *x = RepPrimitives_Aux{} + mi := &file_api_util_proto_test_test_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepPrimitives_Aux) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepPrimitives_Aux) ProtoMessage() {} + +func (x *RepPrimitives_Aux) ProtoReflect() protoreflect.Message { + mi := &file_api_util_proto_test_test_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RepPrimitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.InnerField + } + return 0 +} + +func (x *RepPrimitives_Aux) SetInnerField(v uint32) { + x.InnerField = v +} + +type RepPrimitives_Aux_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + InnerField uint32 +} + +func (b0 RepPrimitives_Aux_builder) Build() *RepPrimitives_Aux { + m0 := &RepPrimitives_Aux{} + b, x := &b0, m0 + _, _ = b, x + x.InnerField = b.InnerField + return m0 +} + +var File_api_util_proto_test_test_proto protoreflect.FileDescriptor + +var file_api_util_proto_test_test_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x04, 0x74, 0x65, 0x73, 0x74, 0x22, 0xa6, 0x04, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, + 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, + 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x63, 0x18, 0xc8, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x43, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0xc9, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, + 0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, + 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x67, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x69, 0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x49, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6a, 0x18, 0xce, + 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4a, 0x12, 0x18, 0x0a, + 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6b, 0x18, 0xcf, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4b, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x68, 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, + 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x12, 0x1c, 0x0a, 0x08, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x18, 0x91, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x12, 0x1c, 0x0a, 0x08, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x18, 0x92, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, + 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x61, 0x75, 0x78, 0x18, 0x93, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, + 0x75, 0x78, 0x48, 0x00, 0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, + 0x0a, 0x03, 0x41, 0x75, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, + 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, + 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22, + 0xa2, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, + 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x1d, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x66, 0x75, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x46, 0x75, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x61, 0x75, 0x78, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x2e, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, + 0x75, 0x78, 0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, 0x0a, 0x03, + 0x41, 0x75, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_api_util_proto_test_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_api_util_proto_test_test_proto_goTypes = []any{ + (Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum + (*Primitives)(nil), // 1: test.Primitives + (*RepPrimitives)(nil), // 2: test.RepPrimitives + (*Primitives_Aux)(nil), // 3: test.Primitives.Aux + (*RepPrimitives_Aux)(nil), // 4: test.RepPrimitives.Aux +} +var file_api_util_proto_test_test_proto_depIdxs = []int32{ + 0, // 0: test.Primitives.field_h:type_name -> test.Primitives.SomeEnum + 3, // 1: test.Primitives.field_aux:type_name -> test.Primitives.Aux + 4, // 2: test.RepPrimitives.field_aux:type_name -> test.RepPrimitives.Aux + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_api_util_proto_test_test_proto_init() } +func file_api_util_proto_test_test_proto_init() { + if File_api_util_proto_test_test_proto != nil { + return + } + file_api_util_proto_test_test_proto_msgTypes[0].OneofWrappers = []any{ + (*Primitives_FieldMa)(nil), + (*Primitives_FieldMe)(nil), + (*Primitives_FieldAux)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_util_proto_test_test_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_util_proto_test_test_proto_goTypes, + DependencyIndexes: file_api_util_proto_test_test_proto_depIdxs, + EnumInfos: file_api_util_proto_test_test_proto_enumTypes, + MessageInfos: file_api_util_proto_test_test_proto_msgTypes, + }.Build() + File_api_util_proto_test_test_proto = out.File + file_api_util_proto_test_test_proto_rawDesc = nil + file_api_util_proto_test_test_proto_goTypes = nil + file_api_util_proto_test_test_proto_depIdxs = nil +} diff --git a/api/util/proto/test/test.proto b/api/util/proto/test/test.proto new file mode 100644 index 00000000..58cee2f2 --- /dev/null +++ b/api/util/proto/test/test.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +package test; + +option go_package = "util/proto/test"; + +message Primitives { + bytes field_a = 1; + string field_b = 2; + bool field_c = 200; + int32 field_d = 201; + uint32 field_e = 202; + int64 field_f = 203; + uint64 field_g = 204; + fixed64 field_i = 205; + double field_j = 206; + fixed32 field_k = 207; + + enum SomeEnum { + UNKNOWN = 0; + POSITIVE = 1; + NEGATIVE = -1; + } + SomeEnum field_h = 300; + + message Aux { uint32 inner_field = 1; } + + oneof field_m { + bytes field_ma = 401; + uint32 field_me = 402; + Aux field_aux = 403; + } +} + +message RepPrimitives { + repeated bytes field_a = 1; + repeated string field_b = 2; + repeated int32 field_c = 3; + repeated uint32 field_d = 4; + repeated int64 field_e = 5; + repeated uint64 field_f = 6; + repeated uint64 field_fu = 7 [ packed = false ]; + + message Aux { uint32 inner_field = 1; } + repeated Aux field_aux = 8; +} diff --git a/api/util/proto/test/test_protoopaque.pb.go b/api/util/proto/test/test_protoopaque.pb.go new file mode 100644 index 00000000..29ce3b76 --- /dev/null +++ b/api/util/proto/test/test_protoopaque.pb.go @@ -0,0 +1,817 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.1 +// protoc v5.29.2 +// source: api/util/proto/test/test.proto + +//go:build protoopaque + +package test + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Primitives_SomeEnum int32 + +const ( + Primitives_UNKNOWN Primitives_SomeEnum = 0 + Primitives_POSITIVE Primitives_SomeEnum = 1 + Primitives_NEGATIVE Primitives_SomeEnum = -1 +) + +// Enum value maps for Primitives_SomeEnum. +var ( + Primitives_SomeEnum_name = map[int32]string{ + 0: "UNKNOWN", + 1: "POSITIVE", + -1: "NEGATIVE", + } + Primitives_SomeEnum_value = map[string]int32{ + "UNKNOWN": 0, + "POSITIVE": 1, + "NEGATIVE": -1, + } +) + +func (x Primitives_SomeEnum) Enum() *Primitives_SomeEnum { + p := new(Primitives_SomeEnum) + *p = x + return p +} + +func (x Primitives_SomeEnum) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Primitives_SomeEnum) Descriptor() protoreflect.EnumDescriptor { + return file_api_util_proto_test_test_proto_enumTypes[0].Descriptor() +} + +func (Primitives_SomeEnum) Type() protoreflect.EnumType { + return &file_api_util_proto_test_test_proto_enumTypes[0] +} + +func (x Primitives_SomeEnum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +type Primitives struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_FieldA []byte `protobuf:"bytes,1,opt,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + xxx_hidden_FieldB string `protobuf:"bytes,2,opt,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + xxx_hidden_FieldC bool `protobuf:"varint,200,opt,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + xxx_hidden_FieldD int32 `protobuf:"varint,201,opt,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + xxx_hidden_FieldE uint32 `protobuf:"varint,202,opt,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + xxx_hidden_FieldF int64 `protobuf:"varint,203,opt,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + xxx_hidden_FieldG uint64 `protobuf:"varint,204,opt,name=field_g,json=fieldG,proto3" json:"field_g,omitempty"` + xxx_hidden_FieldI uint64 `protobuf:"fixed64,205,opt,name=field_i,json=fieldI,proto3" json:"field_i,omitempty"` + xxx_hidden_FieldJ float64 `protobuf:"fixed64,206,opt,name=field_j,json=fieldJ,proto3" json:"field_j,omitempty"` + xxx_hidden_FieldK uint32 `protobuf:"fixed32,207,opt,name=field_k,json=fieldK,proto3" json:"field_k,omitempty"` + xxx_hidden_FieldH Primitives_SomeEnum `protobuf:"varint,300,opt,name=field_h,json=fieldH,proto3,enum=test.Primitives_SomeEnum" json:"field_h,omitempty"` + xxx_hidden_FieldM isPrimitives_FieldM `protobuf_oneof:"field_m"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Primitives) Reset() { + *x = Primitives{} + mi := &file_api_util_proto_test_test_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Primitives) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Primitives) ProtoMessage() {} + +func (x *Primitives) ProtoReflect() protoreflect.Message { + mi := &file_api_util_proto_test_test_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Primitives) GetFieldA() []byte { + if x != nil { + return x.xxx_hidden_FieldA + } + return nil +} + +func (x *Primitives) GetFieldB() string { + if x != nil { + return x.xxx_hidden_FieldB + } + return "" +} + +func (x *Primitives) GetFieldC() bool { + if x != nil { + return x.xxx_hidden_FieldC + } + return false +} + +func (x *Primitives) GetFieldD() int32 { + if x != nil { + return x.xxx_hidden_FieldD + } + return 0 +} + +func (x *Primitives) GetFieldE() uint32 { + if x != nil { + return x.xxx_hidden_FieldE + } + return 0 +} + +func (x *Primitives) GetFieldF() int64 { + if x != nil { + return x.xxx_hidden_FieldF + } + return 0 +} + +func (x *Primitives) GetFieldG() uint64 { + if x != nil { + return x.xxx_hidden_FieldG + } + return 0 +} + +func (x *Primitives) GetFieldI() uint64 { + if x != nil { + return x.xxx_hidden_FieldI + } + return 0 +} + +func (x *Primitives) GetFieldJ() float64 { + if x != nil { + return x.xxx_hidden_FieldJ + } + return 0 +} + +func (x *Primitives) GetFieldK() uint32 { + if x != nil { + return x.xxx_hidden_FieldK + } + return 0 +} + +func (x *Primitives) GetFieldH() Primitives_SomeEnum { + if x != nil { + return x.xxx_hidden_FieldH + } + return Primitives_UNKNOWN +} + +func (x *Primitives) GetFieldMa() []byte { + if x != nil { + if x, ok := x.xxx_hidden_FieldM.(*primitives_FieldMa); ok { + return x.FieldMa + } + } + return nil +} + +func (x *Primitives) GetFieldMe() uint32 { + if x != nil { + if x, ok := x.xxx_hidden_FieldM.(*primitives_FieldMe); ok { + return x.FieldMe + } + } + return 0 +} + +func (x *Primitives) GetFieldAux() *Primitives_Aux { + if x != nil { + if x, ok := x.xxx_hidden_FieldM.(*primitives_FieldAux); ok { + return x.FieldAux + } + } + return nil +} + +func (x *Primitives) SetFieldA(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_FieldA = v +} + +func (x *Primitives) SetFieldB(v string) { + x.xxx_hidden_FieldB = v +} + +func (x *Primitives) SetFieldC(v bool) { + x.xxx_hidden_FieldC = v +} + +func (x *Primitives) SetFieldD(v int32) { + x.xxx_hidden_FieldD = v +} + +func (x *Primitives) SetFieldE(v uint32) { + x.xxx_hidden_FieldE = v +} + +func (x *Primitives) SetFieldF(v int64) { + x.xxx_hidden_FieldF = v +} + +func (x *Primitives) SetFieldG(v uint64) { + x.xxx_hidden_FieldG = v +} + +func (x *Primitives) SetFieldI(v uint64) { + x.xxx_hidden_FieldI = v +} + +func (x *Primitives) SetFieldJ(v float64) { + x.xxx_hidden_FieldJ = v +} + +func (x *Primitives) SetFieldK(v uint32) { + x.xxx_hidden_FieldK = v +} + +func (x *Primitives) SetFieldH(v Primitives_SomeEnum) { + x.xxx_hidden_FieldH = v +} + +func (x *Primitives) SetFieldMa(v []byte) { + if v == nil { + v = []byte{} + } + x.xxx_hidden_FieldM = &primitives_FieldMa{v} +} + +func (x *Primitives) SetFieldMe(v uint32) { + x.xxx_hidden_FieldM = &primitives_FieldMe{v} +} + +func (x *Primitives) SetFieldAux(v *Primitives_Aux) { + if v == nil { + x.xxx_hidden_FieldM = nil + return + } + x.xxx_hidden_FieldM = &primitives_FieldAux{v} +} + +func (x *Primitives) HasFieldM() bool { + if x == nil { + return false + } + return x.xxx_hidden_FieldM != nil +} + +func (x *Primitives) HasFieldMa() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_FieldM.(*primitives_FieldMa) + return ok +} + +func (x *Primitives) HasFieldMe() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_FieldM.(*primitives_FieldMe) + return ok +} + +func (x *Primitives) HasFieldAux() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_FieldM.(*primitives_FieldAux) + return ok +} + +func (x *Primitives) ClearFieldM() { + x.xxx_hidden_FieldM = nil +} + +func (x *Primitives) ClearFieldMa() { + if _, ok := x.xxx_hidden_FieldM.(*primitives_FieldMa); ok { + x.xxx_hidden_FieldM = nil + } +} + +func (x *Primitives) ClearFieldMe() { + if _, ok := x.xxx_hidden_FieldM.(*primitives_FieldMe); ok { + x.xxx_hidden_FieldM = nil + } +} + +func (x *Primitives) ClearFieldAux() { + if _, ok := x.xxx_hidden_FieldM.(*primitives_FieldAux); ok { + x.xxx_hidden_FieldM = nil + } +} + +const Primitives_FieldM_not_set_case case_Primitives_FieldM = 0 +const Primitives_FieldMa_case case_Primitives_FieldM = 401 +const Primitives_FieldMe_case case_Primitives_FieldM = 402 +const Primitives_FieldAux_case case_Primitives_FieldM = 403 + +func (x *Primitives) WhichFieldM() case_Primitives_FieldM { + if x == nil { + return Primitives_FieldM_not_set_case + } + switch x.xxx_hidden_FieldM.(type) { + case *primitives_FieldMa: + return Primitives_FieldMa_case + case *primitives_FieldMe: + return Primitives_FieldMe_case + case *primitives_FieldAux: + return Primitives_FieldAux_case + default: + return Primitives_FieldM_not_set_case + } +} + +type Primitives_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + FieldA []byte + FieldB string + FieldC bool + FieldD int32 + FieldE uint32 + FieldF int64 + FieldG uint64 + FieldI uint64 + FieldJ float64 + FieldK uint32 + FieldH Primitives_SomeEnum + // Fields of oneof xxx_hidden_FieldM: + FieldMa []byte + FieldMe *uint32 + FieldAux *Primitives_Aux + // -- end of xxx_hidden_FieldM +} + +func (b0 Primitives_builder) Build() *Primitives { + m0 := &Primitives{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_FieldA = b.FieldA + x.xxx_hidden_FieldB = b.FieldB + x.xxx_hidden_FieldC = b.FieldC + x.xxx_hidden_FieldD = b.FieldD + x.xxx_hidden_FieldE = b.FieldE + x.xxx_hidden_FieldF = b.FieldF + x.xxx_hidden_FieldG = b.FieldG + x.xxx_hidden_FieldI = b.FieldI + x.xxx_hidden_FieldJ = b.FieldJ + x.xxx_hidden_FieldK = b.FieldK + x.xxx_hidden_FieldH = b.FieldH + if b.FieldMa != nil { + x.xxx_hidden_FieldM = &primitives_FieldMa{b.FieldMa} + } + if b.FieldMe != nil { + x.xxx_hidden_FieldM = &primitives_FieldMe{*b.FieldMe} + } + if b.FieldAux != nil { + x.xxx_hidden_FieldM = &primitives_FieldAux{b.FieldAux} + } + return m0 +} + +type case_Primitives_FieldM protoreflect.FieldNumber + +func (x case_Primitives_FieldM) String() string { + md := file_api_util_proto_test_test_proto_msgTypes[0].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isPrimitives_FieldM interface { + isPrimitives_FieldM() +} + +type primitives_FieldMa struct { + FieldMa []byte `protobuf:"bytes,401,opt,name=field_ma,json=fieldMa,proto3,oneof"` +} + +type primitives_FieldMe struct { + FieldMe uint32 `protobuf:"varint,402,opt,name=field_me,json=fieldMe,proto3,oneof"` +} + +type primitives_FieldAux struct { + FieldAux *Primitives_Aux `protobuf:"bytes,403,opt,name=field_aux,json=fieldAux,proto3,oneof"` +} + +func (*primitives_FieldMa) isPrimitives_FieldM() {} + +func (*primitives_FieldMe) isPrimitives_FieldM() {} + +func (*primitives_FieldAux) isPrimitives_FieldM() {} + +type RepPrimitives struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"` + xxx_hidden_FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"` + xxx_hidden_FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"` + xxx_hidden_FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"` + xxx_hidden_FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"` + xxx_hidden_FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"` + xxx_hidden_FieldFu []uint64 `protobuf:"varint,7,rep,name=field_fu,json=fieldFu,proto3" json:"field_fu,omitempty"` + xxx_hidden_FieldAux *[]*RepPrimitives_Aux `protobuf:"bytes,8,rep,name=field_aux,json=fieldAux,proto3" json:"field_aux,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepPrimitives) Reset() { + *x = RepPrimitives{} + mi := &file_api_util_proto_test_test_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepPrimitives) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepPrimitives) ProtoMessage() {} + +func (x *RepPrimitives) ProtoReflect() protoreflect.Message { + mi := &file_api_util_proto_test_test_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RepPrimitives) GetFieldA() [][]byte { + if x != nil { + return x.xxx_hidden_FieldA + } + return nil +} + +func (x *RepPrimitives) GetFieldB() []string { + if x != nil { + return x.xxx_hidden_FieldB + } + return nil +} + +func (x *RepPrimitives) GetFieldC() []int32 { + if x != nil { + return x.xxx_hidden_FieldC + } + return nil +} + +func (x *RepPrimitives) GetFieldD() []uint32 { + if x != nil { + return x.xxx_hidden_FieldD + } + return nil +} + +func (x *RepPrimitives) GetFieldE() []int64 { + if x != nil { + return x.xxx_hidden_FieldE + } + return nil +} + +func (x *RepPrimitives) GetFieldF() []uint64 { + if x != nil { + return x.xxx_hidden_FieldF + } + return nil +} + +func (x *RepPrimitives) GetFieldFu() []uint64 { + if x != nil { + return x.xxx_hidden_FieldFu + } + return nil +} + +func (x *RepPrimitives) GetFieldAux() []*RepPrimitives_Aux { + if x != nil { + if x.xxx_hidden_FieldAux != nil { + return *x.xxx_hidden_FieldAux + } + } + return nil +} + +func (x *RepPrimitives) SetFieldA(v [][]byte) { + x.xxx_hidden_FieldA = v +} + +func (x *RepPrimitives) SetFieldB(v []string) { + x.xxx_hidden_FieldB = v +} + +func (x *RepPrimitives) SetFieldC(v []int32) { + x.xxx_hidden_FieldC = v +} + +func (x *RepPrimitives) SetFieldD(v []uint32) { + x.xxx_hidden_FieldD = v +} + +func (x *RepPrimitives) SetFieldE(v []int64) { + x.xxx_hidden_FieldE = v +} + +func (x *RepPrimitives) SetFieldF(v []uint64) { + x.xxx_hidden_FieldF = v +} + +func (x *RepPrimitives) SetFieldFu(v []uint64) { + x.xxx_hidden_FieldFu = v +} + +func (x *RepPrimitives) SetFieldAux(v []*RepPrimitives_Aux) { + x.xxx_hidden_FieldAux = &v +} + +type RepPrimitives_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + FieldA [][]byte + FieldB []string + FieldC []int32 + FieldD []uint32 + FieldE []int64 + FieldF []uint64 + FieldFu []uint64 + FieldAux []*RepPrimitives_Aux +} + +func (b0 RepPrimitives_builder) Build() *RepPrimitives { + m0 := &RepPrimitives{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_FieldA = b.FieldA + x.xxx_hidden_FieldB = b.FieldB + x.xxx_hidden_FieldC = b.FieldC + x.xxx_hidden_FieldD = b.FieldD + x.xxx_hidden_FieldE = b.FieldE + x.xxx_hidden_FieldF = b.FieldF + x.xxx_hidden_FieldFu = b.FieldFu + x.xxx_hidden_FieldAux = &b.FieldAux + return m0 +} + +type Primitives_Aux struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_InnerField uint32 `protobuf:"varint,1,opt,name=inner_field,json=innerField,proto3" json:"inner_field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Primitives_Aux) Reset() { + *x = Primitives_Aux{} + mi := &file_api_util_proto_test_test_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Primitives_Aux) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Primitives_Aux) ProtoMessage() {} + +func (x *Primitives_Aux) ProtoReflect() protoreflect.Message { + mi := &file_api_util_proto_test_test_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Primitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.xxx_hidden_InnerField + } + return 0 +} + +func (x *Primitives_Aux) SetInnerField(v uint32) { + x.xxx_hidden_InnerField = v +} + +type Primitives_Aux_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + InnerField uint32 +} + +func (b0 Primitives_Aux_builder) Build() *Primitives_Aux { + m0 := &Primitives_Aux{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_InnerField = b.InnerField + return m0 +} + +type RepPrimitives_Aux struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_InnerField uint32 `protobuf:"varint,1,opt,name=inner_field,json=innerField,proto3" json:"inner_field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepPrimitives_Aux) Reset() { + *x = RepPrimitives_Aux{} + mi := &file_api_util_proto_test_test_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepPrimitives_Aux) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepPrimitives_Aux) ProtoMessage() {} + +func (x *RepPrimitives_Aux) ProtoReflect() protoreflect.Message { + mi := &file_api_util_proto_test_test_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RepPrimitives_Aux) GetInnerField() uint32 { + if x != nil { + return x.xxx_hidden_InnerField + } + return 0 +} + +func (x *RepPrimitives_Aux) SetInnerField(v uint32) { + x.xxx_hidden_InnerField = v +} + +type RepPrimitives_Aux_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + InnerField uint32 +} + +func (b0 RepPrimitives_Aux_builder) Build() *RepPrimitives_Aux { + m0 := &RepPrimitives_Aux{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_InnerField = b.InnerField + return m0 +} + +var File_api_util_proto_test_test_proto protoreflect.FileDescriptor + +var file_api_util_proto_test_test_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x04, 0x74, 0x65, 0x73, 0x74, 0x22, 0xa6, 0x04, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x6d, 0x69, + 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, + 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x42, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x63, 0x18, 0xc8, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x43, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0xc9, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, + 0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, + 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x67, 0x18, 0xcc, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x47, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x69, 0x18, 0xcd, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x49, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6a, 0x18, 0xce, + 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4a, 0x12, 0x18, 0x0a, + 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6b, 0x18, 0xcf, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4b, 0x12, 0x33, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x68, 0x18, 0xac, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6f, 0x6d, 0x65, + 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x48, 0x12, 0x1c, 0x0a, 0x08, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x18, 0x91, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x12, 0x1c, 0x0a, 0x08, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x18, 0x92, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, + 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x61, 0x75, 0x78, 0x18, 0x93, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, + 0x75, 0x78, 0x48, 0x00, 0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, + 0x0a, 0x03, 0x41, 0x75, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, + 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x3c, 0x0a, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, + 0x08, 0x4e, 0x45, 0x47, 0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22, + 0xa2, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, + 0x73, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x42, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x12, 0x17, 0x0a, 0x07, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x44, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x12, 0x17, + 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, + 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x46, 0x12, 0x1d, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x66, 0x75, 0x18, 0x07, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x46, 0x75, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x61, 0x75, 0x78, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x2e, 0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, + 0x75, 0x78, 0x52, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, 0x0a, 0x03, + 0x41, 0x75, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_api_util_proto_test_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_api_util_proto_test_test_proto_goTypes = []any{ + (Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum + (*Primitives)(nil), // 1: test.Primitives + (*RepPrimitives)(nil), // 2: test.RepPrimitives + (*Primitives_Aux)(nil), // 3: test.Primitives.Aux + (*RepPrimitives_Aux)(nil), // 4: test.RepPrimitives.Aux +} +var file_api_util_proto_test_test_proto_depIdxs = []int32{ + 0, // 0: test.Primitives.field_h:type_name -> test.Primitives.SomeEnum + 3, // 1: test.Primitives.field_aux:type_name -> test.Primitives.Aux + 4, // 2: test.RepPrimitives.field_aux:type_name -> test.RepPrimitives.Aux + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_api_util_proto_test_test_proto_init() } +func file_api_util_proto_test_test_proto_init() { + if File_api_util_proto_test_test_proto != nil { + return + } + file_api_util_proto_test_test_proto_msgTypes[0].OneofWrappers = []any{ + (*primitives_FieldMa)(nil), + (*primitives_FieldMe)(nil), + (*primitives_FieldAux)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_util_proto_test_test_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_util_proto_test_test_proto_goTypes, + DependencyIndexes: file_api_util_proto_test_test_proto_depIdxs, + EnumInfos: file_api_util_proto_test_test_proto_enumTypes, + MessageInfos: file_api_util_proto_test_test_proto_msgTypes, + }.Build() + File_api_util_proto_test_test_proto = out.File + file_api_util_proto_test_test_proto_rawDesc = nil + file_api_util_proto_test_test_proto_goTypes = nil + file_api_util_proto_test_test_proto_depIdxs = nil +} diff --git a/api/util/protogen/internalgengo/file.go b/api/util/protogen/internalgengo/file.go new file mode 100644 index 00000000..d3dd19e9 --- /dev/null +++ b/api/util/protogen/internalgengo/file.go @@ -0,0 +1,245 @@ +package internalgengo + +import ( + "fmt" + "sort" + "strconv" + "strings" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +var ( + strconvPackage = protogen.GoImportPath("strconv") + fmtPackage = protogen.GoImportPath("fmt") + jsonPackage = protogen.GoImportPath("encoding/json") + easyprotoPackage = protogen.GoImportPath("github.com/VictoriaMetrics/easyproto") + mpPackage = protogen.GoImportPath("git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool") + protoPackage = protogen.GoImportPath("git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto") + encodingPackage = protogen.GoImportPath("git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding") + + mp = mpPackage.Ident("MarshalerPool") +) + +// GenerateFile generates a *.pb.go file enforcing field-order serialization. +func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile { + filename := file.GeneratedFilenamePrefix + "_frostfs.pb.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + + g.P("// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + g.Import(encodingPackage) + + // Doesn't work for multiple files in a single package, use external pool. + // g.P("var mp ", easyprotoPackage.Ident("MarshalerPool")) + + for _, e := range file.Enums { + emitEnum(g, e) + } + for _, msg := range file.Messages { + emitEasyProto(g, msg) + } + return g +} + +func emitEnum(g *protogen.GeneratedFile, e *protogen.Enum) { + g.P("type " + e.GoIdent.GoName + " int32") + g.P("const (") + for _, ev := range e.Values { + g.P(ev.GoIdent.GoName, " ", e.GoIdent.GoName, " = ", ev.Desc.Number()) + } + g.P(")") + + g.P("var (") + g.P(e.GoIdent.GoName+"_name", " = map[int32]string{") + for _, value := range e.Values { + g.P(value.Desc.Number(), ": ", strconv.Quote(string(value.Desc.Name())), ",") + } + g.P("}") + g.P(e.GoIdent.GoName+"_value", " = map[string]int32{") + for _, value := range e.Values { + g.P(strconv.Quote(string(value.Desc.Name())), ": ", value.Desc.Number(), ",") + } + g.P("}") + g.P(")") + g.P() + + g.P("func (x ", e.GoIdent.GoName, ") String() string {") + g.P("if v, ok := ", e.GoIdent.GoName+"_name[int32(x)]; ok {") + g.P("return v") + g.P("}") + g.P("return ", strconvPackage.Ident("FormatInt"), "(int64(x), 10)") + g.P("}") + + g.P("func (x *", e.GoIdent.GoName, ") FromString(s string) bool {") + g.P("if v, ok := ", e.GoIdent.GoName+"_value[s]; ok {") + g.P("*x = ", e.GoIdent.GoName, "(v)") + g.P("return true") + g.P("}") + g.P("return false") + g.P("}") +} + +func emitEasyProto(g *protogen.GeneratedFile, msg *protogen.Message) { + for _, e := range msg.Enums { + emitEnum(g, e) + } + for _, m := range msg.Messages { + emitEasyProto(g, m) + } + + g.P("type " + msg.GoIdent.GoName + " struct {") + emitMessageFields(g, msg) + g.P("}") + + g.P("var (") + g.P("_ ", encodingPackage.Ident("ProtoMarshaler"), " = (*", msg.GoIdent.GoName, ")(nil)") + g.P("_ ", encodingPackage.Ident("ProtoUnmarshaler"), " = (*", msg.GoIdent.GoName, ")(nil)") + g.P("_ ", jsonPackage.Ident("Marshaler"), " = (*", msg.GoIdent.GoName, ")(nil)") + g.P("_ ", jsonPackage.Ident("Unmarshaler"), " = (*", msg.GoIdent.GoName, ")(nil)") + g.P(")") + + emitStableSize(g, msg) + if strings.HasSuffix(msg.GoIdent.GoName, "Request") || strings.HasSuffix(msg.GoIdent.GoName, "Response") { + emitSignatureMethods(g, msg) + } + + emitProtoMethods(g, msg) + emitGettersSetters(g, msg) + emitJSONMethods(g, msg) + + for _, f := range msg.Fields { + if isFirstOneof(f) { + genOneof(g, f) + } + } +} + +func isFirstOneof(f *protogen.Field) bool { + return f.Oneof != nil && f == f.Oneof.Fields[0] +} + +func emitOneofGettersSetters(g *protogen.GeneratedFile, msg *protogen.Message, ff *protogen.Field) { + // For some reason protoc generates different code for oneof message/non-message fields: + // 1. For message we have 2 level struct wrapping and setters use inner type. + // 2. For other types we also have 2 level wrapping, but setters use outer type. + ft := fieldType(g, ff) + + g.P("func (x *", msg.GoIdent.GoName, ") Get", ff.GoName, "() ", ft, " {") + g.P("if xx, ok := x.Get", ff.Oneof.GoName, "().(*", ff.GoIdent, "); ok { return xx.", ff.GoName, " }") + g.P("return ", fieldDefaultValue(ff)) + g.P("}") + + if ff.Desc.Kind() == protoreflect.MessageKind { + g.P("func (x *", msg.GoIdent.GoName, ") Set", ff.GoName, "(v ", ft, ") {") + g.P("x.", ff.Oneof.GoName, " = &", ff.GoIdent, "{", ff.GoName, ": v}") + g.P("}") + } else { + g.P("func (x *", msg.GoIdent.GoName, ") Set", ff.GoName, "(v *", ff.GoIdent, ") {") + g.P("x.", ff.Oneof.GoName, " = v") + g.P("}") + + ft := fieldType(g, ff) + emitGetterSetter(g, ff.GoIdent.GoName, ff.GoName, ft.String(), fieldDefaultValue(ff)) + } +} + +func emitGettersSetters(g *protogen.GeneratedFile, msg *protogen.Message) { + for _, f := range msg.Fields { + if f.Oneof != nil { + if f.Oneof.Fields[0] == f { + emitGetterSetter(g, msg.GoIdent.GoName, f.Oneof.GoName, oneOfDescriptor(f.Oneof), "nil") + for _, ff := range f.Oneof.Fields { + emitOneofGettersSetters(g, msg, ff) + } + } + continue + } + + ft := fieldType(g, f) + emitGetterSetter(g, msg.GoIdent.GoName, f.GoName, ft.String(), fieldDefaultValue(f)) + } +} + +func emitMessageFields(g *protogen.GeneratedFile, msg *protogen.Message) { + for _, field := range msg.Fields { + genMessageField(g, field) + } +} + +func genMessageField(g *protogen.GeneratedFile, field *protogen.Field) { + if field.Oneof != nil { + if field.Oneof.Fields[0] == field { + g.P(field.Oneof.GoName, " ", oneOfDescriptor(field.Oneof)) + } + return + } + + typ := fieldType(g, field) + g.P(field.GoName, " ", typ, fmt.Sprintf(" `json:%q`", fieldJSONName(field))) +} + +func oneOfDescriptor(oneof *protogen.Oneof) string { + return "is" + oneof.GoIdent.GoName +} + +func genOneof(g *protogen.GeneratedFile, field *protogen.Field) { + ifName := oneOfDescriptor(field.Oneof) + g.P("type ", ifName, " interface {") + g.P(ifName, "()") + g.P("}") + g.P() + for _, field := range field.Oneof.Fields { + g.P("type ", field.GoIdent, " struct {") + + ft := fieldType(g, field) + g.P(field.GoName, " ", ft) + g.P("}") + g.P() + } + for _, field := range field.Oneof.Fields { + g.P("func (*", field.GoIdent, ") ", ifName, "() {}") + g.P() + } +} + +func fieldDefaultValue(field *protogen.Field) string { + if field.Desc.Cardinality() == protoreflect.Repeated { + return "nil" + } + + switch field.Desc.Kind() { + case protoreflect.MessageKind, protoreflect.BytesKind: + return "nil" + case protoreflect.BoolKind: + return "false" + case protoreflect.StringKind: + return `""` + default: + return "0" + } +} + +func castFieldName(f *protogen.Field) string { + if f.Oneof != nil { + return "x." + f.Oneof.GoName + } + + name := "x." + f.GoName + if f.Desc.Kind() != protoreflect.EnumKind { + return name + } + return "int32(" + name + ")" +} + +func sortFields(fs []*protogen.Field) []*protogen.Field { + res := make([]*protogen.Field, len(fs)) + copy(res, fs) + sort.Slice(res, func(i, j int) bool { + return res[i].Desc.Number() < res[j].Desc.Number() + }) + return res +} diff --git a/api/util/protogen/internalgengo/fuzz.go b/api/util/protogen/internalgengo/fuzz.go new file mode 100644 index 00000000..ec99692d --- /dev/null +++ b/api/util/protogen/internalgengo/fuzz.go @@ -0,0 +1,69 @@ +package internalgengo + +import ( + "google.golang.org/protobuf/compiler/protogen" +) + +var testingPackage = protogen.GoImportPath("testing") + +func GenerateFuzzTests(gen *protogen.Plugin, file *protogen.File) { + { + filename := file.GeneratedFilenamePrefix + "_frostfs_fuzz.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + + g.P("//go:build gofuzz") + g.P("// +build gofuzz") + g.P("// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + + for _, msg := range file.Messages { + emitFuzzWrappers(g, msg) + } + } + { + filename := file.GeneratedFilenamePrefix + "_frostfs_test.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + + g.P("//go:build gofuzz") + g.P("// +build gofuzz") + g.P("// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + + for _, msg := range file.Messages { + emitFuzzTests(g, msg) + } + } +} + +func emitFuzzWrappers(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("func DoFuzzProto", msg.GoIdent.GoName, "(data []byte) int {") + g.P("msg := new(", msg.GoIdent.GoName, ")") + g.P("if err := msg.UnmarshalProtobuf(data); err != nil { return 0 }") + g.P("_ = msg.MarshalProtobuf(nil)") + g.P("return 1") + g.P("}") + + g.P("func DoFuzzJSON", msg.GoIdent.GoName, "(data []byte) int {") + g.P("msg := new(", msg.GoIdent.GoName, ")") + g.P("if err := msg.UnmarshalJSON(data); err != nil { return 0 }") + g.P("_, err := msg.MarshalJSON()") + g.P("if err != nil { panic(err) }") + g.P("return 1") + g.P("}") +} + +func emitFuzzTests(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("func FuzzProto", msg.GoIdent.GoName, "(f *", testingPackage.Ident("F"), ") {") + g.P("f.Fuzz(func(t *", testingPackage.Ident("T"), ", data []byte) {") + g.P("DoFuzzProto", msg.GoIdent.GoName, "(data)") + g.P("})}") + + g.P("func FuzzJSON", msg.GoIdent.GoName, "(f *", testingPackage.Ident("F"), ") {") + g.P("f.Fuzz(func(t *", testingPackage.Ident("T"), ", data []byte) {") + g.P("DoFuzzJSON", msg.GoIdent.GoName, "(data)") + g.P("})}") +} diff --git a/api/util/protogen/internalgengo/getter.go b/api/util/protogen/internalgengo/getter.go new file mode 100644 index 00000000..78deef76 --- /dev/null +++ b/api/util/protogen/internalgengo/getter.go @@ -0,0 +1,14 @@ +package internalgengo + +import "google.golang.org/protobuf/compiler/protogen" + +func emitGetterSetter(g *protogen.GeneratedFile, typeName string, fieldName string, fieldType string, defaultValue string) { + g.P("func (x *", typeName, ") Get", fieldName, "() ", fieldType, " {") + g.P("if x != nil { return x.", fieldName, "}") + g.P("return ", defaultValue) + g.P("}") + + g.P("func (x *", typeName, ") Set", fieldName, "(v ", fieldType, ") {") + g.P("x.", fieldName, " = v") + g.P("}") +} diff --git a/api/util/protogen/internalgengo/json.go b/api/util/protogen/internalgengo/json.go new file mode 100644 index 00000000..20730a65 --- /dev/null +++ b/api/util/protogen/internalgengo/json.go @@ -0,0 +1,284 @@ +package internalgengo + +import ( + "fmt" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +var ( + jwriterPackage = protogen.GoImportPath("github.com/mailru/easyjson/jwriter") + jlexerPackage = protogen.GoImportPath("github.com/mailru/easyjson/jlexer") +) + +func emitJSONMethods(g *protogen.GeneratedFile, msg *protogen.Message) { + emitJSONMarshal(g, msg) + emitJSONUnmarshal(g, msg) +} + +func emitJSONUnmarshal(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("// UnmarshalJSON implements the json.Unmarshaler interface.") + g.P("func (x *", msg.GoIdent.GoName, ") UnmarshalJSON(data []byte) error {") + g.P("r := ", jlexerPackage.Ident("Lexer"), "{Data: data}") + g.P("x.UnmarshalEasyJSON(&r)") + g.P("return r.Error()") + g.P("}") + + g.P("func (x *", msg.GoIdent.GoName, ") UnmarshalEasyJSON(in *", jlexerPackage.Ident("Lexer"), ") {") + + g.P("isTopLevel := in.IsStart()") + g.P("if in.IsNull() {") + g.P("if isTopLevel { in.Consumed() }") + g.P("in.Skip()") + g.P("return") + g.P("}") + + g.P("in.Delim('{')") + g.P("for !in.IsDelim('}') {") + + g.P("key := in.UnsafeFieldName(false)") + g.P("in.WantColon()") + g.P("if in.IsNull() { in.Skip(); in.WantComma(); continue }") + g.P("switch key {") + for _, f := range msg.Fields { + g.P(`case "`, fieldJSONName(f), `":`) + if f.Oneof != nil { + g.P("xx := new(", f.GoIdent, ")") + g.P("x." + f.Oneof.GoName + " = xx") + emitJSONFieldRead(g, f, "xx") + continue + } + emitJSONFieldRead(g, f, "x") + } + g.P("}") + g.P("in.WantComma()") + g.P("}") + g.P("in.Delim('}')") + g.P("if isTopLevel { in.Consumed() }") + g.P("}") +} + +func emitJSONParseInteger(g *protogen.GeneratedFile, ident string, method string, bitSize int, typ string) { + g.P("r := in.JsonNumber()") + g.P("n := r.String()") + g.P("v, err := ", strconvPackage.Ident(method), "(n, 10, ", bitSize, ")") + g.P("if err != nil {") + g.P(" in.AddError(err)") + g.P(" return") + g.P("}") + g.P(ident, " := ", typ, "(v)") +} + +func emitJSONReadEnum(g *protogen.GeneratedFile, name string, enumType string) { + g.P(`switch v := in.Interface().(type) { + case string: + if vv, ok := `+enumType+`_value[v]; ok { + `+name+` = `+enumType+`(vv) + break + } + vv, err := `, strconvPackage.Ident("ParseInt"), `(v, 10, 32) + if err != nil { + in.AddError(err) + return + } + `+name+` = `+enumType+`(vv) + case float64: + `+name+` = `+enumType+`(v) + }`) +} + +func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string) { + g.P("{") + defer g.P("}") + + if f.Desc.IsList() { + g.P("var f ", fieldType(g, f)[2:]) + g.P("var list ", fieldType(g, f)) + g.P("in.Delim('[')") + defer g.P("in.Delim(']')") + + g.P("for !in.IsDelim(']') {") + } else { + g.P("var f ", fieldType(g, f)) + } + + var template string + switch f.Desc.Kind() { + case protoreflect.BoolKind: + template = "%s = in.Bool()" + case protoreflect.EnumKind: + g.Import(strconvPackage) + + enumType := fieldType(g, f).String() + g.P("var parsedValue " + enumType) + emitJSONReadEnum(g, "parsedValue", enumType) + template = "%s = parsedValue" + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + emitJSONParseInteger(g, "pv", "ParseInt", 32, "int32") + template = "%s = pv" + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + emitJSONParseInteger(g, "pv", "ParseUint", 32, "uint32") + template = "%s = pv" + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + emitJSONParseInteger(g, "pv", "ParseInt", 64, "int64") + template = "%s = pv" + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + emitJSONParseInteger(g, "pv", "ParseUint", 64, "uint64") + template = "%s = pv" + case protoreflect.FloatKind: + template = "%s = in.Float32()" + case protoreflect.DoubleKind: + template = "%s = in.Float64()" + case protoreflect.StringKind: + template = "%s = in.String()" + case protoreflect.BytesKind: + // Since some time ago proto3 support optional keyword, thus the presence is not tracked by default: + // https://github.com/protocolbuffers/protobuf-go/blob/fb995f184a1719ec42b247a3771d1036d92adf67/internal/impl/message_reflect_field.go#L327 + // We do not explicitly support `optional` keyword, protoc will fail on such fileds. + // Thus, treat empty string as `[]byte(nil)`. + template = `{ + tmp := in.Bytes() + if len(tmp) == 0 { + tmp = nil + } + %s = tmp + }` + case protoreflect.MessageKind: + if f.Desc.IsList() { + g.P("f = ", fieldType(g, f)[2:], "{}") + } else { + g.P("f = new(", fieldType(g, f)[1:], ")") + } + template = "%s.UnmarshalEasyJSON(in)" + case protoreflect.GroupKind: + panic("unimplemented") + } + g.P(fmt.Sprintf(template, "f")) + if f.Desc.IsList() { + g.P("list = append(list, f)") + g.P("in.WantComma()") + g.P("}") + g.P(name, ".", f.GoName, " = list") + } else { + g.P(name, ".", f.GoName, " = f") + } +} + +func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("// MarshalJSON implements the json.Marshaler interface.") + g.P("func (x *", msg.GoIdent.GoName, ") MarshalJSON() ([]byte, error) {") + g.P("w := ", jwriterPackage.Ident("Writer"), "{}") + g.P("x.MarshalEasyJSON(&w)") + g.P("return w.Buffer.BuildBytes(), w.Error") + g.P("}") + + g.P("func (x *", msg.GoIdent.GoName, ") MarshalEasyJSON(out *", jwriterPackage.Ident("Writer"), ") {") + g.P(`if x == nil { out.RawString("null"); return }`) + + if len(msg.Fields) != 0 { + g.P("first := true") + } + g.P("out.RawByte('{')") + for _, f := range msg.Fields { + if f.Oneof != nil { + if f.Oneof.Fields[0] != f { + continue + } + + g.P("switch xx := x.", f.Oneof.GoName, ".(type) {") + for _, ff := range f.Oneof.Fields { + g.P("case *", ff.GoIdent, ":") + emitJSONFieldWrite(g, ff, "xx") + } + g.P("}") + continue + } + emitJSONFieldWrite(g, f, "x") + } + g.P("out.RawByte('}')") + g.P("}") +} + +func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string) { + g.P("{") + defer g.P("}") + + selector := name + "." + f.GoName + + // This code is responsible for ignoring default values. + // We will restore it after having parametrized JSON marshaling. + // + // isNotDefault := notNil + // if f.Desc.IsList() { + // isNotDefault = notEmpty + // } else if f.Desc.Kind() != protoreflect.MessageKind { + // _, isNotDefault = easyprotoKindInfo(f.Desc.Kind()) + // } + // g.P("if ", isNotDefault(selector), "{") + // defer g.P("}") + + g.P("if !first { out.RawByte(','); } else { first = false; }") + g.P("const prefix string = ", `"\"`, fieldJSONName(f), `\":"`) + g.P("out.RawString(prefix)") + if f.Desc.IsList() { + selector += "[i]" + g.P("out.RawByte('[')") + defer g.P("out.RawByte(']')") + + g.P("for i := range ", name, ".", f.GoName, " {") + g.P("if i != 0 { out.RawByte(',') }") + defer g.P("}") + } + + var template string + switch f.Desc.Kind() { + case protoreflect.BoolKind: + template = "out.Bool(%s)" + case protoreflect.EnumKind: + enumType := fieldType(g, f).String() + template = `v := int32(%s) + if vv, ok := ` + enumType + `_name[v]; ok { + out.String(vv) + } else { + out.Int32(v) + }` + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + template = "out.Int32(%s)" + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + template = "out.Uint32(%s)" + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + g.P("out.RawByte('\"')") + g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendInt"), "(out.Buffer.Buf, ", selector, ", 10)") + g.P("out.RawByte('\"')") + return + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + g.P("out.RawByte('\"')") + g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendUint"), "(out.Buffer.Buf, ", selector, ", 10)") + g.P("out.RawByte('\"')") + return + case protoreflect.FloatKind: + template = "out.Float32(%s)" + case protoreflect.DoubleKind: + template = "out.Float64(%s)" + case protoreflect.StringKind: + template = "out.String(%s)" + case protoreflect.BytesKind: + g.P("if ", selector, "!= nil {") + g.P("out.Base64Bytes(", selector, ")") + g.P("} else { out.String(\"\") }") + return + case protoreflect.MessageKind: + template = "%s.MarshalEasyJSON(out)" + case protoreflect.GroupKind: + panic("unimplemented") + } + g.P(fmt.Sprintf(template, selector)) +} + +func fieldJSONName(f *protogen.Field) string { + if f.Desc.HasJSONName() { + return f.Desc.JSONName() + } + return string(f.Desc.Name()) +} diff --git a/api/util/protogen/internalgengo/options.go b/api/util/protogen/internalgengo/options.go new file mode 100644 index 00000000..8aab8f01 --- /dev/null +++ b/api/util/protogen/internalgengo/options.go @@ -0,0 +1,7 @@ +package internalgengo + +type Options struct { + Fuzz bool `yaml:"fuzz"` + JSON bool `yaml:"json"` + MessageData []string `yaml:"message_data"` +} diff --git a/api/util/protogen/internalgengo/proto.go b/api/util/protogen/internalgengo/proto.go new file mode 100644 index 00000000..1467541e --- /dev/null +++ b/api/util/protogen/internalgengo/proto.go @@ -0,0 +1,202 @@ +package internalgengo + +import ( + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func emitProtoMethods(g *protogen.GeneratedFile, msg *protogen.Message) { + emitMarshalProtobuf(g, msg) + emitUnmarshalProtobuf(g, msg) +} + +func emitUnmarshalProtobuf(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.") + g.P("func (x *", msg.GoIdent.GoName, ") UnmarshalProtobuf(src []byte) (err error) {") + g.P("var fc ", easyprotoPackage.Ident("FieldContext")) + g.P("for len(src) > 0 {") + { + g.P("src, err = fc.NextField(src)") + g.P("if err != nil { return ", fmtPackage.Ident("Errorf"), `("cannot read next field in %s", "`, msg.GoIdent.GoName, `")}`) + g.P("switch fc.FieldNum {") + { + for _, f := range msg.Fields { + g.P("case ", f.Desc.Number(), ":", " // ", f.GoName) + emitFieldUnmarshal(g, f) + } + } + g.P("}") + } + g.P("}") + + g.P("return nil") + g.P("}") +} + +func emitFieldUnmarshal(g *protogen.GeneratedFile, f *protogen.Field) { + name := castFieldName(f) + if f.Desc.Kind() == protoreflect.MessageKind { + g.P("data, ok := fc.MessageData()") + g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`) + if f.Desc.IsList() { + g.P(name, " = append(", name, ", ", fieldType(g, f)[2:], "{})") + g.P("ff := &", name, "[len(", name, ")-1]") + name = "ff" + } else if f.Oneof != nil { + const tmp = "oneofField" + g.P(tmp, " := &", f.GoIdent, "{", f.GoName, ": ", "new(", fieldType(g, f)[1:], ")}") + defer g.P(name, " = ", tmp) + + name = tmp + "." + f.GoName + } else { + g.P(name, " = new(", fieldType(g, f)[1:], ")") + } + + g.P(`if err := `, name, `.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err)}`) + return + } + + getter, _ := easyprotoKindInfo(f.Desc.Kind()) + + if f.Desc.IsList() && (f.Desc.Kind() == protoreflect.BytesKind || f.Desc.Kind() == protoreflect.StringKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()) { + g.P("data, ok := fc.", getter, "()") + g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`) + g.P(name, " = append(", name, ", data)") + return + } + + if f.Desc.IsList() { + g.P("data, ok := fc.Unpack", getter, "s(nil)") + } else { + g.P("data, ok := fc.", getter, "()") + } + + g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`) + value := "data" + if f.Desc.Kind() == protoreflect.EnumKind { + value = fieldType(g, f).String() + "(data)" + } + + if f.Oneof == nil { + g.P("x.", f.GoName, " = ", value) + } else { + g.P("x.", f.Oneof.GoName, " = &", f.GoIdent, "{", f.GoName, ": data}") + } +} + +func emitMarshalProtobuf(g *protogen.GeneratedFile, msg *protogen.Message) { + g.P("// MarshalProtobuf implements the encoding.ProtoMarshaler interface.") + g.P("func (x *", msg.GoIdent.GoName, ") MarshalProtobuf(dst []byte) []byte {") + g.P("m := ", mp, ".Get()") + g.P("defer ", mp, ".Put(m)") + g.P("x.EmitProtobuf(m.MessageMarshaler())") + g.P("dst = m.Marshal(dst)") + g.P("return dst") + g.P("}\n") + + g.P("func (x *", msg.GoIdent.GoName, ") EmitProtobuf(mm *", easyprotoPackage.Ident("MessageMarshaler"), ") {") + if len(msg.Fields) != 0 { + fs := sortFields(msg.Fields) + + g.P("if x == nil { return }") + for _, f := range fs { + emitFieldMarshal(g, f) + } + } + g.P("}") +} + +func emitMarshalOneof(g *protogen.GeneratedFile, f *protogen.Field) { + name := "x." + f.Oneof.GoName + g.P("if inner, ok := ", name, ".(*", f.GoIdent.GoName, "); ok {") + defer g.P("}") + emitMarshalRaw(g, f, "inner."+f.GoName) +} + +// easyprotoKindInfo returns string name for kind, used in easyproto methods. +// The second return value is a condition to test for the default value of kind. +func easyprotoKindInfo(kind protoreflect.Kind) (string, func(string) string) { + switch kind { + case protoreflect.BoolKind: + return "Bool", identity + case protoreflect.EnumKind: + return "Int32", notZero + case protoreflect.Int32Kind: + return "Int32", notZero + case protoreflect.Sint32Kind: + return "Sint32", notZero + case protoreflect.Uint32Kind: + return "Uint32", notZero + case protoreflect.Int64Kind: + return "Int64", notZero + case protoreflect.Sint64Kind: + return "Sint64", notZero + case protoreflect.Uint64Kind: + return "Uint64", notZero + case protoreflect.Sfixed32Kind: + return "Sfixed32", notZero + case protoreflect.Fixed32Kind: + return "Fixed32", notZero + case protoreflect.FloatKind: + return "Float", notZero + case protoreflect.Sfixed64Kind: + return "Sfixed64", notZero + case protoreflect.Fixed64Kind: + return "Fixed64", notZero + case protoreflect.DoubleKind: + return "Double", notZero + case protoreflect.StringKind: + return "String", notEmpty + case protoreflect.BytesKind: + return "Bytes", notEmpty + case protoreflect.GroupKind: + panic("unimplemented") + default: + panic("unreachable") + } +} + +func emitFieldMarshal(g *protogen.GeneratedFile, f *protogen.Field) { + if f.Oneof != nil { + emitMarshalOneof(g, f) + return + } + + emitMarshalRaw(g, f, castFieldName(f)) +} + +func emitMarshalRaw(g *protogen.GeneratedFile, f *protogen.Field, name string) { + if f.Desc.Kind() == protoreflect.MessageKind { + if f.Desc.IsList() { + g.P("for i := range ", name, " {") + defer g.P("}") + + name += "[i]" + } else { + g.P("if ", notNil(name), " {") + defer g.P("}") + } + + g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))") + return + } + + method, cond := easyprotoKindInfo(f.Desc.Kind()) + method = "Append" + method + if f.Desc.IsList() && !f.Desc.IsPacked() { + g.P("for j := range ", name, " {") + g.P("mm.", method, "(", f.Desc.Number(), ", ", name, "[j])") + g.P("}") + return + } + + if f.Desc.IsList() { + method += "s" + g.P("if ", notEmpty(name), "{") + } else { + g.P("if ", cond(name), " {") + } + + g.P("mm.", method, "(", f.Desc.Number(), ", ", name, ")") + g.P("}") +} diff --git a/api/util/protogen/internalgengo/proto_field_type.go b/api/util/protogen/internalgengo/proto_field_type.go new file mode 100644 index 00000000..00967516 --- /dev/null +++ b/api/util/protogen/internalgengo/proto_field_type.go @@ -0,0 +1,59 @@ +package internalgengo + +import ( + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +type structField string + +func (f structField) String() string { + return string(f) +} + +func (f structField) PointerTo() structField { + return "*" + f +} + +func (f structField) SliceOf() structField { + return "[]" + f +} + +func fieldType(g *protogen.GeneratedFile, field *protogen.Field) structField { + var typ structField + switch field.Desc.Kind() { + case protoreflect.BoolKind: + typ = "bool" + case protoreflect.EnumKind: + typ = structField(g.QualifiedGoIdent(field.Enum.GoIdent)) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + typ = "int32" + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + typ = "uint32" + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + typ = "int64" + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + typ = "uint64" + case protoreflect.FloatKind: + typ = "float32" + case protoreflect.DoubleKind: + typ = "float64" + case protoreflect.StringKind: + typ = "string" + case protoreflect.BytesKind: + typ = "[]byte" + case protoreflect.MessageKind: + typ = structField(g.QualifiedGoIdent(field.Message.GoIdent)) + if !field.Desc.IsList() { + typ = typ.PointerTo() + } + case protoreflect.GroupKind: + panic("unimplemented") + } + + if field.Desc.IsList() { + typ = "[]" + typ + } + + return typ +} diff --git a/api/util/protogen/internalgengo/proto_stable_compat.go b/api/util/protogen/internalgengo/proto_stable_compat.go new file mode 100644 index 00000000..3c4670cf --- /dev/null +++ b/api/util/protogen/internalgengo/proto_stable_compat.go @@ -0,0 +1,124 @@ +package internalgengo + +import ( + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" +) + +var protowirePackage = protogen.GoImportPath("google.golang.org/protobuf/encoding/protowire") + +func emitStableSize(g *protogen.GeneratedFile, msg *protogen.Message) { + fs := sortFields(msg.Fields) + + g.P("// StableSize returns the size of x in protobuf format.") + g.P("//") + g.P("// Structures with the same field values have the same binary size.") + g.P("func (x *", msg.GoIdent.GoName, ") StableSize() (size int) {") + g.P("if x == nil { return 0 }") + if len(fs) != 0 { + for _, f := range fs { + if f.Desc.IsList() && marshalers[f.Desc.Kind()].RepeatedDouble && !(f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()) { + g.P("var n int") + break + } + } + for _, f := range fs { + emitFieldSize(g, f) + } + } + g.P("return size") + g.P("}\n") +} + +func emitSignatureMethods(g *protogen.GeneratedFile, msg *protogen.Message) { + // SignedDataSize implementation (only for requests and responses). + g.P("// ReadSignedData fills buf with signed data of x.") + g.P("// If buffer length is less than x.SignedDataSize(), new buffer is allocated.") + g.P("//") + g.P("// Returns any error encountered which did not allow writing the data completely.") + g.P("// Otherwise, returns the buffer in which the data is written.") + g.P("//") + g.P("// Structures with the same field values have the same signed data.") + g.P("func (x *", msg.GoIdent.GoName, ") SignedDataSize() int {") + g.P("return x.GetBody().StableSize()") + g.P("}\n") + + // ReadSignedData implementation (only for requests and responses). + g.P("// SignedDataSize returns size of the request signed data in bytes.") + g.P("//") + g.P("// Structures with the same field values have the same signed data size.") + g.P("func (x *", msg.GoIdent.GoName, ") ReadSignedData(buf []byte) ([]byte, error) {") + g.P("return x.GetBody().MarshalProtobuf(buf), nil") + g.P("}\n") +} + +func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) { + m := marshalers[f.Desc.Kind()] + if m.Prefix == "" { + g.P("// FIXME missing field marshaler: ", f.GoName, " of type ", f.Desc.Kind().String()) + g.P(`panic("unimplemented")`) + return + } + + name := castFieldName(f) + if f.Oneof != nil { + name = "x." + f.Oneof.GoName + g.P("if inner, ok := ", name, ".(*", f.GoIdent.GoName, "); ok {") + defer g.P("}") + name = "inner." + f.GoName + } + + switch { + case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()): + g.P("for i := range ", name, "{") + if f.Desc.Kind() == protoreflect.MessageKind { + g.P("size += ", protoPackage.Ident("NestedStructureSizeUnchecked"), "(", f.Desc.Number(), ", &", name, "[i])") + } else { + if f.Desc.Kind() != protoreflect.Uint64Kind { + panic("only uint64 unpacked primitive is supported") + } + + g.P("size += ", protowirePackage.Ident("SizeGroup"), "(", + protowirePackage.Ident("Number"), "(", f.Desc.Number(), "), ", + protowirePackage.Ident("SizeVarint"), "(", name, "[i]))") + } + g.P("}") + + case f.Desc.IsList(): + if m.RepeatedDouble { + g.P("n, _ = ", protoPackage.Ident("Repeated"+m.Prefix+"Size"), "(", f.Desc.Number(), ", ", name, ")") + g.P("size += n") + } else { + g.P("size += ", protoPackage.Ident("Repeated"+m.Prefix+"Size"), "(", f.Desc.Number(), ", ", name, ")") + } + default: + g.P("size += ", protoPackage.Ident(m.Prefix+"Size"), "(", f.Desc.Number(), ", ", name, ")") + } +} + +type marshalerDesc struct { + Prefix string + RepeatedDouble bool +} + +// Unused kinds are commented. +var marshalers = map[protoreflect.Kind]marshalerDesc{ + protoreflect.BoolKind: {Prefix: "Bool"}, + protoreflect.EnumKind: {Prefix: "Enum"}, + protoreflect.Int32Kind: {Prefix: "Int32", RepeatedDouble: true}, + // protoreflect.Sint32Kind: "", + protoreflect.Uint32Kind: {Prefix: "UInt32", RepeatedDouble: true}, + protoreflect.Int64Kind: {Prefix: "Int64", RepeatedDouble: true}, + // protoreflect.Sint64Kind: "", + protoreflect.Uint64Kind: {Prefix: "UInt64", RepeatedDouble: true}, + // protoreflect.Sfixed32Kind: "", + protoreflect.Fixed32Kind: {Prefix: "Fixed32", RepeatedDouble: true}, + // protoreflect.FloatKind: "", + // protoreflect.Sfixed64Kind: "", + protoreflect.Fixed64Kind: {Prefix: "Fixed64", RepeatedDouble: true}, + protoreflect.DoubleKind: {Prefix: "Float64"}, + protoreflect.StringKind: {Prefix: "String"}, + protoreflect.BytesKind: {Prefix: "Bytes"}, + protoreflect.MessageKind: {Prefix: "NestedStructure"}, + // protoreflect.GroupKind: "", +} diff --git a/api/util/protogen/internalgengo/writer.go b/api/util/protogen/internalgengo/writer.go new file mode 100644 index 00000000..7b0d4f12 --- /dev/null +++ b/api/util/protogen/internalgengo/writer.go @@ -0,0 +1,30 @@ +package internalgengo + +import ( + "fmt" +) + +type condition = func(string) string + +var ( + _ condition = notZero + _ condition = notEmpty + _ condition = identity + _ condition = notNil +) + +func notZero(name string) string { + return fmt.Sprintf("%s != 0", name) +} + +func notEmpty(name string) string { + return fmt.Sprintf("len(%s) != 0", name) +} + +func identity(name string) string { + return name +} + +func notNil(name string) string { + return fmt.Sprintf("%s != nil", name) +} diff --git a/api/util/protogen/main.go b/api/util/protogen/main.go new file mode 100644 index 00000000..3ebc1dd9 --- /dev/null +++ b/api/util/protogen/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "flag" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/protogen/internalgengo" + "google.golang.org/protobuf/compiler/protogen" +) + +func main() { + var flags flag.FlagSet + genFuzz := flags.Bool("fuzz", false, "generate fuzz tests") + + protogen.Options{ + ParamFunc: flags.Set, + }.Run(func(gen *protogen.Plugin) error { + for _, f := range gen.Files { + if f.Generate { + internalgengo.GenerateFile(gen, f) + if *genFuzz { + internalgengo.GenerateFuzzTests(gen, f) + } + } + } + return nil + }) +} diff --git a/api/util/signature/data.go b/api/util/signature/data.go new file mode 100644 index 00000000..e444a737 --- /dev/null +++ b/api/util/signature/data.go @@ -0,0 +1,93 @@ +package signature + +import ( + "crypto/ecdsa" + + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool" +) + +const poolSliceMaxSize = 128 * 1024 + +var buffersPool = pool.NewBufferPool(poolSliceMaxSize) + +type DataSource interface { + ReadSignedData([]byte) ([]byte, error) + SignedDataSize() int +} + +type DataWithSignature interface { + DataSource + GetSignature() *refs.Signature + SetSignature(*refs.Signature) +} + +type SignOption func(*cfg) + +type KeySignatureHandler func(*refs.Signature) + +type KeySignatureSource func() *refs.Signature + +func SignDataWithHandler(key *ecdsa.PrivateKey, src DataSource, handler KeySignatureHandler, opts ...SignOption) error { + if key == nil { + return crypto.ErrEmptyPrivateKey + } + + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + buffer := buffersPool.Get(uint32(src.SignedDataSize())) + defer buffersPool.Put(buffer) + + data, err := src.ReadSignedData(buffer.Data) + if err != nil { + return err + } + + sigData, err := sign(cfg, key, data) + if err != nil { + return err + } + + sig := new(refs.Signature) + sig.SetScheme(cfg.scheme) + sig.SetKey(crypto.MarshalPublicKey(&key.PublicKey)) + sig.SetSign(sigData) + handler(sig) + + return nil +} + +func VerifyDataWithSource(dataSrc DataSource, sigSrc KeySignatureSource, opts ...SignOption) error { + buffer := buffersPool.Get(uint32(dataSrc.SignedDataSize())) + defer buffersPool.Put(buffer) + + data, err := dataSrc.ReadSignedData(buffer.Data) + if err != nil { + return err + } + + return VerifyDataSlice(data, sigSrc, opts...) +} + +func SignData(key *ecdsa.PrivateKey, v DataWithSignature, opts ...SignOption) error { + return SignDataWithHandler(key, v, v.SetSignature, opts...) +} + +func VerifyData(src DataWithSignature, opts ...SignOption) error { + return VerifyDataWithSource(src, src.GetSignature, opts...) +} + +func VerifyDataSlice(data []byte, sigSrc KeySignatureSource, opts ...SignOption) error { + cfg := defaultCfg() + + for i := range opts { + opts[i](cfg) + } + + return verify(cfg, data, sigSrc()) +} diff --git a/api/util/signature/options.go b/api/util/signature/options.go new file mode 100644 index 00000000..d27eff22 --- /dev/null +++ b/api/util/signature/options.go @@ -0,0 +1,77 @@ +package signature + +import ( + "crypto/ecdsa" + "encoding/base64" + "fmt" + + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/signature/walletconnect" +) + +type cfg struct { + schemeFixed bool + scheme refs.SignatureScheme +} + +func defaultCfg() *cfg { + return new(cfg) +} + +func verify(cfg *cfg, data []byte, sig *refs.Signature) error { + if !cfg.schemeFixed { + cfg.scheme = sig.GetScheme() + } + + pub := crypto.UnmarshalPublicKey(sig.GetKey()) + if pub == nil { + return crypto.ErrEmptyPublicKey + } + + switch cfg.scheme { + case refs.ECDSA_SHA512: + return crypto.Verify(pub, data, sig.GetSign()) + case refs.ECDSA_RFC6979_SHA256: + return crypto.VerifyRFC6979(pub, data, sig.GetSign()) + case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: + buffer := buffersPool.Get(uint32(base64.StdEncoding.EncodedLen(len(data)))) + defer buffersPool.Put(buffer) + base64.StdEncoding.Encode(buffer.Data, data) + if !walletconnect.Verify(pub, buffer.Data, sig.GetSign()) { + return crypto.ErrInvalidSignature + } + return nil + default: + return fmt.Errorf("unsupported signature scheme %s", cfg.scheme) + } +} + +func sign(cfg *cfg, key *ecdsa.PrivateKey, data []byte) ([]byte, error) { + switch cfg.scheme { + case refs.ECDSA_SHA512: + return crypto.Sign(key, data) + case refs.ECDSA_RFC6979_SHA256: + return crypto.SignRFC6979(key, data) + case refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT: + buffer := buffersPool.Get(uint32(base64.StdEncoding.EncodedLen(len(data)))) + defer buffersPool.Put(buffer) + base64.StdEncoding.Encode(buffer.Data, data) + return walletconnect.Sign(key, buffer.Data) + default: + panic(fmt.Sprintf("unsupported scheme %s", cfg.scheme)) + } +} + +func SignWithRFC6979() SignOption { + return func(c *cfg) { + c.schemeFixed = true + c.scheme = refs.ECDSA_RFC6979_SHA256 + } +} + +func SignWithWalletConnect() SignOption { + return func(c *cfg) { + c.scheme = refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT + } +} diff --git a/api/util/signature/sign_test.go b/api/util/signature/sign_test.go new file mode 100644 index 00000000..222f9be1 --- /dev/null +++ b/api/util/signature/sign_test.go @@ -0,0 +1,44 @@ +package signature + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "github.com/stretchr/testify/require" +) + +type testData struct { + data []byte + sig *refs.Signature +} + +func (t testData) SignedDataSize() int { return len(t.data) } +func (t testData) ReadSignedData(data []byte) ([]byte, error) { + n := copy(data, t.data) + return data[:n], nil +} +func (t testData) GetSignature() *refs.Signature { return t.sig } +func (t *testData) SetSignature(s *refs.Signature) { t.sig = s } + +func TestWalletConnect(t *testing.T) { + testCases := [...][]byte{ + {}, + {0}, + {1, 2}, + {3, 4, 5}, + {6, 7, 8, 9, 10, 11, 12}, + } + + pk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + + for _, tc := range testCases { + td := &testData{data: tc} + require.NoError(t, SignData(pk, td, SignWithWalletConnect())) + require.Equal(t, refs.ECDSA_RFC6979_SHA256_WALLET_CONNECT, td.sig.GetScheme()) + require.NoError(t, VerifyData(td)) + } +} diff --git a/api/util/signature/walletconnect/sign.go b/api/util/signature/walletconnect/sign.go new file mode 100644 index 00000000..b96a8420 --- /dev/null +++ b/api/util/signature/walletconnect/sign.go @@ -0,0 +1,142 @@ +package walletconnect + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "encoding/binary" + "encoding/hex" + + crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" +) + +const ( + // saltSize is the salt size added to signed message. + saltSize = 16 + // signatureLen is the length of RFC6979 signature. + signatureLen = 64 +) + +// SignedMessage contains mirrors `SignedMessage` struct from the WalletConnect API. +// https://neon.coz.io/wksdk/core/modules.html#SignedMessage +type SignedMessage struct { + Data []byte + Message []byte + PublicKey []byte + Salt []byte +} + +// Sign signs message using WalletConnect API. The returned signature +// contains RFC6979 signature and 16-byte salt. +func Sign(p *ecdsa.PrivateKey, msg []byte) ([]byte, error) { + sm, err := SignMessage(p, msg) + if err != nil { + return nil, err + } + return append(sm.Data, sm.Salt...), nil +} + +// Verify verifies message using WalletConnect API. +func Verify(p *ecdsa.PublicKey, data, sign []byte) bool { + if len(sign) != signatureLen+saltSize { + return false + } + + salt := sign[signatureLen:] + return VerifyMessage(p, SignedMessage{ + Data: sign[:signatureLen], + Message: createMessageWithSalt(data, salt), + Salt: salt, + }) +} + +// SignMessage signs message with a private key and returns structure similar to +// `signMessage` of the WalletConnect API. +// https://github.com/CityOfZion/wallet-connect-sdk/blob/89c236b/packages/wallet-connect-sdk-core/src/index.ts#L496 +// https://github.com/CityOfZion/neon-wallet/blob/1174a9388480e6bbc4f79eb13183c2a573f67ca8/app/context/WalletConnect/helpers.js#L133 +func SignMessage(p *ecdsa.PrivateKey, msg []byte) (SignedMessage, error) { + var salt [saltSize]byte + _, _ = rand.Read(salt[:]) + + msg = createMessageWithSalt(msg, salt[:]) + sign, err := crypto.SignRFC6979(p, msg) + if err != nil { + return SignedMessage{}, err + } + + return SignedMessage{ + Data: sign, + Message: msg, + PublicKey: elliptic.MarshalCompressed(p.Curve, p.X, p.Y), + Salt: salt[:], + }, nil +} + +// VerifyMessage verifies message with a private key and returns structure similar to +// `verifyMessage` of WalletConnect API. +// https://github.com/CityOfZion/wallet-connect-sdk/blob/89c236b/packages/wallet-connect-sdk-core/src/index.ts#L515 +// https://github.com/CityOfZion/neon-wallet/blob/1174a9388480e6bbc4f79eb13183c2a573f67ca8/app/context/WalletConnect/helpers.js#L147 +func VerifyMessage(p *ecdsa.PublicKey, m SignedMessage) bool { + if p == nil { + x, y := elliptic.UnmarshalCompressed(elliptic.P256(), m.PublicKey) + if x == nil || y == nil { + return false + } + p = &ecdsa.PublicKey{ + Curve: elliptic.P256(), + X: x, + Y: y, + } + } + return crypto.VerifyRFC6979(p, m.Message, m.Data) == nil +} + +func createMessageWithSalt(msg, salt []byte) []byte { + // 4 byte prefix + length of the message with salt in bytes + + // + salt + message + 2 byte postfix. + saltedLen := hex.EncodedLen(len(salt)) + len(msg) + data := make([]byte, 4+getVarIntSize(saltedLen)+saltedLen+2) + + n := copy(data, []byte{0x01, 0x00, 0x01, 0xf0}) // fixed prefix + n += putVarUint(data[n:], uint64(saltedLen)) // salt is hex encoded, double its size + n += hex.Encode(data[n:], salt[:]) // for some reason we encode salt in hex + n += copy(data[n:], msg) + copy(data[n:], []byte{0x00, 0x00}) + + return data +} + +// Following functions are copied from github.com/nspcc-dev/neo-go/pkg/io package +// to avoid having another dependency. + +// getVarIntSize returns the size in number of bytes of a variable integer. +// Reference: https://github.com/neo-project/neo/blob/26d04a642ac5a1dd1827dabf5602767e0acba25c/src/neo/IO/Helper.cs#L131 +func getVarIntSize(value int) int { + var size uintptr + + if value < 0xFD { + size = 1 // unit8 + } else if value <= 0xFFFF { + size = 3 // byte + uint16 + } else { + size = 5 // byte + uint32 + } + return int(size) +} + +// putVarUint puts val in varint form to the pre-allocated buffer. +func putVarUint(data []byte, val uint64) int { + if val < 0xfd { + data[0] = byte(val) + return 1 + } + if val <= 0xFFFF { + data[0] = byte(0xfd) + binary.LittleEndian.PutUint16(data[1:], uint16(val)) + return 3 + } + + data[0] = byte(0xfe) + binary.LittleEndian.PutUint32(data[1:], uint32(val)) + return 5 +} diff --git a/api/util/signature/walletconnect/sign_test.go b/api/util/signature/walletconnect/sign_test.go new file mode 100644 index 00000000..1b4fe180 --- /dev/null +++ b/api/util/signature/walletconnect/sign_test.go @@ -0,0 +1,112 @@ +package walletconnect + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "encoding/hex" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestSignMessage(t *testing.T) { + p1, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + + msg := []byte("NEO") + result, err := SignMessage(p1, msg) + require.NoError(t, err) + require.Equal(t, elliptic.MarshalCompressed(elliptic.P256(), p1.PublicKey.X, p1.PublicKey.Y), result.PublicKey) + require.Equal(t, saltSize, len(result.Salt)) + require.Equal(t, 64, len(result.Data)) + require.Equal(t, 4+1+16*2+3+2, len(result.Message)) + + require.True(t, VerifyMessage(&p1.PublicKey, result)) + + t.Run("invalid public key", func(t *testing.T) { + p2, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + require.False(t, VerifyMessage(&p2.PublicKey, result)) + }) + t.Run("invalid signature", func(t *testing.T) { + result := result + result.Data[0] ^= 0xFF + require.False(t, VerifyMessage(&p1.PublicKey, result)) + }) +} + +func TestSign(t *testing.T) { + p1, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + + msg := []byte("NEO") + sign, err := Sign(p1, msg) + require.NoError(t, err) + require.True(t, Verify(&p1.PublicKey, msg, sign)) + + t.Run("invalid public key", func(t *testing.T) { + p2, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + require.False(t, Verify(&p2.PublicKey, msg, sign)) + }) + t.Run("invalid signature", func(t *testing.T) { + sign[0] ^= 0xFF + require.False(t, Verify(&p1.PublicKey, msg, sign)) + }) +} + +func TestVerifyNeonWallet(t *testing.T) { + testCases := [...]struct { + publicKey string + data string + salt string + messageHex string + messageOriginal string + }{ + { // Test values from this GIF https://github.com/CityOfZion/neon-wallet/pull/2390 . + publicKey: "02ce6228ba2cb2fc235be93aff9cd5fc0851702eb9791552f60db062f01e3d83f6", + data: "90ab1886ca0bece59b982d9ade8f5598065d651362fb9ce45ad66d0474b89c0b80913c8f0118a282acbdf200a429ba2d81bc52534a53ab41a2c6dfe2f0b4fb1b", + salt: "d41e348afccc2f3ee45cd9f5128b16dc", + messageHex: "010001f05c6434316533343861666363633266336565343563643966353132386231366463436172616c686f2c206d756c65712c206f2062616775697520656820697373756d65726d6f2074616978206c696761646f206e61206d697373e36f3f0000", + messageOriginal: "436172616c686f2c206d756c65712c206f2062616775697520656820697373756d65726d6f2074616978206c696761646f206e61206d697373e36f3f", + }, + { // Test value from wallet connect integration test + publicKey: "03bd9108c0b49f657e9eee50d1399022bd1e436118e5b7529a1b7cd606652f578f", + data: "510caa8cb6db5dedf04d215a064208d64be7496916d890df59aee132db8f2b07532e06f7ea664c4a99e3bcb74b43a35eb9653891b5f8701d2aef9e7526703eaa", + salt: "2c5b189569e92cce12e1c640f23e83ba", + messageHex: "010001f02632633562313839353639653932636365313265316336343066323365383362613132333435360000", + messageOriginal: "313233343536", // ascii string "123456" + }, + { // Test value from wallet connect integration test + publicKey: "03bd9108c0b49f657e9eee50d1399022bd1e436118e5b7529a1b7cd606652f578f", + data: "1e13f248962d8b3b60708b55ddf448d6d6a28c6b43887212a38b00bf6bab695e61261e54451c6e3d5f1f000e5534d166c7ca30f662a296d3a9aafa6d8c173c01", + salt: "58c86b2e74215b4f36b47d731236be3b", + messageHex: "010001f02035386338366232653734323135623466333662343764373331323336626533620000", + messageOriginal: "", // empty string + }, + } + + for _, testCase := range testCases { + rawPub, err := hex.DecodeString(testCase.publicKey) + require.NoError(t, err) + data, err := hex.DecodeString(testCase.data) + require.NoError(t, err) + salt, err := hex.DecodeString(testCase.salt) + require.NoError(t, err) + msg, err := hex.DecodeString(testCase.messageHex) + require.NoError(t, err) + orig, err := hex.DecodeString(testCase.messageOriginal) + require.NoError(t, err) + + require.Equal(t, msg, createMessageWithSalt(orig, salt)) + + sm := SignedMessage{ + Data: data, + Message: msg, + PublicKey: rawPub, + Salt: salt, + } + require.True(t, VerifyMessage(nil, sm)) + } +} diff --git a/bearer/bearer.go b/bearer/bearer.go index aaea6c31..3c4e0e91 100644 --- a/bearer/bearer.go +++ b/bearer/bearer.go @@ -5,8 +5,10 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + apeSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + apeV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" @@ -16,7 +18,7 @@ import ( // Token represents bearer token for object service operations. // -// Token is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl.BearerToken +// Token is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl.BearerToken // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. @@ -33,9 +35,85 @@ type Token struct { sigSet bool sig refs.Signature + apeOverrideSet bool + apeOverride APEOverride + impersonate bool } +// APEOverride is the list of APE chains defined for a target. +// These chains are meant to serve as overrides to the already defined (or even undefined) +// APE chains for the target (see contract `Policy`). +// +// The server-side processing of the bearer token with set APE overrides must verify if a client is permitted +// to override chains for the target, preventing unauthorized access through the APE mechanism. +type APEOverride struct { + // Target for which chains are applied. + Target apeSDK.ChainTarget + + // The list of APE chains. + Chains []apeSDK.Chain +} + +// Marshal marshals APEOverride into a protobuf binary form. +func (c *APEOverride) Marshal() ([]byte, error) { + return c.ToV2().StableMarshal(nil), nil +} + +// Unmarshal unmarshals protobuf binary representation of APEOverride. +func (c *APEOverride) Unmarshal(data []byte) error { + overrideV2 := new(acl.APEOverride) + if err := overrideV2.Unmarshal(data); err != nil { + return err + } + + return c.FromV2(overrideV2) +} + +// MarshalJSON encodes APEOverride to protobuf JSON format. +func (c *APEOverride) MarshalJSON() ([]byte, error) { + return c.ToV2().MarshalJSON() +} + +// UnmarshalJSON decodes APEOverride from protobuf JSON format. +func (c *APEOverride) UnmarshalJSON(data []byte) error { + overrideV2 := new(acl.APEOverride) + if err := overrideV2.UnmarshalJSON(data); err != nil { + return err + } + + return c.FromV2(overrideV2) +} + +func (c *APEOverride) FromV2(tokenAPEChains *acl.APEOverride) error { + c.Target.FromV2(tokenAPEChains.GetTarget()) + if chains := tokenAPEChains.GetChains(); len(chains) > 0 { + c.Chains = make([]apeSDK.Chain, len(chains)) + for i := range chains { + if err := c.Chains[i].ReadFromV2(chains[i]); err != nil { + return fmt.Errorf("invalid APE chain: %w", err) + } + } + } + return nil +} + +func (c *APEOverride) ToV2() *acl.APEOverride { + if c == nil { + return nil + } + + apeOverride := new(acl.APEOverride) + apeOverride.SetTarget(c.Target.ToV2()) + chains := make([]*apeV2.Chain, len(c.Chains)) + for i := range c.Chains { + chains[i] = c.Chains[i].ToV2() + } + apeOverride.SetChains(chains) + + return apeOverride +} + // reads Token from the acl.BearerToken message. If checkFieldPresence is set, // returns an error on absence of any protocol-required field. func (b *Token) readFromV2(m acl.BearerToken, checkFieldPresence bool) error { @@ -48,10 +126,11 @@ func (b *Token) readFromV2(m acl.BearerToken, checkFieldPresence bool) error { b.impersonate = body.GetImpersonate() + apeOverrides := body.GetAPEOverride() eaclTable := body.GetEACL() if b.eaclTableSet = eaclTable != nil; b.eaclTableSet { b.eaclTable = *eacl.NewTableFromV2(eaclTable) - } else if checkFieldPresence && !b.impersonate { + } else if checkFieldPresence && !b.impersonate && apeOverrides == nil { return errors.New("missing eACL table") } @@ -72,6 +151,14 @@ func (b *Token) readFromV2(m acl.BearerToken, checkFieldPresence bool) error { return errors.New("missing token lifetime") } + if b.apeOverrideSet = apeOverrides != nil; b.apeOverrideSet { + if err = b.apeOverride.FromV2(apeOverrides); err != nil { + return err + } + } else if checkFieldPresence && !b.impersonate && !b.eaclTableSet { + return errors.New("missing APE override") + } + sig := m.GetSignature() if b.sigSet = sig != nil; sig != nil { b.sig = *sig @@ -90,7 +177,7 @@ func (b *Token) ReadFromV2(m acl.BearerToken) error { } func (b Token) fillBody() *acl.BearerTokenBody { - if !b.eaclTableSet && !b.targetUserSet && !b.lifetimeSet && !b.impersonate { + if !b.eaclTableSet && !b.targetUserSet && !b.lifetimeSet && !b.impersonate && !b.apeOverrideSet { return nil } @@ -116,6 +203,10 @@ func (b Token) fillBody() *acl.BearerTokenBody { body.SetLifetime(&lifetime) } + if b.apeOverrideSet { + body.SetAPEOverride(b.apeOverride.ToV2()) + } + body.SetImpersonate(b.impersonate) return &body @@ -214,6 +305,20 @@ func (b Token) EACLTable() eacl.Table { return eacl.Table{} } +// SetAPEOverride sets APE override to the bearer token. +// +// See also: APEOverride. +func (b *Token) SetAPEOverride(v APEOverride) { + b.apeOverride = v + b.apeOverrideSet = true +} + +// APEOverride returns APE override set by SetAPEOverride and a flag that indicates whether override +// is set for the token. +func (b *Token) APEOverride() (override APEOverride, isSet bool) { + return b.apeOverride, b.apeOverrideSet +} + // SetImpersonate mark token as impersonate to consider token signer as request owner. // If this field is true extended EACLTable in token body isn't processed. func (b *Token) SetImpersonate(v bool) { diff --git a/bearer/bearer_test.go b/bearer/bearer_test.go index 3c0e946e..cbba7c5e 100644 --- a/bearer/bearer_test.go +++ b/bearer/bearer_test.go @@ -3,10 +3,11 @@ package bearer_test import ( "bytes" "math/rand" + "reflect" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" bearertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" @@ -81,6 +82,63 @@ func TestToken_SetEACLTable(t *testing.T) { require.True(t, isEqualEACLTables(eaclTable, val.EACLTable())) } +func TestToken_SetAPEOverrides(t *testing.T) { + var val bearer.Token + var m acl.BearerToken + filled := bearertest.Token() + + val.WriteToV2(&m) + require.Zero(t, m.GetBody()) + + val2 := filled + + require.NoError(t, val2.Unmarshal(val.Marshal())) + _, isSet := val2.APEOverride() + require.False(t, isSet) + + val2 = filled + + jd, err := val.MarshalJSON() + require.NoError(t, err) + + require.NoError(t, val2.UnmarshalJSON(jd)) + _, isSet = val2.APEOverride() + require.False(t, isSet) + + // set value + + tApe := bearertest.APEOverride() + + val.SetAPEOverride(tApe) + _, isSet = val.APEOverride() + require.True(t, isSet) + + val.WriteToV2(&m) + require.NotNil(t, m.GetBody().GetAPEOverride()) + require.True(t, tokenAPEOverridesEqual(tApe.ToV2(), m.GetBody().GetAPEOverride())) + + val2 = filled + + require.NoError(t, val2.Unmarshal(val.Marshal())) + apeOverride, isSet := val2.APEOverride() + require.True(t, isSet) + require.True(t, tokenAPEOverridesEqual(tApe.ToV2(), apeOverride.ToV2())) + + val2 = filled + + jd, err = val.MarshalJSON() + require.NoError(t, err) + + require.NoError(t, val2.UnmarshalJSON(jd)) + apeOverride, isSet = val.APEOverride() + require.True(t, isSet) + require.True(t, tokenAPEOverridesEqual(tApe.ToV2(), apeOverride.ToV2())) +} + +func tokenAPEOverridesEqual(lhs, rhs *acl.APEOverride) bool { + return reflect.DeepEqual(lhs, rhs) +} + func TestToken_ForUser(t *testing.T) { var val bearer.Token var m acl.BearerToken diff --git a/bearer/doc.go b/bearer/doc.go index c97ab483..256fae23 100644 --- a/bearer/doc.go +++ b/bearer/doc.go @@ -1,19 +1,19 @@ /* Package bearer provides bearer token definition. -Bearer token is attached to the object service requests, and it overwrites -extended ACL of the container. Mainly it is used to provide access of private +Bearer token is attached to the object service requests, and it can override +APE policy set on the container. Mainly it is used to provide access to private data for specific user. Therefore, it must be signed by owner of the container. -Define bearer token by setting correct lifetime, extended ACL and owner ID of +Define bearer token by setting correct lifetime, APE policy and owner ID of the user that will attach token to its requests. var bearerToken bearer.Token - bearerToken.SetExpiration(500) - bearerToken.SetIssuedAt(10) - bearerToken.SetNotBefore(10) - bearerToken.SetEACL(eaclTable) - bearerToken.SetOwner(ownerID) + bearerToken.SetExp(500) + bearerToken.SetIat(10) + bearerToken.SetNbf(10) + bearerToken.SetAPEOverride(apeOverride) + bearerToken.ForUser(ownerID) Bearer token must be signed by owner of the container. @@ -24,8 +24,6 @@ sender can attach this bearer token to the object service requests: import sdkClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" - var headParams sdkClient.PrmObjectHead - headParams.WithBearerToken(bearerToken) - response, err := client.ObjectHead(ctx, headParams) + response, err := client.ObjectHead(ctx, sdkClient.PrmObjectHead{BearerToken: bearerToken}) */ package bearer diff --git a/bearer/test/generate.go b/bearer/test/generate.go index 4fce6a40..0ea3936a 100644 --- a/bearer/test/generate.go +++ b/bearer/test/generate.go @@ -1,6 +1,7 @@ package bearertest import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" eacltest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl/test" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" @@ -15,6 +16,17 @@ func Token() (t bearer.Token) { t.SetIat(1) t.ForUser(usertest.ID()) t.SetEACLTable(*eacltest.Table()) + t.SetAPEOverride(APEOverride()) return t } + +func APEOverride() bearer.APEOverride { + return bearer.APEOverride{ + Target: ape.ChainTarget{ + TargetType: ape.TargetTypeContainer, + Name: "F8JsMnChywiPvbDvpxMbjTjx5KhWHHp6gCDt8BhzL9kF", + }, + Chains: []ape.Chain{{Raw: []byte("{}")}}, + } +} diff --git a/checksum/checksum.go b/checksum/checksum.go index 9d227ada..76887f66 100644 --- a/checksum/checksum.go +++ b/checksum/checksum.go @@ -6,13 +6,13 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "git.frostfs.info/TrueCloudLab/tzhash/tz" ) // Checksum represents checksum of some digital data. // -// Checksum is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs.Checksum +// Checksum is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs.Checksum // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. diff --git a/checksum/checksum_test.go b/checksum/checksum_test.go index 9da857df..1e1c07c8 100644 --- a/checksum/checksum_test.go +++ b/checksum/checksum_test.go @@ -5,7 +5,7 @@ import ( "crypto/sha256" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "git.frostfs.info/TrueCloudLab/tzhash/tz" "github.com/stretchr/testify/require" ) diff --git a/checksum/example_test.go b/checksum/example_test.go index 337767ab..72d4a056 100644 --- a/checksum/example_test.go +++ b/checksum/example_test.go @@ -6,7 +6,7 @@ import ( "crypto/sha256" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" ) func ExampleCalculate() { diff --git a/client/accounting.go b/client/accounting.go index faf7ddcc..707ec3d7 100644 --- a/client/accounting.go +++ b/client/accounting.go @@ -4,13 +4,13 @@ import ( "context" "fmt" - v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting" + v2accounting "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" ) diff --git a/client/apemanager_add_chain.go b/client/apemanager_add_chain.go new file mode 100644 index 00000000..a8d53a76 --- /dev/null +++ b/client/apemanager_add_chain.go @@ -0,0 +1,79 @@ +package client + +import ( + "context" + "fmt" + + apeSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" + apemanagerV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + sessionV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" +) + +// PrmAPEManagerAddChain groups parameters of APEManagerAddChain operation. +type PrmAPEManagerAddChain struct { + XHeaders []string + + ChainTarget apeSDK.ChainTarget + + Chain apeSDK.Chain +} + +func (prm *PrmAPEManagerAddChain) buildRequest(c *Client) (*apemanagerV2.AddChainRequest, error) { + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + req := new(apemanagerV2.AddChainRequest) + reqBody := new(apemanagerV2.AddChainRequestBody) + + reqBody.SetTarget(prm.ChainTarget.ToV2()) + reqBody.SetChain(prm.Chain.ToV2()) + + req.SetBody(reqBody) + + var meta sessionV2.RequestMetaHeader + writeXHeadersToMeta(prm.XHeaders, &meta) + + c.prepareRequest(req, &meta) + + return req, nil +} + +type ResAPEManagerAddChain struct { + statusRes + + // ChainID of set Chain. If Chain does not contain chainID before request, then + // ChainID is generated. + ChainID apeSDK.ChainID +} + +// APEManagerAddChain sets Chain for ChainTarget. +func (c *Client) APEManagerAddChain(ctx context.Context, prm PrmAPEManagerAddChain) (*ResAPEManagerAddChain, error) { + req, err := prm.buildRequest(c) + if err != nil { + return nil, err + } + + if err := signature.SignServiceMessage(&c.prm.Key, req); err != nil { + return nil, fmt.Errorf("sign request: %w", err) + } + + resp, err := rpcapi.AddChain(&c.c, req, client.WithContext(ctx)) + if err != nil { + return nil, err + } + + var res ResAPEManagerAddChain + res.st, err = c.processResponse(resp) + if err != nil || !apistatus.IsSuccessful(res.st) { + return &res, err + } + + res.ChainID = resp.GetBody().GetChainID() + + return &res, nil +} diff --git a/client/apemanager_list_chains.go b/client/apemanager_list_chains.go new file mode 100644 index 00000000..56cc4efa --- /dev/null +++ b/client/apemanager_list_chains.go @@ -0,0 +1,80 @@ +package client + +import ( + "context" + "fmt" + + apeSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" + apemanagerV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + sessionV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" +) + +// PrmAPEManagerListChains groups parameters of APEManagerListChains operation. +type PrmAPEManagerListChains struct { + XHeaders []string + + ChainTarget apeSDK.ChainTarget +} + +func (prm *PrmAPEManagerListChains) buildRequest(c *Client) (*apemanagerV2.ListChainsRequest, error) { + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + req := new(apemanagerV2.ListChainsRequest) + reqBody := new(apemanagerV2.ListChainsRequestBody) + + reqBody.SetTarget(prm.ChainTarget.ToV2()) + + req.SetBody(reqBody) + + var meta sessionV2.RequestMetaHeader + writeXHeadersToMeta(prm.XHeaders, &meta) + + c.prepareRequest(req, &meta) + + return req, nil +} + +type ResAPEManagerListChains struct { + statusRes + + Chains []apeSDK.Chain +} + +// APEManagerListChains lists Chains for ChainTarget. +func (c *Client) APEManagerListChains(ctx context.Context, prm PrmAPEManagerListChains) (*ResAPEManagerListChains, error) { + req, err := prm.buildRequest(c) + if err != nil { + return nil, err + } + + if err := signature.SignServiceMessage(&c.prm.Key, req); err != nil { + return nil, fmt.Errorf("sign request: %w", err) + } + + resp, err := rpcapi.ListChains(&c.c, req, client.WithContext(ctx)) + if err != nil { + return nil, err + } + + var res ResAPEManagerListChains + res.st, err = c.processResponse(resp) + if err != nil || !apistatus.IsSuccessful(res.st) { + return &res, err + } + + for _, ch := range resp.GetBody().GetChains() { + var chSDK apeSDK.Chain + if err := chSDK.ReadFromV2(ch); err != nil { + return nil, err + } + res.Chains = append(res.Chains, chSDK) + } + + return &res, nil +} diff --git a/client/apemanager_remove_chain.go b/client/apemanager_remove_chain.go new file mode 100644 index 00000000..39ccdeb9 --- /dev/null +++ b/client/apemanager_remove_chain.go @@ -0,0 +1,73 @@ +package client + +import ( + "context" + "fmt" + + apeSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" + apemanagerV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + sessionV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" +) + +// PrmAPEManagerRemoveChain groups parameters of APEManagerRemoveChain operation. +type PrmAPEManagerRemoveChain struct { + XHeaders []string + + ChainTarget apeSDK.ChainTarget + + ChainID apeSDK.ChainID +} + +func (prm *PrmAPEManagerRemoveChain) buildRequest(c *Client) (*apemanagerV2.RemoveChainRequest, error) { + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + req := new(apemanagerV2.RemoveChainRequest) + reqBody := new(apemanagerV2.RemoveChainRequestBody) + + reqBody.SetTarget(prm.ChainTarget.ToV2()) + reqBody.SetChainID(prm.ChainID) + + req.SetBody(reqBody) + + var meta sessionV2.RequestMetaHeader + writeXHeadersToMeta(prm.XHeaders, &meta) + + c.prepareRequest(req, &meta) + + return req, nil +} + +type ResAPEManagerRemoveChain struct { + statusRes +} + +// APEManagerRemoveChain removes Chain with ChainID defined for ChainTarget. +func (c *Client) APEManagerRemoveChain(ctx context.Context, prm PrmAPEManagerRemoveChain) (*ResAPEManagerRemoveChain, error) { + req, err := prm.buildRequest(c) + if err != nil { + return nil, err + } + + if err := signature.SignServiceMessage(&c.prm.Key, req); err != nil { + return nil, fmt.Errorf("sign request: %w", err) + } + + resp, err := rpcapi.RemoveChain(&c.c, req, client.WithContext(ctx)) + if err != nil { + return nil, err + } + + var res ResAPEManagerRemoveChain + res.st, err = c.processResponse(resp) + if err != nil || !apistatus.IsSuccessful(res.st) { + return &res, err + } + + return &res, nil +} diff --git a/client/api.go b/client/api.go index dd18c42f..c86dde2f 100644 --- a/client/api.go +++ b/client/api.go @@ -4,9 +4,9 @@ import ( "context" "fmt" - v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + v2netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" ) // interface of FrostFS API server. Exists for test purposes only. diff --git a/client/client.go b/client/client.go index 014b3d76..98d42757 100644 --- a/client/client.go +++ b/client/client.go @@ -7,10 +7,12 @@ import ( "errors" "time" - v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" + v2accounting "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // Client represents virtual connection to the FrostFS network to communicate @@ -98,13 +100,28 @@ func (c *Client) Dial(ctx context.Context, prm PrmDial) error { c.setFrostFSAPIServer((*coreServer)(&c.c)) - // TODO: (neofs-api-go#382) perform generic dial stage of the client.Client + ctx, cancel := context.WithTimeout(ctx, prm.DialTimeout) + defer cancel() _, err := rpc.Balance(&c.c, new(v2accounting.BalanceRequest), client.WithContext(ctx), ) - // return context errors since they signal about dial problem - if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { - return err + if err != nil { + var ctxErr error + + // return context errors since they signal about dial problem + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + ctxErr = err + } else if st, ok := status.FromError(err); ok && st.Code() == codes.Canceled { + ctxErr = context.Canceled + } else if ok && st.Code() == codes.DeadlineExceeded { + ctxErr = context.DeadlineExceeded + } + if ctxErr != nil { + if conn := c.c.Conn(); conn != nil { + _ = conn.Close() + } + return ctxErr + } } return nil @@ -112,7 +129,7 @@ func (c *Client) Dial(ctx context.Context, prm PrmDial) error { // sets underlying provider of frostFSAPIServer. The method is used for testing as an approach // to skip Dial stage and override FrostFS API server. MUST NOT be used outside test code. -// In real applications wrapper over git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client +// In real applications wrapper over git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client // is statically used. func (c *Client) setFrostFSAPIServer(server frostFSAPIServer) { c.server = server diff --git a/client/common.go b/client/common.go index 11cec283..ba8281d2 100644 --- a/client/common.go +++ b/client/common.go @@ -4,10 +4,10 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" ) @@ -46,15 +46,13 @@ func writeXHeadersToMeta(xHeaders []string, h *v2session.RequestMetaHeader) { // error messages. var ( - errorMissingContainer = errors.New("missing container") - errorMissingObject = errors.New("missing object") - errorAccountNotSet = errors.New("account not set") - errorServerAddrUnset = errors.New("server address is unset or empty") - errorEACLTableNotSet = errors.New("eACL table not set") - errorMissingAnnouncements = errors.New("missing announcements") - errorZeroRangeLength = errors.New("zero range length") - errorMissingRanges = errors.New("missing ranges") - errorInvalidXHeaders = errors.New("xheaders must be presented only as key-value pairs") + errorMissingContainer = errors.New("missing container") + errorMissingObject = errors.New("missing object") + errorAccountNotSet = errors.New("account not set") + errorServerAddrUnset = errors.New("server address is unset or empty") + errorZeroRangeLength = errors.New("zero range length") + errorMissingRanges = errors.New("missing ranges") + errorInvalidXHeaders = errors.New("xheaders must be presented only as key-value pairs") ) type request interface { @@ -106,7 +104,7 @@ func (c *Client) processResponse(resp responseV2) (apistatus.Status, error) { return st, nil } -// ExecRaw executes f with underlying git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client.Client +// ExecRaw executes f with underlying sdk-go/api/rpc/client.Client // instance. Communicate over the Protocol Buffers protocol in a more flexible way: // most often used to transmit data over a fixed version of the FrostFS protocol, as well // as to support custom services. @@ -117,7 +115,7 @@ func (c *Client) processResponse(resp responseV2) (apistatus.Status, error) { // before closing the connection. // // See also Dial and Close. -// See also git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client package docs. +// See also git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client package docs. func (c *Client) ExecRaw(f func(client *client.Client) error) error { return f(&c.c) } diff --git a/client/container_delete.go b/client/container_delete.go index 6d4b3450..cf5adf4a 100644 --- a/client/container_delete.go +++ b/client/container_delete.go @@ -4,12 +4,12 @@ import ( "context" "fmt" - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" diff --git a/client/container_eacl.go b/client/container_eacl.go deleted file mode 100644 index 87d32d1b..00000000 --- a/client/container_eacl.go +++ /dev/null @@ -1,110 +0,0 @@ -package client - -import ( - "context" - "fmt" - - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" - apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" - cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" -) - -// PrmContainerEACL groups parameters of ContainerEACL operation. -type PrmContainerEACL struct { - // FrostFS request X-Headers. - XHeaders []string - - ContainerID *cid.ID -} - -// SetContainer sets identifier of the FrostFS container to read the eACL table. -// Required parameter. -// -// Deprecated: Use PrmContainerEACL.ContainerID instead. -func (x *PrmContainerEACL) SetContainer(id cid.ID) { - x.ContainerID = &id -} - -func (x *PrmContainerEACL) buildRequest(c *Client) (*v2container.GetExtendedACLRequest, error) { - if x.ContainerID == nil { - return nil, errorMissingContainer - } - - if len(x.XHeaders)%2 != 0 { - return nil, errorInvalidXHeaders - } - - var cidV2 refs.ContainerID - x.ContainerID.WriteToV2(&cidV2) - - reqBody := new(v2container.GetExtendedACLRequestBody) - reqBody.SetContainerID(&cidV2) - - var req v2container.GetExtendedACLRequest - req.SetBody(reqBody) - c.prepareRequest(&req, new(v2session.RequestMetaHeader)) - return &req, nil -} - -// ResContainerEACL groups resulting values of ContainerEACL operation. -type ResContainerEACL struct { - statusRes - - table eacl.Table -} - -// Table returns eACL table of the requested container. -func (x ResContainerEACL) Table() eacl.Table { - return x.table -} - -// ContainerEACL reads eACL table of the FrostFS container. -// -// Exactly one return value is non-nil. By default, server status is returned in res structure. -// Any client's internal or transport errors are returned as `error`. -// If PrmInit.DisableFrostFSFailuresResolution has been called, unsuccessful -// FrostFS status codes are included in the returned result structure, -// otherwise, are also returned as `error`. -// -// Returns an error if parameters are set incorrectly (see PrmContainerEACL docs). -// Context is required and must not be nil. It is used for network communication. -// -// Return statuses: -// - global (see Client docs); -// - *apistatus.ContainerNotFound; -// - *apistatus.EACLNotFound. -func (c *Client) ContainerEACL(ctx context.Context, prm PrmContainerEACL) (*ResContainerEACL, error) { - req, err := prm.buildRequest(c) - if err != nil { - return nil, err - } - - if err := signature.SignServiceMessage(&c.prm.Key, req); err != nil { - return nil, fmt.Errorf("sign request: %w", err) - } - - resp, err := rpcapi.GetEACL(&c.c, req, client.WithContext(ctx)) - if err != nil { - return nil, err - } - - var res ResContainerEACL - res.st, err = c.processResponse(resp) - if err != nil || !apistatus.IsSuccessful(res.st) { - return &res, err - } - - eACL := resp.GetBody().GetEACL() - if eACL == nil { - return &res, newErrMissingResponseField("eACL") - } - - res.table = *eacl.NewTableFromV2(eACL) - return &res, nil -} diff --git a/client/container_get.go b/client/container_get.go index a6dd6f2c..fd340905 100644 --- a/client/container_get.go +++ b/client/container_get.go @@ -5,15 +5,16 @@ import ( "errors" "fmt" - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" ) // PrmContainerGet groups parameters of ContainerGet operation. @@ -22,6 +23,8 @@ type PrmContainerGet struct { XHeaders []string ContainerID *cid.ID + + Session *session.Container } // SetContainer sets identifier of the container to be read. @@ -47,9 +50,19 @@ func (prm *PrmContainerGet) buildRequest(c *Client) (*v2container.GetRequest, er reqBody := new(v2container.GetRequestBody) reqBody.SetContainerID(&cidV2) + var meta v2session.RequestMetaHeader + writeXHeadersToMeta(prm.XHeaders, &meta) + + if prm.Session != nil { + var tokv2 v2session.Token + prm.Session.WriteToV2(&tokv2) + + meta.SetSessionToken(&tokv2) + } + var req v2container.GetRequest req.SetBody(reqBody) - c.prepareRequest(&req, new(v2session.RequestMetaHeader)) + c.prepareRequest(&req, &meta) return &req, nil } diff --git a/client/container_list.go b/client/container_list.go index 4e88135f..5c768cc0 100644 --- a/client/container_list.go +++ b/client/container_list.go @@ -4,14 +4,15 @@ import ( "context" "fmt" - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" ) @@ -19,31 +20,43 @@ import ( type PrmContainerList struct { XHeaders []string - Account user.ID + OwnerID user.ID + + Session *session.Container } // SetAccount sets identifier of the FrostFS account to list the containers. // Required parameter. // -// Deprecated: Use PrmContainerList.Account instead. +// Deprecated: Use PrmContainerList.OwnerID instead. func (x *PrmContainerList) SetAccount(id user.ID) { - x.Account = id + x.OwnerID = id } func (x *PrmContainerList) buildRequest(c *Client) (*v2container.ListRequest, error) { - if x.Account.IsEmpty() { + if x.OwnerID.IsEmpty() { return nil, errorAccountNotSet } var ownerV2 refs.OwnerID - x.Account.WriteToV2(&ownerV2) + x.OwnerID.WriteToV2(&ownerV2) reqBody := new(v2container.ListRequestBody) reqBody.SetOwnerID(&ownerV2) + var meta v2session.RequestMetaHeader + writeXHeadersToMeta(x.XHeaders, &meta) + + if x.Session != nil { + var tokv2 v2session.Token + x.Session.WriteToV2(&tokv2) + + meta.SetSessionToken(&tokv2) + } + var req v2container.ListRequest req.SetBody(reqBody) - c.prepareRequest(&req, new(v2session.RequestMetaHeader)) + c.prepareRequest(&req, &meta) return &req, nil } diff --git a/client/container_list_stream.go b/client/container_list_stream.go new file mode 100644 index 00000000..9aecd224 --- /dev/null +++ b/client/container_list_stream.go @@ -0,0 +1,197 @@ +package client + +import ( + "context" + "errors" + "fmt" + "io" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" + cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" +) + +// PrmContainerListStream groups parameters of ContainerListStream operation. +type PrmContainerListStream struct { + XHeaders []string + + OwnerID user.ID + + Session *session.Container +} + +func (x *PrmContainerListStream) buildRequest(c *Client) (*container.ListStreamRequest, error) { + if x.OwnerID.IsEmpty() { + return nil, errorAccountNotSet + } + + var ownerV2 refs.OwnerID + x.OwnerID.WriteToV2(&ownerV2) + + reqBody := new(container.ListStreamRequestBody) + reqBody.SetOwnerID(&ownerV2) + + var meta v2session.RequestMetaHeader + writeXHeadersToMeta(x.XHeaders, &meta) + + if x.Session != nil { + var tokv2 v2session.Token + x.Session.WriteToV2(&tokv2) + + meta.SetSessionToken(&tokv2) + } + + var req container.ListStreamRequest + req.SetBody(reqBody) + c.prepareRequest(&req, &meta) + return &req, nil +} + +// ResContainerListStream groups the final result values of ContainerListStream operation. +type ResContainerListStream struct { + statusRes +} + +// ContainerListReader is designed to read list of container identifiers from FrostFS system. +// +// Must be initialized using Client.ContainerListInit, any other usage is unsafe. +type ContainerListReader struct { + client *Client + cancelCtxStream context.CancelFunc + err error + res ResContainerListStream + stream interface { + Read(resp *container.ListStreamResponse) error + } + tail []refs.ContainerID +} + +// Read reads another list of the container identifiers. Works similar to +// io.Reader.Read but copies cid.ID and returns success flag instead of error. +// +// Failure reason can be received via Close. +func (x *ContainerListReader) Read(buf []cid.ID) (int, bool) { + read := copyCnrIDBuffers(buf, x.tail) + x.tail = x.tail[read:] + + if len(buf) == read { + return read, true + } + + for { + var resp container.ListStreamResponse + x.err = x.stream.Read(&resp) + if x.err != nil { + return read, false + } + + x.res.st, x.err = x.client.processResponse(&resp) + if x.err != nil || !apistatus.IsSuccessful(x.res.st) { + return read, false + } + + // read new chunk of containers + ids := resp.GetBody().GetContainerIDs() + if len(ids) == 0 { + // just skip empty lists since they are not prohibited by protocol + continue + } + + ln := copyCnrIDBuffers(buf[read:], ids) + read += ln + + if read == len(buf) { + // save the tail + x.tail = append(x.tail, ids[ln:]...) + + return read, true + } + } +} + +func copyCnrIDBuffers(dst []cid.ID, src []refs.ContainerID) int { + var i int + for ; i < len(dst) && i < len(src); i++ { + _ = dst[i].ReadFromV2(src[i]) + } + return i +} + +// Iterate iterates over the list of found container identifiers. +// f can return true to stop iteration earlier. +// +// Returns an error if container can't be read. +func (x *ContainerListReader) Iterate(f func(cid.ID) bool) error { + buf := make([]cid.ID, 1) + + for { + // Do not check first return value because `len(buf) == 1`, + // so false means nothing was read. + _, ok := x.Read(buf) + if !ok { + res, err := x.Close() + if err != nil { + return err + } + return apistatus.ErrFromStatus(res.Status()) + } + if f(buf[0]) { + return nil + } + } +} + +// Close ends reading list of the matched containers and returns the result of the operation +// along with the final results. Must be called after using the ContainerListReader. +// +// Exactly one return value is non-nil. By default, server status is returned in res structure. +// Any client's internal or transport errors are returned as Go built-in error. +// If Client is tuned to resolve FrostFS API statuses, then FrostFS failures +// codes are returned as error. +func (x *ContainerListReader) Close() (*ResContainerListStream, error) { + defer x.cancelCtxStream() + + if x.err != nil && !errors.Is(x.err, io.EOF) { + return nil, x.err + } + + return &x.res, nil +} + +// ContainerListInit initiates container selection through a remote server using FrostFS API protocol. +// +// The call only opens the transmission channel, explicit fetching of identifiers of the account-owned +// containers is done using the ContainerListReader. Exactly one return value is non-nil. +// Resulting reader must be finally closed. +// +// Returns an error if parameters are set incorrectly (see PrmContainerListStream docs). +// Context is required and must not be nil. It is used for network communication. +func (c *Client) ContainerListInit(ctx context.Context, prm PrmContainerListStream) (*ContainerListReader, error) { + req, err := prm.buildRequest(c) + if err != nil { + return nil, err + } + + err = signature.SignServiceMessage(&c.prm.Key, req) + if err != nil { + return nil, fmt.Errorf("sign request: %w", err) + } + + var r ContainerListReader + ctx, r.cancelCtxStream = context.WithCancel(ctx) + + r.stream, err = rpcapi.ListContainersStream(&c.c, req, client.WithContext(ctx)) + if err != nil { + return nil, fmt.Errorf("open stream: %w", err) + } + r.client = c + + return &r, nil +} diff --git a/client/container_put.go b/client/container_put.go index e5b8f18e..30ebf7ab 100644 --- a/client/container_put.go +++ b/client/container_put.go @@ -4,12 +4,12 @@ import ( "context" "fmt" - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" diff --git a/client/container_set_eacl.go b/client/container_set_eacl.go deleted file mode 100644 index b1493348..00000000 --- a/client/container_set_eacl.go +++ /dev/null @@ -1,136 +0,0 @@ -package client - -import ( - "context" - "fmt" - - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" - frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" - frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" -) - -// PrmContainerSetEACL groups parameters of ContainerSetEACL operation. -type PrmContainerSetEACL struct { - // FrostFS request X-Headers. - XHeaders []string - - Table *eacl.Table - - Session *session.Container -} - -// SetTable sets eACL table structure to be set for the container. -// Required parameter. -// -// Deprecated: Use PrmContainerSetEACL.Table instead. -func (x *PrmContainerSetEACL) SetTable(table eacl.Table) { - x.Table = &table -} - -// WithinSession specifies session within which extended ACL of the container -// should be saved. -// -// Creator of the session acquires the authorship of the request. This affects -// the execution of an operation (e.g. access control). -// -// Session is optional, if set the following requirements apply: -// - if particular container is specified (ApplyOnlyTo), it MUST equal the container -// for which extended ACL is going to be set -// - session operation MUST be session.VerbContainerSetEACL (ForVerb) -// - token MUST be signed using private key of the owner of the container to be saved -// -// Deprecated: Use PrmContainerSetEACL.Session instead. -func (x *PrmContainerSetEACL) WithinSession(s session.Container) { - x.Session = &s -} - -func (x *PrmContainerSetEACL) buildRequest(c *Client) (*v2container.SetExtendedACLRequest, error) { - if x.Table == nil { - return nil, errorEACLTableNotSet - } - - if len(x.XHeaders)%2 != 0 { - return nil, errorInvalidXHeaders - } - - eaclV2 := x.Table.ToV2() - - var sig frostfscrypto.Signature - - err := sig.Calculate(frostfsecdsa.SignerRFC6979(c.prm.Key), eaclV2.StableMarshal(nil)) - if err != nil { - return nil, fmt.Errorf("calculate signature: %w", err) - } - - var sigv2 refs.Signature - sig.WriteToV2(&sigv2) - - reqBody := new(v2container.SetExtendedACLRequestBody) - reqBody.SetEACL(eaclV2) - reqBody.SetSignature(&sigv2) - - var meta v2session.RequestMetaHeader - writeXHeadersToMeta(x.XHeaders, &meta) - - if x.Session != nil { - var tokv2 v2session.Token - x.Session.WriteToV2(&tokv2) - - meta.SetSessionToken(&tokv2) - } - - var req v2container.SetExtendedACLRequest - req.SetBody(reqBody) - c.prepareRequest(&req, &meta) - return &req, nil -} - -// ResContainerSetEACL groups resulting values of ContainerSetEACL operation. -type ResContainerSetEACL struct { - statusRes -} - -// ContainerSetEACL sends request to update eACL table of the FrostFS container. -// -// Exactly one return value is non-nil. By default, server status is returned in res structure. -// Any client's internal or transport errors are returned as `error`. -// If PrmInit.DisableFrostFSFailuresResolution has been called, unsuccessful -// FrostFS status codes are included in the returned result structure, -// otherwise, are also returned as `error`. -// -// Operation is asynchronous and no guaranteed even in the absence of errors. -// The required time is also not predictable. -// -// Success can be verified by reading by identifier (see EACL). -// -// Returns an error if parameters are set incorrectly (see PrmContainerSetEACL docs). -// Context is required and must not be nil. It is used for network communication. -// -// Return statuses: -// - global (see Client docs). -func (c *Client) ContainerSetEACL(ctx context.Context, prm PrmContainerSetEACL) (*ResContainerSetEACL, error) { - req, err := prm.buildRequest(c) - if err != nil { - return nil, err - } - - if err := signature.SignServiceMessage(&c.prm.Key, req); err != nil { - return nil, fmt.Errorf("sign request: %w", err) - } - - resp, err := rpcapi.SetEACL(&c.c, req, client.WithContext(ctx)) - if err != nil { - return nil, err - } - - var res ResContainerSetEACL - res.st, err = c.processResponse(resp) - return &res, err -} diff --git a/client/container_space.go b/client/container_space.go deleted file mode 100644 index dda5acc4..00000000 --- a/client/container_space.go +++ /dev/null @@ -1,92 +0,0 @@ -package client - -import ( - "context" - "fmt" - - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" -) - -// PrmAnnounceSpace groups parameters of ContainerAnnounceUsedSpace operation. -type PrmAnnounceSpace struct { - XHeaders []string - - Announcements []container.SizeEstimation -} - -// SetValues sets values describing volume of space that is used for the container objects. -// Required parameter. Must not be empty. -// -// Must not be mutated before the end of the operation. -// -// Deprecated: Use PrmAnnounceSpace.Announcements instead. -func (x *PrmAnnounceSpace) SetValues(vs []container.SizeEstimation) { - x.Announcements = vs -} - -func (x *PrmAnnounceSpace) buildRequest(c *Client) (*v2container.AnnounceUsedSpaceRequest, error) { - if len(x.Announcements) == 0 { - return nil, errorMissingAnnouncements - } - - v2announce := make([]v2container.UsedSpaceAnnouncement, len(x.Announcements)) - for i := range x.Announcements { - x.Announcements[i].WriteToV2(&v2announce[i]) - } - - reqBody := new(v2container.AnnounceUsedSpaceRequestBody) - reqBody.SetAnnouncements(v2announce) - - var req v2container.AnnounceUsedSpaceRequest - req.SetBody(reqBody) - c.prepareRequest(&req, new(v2session.RequestMetaHeader)) - return &req, nil -} - -// ResAnnounceSpace groups resulting values of ContainerAnnounceUsedSpace operation. -type ResAnnounceSpace struct { - statusRes -} - -// ContainerAnnounceUsedSpace sends request to announce volume of the space used for the container objects. -// -// Exactly one return value is non-nil. By default, server status is returned in res structure. -// Any client's internal or transport errors are returned as `error`. -// If PrmInit.DisableFrostFSFailuresResolution has been called, unsuccessful -// FrostFS status codes are included in the returned result structure, -// otherwise, are also returned as `error`. -// -// Operation is asynchronous and no guaranteed even in the absence of errors. -// The required time is also not predictable. -// -// At this moment success can not be checked. -// -// Returns an error if parameters are set incorrectly (see PrmAnnounceSpace docs). -// Context is required and must not be nil. It is used for network communication. -// -// Return statuses: -// - global (see Client docs). -func (c *Client) ContainerAnnounceUsedSpace(ctx context.Context, prm PrmAnnounceSpace) (*ResAnnounceSpace, error) { - req, err := prm.buildRequest(c) - if err != nil { - return nil, err - } - - if err := signature.SignServiceMessage(&c.prm.Key, req); err != nil { - return nil, fmt.Errorf("sign request: %w", err) - } - - resp, err := rpcapi.AnnounceUsedSpace(&c.c, req, client.WithContext(ctx)) - if err != nil { - return nil, err - } - - var res ResAnnounceSpace - res.st, err = c.processResponse(resp) - return &res, err -} diff --git a/client/doc.go b/client/doc.go index 7f6ec420..2a1d6074 100644 --- a/client/doc.go +++ b/client/doc.go @@ -47,8 +47,8 @@ Consume custom service of the server: rpc CustomRPC(CustomRPCRequest) returns (CustomRPCResponse); } - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" + import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common" req := new(CustomRPCRequest) // ... diff --git a/client/errors.go b/client/errors.go index 64144b6e..b457ff0b 100644 --- a/client/errors.go +++ b/client/errors.go @@ -61,6 +61,18 @@ func IsErrSessionNotFound(err error) bool { return wrapsErrType[*apistatus.SessionTokenNotFound](err) } +// IsErrAPEManagerAccessDenied checks if err corresponds to FrostFS status return +// corresponding to apemanager access deny. Supports wrapped errors. +func IsErrAPEManagerAccessDenied(err error) bool { + return wrapsErrType[*apistatus.APEManagerAccessDenied](err) +} + +// IsErrNodeUnderMaintenance checks if err corresponds to FrostFS status return +// corresponding to nodes being under maintenance. Supports wrapped errors. +func IsErrNodeUnderMaintenance(err error) bool { + return wrapsErrType[*apistatus.NodeUnderMaintenance](err) +} + // returns error describing missing field with the given name. func newErrMissingResponseField(name string) error { return fmt.Errorf("missing %s field in the response", name) diff --git a/client/errors_test.go b/client/errors_test.go index 53872fa4..acf82b9d 100644 --- a/client/errors_test.go +++ b/client/errors_test.go @@ -38,6 +38,10 @@ func TestErrors(t *testing.T) { check: client.IsErrSessionNotFound, err: new(apistatus.SessionTokenNotFound), }, + { + check: client.IsErrNodeUnderMaintenance, + err: new(apistatus.NodeUnderMaintenance), + }, } for i := range errs { diff --git a/client/netmap.go b/client/netmap.go index 8bedf463..f87d3b0d 100644 --- a/client/netmap.go +++ b/client/netmap.go @@ -4,11 +4,11 @@ import ( "context" "fmt" - v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + v2netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" @@ -239,12 +239,8 @@ func (c *Client) NetMapSnapshot(ctx context.Context, _ PrmNetMapSnapshot) (*ResN var res ResNetMapSnapshot res.st, err = c.processResponse(resp) - if err != nil { - return nil, err - } - - if !apistatus.IsSuccessful(res.st) { - return &res, nil + if err != nil || !apistatus.IsSuccessful(res.st) { + return &res, err } const fieldNetMap = "network map" diff --git a/client/netmap_test.go b/client/netmap_test.go index bce6b3af..d6ff0fb6 100644 --- a/client/netmap_test.go +++ b/client/netmap_test.go @@ -6,9 +6,9 @@ import ( "fmt" "testing" - v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + v2netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "github.com/stretchr/testify/require" diff --git a/client/object_delete.go b/client/object_delete.go index a9fe8e86..048398c2 100644 --- a/client/object_delete.go +++ b/client/object_delete.go @@ -5,13 +5,13 @@ import ( "crypto/ecdsa" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - v2refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + v2refs "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" @@ -148,12 +148,8 @@ func (c *Client) ObjectDelete(ctx context.Context, prm PrmObjectDelete) (*ResObj var res ResObjectDelete res.st, err = c.processResponse(resp) - if err != nil { - return nil, err - } - - if !apistatus.IsSuccessful(res.st) { - return &res, nil + if err != nil || !apistatus.IsSuccessful(res.st) { + return &res, err } const fieldTombstone = "tombstone" diff --git a/client/object_get.go b/client/object_get.go index 363c1ec0..b84844ee 100644 --- a/client/object_get.go +++ b/client/object_get.go @@ -7,13 +7,13 @@ import ( "fmt" "io" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - v2refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + v2refs "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" @@ -150,6 +150,9 @@ func (x *ObjectReader) ReadHeader(dst *object.Object) bool { case *v2object.SplitInfo: x.err = object.NewSplitInfoError(object.NewSplitInfoFromV2(v)) return false + case *v2object.ECInfo: + x.err = object.NewECInfoError(object.NewECInfoFromV2(v)) + return false case *v2object.GetObjectPartInit: partInit = v } @@ -258,6 +261,7 @@ func (x *ObjectReader) close(ignoreEOF bool) (*ResObjectGet, error) { // Return errors: // // *object.SplitInfoError (returned on virtual objects with PrmObjectGet.MakeRaw). +// *object.ECInfoError (returned on erasure-coded objects with PrmObjectGet.MakeRaw). // // Return statuses: // - global (see Client docs); @@ -454,6 +458,7 @@ func (prm *PrmObjectHead) buildRequest(c *Client) (*v2object.HeadRequest, error) // Return errors: // // *object.SplitInfoError (returned on virtual objects with PrmObjectHead.MakeRaw). +// *object.ECInfoError (returned on erasure-coded objects with PrmObjectHead.MakeRaw). // // Return statuses: // - global (see Client docs); @@ -487,12 +492,8 @@ func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectH var res ResObjectHead res.st, err = c.processResponse(resp) - if err != nil { - return nil, err - } - - if !apistatus.IsSuccessful(res.st) { - return &res, nil + if err != nil || !apistatus.IsSuccessful(res.st) { + return &res, err } res.idObj = *prm.ObjectID @@ -502,6 +503,8 @@ func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectH return nil, fmt.Errorf("unexpected header type %T", v) case *v2object.SplitInfo: return nil, object.NewSplitInfoError(object.NewSplitInfoFromV2(v)) + case *v2object.ECInfo: + return nil, object.NewECInfoError(object.NewECInfoFromV2(v)) case *v2object.HeaderWithSignature: res.hdr = v } @@ -665,6 +668,9 @@ func (x *ObjectRangeReader) readChunk(buf []byte) (int, bool) { case *v2object.SplitInfo: x.err = object.NewSplitInfoError(object.NewSplitInfoFromV2(v)) return read, false + case *v2object.ECInfo: + x.err = object.NewECInfoError(object.NewECInfoFromV2(v)) + return read, false case *v2object.GetRangePartChunk: partChunk = v } @@ -725,6 +731,7 @@ func (x *ObjectRangeReader) close(ignoreEOF bool) (*ResObjectRange, error) { // Return errors: // // *object.SplitInfoError (returned on virtual objects with PrmObjectRange.MakeRaw). +// *object.ECInfoError (returned on erasure-coded objects with PrmObjectRange.MakeRaw). // // Return statuses: // - global (see Client docs); diff --git a/client/object_hash.go b/client/object_hash.go index 108e0ce0..83f23602 100644 --- a/client/object_hash.go +++ b/client/object_hash.go @@ -5,13 +5,13 @@ import ( "crypto/ecdsa" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - v2refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + v2refs "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" @@ -189,12 +189,8 @@ func (c *Client) ObjectHash(ctx context.Context, prm PrmObjectHash) (*ResObjectH var res ResObjectHash res.st, err = c.processResponse(resp) - if err != nil { - return nil, err - } - - if !apistatus.IsSuccessful(res.st) { - return &res, nil + if err != nil || !apistatus.IsSuccessful(res.st) { + return &res, err } res.checksums = resp.GetBody().GetHashList() diff --git a/client/object_patch.go b/client/object_patch.go new file mode 100644 index 00000000..87033c52 --- /dev/null +++ b/client/object_patch.go @@ -0,0 +1,291 @@ +package client + +import ( + "context" + "crypto/ecdsa" + "errors" + "fmt" + "io" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" +) + +// ObjectPatcher is designed to patch an object. +// +// Must be initialized using Client.ObjectPatchInit, any other +// usage is unsafe. +type ObjectPatcher interface { + // PatchAttributes patches attributes. Attributes can be patched no more than once, + // otherwise, the server returns an error. `PatchAttributes` and `PatchHeader` are mutually + // exclusive - only one method can be used. + // + // Result means success. Failure reason can be received via Close. + PatchAttributes(ctx context.Context, newAttrs []object.Attribute, replace bool) bool + + // PatchHeader patches object's header. Header can be patched no more than once, + // otherwise, the server returns an error. `PatchAttributes` and `PatchHeader` are mutually + // exclusive - only one method can be used. + // + // Result means success. Failure reason can be received via Close. + PatchHeader(ctx context.Context, prm PatchHeaderPrm) bool + + // PatchPayload patches the object's payload. + // + // PatchPayload receives `payloadReader` and thus the payload of the patch is read and sent by chunks of + // `MaxChunkLength` length. + // + // Result means success. Failure reason can be received via Close. + PatchPayload(ctx context.Context, rng *object.Range, payloadReader io.Reader) bool + + // Close ends patching the object and returns the result of the operation + // along with the final results. Must be called after using the ObjectPatcher. + // + // Exactly one return value is non-nil. By default, server status is returned in res structure. + // Any client's internal or transport errors are returned as Go built-in error. + // If Client is tuned to resolve FrostFS API statuses, then FrostFS failures + // codes are returned as error. + // + // Return statuses: + // - global (see Client docs); + // - *apistatus.ContainerNotFound; + // - *apistatus.ContainerAccessDenied; + // - *apistatus.ObjectAccessDenied; + // - *apistatus.ObjectAlreadyRemoved; + // - *apistatus.ObjectLocked; + // - *apistatus.ObjectOutOfRange; + // - *apistatus.SessionTokenNotFound; + // - *apistatus.SessionTokenExpired. + Close(_ context.Context) (*ResObjectPatch, error) +} + +type PatchHeaderPrm struct { + NewSplitHeader *object.SplitHeader + + NewAttributes []object.Attribute + + ReplaceAttributes bool +} + +// ResObjectPatch groups resulting values of ObjectPatch operation. +type ResObjectPatch struct { + statusRes + + obj oid.ID +} + +// ObjectID returns an object ID of the patched object. +func (r ResObjectPatch) ObjectID() oid.ID { + return r.obj +} + +// PrmObjectPatch groups parameters of ObjectPatch operation. +type PrmObjectPatch struct { + XHeaders []string + + Address oid.Address + + BearerToken *bearer.Token + + Session *session.Object + + Key *ecdsa.PrivateKey + + MaxChunkLength int +} + +// ObjectPatchInit initializes object patcher. +func (c *Client) ObjectPatchInit(ctx context.Context, prm PrmObjectPatch) (ObjectPatcher, error) { + if len(prm.XHeaders)%2 != 0 { + return nil, errorInvalidXHeaders + } + + var objectPatcher objectPatcher + stream, err := rpcapi.Patch(&c.c, &objectPatcher.respV2, client.WithContext(ctx)) + if err != nil { + return nil, fmt.Errorf("open stream: %w", err) + } + + objectPatcher.addr = prm.Address + objectPatcher.key = &c.prm.Key + if prm.Key != nil { + objectPatcher.key = prm.Key + } + objectPatcher.client = c + objectPatcher.stream = stream + + if prm.MaxChunkLength > 0 { + objectPatcher.maxChunkLen = prm.MaxChunkLength + } else { + objectPatcher.maxChunkLen = defaultGRPCPayloadChunkLen + } + + objectPatcher.req.SetBody(&v2object.PatchRequestBody{}) + + meta := new(v2session.RequestMetaHeader) + writeXHeadersToMeta(prm.XHeaders, meta) + + if prm.BearerToken != nil { + v2BearerToken := new(acl.BearerToken) + prm.BearerToken.WriteToV2(v2BearerToken) + meta.SetBearerToken(v2BearerToken) + } + + if prm.Session != nil { + v2SessionToken := new(v2session.Token) + prm.Session.WriteToV2(v2SessionToken) + meta.SetSessionToken(v2SessionToken) + } + + c.prepareRequest(&objectPatcher.req, meta) + + return &objectPatcher, nil +} + +type objectPatcher struct { + client *Client + + stream interface { + Write(*v2object.PatchRequest) error + Close() error + } + + key *ecdsa.PrivateKey + res ResObjectPatch + err error + + addr oid.Address + + req v2object.PatchRequest + respV2 v2object.PatchResponse + + maxChunkLen int +} + +func (x *objectPatcher) PatchAttributes(_ context.Context, newAttrs []object.Attribute, replace bool) bool { + return x.patch(&object.Patch{ + Address: x.addr, + NewAttributes: newAttrs, + ReplaceAttributes: replace, + }) +} + +func (x *objectPatcher) PatchHeader(_ context.Context, prm PatchHeaderPrm) bool { + return x.patch(&object.Patch{ + Address: x.addr, + NewAttributes: prm.NewAttributes, + ReplaceAttributes: prm.ReplaceAttributes, + NewSplitHeader: prm.NewSplitHeader, + }) +} + +func (x *objectPatcher) PatchPayload(_ context.Context, rng *object.Range, payloadReader io.Reader) bool { + offset := rng.GetOffset() + + buf := make([]byte, x.maxChunkLen) + + for patchIter := 0; ; patchIter++ { + n, err := payloadReader.Read(buf) + if err != nil && err != io.EOF { + x.err = fmt.Errorf("read payload: %w", err) + return false + } + if n == 0 { + if patchIter == 0 { + if rng.GetLength() == 0 { + x.err = errors.New("zero-length empty payload patch can't be applied") + return false + } + if !x.patch(&object.Patch{ + Address: x.addr, + PayloadPatch: &object.PayloadPatch{ + Range: rng, + Chunk: []byte{}, + }, + }) { + return false + } + } + break + } + + rngPart := object.NewRange() + if patchIter == 0 { + rngPart.SetOffset(offset) + rngPart.SetLength(rng.GetLength()) + } else { + rngPart.SetOffset(offset + rng.GetLength()) + } + + if !x.patch(&object.Patch{ + Address: x.addr, + PayloadPatch: &object.PayloadPatch{ + Range: rngPart, + Chunk: buf[:n], + }, + }) { + return false + } + + if err == io.EOF { + break + } + } + + return true +} + +func (x *objectPatcher) patch(patch *object.Patch) bool { + x.req.SetBody(patch.ToV2()) + x.req.SetVerificationHeader(nil) + + x.err = signature.SignServiceMessage(x.key, &x.req) + if x.err != nil { + x.err = fmt.Errorf("sign message: %w", x.err) + return false + } + + x.err = x.stream.Write(&x.req) + return x.err == nil +} + +func (x *objectPatcher) Close(_ context.Context) (*ResObjectPatch, error) { + // Ignore io.EOF error, because it is expected error for client-side + // stream termination by the server. E.g. when stream contains invalid + // message. Server returns an error in response message (in status). + if x.err != nil && !errors.Is(x.err, io.EOF) { + return nil, x.err + } + + if x.err = x.stream.Close(); x.err != nil { + return nil, x.err + } + + x.res.st, x.err = x.client.processResponse(&x.respV2) + if x.err != nil || !apistatus.IsSuccessful(x.res.st) { + return &x.res, x.err + } + + const fieldID = "ID" + + idV2 := x.respV2.Body.ObjectID + if idV2 == nil { + return nil, newErrMissingResponseField(fieldID) + } + + x.err = x.res.obj.ReadFromV2(*idV2) + if x.err != nil { + x.err = newErrInvalidResponseField(fieldID, x.err) + } + + return &x.res, nil +} diff --git a/client/object_patch_test.go b/client/object_patch_test.go new file mode 100644 index 00000000..3e801f3a --- /dev/null +++ b/client/object_patch_test.go @@ -0,0 +1,295 @@ +package client + +import ( + "bytes" + "context" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "testing" + + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" + "github.com/stretchr/testify/require" +) + +type mockPatchStream struct { + streamedPayloadPatches []*object.PayloadPatch +} + +func (m *mockPatchStream) Write(r *v2object.PatchRequest) error { + pp := new(object.PayloadPatch) + pp.FromV2(r.GetBody().GetPatch()) + + if r.GetBody().GetPatch() != nil { + bodyChunk := r.GetBody().GetPatch().Chunk + pp.Chunk = make([]byte, len(bodyChunk)) + copy(pp.Chunk, bodyChunk) + } + + m.streamedPayloadPatches = append(m.streamedPayloadPatches, pp) + + return nil +} + +func (m *mockPatchStream) Close() error { + return nil +} + +func TestObjectPatcher(t *testing.T) { + type part struct { + offset int + length int + chunk string + } + + for _, test := range []struct { + name string + patchPayload string + rng *object.Range + maxChunkLen int + expectParts []part + }{ + { + name: "no split payload patch", + patchPayload: "011111", + rng: newRange(0, 6), + maxChunkLen: defaultGRPCPayloadChunkLen, + expectParts: []part{ + { + offset: 0, + length: 6, + chunk: "011111", + }, + }, + }, + { + name: "splitted payload patch", + patchPayload: "012345", + rng: newRange(0, 6), + maxChunkLen: 2, + expectParts: []part{ + { + offset: 0, + length: 6, + chunk: "01", + }, + { + offset: 6, + length: 0, + chunk: "23", + }, + { + offset: 6, + length: 0, + chunk: "45", + }, + }, + }, + { + name: "splitted payload patch with zero-length subpatches", + patchPayload: "0123456789!@", + rng: newRange(0, 4), + maxChunkLen: 2, + expectParts: []part{ + { + offset: 0, + length: 4, + chunk: "01", + }, + { + offset: 4, + length: 0, + chunk: "23", + }, + { + offset: 4, + length: 0, + chunk: "45", + }, + { + offset: 4, + length: 0, + chunk: "67", + }, + { + offset: 4, + length: 0, + chunk: "89", + }, + { + offset: 4, + length: 0, + chunk: "!@", + }, + }, + }, + { + name: "splitted payload patch with zero-length subpatches only", + patchPayload: "0123456789!@", + rng: newRange(0, 0), + maxChunkLen: 2, + expectParts: []part{ + { + offset: 0, + length: 0, + chunk: "01", + }, + { + offset: 0, + length: 0, + chunk: "23", + }, + { + offset: 0, + length: 0, + chunk: "45", + }, + { + offset: 0, + length: 0, + chunk: "67", + }, + { + offset: 0, + length: 0, + chunk: "89", + }, + { + offset: 0, + length: 0, + chunk: "!@", + }, + }, + }, + } { + t.Run(test.name, func(t *testing.T) { + m := &mockPatchStream{} + + pk, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + + patcher := objectPatcher{ + client: &Client{}, + stream: m, + addr: oidtest.Address(), + key: pk, + maxChunkLen: test.maxChunkLen, + } + + success := patcher.PatchHeader(context.Background(), PatchHeaderPrm{}) + require.True(t, success) + + success = patcher.PatchPayload(context.Background(), test.rng, bytes.NewReader([]byte(test.patchPayload))) + require.True(t, success) + + require.Len(t, m.streamedPayloadPatches, len(test.expectParts)+1) + + // m.streamedPayloadPatches[0] is attribute patch, so skip it + for i, part := range test.expectParts { + requireRangeChunk(t, m.streamedPayloadPatches[i+1], part.offset, part.length, part.chunk) + } + }) + } +} + +func TestRepeatPayloadPatch(t *testing.T) { + t.Run("no payload patch partioning", func(t *testing.T) { + m := &mockPatchStream{} + + pk, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + + const maxChunkLen = 20 + + patcher := objectPatcher{ + client: &Client{}, + stream: m, + addr: oidtest.Address(), + key: pk, + maxChunkLen: maxChunkLen, + } + + for _, pp := range []struct { + patchPayload string + rng *object.Range + }{ + { + patchPayload: "xxxxxxxxxx", + rng: newRange(1, 6), + }, + { + patchPayload: "yyyyyyyyyy", + rng: newRange(5, 9), + }, + { + patchPayload: "zzzzzzzzzz", + rng: newRange(10, 0), + }, + } { + success := patcher.PatchPayload(context.Background(), pp.rng, bytes.NewReader([]byte(pp.patchPayload))) + require.True(t, success) + } + + requireRangeChunk(t, m.streamedPayloadPatches[0], 1, 6, "xxxxxxxxxx") + requireRangeChunk(t, m.streamedPayloadPatches[1], 5, 9, "yyyyyyyyyy") + requireRangeChunk(t, m.streamedPayloadPatches[2], 10, 0, "zzzzzzzzzz") + }) + + t.Run("payload patch partioning", func(t *testing.T) { + m := &mockPatchStream{} + + pk, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + + const maxChunkLen = 5 + + patcher := objectPatcher{ + client: &Client{}, + stream: m, + addr: oidtest.Address(), + key: pk, + maxChunkLen: maxChunkLen, + } + + for _, pp := range []struct { + patchPayload string + rng *object.Range + }{ + { + patchPayload: "xxxxxxxxxx", + rng: newRange(1, 6), + }, + { + patchPayload: "yyyyyyyyyy", + rng: newRange(5, 9), + }, + { + patchPayload: "zzzzzzzzzz", + rng: newRange(10, 0), + }, + } { + success := patcher.PatchPayload(context.Background(), pp.rng, bytes.NewReader([]byte(pp.patchPayload))) + require.True(t, success) + } + + requireRangeChunk(t, m.streamedPayloadPatches[0], 1, 6, "xxxxx") + requireRangeChunk(t, m.streamedPayloadPatches[1], 7, 0, "xxxxx") + requireRangeChunk(t, m.streamedPayloadPatches[2], 5, 9, "yyyyy") + requireRangeChunk(t, m.streamedPayloadPatches[3], 14, 0, "yyyyy") + requireRangeChunk(t, m.streamedPayloadPatches[4], 10, 0, "zzzzz") + requireRangeChunk(t, m.streamedPayloadPatches[5], 10, 0, "zzzzz") + }) +} + +func requireRangeChunk(t *testing.T, pp *object.PayloadPatch, offset, length int, chunk string) { + require.NotNil(t, pp) + require.Equal(t, uint64(offset), pp.Range.GetOffset()) + require.Equal(t, uint64(length), pp.Range.GetLength()) + require.Equal(t, []byte(chunk), pp.Chunk) +} + +func newRange(offest, length uint64) *object.Range { + rng := &object.Range{} + rng.SetOffset(offest) + rng.SetLength(length) + return rng +} diff --git a/client/object_put.go b/client/object_put.go index 213ec7fe..9a01f349 100644 --- a/client/object_put.go +++ b/client/object_put.go @@ -4,6 +4,7 @@ import ( "context" "crypto/ecdsa" + buffPool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -36,6 +37,8 @@ type PrmObjectPutInit struct { WithoutHomomorphHash bool Key *ecdsa.PrivateKey + + Pool *buffPool.BufferPool } // SetCopiesNumber sets number of object copies that is enough to consider put successful. @@ -69,7 +72,8 @@ func (x *PrmObjectPutInit) SetGRPCPayloadChunkLen(v int) { type ResObjectPut struct { statusRes - obj oid.ID + obj oid.ID + epoch uint64 } // StoredObjectID returns identifier of the saved object. @@ -77,6 +81,11 @@ func (x ResObjectPut) StoredObjectID() oid.ID { return x.obj } +// StoredEpoch returns creation epoch of the saved object. +func (x ResObjectPut) StoredEpoch() uint64 { + return x.epoch +} + // ObjectWriter is designed to write one object or // multiple parts of one object to FrostFS system. // diff --git a/client/object_put_raw.go b/client/object_put_raw.go index dd210a8c..b6821024 100644 --- a/client/object_put_raw.go +++ b/client/object_put_raw.go @@ -7,12 +7,12 @@ import ( "fmt" "io" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" ) @@ -156,12 +156,8 @@ func (x *objectWriterRaw) Close(_ context.Context) (*ResObjectPut, error) { } x.res.st, x.err = x.client.processResponse(&x.respV2) - if x.err != nil { - return nil, x.err - } - - if !apistatus.IsSuccessful(x.res.st) { - return &x.res, nil + if x.err != nil || !apistatus.IsSuccessful(x.res.st) { + return &x.res, x.err } const fieldID = "ID" @@ -175,6 +171,7 @@ func (x *objectWriterRaw) Close(_ context.Context) (*ResObjectPut, error) { if x.err != nil { x.err = newErrInvalidResponseField(fieldID, x.err) } + x.res.epoch = x.respV2.GetMetaHeader().GetEpoch() return &x.res, nil } diff --git a/client/object_put_single.go b/client/object_put_single.go index 8eaeca99..ffce1267 100644 --- a/client/object_put_single.go +++ b/client/object_put_single.go @@ -5,12 +5,12 @@ import ( "crypto/ecdsa" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" @@ -93,6 +93,13 @@ func (prm *PrmObjectPutSingle) SetObject(o *v2object.Object) { // ResObjectPutSingle groups resulting values of PutSingle operation. type ResObjectPutSingle struct { statusRes + + epoch uint64 +} + +// Epoch returns creation epoch of the saved object. +func (r *ResObjectPutSingle) Epoch() uint64 { + return r.epoch } func (prm *PrmObjectPutSingle) buildRequest(c *Client) (*v2object.PutSingleRequest, error) { @@ -160,8 +167,9 @@ func (c *Client) ObjectPutSingle(ctx context.Context, prm PrmObjectPutSingle) (* var res ResObjectPutSingle res.st, err = c.processResponse(resp) if err != nil { - return nil, err + return &res, err } + res.epoch = resp.GetMetaHeader().GetEpoch() return &res, nil } diff --git a/client/object_put_transformer.go b/client/object_put_transformer.go index c671b553..7e30be1d 100644 --- a/client/object_put_transformer.go +++ b/client/object_put_transformer.go @@ -3,6 +3,7 @@ package client import ( "context" + buffPool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" @@ -26,6 +27,7 @@ func (c *Client) objectPutInitTransformer(prm PrmObjectPutInit) (*objectWriterTr MaxSize: prm.MaxSize, WithoutHomomorphicHash: prm.WithoutHomomorphHash, NetworkState: prm.EpochSource, + Pool: prm.Pool, }) return &w, nil } @@ -47,13 +49,20 @@ func (x *objectWriterTransformer) WritePayloadChunk(ctx context.Context, chunk [ } func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, error) { + if x.err != nil { + return nil, x.err + } + ai, err := x.ot.Close(ctx) if err != nil { return nil, err } - if ai != nil && ai.ParentID != nil { - x.it.res.obj = *ai.ParentID + if ai != nil { + x.it.res.epoch = ai.Epoch + if ai.ParentID != nil { + x.it.res.obj = *ai.ParentID + } } return x.it.res, nil } @@ -110,10 +119,12 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b } if err == nil { + it.returnBuffPool(o.Payload()) id, _ := o.ID() it.res = &ResObjectPut{ statusRes: res.statusRes, obj: id, + epoch: res.epoch, } if it.client.prm.DisableFrostFSErrorResolution && !apistatus.IsSuccessful(it.res.st) { return true, apistatus.ErrFromStatus(it.res.st) @@ -122,3 +133,12 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b } return true, err } + +func (it *internalTarget) returnBuffPool(playback []byte) { + if it.prm.Pool == nil { + return + } + var buffer buffPool.Buffer + buffer.Data = playback + it.prm.Pool.Put(&buffer) +} diff --git a/client/object_search.go b/client/object_search.go index aa02542b..781d872c 100644 --- a/client/object_search.go +++ b/client/object_search.go @@ -7,13 +7,13 @@ import ( "fmt" "io" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - v2refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + v2refs "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" @@ -220,7 +220,7 @@ func (x *ObjectListReader) Close() (*ResObjectSearch, error) { defer x.cancelCtxStream() if x.err != nil && !errors.Is(x.err, io.EOF) { - return nil, x.err + return &x.res, x.err } return &x.res, nil diff --git a/client/object_search_test.go b/client/object_search_test.go index f449d61f..f385f48f 100644 --- a/client/object_search_test.go +++ b/client/object_search_test.go @@ -7,9 +7,9 @@ import ( "io" "testing" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - signatureV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + signatureV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" diff --git a/client/response.go b/client/response.go index e1a702e4..69972b91 100644 --- a/client/response.go +++ b/client/response.go @@ -1,6 +1,6 @@ package client -import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" +import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" // ResponseMetaInfo groups meta information about any FrostFS API response. type ResponseMetaInfo struct { diff --git a/client/session.go b/client/session.go index b49c67bc..9f806f00 100644 --- a/client/session.go +++ b/client/session.go @@ -5,11 +5,11 @@ import ( "crypto/ecdsa" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" ) diff --git a/client/status/apemanager.go b/client/status/apemanager.go new file mode 100644 index 00000000..b4d49cbf --- /dev/null +++ b/client/status/apemanager.go @@ -0,0 +1,53 @@ +package apistatus + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" +) + +// APEManagerAccessDenied describes status of the failure because of the access control violation. +// Instances provide Status and StatusV2 interfaces. +type APEManagerAccessDenied struct { + v2 status.Status +} + +const defaultAPEManagerAccessDeniedMsg = "apemanager access denied" + +func (x *APEManagerAccessDenied) Error() string { + msg := x.v2.Message() + if msg == "" { + msg = defaultAPEManagerAccessDeniedMsg + } + + return errMessageStatusV2( + globalizeCodeV2(apemanager.StatusAPEManagerAccessDenied, apemanager.GlobalizeFail), + msg, + ) +} + +func (x *APEManagerAccessDenied) fromStatusV2(st *status.Status) { + x.v2 = *st +} + +// ToStatusV2 converts APEManagerAccessDenied to v2's Status. +// If the value was returned by FromStatusV2, returns the source message. +// Otherwise, returns message with +// - code: APE_MANAGER_ACCESS_DENIED; +// - string message: "apemanager access denied"; +// - details: empty. +func (x APEManagerAccessDenied) ToStatusV2() *status.Status { + x.v2.SetCode(globalizeCodeV2(apemanager.StatusAPEManagerAccessDenied, apemanager.GlobalizeFail)) + x.v2.SetMessage(defaultAPEManagerAccessDeniedMsg) + return &x.v2 +} + +// WriteReason writes human-readable access rejection reason. +func (x *APEManagerAccessDenied) WriteReason(reason string) { + apemanager.WriteAccessDeniedDesc(&x.v2, reason) +} + +// Reason returns human-readable access rejection reason returned by the server. +// Returns empty value is reason is not presented. +func (x APEManagerAccessDenied) Reason() string { + return apemanager.ReadAccessDeniedDesc(x.v2) +} diff --git a/client/status/common.go b/client/status/common.go index af0dc8ec..65c4ba31 100644 --- a/client/status/common.go +++ b/client/status/common.go @@ -3,7 +3,7 @@ package apistatus import ( "encoding/binary" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" ) // ServerInternal describes failure statuses related to internal server errors. @@ -53,7 +53,7 @@ func (x ServerInternal) Message() string { // WriteInternalServerErr writes err message to ServerInternal instance. func WriteInternalServerErr(x *ServerInternal, err error) { - x.SetMessage(err.Error()) + x.v2.SetMessage(err.Error()) } // WrongMagicNumber describes failure status related to incorrect network magic. @@ -192,7 +192,7 @@ const defaultNodeUnderMaintenanceMsg = "node is under maintenance" // Error implements the error interface. func (x *NodeUnderMaintenance) Error() string { - msg := x.Message() + msg := x.v2.Message() if msg == "" { msg = defaultNodeUnderMaintenanceMsg } @@ -238,3 +238,120 @@ func (x *NodeUnderMaintenance) SetMessage(v string) { func (x NodeUnderMaintenance) Message() string { return x.v2.Message() } + +// InvalidArgument describes failure status related to invalid argument. +// Instances provide Status and StatusV2 interfaces. +type InvalidArgument struct { + v2 status.Status +} + +const defaultInvalidArgumentMsg = "argument is invalid" + +// Error implements the error interface. +func (x *InvalidArgument) Error() string { + msg := x.v2.Message() + if msg == "" { + msg = defaultInvalidArgumentMsg + } + + return errMessageStatusV2( + globalizeCodeV2(status.InvalidArgument, status.GlobalizeCommonFail), + msg, + ) +} + +// implements local interface defined in FromStatusV2 func. +func (x *InvalidArgument) fromStatusV2(st *status.Status) { + x.v2 = *st +} + +// ToStatusV2 implements StatusV2 interface method. +// If the value was returned by FromStatusV2, returns the source message. +// Otherwise, returns message with +// - code: INVALID_ARGUMENT; +// - string message: written message via SetMessage or +// "argument is invalid" as a default message; +// - details: empty. +func (x InvalidArgument) ToStatusV2() *status.Status { + x.v2.SetCode(globalizeCodeV2(status.InvalidArgument, status.GlobalizeCommonFail)) + if x.v2.Message() == "" { + x.v2.SetMessage(defaultInvalidArgumentMsg) + } + + return &x.v2 +} + +// SetMessage writes invalid argument failure message. +// Message should be used for debug purposes only. +// +// See also Message. +func (x *InvalidArgument) SetMessage(v string) { + x.v2.SetMessage(v) +} + +// Message returns status message. Zero status returns empty message. +// Message should be used for debug purposes only. +// +// See also SetMessage. +func (x InvalidArgument) Message() string { + return x.v2.Message() +} + +// ResourceExhausted is a failure status indicating that +// the operation cannot be performed due to a lack of resources. +// Instances provide Status and StatusV2 interfaces. +type ResourceExhausted struct { + v2 status.Status +} + +const defaultResourceExhaustedMsg = "resource exhausted" + +// Error implements the error interface. +func (x *ResourceExhausted) Error() string { + msg := x.v2.Message() + if msg == "" { + msg = defaultResourceExhaustedMsg + } + + return errMessageStatusV2( + globalizeCodeV2(status.ResourceExhausted, status.GlobalizeCommonFail), + msg, + ) +} + +// implements local interface defined in FromStatusV2 func. +func (x *ResourceExhausted) fromStatusV2(st *status.Status) { + x.v2 = *st +} + +// ToStatusV2 implements StatusV2 interface method. +// If the value was returned by FromStatusV2, returns the source message. +// Otherwise, returns message with +// - code: RESOURCE_EXHAUSTED; +// - string message: written message via SetMessage or +// "resource exhausted" as a default message; +// - details: empty. +func (x ResourceExhausted) ToStatusV2() *status.Status { + x.v2.SetCode(globalizeCodeV2(status.ResourceExhausted, status.GlobalizeCommonFail)) + if x.v2.Message() == "" { + x.v2.SetMessage(defaultResourceExhaustedMsg) + } + + return &x.v2 +} + +// SetMessage writes invalid argument failure message. +// Message should be used for debug purposes only. +// +// See also Message. +func (x *ResourceExhausted) SetMessage(v string) { + x.v2.SetMessage(v) +} + +// Message returns status message. Zero status returns empty message. +// Message should be used for debug purposes only. +// +// See also SetMessage. +func (x ResourceExhausted) Message() string { + return x.v2.Message() +} diff --git a/client/status/common_test.go b/client/status/common_test.go index d66b5b59..0c3d2d5d 100644 --- a/client/status/common_test.go +++ b/client/status/common_test.go @@ -3,7 +3,7 @@ package apistatus_test import ( "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "github.com/stretchr/testify/require" ) @@ -114,7 +114,7 @@ func TestNodeUnderMaintenance(t *testing.T) { stV2 := st.ToStatusV2() - require.Empty(t, "", stV2.Message()) + require.Equal(t, "node is under maintenance", stV2.Message()) }) t.Run("non-empty to V2", func(t *testing.T) { @@ -128,3 +128,81 @@ func TestNodeUnderMaintenance(t *testing.T) { require.Equal(t, msg, stV2.Message()) }) } + +func TestInvalidArgument(t *testing.T) { + t.Run("default", func(t *testing.T) { + var st apistatus.InvalidArgument + + require.Empty(t, st.Message()) + }) + + t.Run("custom message", func(t *testing.T) { + var st apistatus.InvalidArgument + msg := "some message" + + st.SetMessage(msg) + + stV2 := st.ToStatusV2() + + require.Equal(t, msg, st.Message()) + require.Equal(t, msg, stV2.Message()) + }) + + t.Run("empty to V2", func(t *testing.T) { + var st apistatus.InvalidArgument + + stV2 := st.ToStatusV2() + + require.Equal(t, "argument is invalid", stV2.Message()) + }) + + t.Run("non-empty to V2", func(t *testing.T) { + var st apistatus.InvalidArgument + msg := "some other msg" + + st.SetMessage(msg) + + stV2 := st.ToStatusV2() + + require.Equal(t, msg, stV2.Message()) + }) +} + +func TestResourceExhausted(t *testing.T) { + t.Run("default", func(t *testing.T) { + var st apistatus.ResourceExhausted + + require.Empty(t, st.Message()) + }) + + t.Run("custom message", func(t *testing.T) { + var st apistatus.ResourceExhausted + msg := "some message" + + st.SetMessage(msg) + + stV2 := st.ToStatusV2() + + require.Equal(t, msg, st.Message()) + require.Equal(t, msg, stV2.Message()) + }) + + t.Run("empty to V2", func(t *testing.T) { + var st apistatus.ResourceExhausted + + stV2 := st.ToStatusV2() + + require.Equal(t, "resource exhausted", stV2.Message()) + }) + + t.Run("non-empty to V2", func(t *testing.T) { + var st apistatus.ResourceExhausted + msg := "some other msg" + + st.SetMessage(msg) + + stV2 := st.ToStatusV2() + + require.Equal(t, msg, stV2.Message()) + }) +} diff --git a/client/status/container.go b/client/status/container.go index 9f06b27e..594d9849 100644 --- a/client/status/container.go +++ b/client/status/container.go @@ -1,8 +1,8 @@ package apistatus import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" ) // ContainerNotFound describes status of the failure because of the missing container. diff --git a/client/status/object.go b/client/status/object.go index 27ea86cb..ae2e8e04 100644 --- a/client/status/object.go +++ b/client/status/object.go @@ -1,8 +1,8 @@ package apistatus import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" ) // ObjectLocked describes status of the failure because of the locked object. diff --git a/client/status/session.go b/client/status/session.go index 6f607581..f87ce616 100644 --- a/client/status/session.go +++ b/client/status/session.go @@ -1,8 +1,8 @@ package apistatus import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" ) // SessionTokenNotFound describes status of the failure because of the missing session token. diff --git a/client/status/success.go b/client/status/success.go index a68983d5..3975b924 100644 --- a/client/status/success.go +++ b/client/status/success.go @@ -1,7 +1,7 @@ package apistatus import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" ) // SuccessDefaultV2 represents Status instance of default success. Implements StatusV2. diff --git a/client/status/unrecognized.go b/client/status/unrecognized.go index 19e481ee..e4b4a81f 100644 --- a/client/status/unrecognized.go +++ b/client/status/unrecognized.go @@ -1,7 +1,7 @@ package apistatus import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" ) type unrecognizedStatusV2 struct { diff --git a/client/status/v2.go b/client/status/v2.go index ff6ccecd..6ee3d84a 100644 --- a/client/status/v2.go +++ b/client/status/v2.go @@ -3,10 +3,11 @@ package apistatus import ( "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status" ) // StatusV2 defines a variety of Status instances compatible with FrostFS API V2 protocol. @@ -15,7 +16,7 @@ import ( type StatusV2 interface { Status - // ToStatusV2 returns the status as git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status.Status message structure. + // ToStatusV2 returns the status as git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status.Status message structure. ToStatusV2() *status.Status } @@ -32,12 +33,29 @@ type StatusV2 interface { // // Common failures: // - status.Internal: *ServerInternal; -// - status.SignatureVerificationFail: *SignatureVerification. +// - status.WrongMagicNumber: *WrongMagicNumber; +// - status.SignatureVerificationFail: *SignatureVerification; +// - status.NodeUnderMaintenance: *NodeUnderMaintenance; +// - status.InvalidArgument: *InvalidArgument. // // Object failures: // - object.StatusLocked: *ObjectLocked; -// - object.StatusLockNonRegularObject: *LockNonRegularObject. -// - object.StatusAccessDenied: *ObjectAccessDenied. +// - object.StatusLockNonRegularObject: *LockNonRegularObject; +// - object.StatusAccessDenied: *ObjectAccessDenied; +// - object.StatusNotFound: *ObjectNotFound; +// - object.StatusAlreadyRemoved: *ObjectAlreadyRemoved; +// - object.StatusOutOfRange: *ObjectOutOfRange. +// +// Container failures: +// - container.StatusNotFound: *ContainerNotFound; +// - container.StatusEACLNotFound: *EACLNotFound. +// +// Session failures: +// - session.StatusTokenNotFound: *SessionTokenNotFound; +// - session.StatusTokenExpired: *SessionTokenExpired. +// +// APE Manager failures +// - apemanager.StatusAPEManagerAccessDenied: *APEManagerAccessDenied. func FromStatusV2(st *status.Status) Status { var decoder interface { fromStatusV2(*status.Status) @@ -60,6 +78,10 @@ func FromStatusV2(st *status.Status) Status { decoder = new(SignatureVerification) case status.NodeUnderMaintenance: decoder = new(NodeUnderMaintenance) + case status.InvalidArgument: + decoder = new(InvalidArgument) + case status.ResourceExhausted: + decoder = new(ResourceExhausted) } case object.LocalizeFailStatus(&code): switch code { @@ -92,6 +114,12 @@ func FromStatusV2(st *status.Status) Status { case session.StatusTokenExpired: decoder = new(SessionTokenExpired) } + case apemanager.LocalizeFailStatus(&code): + //nolint:exhaustive + switch code { + case apemanager.StatusAPEManagerAccessDenied: + decoder = new(APEManagerAccessDenied) + } } if decoder == nil { diff --git a/client/status/v2_test.go b/client/status/v2_test.go index 14d4c309..cecd075a 100644 --- a/client/status/v2_test.go +++ b/client/status/v2_test.go @@ -61,6 +61,24 @@ func TestToStatusV2(t *testing.T) { }), codeV2: 1025, }, + { + status: (statusConstructor)(func() apistatus.Status { + return new(apistatus.SignatureVerification) + }), + codeV2: 1026, + }, + { + status: (statusConstructor)(func() apistatus.Status { + return new(apistatus.NodeUnderMaintenance) + }), + codeV2: 1027, + }, + { + status: (statusConstructor)(func() apistatus.Status { + return new(apistatus.InvalidArgument) + }), + codeV2: 1028, + }, { status: (statusConstructor)(func() apistatus.Status { return new(apistatus.ObjectLocked) @@ -127,9 +145,9 @@ func TestToStatusV2(t *testing.T) { }, { status: (statusConstructor)(func() apistatus.Status { - return new(apistatus.NodeUnderMaintenance) + return new(apistatus.APEManagerAccessDenied) }), - codeV2: 1027, + codeV2: 5120, }, } { var st apistatus.Status @@ -278,6 +296,12 @@ func TestFromStatusV2(t *testing.T) { }), codeV2: 4097, }, + { + status: (statusConstructor)(func() apistatus.Status { + return new(apistatus.APEManagerAccessDenied) + }), + codeV2: 5120, + }, { status: (statusConstructor)(func() apistatus.Status { return new(apistatus.NodeUnderMaintenance) diff --git a/container/container.go b/container/container.go index 8c9c4475..f10c3202 100644 --- a/container/container.go +++ b/container/container.go @@ -5,13 +5,14 @@ import ( "crypto/sha256" "errors" "fmt" + "iter" "strconv" "strings" "time" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + v2netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" @@ -37,7 +38,7 @@ import ( // Instances for existing containers can be initialized using decoding methods // (e.g Unmarshal). // -// Container is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container.Container +// Container is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container.Container // message. See ReadFromV2 / WriteToV2 methods. type Container struct { v2 container.Container @@ -308,7 +309,7 @@ func (x *Container) SetAttribute(key, value string) { attrs := x.v2.GetAttributes() ln := len(attrs) - for i := 0; i < ln; i++ { + for i := range ln { if attrs[i].GetKey() == key { attrs[i].SetValue(value) return @@ -337,10 +338,41 @@ func (x Container) Attribute(key string) string { return "" } +// Attributes returns an iterator over all Container attributes. +// +// See also [Container.SetAttribute], [Container.UserAttributes]. +func (x Container) Attributes() iter.Seq2[string, string] { + return func(yield func(string, string) bool) { + attrs := x.v2.GetAttributes() + for i := range attrs { + if !yield(attrs[i].GetKey(), attrs[i].GetValue()) { + return + } + } + } +} + +// Attributes returns an iterator over all non-system Container attributes. +// +// See also [Container.SetAttribute], [Container.Attributes]. +func (x Container) UserAttributes() iter.Seq2[string, string] { + return func(yield func(string, string) bool) { + for key, value := range x.Attributes() { + if !strings.HasPrefix(key, container.SysAttributePrefix) { + if !yield(key, value) { + return + } + } + } + } +} + // IterateAttributes iterates over all Container attributes and passes them // into f. The handler MUST NOT be nil. // // See also SetAttribute, Attribute. +// +// Deprecated: use [Container.Attributes] instead. func (x Container) IterateAttributes(f func(key, val string)) { attrs := x.v2.GetAttributes() for i := range attrs { @@ -352,12 +384,13 @@ func (x Container) IterateAttributes(f func(key, val string)) { // into f. The handler MUST NOT be nil. // // See also SetAttribute, Attribute. +// +// Deprecated: use [Container.UserAttributes] instead. func (x Container) IterateUserAttributes(f func(key, val string)) { attrs := x.v2.GetAttributes() for _, attr := range attrs { key := attr.GetKey() - if !strings.HasPrefix(key, container.SysAttributePrefix) && - !strings.HasPrefix(key, container.SysAttributePrefixNeoFS) { + if !strings.HasPrefix(key, container.SysAttributePrefix) { f(key, attr.GetValue()) } } @@ -417,8 +450,7 @@ func DisableHomomorphicHashing(cnr *Container) { // // Zero Container has enabled hashing. func IsHomomorphicHashingDisabled(cnr Container) bool { - return cnr.Attribute(container.SysAttributeHomomorphicHashing) == attributeHomoHashEnabled || - cnr.Attribute(container.SysAttributeHomomorphicHashingNeoFS) == attributeHomoHashEnabled + return cnr.Attribute(container.SysAttributeHomomorphicHashing) == attributeHomoHashEnabled } // Domain represents information about container domain registered in the NNS @@ -467,9 +499,6 @@ func ReadDomain(cnr Container) (res Domain) { if name := cnr.Attribute(container.SysAttributeName); name != "" { res.SetName(name) res.SetZone(cnr.Attribute(container.SysAttributeZone)) - } else if name = cnr.Attribute(container.SysAttributeNameNeoFS); name != "" { - res.SetName(name) - res.SetZone(cnr.Attribute(container.SysAttributeZoneNeoFS)) } return diff --git a/container/container_test.go b/container/container_test.go index d2ecf1d9..62422aba 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -2,13 +2,14 @@ package container_test import ( "crypto/sha256" + "maps" "strconv" "testing" "time" - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + v2netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" @@ -150,7 +151,7 @@ func assertContainsAttribute(t *testing.T, m v2container.Container, key, val str } func TestContainer_Attribute(t *testing.T) { - const attrKey1, attrKey2 = v2container.SysAttributePrefix + "key1", v2container.SysAttributePrefixNeoFS + "key2" + const attrKey1, attrKey2 = v2container.SysAttributePrefix + "key1", v2container.SysAttributePrefix + "key2" const attrVal1, attrVal2 = "val1", "val2" val := containertest.Container() @@ -159,9 +160,9 @@ func TestContainer_Attribute(t *testing.T) { val.SetAttribute(attrKey2, attrVal2) var i int - val.IterateUserAttributes(func(key, val string) { + for range val.UserAttributes() { i++ - }) + } require.Equal(t, 1, i) var msg v2container.Container @@ -177,11 +178,7 @@ func TestContainer_Attribute(t *testing.T) { require.Equal(t, attrVal1, val2.Attribute(attrKey1)) require.Equal(t, attrVal2, val2.Attribute(attrKey2)) - m := map[string]string{} - - val2.IterateAttributes(func(key, val string) { - m[key] = val - }) + m := maps.Collect(val2.Attributes()) require.GreaterOrEqual(t, len(m), 2) require.Equal(t, attrVal1, m[attrKey1]) diff --git a/container/doc.go b/container/doc.go index 34b044d7..85e20828 100644 --- a/container/doc.go +++ b/container/doc.go @@ -27,7 +27,7 @@ Instances can be also used to process FrostFS API V2 protocol messages On client side: - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" + import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" var msg container.Container cnr.WriteToV2(&msg) diff --git a/container/id/id.go b/container/id/id.go index bde739c6..1cbd60b5 100644 --- a/container/id/id.go +++ b/container/id/id.go @@ -3,14 +3,15 @@ package cid import ( "crypto/sha256" "fmt" + "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "github.com/mr-tron/base58" ) // ID represents FrostFS container identifier. // -// ID is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs.ContainerID +// ID is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs.ContainerID // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. @@ -113,3 +114,9 @@ func (id *ID) DecodeString(s string) error { func (id ID) String() string { return id.EncodeToString() } + +// Cmp returns an integer comparing two base58 encoded container ID lexicographically. +// The result will be 0 if id1 == id2, -1 if id1 < id2, and +1 if id1 > id2. +func (id ID) Cmp(id2 ID) int { + return strings.Compare(id.EncodeToString(), id2.EncodeToString()) +} diff --git a/container/id/id_test.go b/container/id/id_test.go index ded74572..2bbd8b34 100644 --- a/container/id/id_test.go +++ b/container/id/id_test.go @@ -3,9 +3,11 @@ package cid_test import ( "crypto/rand" "crypto/sha256" + "slices" + "strings" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" "github.com/mr-tron/base58" @@ -106,3 +108,17 @@ func TestID_Encode(t *testing.T) { require.Equal(t, emptyID, id.EncodeToString()) }) } + +func TestID_Cmp(t *testing.T) { + var arr []cid.ID + for i := 0; i < 3; i++ { + checksum := randSHA256Checksum() + arr = append(arr, cidtest.IDWithChecksum(checksum)) + } + + slices.SortFunc(arr, cid.ID.Cmp) + + for i := 1; i < len(arr); i++ { + require.NotEqual(t, strings.Compare(arr[i-1].EncodeToString(), arr[i].EncodeToString()), 1, "array is not sorted correctly") + } +} diff --git a/container/iterators_test.go b/container/iterators_test.go new file mode 100644 index 00000000..00522a5c --- /dev/null +++ b/container/iterators_test.go @@ -0,0 +1,95 @@ +package container_test + +import ( + "testing" + + containerAPI "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" + "github.com/stretchr/testify/require" +) + +func TestContainer_Attributes(t *testing.T) { + t.Run("empty", func(t *testing.T) { + var n container.Container + t.Run("attributes", func(t *testing.T) { + for range n.Attributes() { + t.Fatalf("handler is called, but it shouldn't") + } + }) + t.Run("user attributes", func(t *testing.T) { + for range n.UserAttributes() { + t.Fatalf("handler is called, but it shouldn't") + } + }) + }) + + var n container.Container + n.SetAttribute(containerAPI.SysAttributeName, "myname") + n.SetAttribute("key1", "value1") + n.SetAttribute("key2", "value2") + n.SetAttribute(containerAPI.SysAttributeZone, "test") + + t.Run("break", func(t *testing.T) { + t.Run("attributes", func(t *testing.T) { + var res [][2]string + for key, value := range n.Attributes() { + if key == "key2" { + break + } + res = append(res, [2]string{key, value}) + } + require.Equal(t, [][2]string{{containerAPI.SysAttributeName, "myname"}, {"key1", "value1"}}, res) + }) + t.Run("user attributes", func(t *testing.T) { + var res [][2]string + for key, value := range n.UserAttributes() { + if key == "key2" { + break + } + res = append(res, [2]string{key, value}) + } + require.Equal(t, [][2]string{{"key1", "value1"}}, res) + }) + }) + t.Run("continue", func(t *testing.T) { + t.Run("attributes", func(t *testing.T) { + var res [][2]string + for key, value := range n.Attributes() { + if key == "key2" { + continue + } + res = append(res, [2]string{key, value}) + } + require.Equal(t, [][2]string{{containerAPI.SysAttributeName, "myname"}, {"key1", "value1"}, {containerAPI.SysAttributeZone, "test"}}, res) + }) + t.Run("user attributes", func(t *testing.T) { + var res [][2]string + for key, value := range n.UserAttributes() { + if key == "key2" { + continue + } + res = append(res, [2]string{key, value}) + } + require.Equal(t, [][2]string{{"key1", "value1"}}, res) + }) + }) + t.Run("attributes", func(t *testing.T) { + var res [][2]string + for key, value := range n.Attributes() { + res = append(res, [2]string{key, value}) + } + require.Equal(t, [][2]string{ + {containerAPI.SysAttributeName, "myname"}, + {"key1", "value1"}, + {"key2", "value2"}, + {containerAPI.SysAttributeZone, "test"}, + }, res) + }) + t.Run("user attributes", func(t *testing.T) { + var res [][2]string + for key, value := range n.UserAttributes() { + res = append(res, [2]string{key, value}) + } + require.Equal(t, [][2]string{{"key1", "value1"}, {"key2", "value2"}}, res) + }) +} diff --git a/container/size.go b/container/size.go deleted file mode 100644 index 64220ed7..00000000 --- a/container/size.go +++ /dev/null @@ -1,104 +0,0 @@ -package container - -import ( - "errors" - "fmt" - - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" -) - -// SizeEstimation groups information about estimation of the size of the data -// stored in the FrostFS container. -// -// SizeEstimation is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container.UsedSpaceAnnouncement -// message. See ReadFromV2 / WriteToV2 methods. -type SizeEstimation struct { - m container.UsedSpaceAnnouncement -} - -// ReadFromV2 reads SizeEstimation from the container.UsedSpaceAnnouncement message. -// Checks if the message conforms to FrostFS API V2 protocol. -// -// See also WriteToV2. -func (x *SizeEstimation) ReadFromV2(m container.UsedSpaceAnnouncement) error { - cnrV2 := m.GetContainerID() - if cnrV2 == nil { - return errors.New("missing container") - } - - var cnr cid.ID - - err := cnr.ReadFromV2(*cnrV2) - if err != nil { - return fmt.Errorf("invalid container: %w", err) - } - - x.m = m - - return nil -} - -// WriteToV2 writes SizeEstimation into the container.UsedSpaceAnnouncement message. -// The message MUST NOT be nil. -// -// See also ReadFromV2. -func (x SizeEstimation) WriteToV2(m *container.UsedSpaceAnnouncement) { - *m = x.m -} - -// SetEpoch sets epoch when estimation of the container data size was calculated. -// -// See also Epoch. -func (x *SizeEstimation) SetEpoch(epoch uint64) { - x.m.SetEpoch(epoch) -} - -// Epoch return epoch set using SetEpoch. -// -// Zero SizeEstimation represents estimation in zero epoch. -func (x SizeEstimation) Epoch() uint64 { - return x.m.GetEpoch() -} - -// SetContainer specifies the container for which the amount of data is estimated. -// Required by the FrostFS API protocol. -// -// See also Container. -func (x *SizeEstimation) SetContainer(cnr cid.ID) { - var cidV2 refs.ContainerID - cnr.WriteToV2(&cidV2) - - x.m.SetContainerID(&cidV2) -} - -// Container returns container set using SetContainer. -// -// Zero SizeEstimation is not bound to any container (returns zero) which is -// incorrect according to FrostFS API protocol. -func (x SizeEstimation) Container() (res cid.ID) { - m := x.m.GetContainerID() - if m != nil { - err := res.ReadFromV2(*m) - if err != nil { - panic(fmt.Errorf("unexpected error from cid.ID.ReadFromV2: %w", err)) - } - } - - return -} - -// SetValue sets estimated amount of data (in bytes) in the specified container. -// -// See also Value. -func (x *SizeEstimation) SetValue(value uint64) { - x.m.SetUsedSpace(value) -} - -// Value returns data size estimation set using SetValue. -// -// Zero SizeEstimation has zero value. -func (x SizeEstimation) Value() uint64 { - return x.m.GetUsedSpace() -} diff --git a/container/size_test.go b/container/size_test.go deleted file mode 100644 index 77fed4db..00000000 --- a/container/size_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package container_test - -import ( - "crypto/sha256" - "testing" - - v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" - cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" - cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" - "github.com/stretchr/testify/require" -) - -func TestSizeEstimation_Epoch(t *testing.T) { - var val container.SizeEstimation - - require.Zero(t, val.Epoch()) - - const epoch = 123 - - val.SetEpoch(epoch) - require.EqualValues(t, epoch, val.Epoch()) - - var msg v2container.UsedSpaceAnnouncement - val.WriteToV2(&msg) - - require.EqualValues(t, epoch, msg.GetEpoch()) -} - -func TestSizeEstimation_Container(t *testing.T) { - var val container.SizeEstimation - - require.Zero(t, val.Container()) - - cnr := cidtest.ID() - - val.SetContainer(cnr) - require.True(t, val.Container().Equals(cnr)) - - var msg v2container.UsedSpaceAnnouncement - val.WriteToV2(&msg) - - var msgCnr refs.ContainerID - cnr.WriteToV2(&msgCnr) - - require.Equal(t, &msgCnr, msg.GetContainerID()) -} - -func TestSizeEstimation_Value(t *testing.T) { - var val container.SizeEstimation - - require.Zero(t, val.Value()) - - const value = 876 - - val.SetValue(value) - require.EqualValues(t, value, val.Value()) - - var msg v2container.UsedSpaceAnnouncement - val.WriteToV2(&msg) - - require.EqualValues(t, value, msg.GetUsedSpace()) -} - -func TestSizeEstimation_ReadFromV2(t *testing.T) { - const epoch = 654 - const value = 903 - var cnrMsg refs.ContainerID - - var msg v2container.UsedSpaceAnnouncement - - var val container.SizeEstimation - - require.Error(t, val.ReadFromV2(msg)) - - msg.SetContainerID(&cnrMsg) - - require.Error(t, val.ReadFromV2(msg)) - - cnrMsg.SetValue(make([]byte, sha256.Size)) - - var cnr cid.ID - require.NoError(t, cnr.ReadFromV2(cnrMsg)) - - msg.SetEpoch(epoch) - msg.SetUsedSpace(value) - - require.NoError(t, val.ReadFromV2(msg)) - - require.EqualValues(t, epoch, val.Epoch()) - require.EqualValues(t, value, val.Value()) - require.EqualValues(t, cnr, val.Container()) -} diff --git a/container/test/generate.go b/container/test/generate.go index 7ac0c2ae..c2423693 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -5,7 +5,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl" - cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" netmaptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/test" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" ) @@ -23,15 +22,6 @@ func Container() (x container.Container) { return x } -// SizeEstimation returns random container.SizeEstimation. -func SizeEstimation() (x container.SizeEstimation) { - x.SetContainer(cidtest.ID()) - x.SetEpoch(rand.Uint64()) - x.SetValue(rand.Uint64()) - - return x -} - // BasicACL returns random acl.Basic. func BasicACL() (x acl.Basic) { x.FromBits(rand.Uint32()) diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index 7d1ad526..da33d88c 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -4,7 +4,7 @@ import ( "crypto/rand" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" diff --git a/crypto/doc.go b/crypto/doc.go index 8b568f5a..7fc66c19 100644 --- a/crypto/doc.go +++ b/crypto/doc.go @@ -29,7 +29,7 @@ Signature can be also used to process FrostFS API V2 protocol messages On client side: - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" var msg refs.Signature sig.WriteToV2(&msg) diff --git a/crypto/ecdsa/wallet_connect.go b/crypto/ecdsa/wallet_connect.go index 34cbcaed..0fe86515 100644 --- a/crypto/ecdsa/wallet_connect.go +++ b/crypto/ecdsa/wallet_connect.go @@ -6,7 +6,7 @@ import ( "encoding/base64" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/signature/walletconnect" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/signature/walletconnect" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" ) diff --git a/crypto/signature.go b/crypto/signature.go index 33c6132f..f8a668e2 100644 --- a/crypto/signature.go +++ b/crypto/signature.go @@ -4,13 +4,13 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" ) // Signature represents a confirmation of data integrity received by the // digital signature mechanism. // -// Signature is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs.Signature +// Signature is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs.Signature // message. See ReadFromV2 / WriteToV2 methods. // // Note that direct typecast is not safe and may result in loss of compatibility: diff --git a/crypto/signer.go b/crypto/signer.go index 9f99e3df..be96973b 100644 --- a/crypto/signer.go +++ b/crypto/signer.go @@ -3,7 +3,7 @@ package frostfscrypto import ( "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" ) // Scheme represents digital signature algorithm with fixed cryptographic hash function. diff --git a/doc/image/pool.png b/doc/image/pool.png new file mode 100644 index 00000000..de9788e0 Binary files /dev/null and b/doc/image/pool.png differ diff --git a/doc/policy.md b/doc/policy.md index 28744efc..0b87079e 100644 --- a/doc/policy.md +++ b/doc/policy.md @@ -428,6 +428,13 @@ Comparison operators (all binary): - `LE`: less or equal - `LT`: less than +Pattern operator: +- `LIKE`: specifies pattern for an attribute. Uses as a wildcard symbol `*`. + - `... ATTR LIKE "VAL"` - the behaviour is equal to `EQ` + - `... ATTR LIKE "VAL*"` - matches all which starts with `VAL` + - `... ATTR LIKE "*VAL"` - matches all which ends with `VAL` + - `... ATTR LIKE "*VAL*"` - matches all which contains `VAL` + Logical operators: - `NOT`: negation (unary) - `AND`: conjunction (binary) diff --git a/doc/pool.md b/doc/pool.md new file mode 100644 index 00000000..41e7e69f --- /dev/null +++ b/doc/pool.md @@ -0,0 +1,27 @@ +# Node connection pool + +* Distributes requests between fixed number of nodes +* Wraps + +The distribution between nodes in connection pool is based on priority and weight parameters from +NodeParam struct. The distribution model is presented below. On this scheme nodes with the same +priority have the same color. + +![](./image/pool.png "Pool connections distribution model") + +## Priority + +Pool component forwards request to the nodes with the highest priority (the lower the value - +the higher the priority). The `node 1` from the image's scenario (I) is healthy +and has the highest priority (1), that's why the pool forwards requests from it. There are no other +nodes with priority 1, so `node 1` receives all requests. In the second scenario (II) `node 1` +becomes unhealthy. In that case pool tries to connect nodes with next in priority nodes e.g. +`Node 4` and `node 2`. If all of them become unhealthy too, the pool sends requests to nodes with +priority 3 in scenario (III) and so on. + +## Weights + +If there are several nodes with the same priority, then requests are distributed randomly between +these nodes based on their weights. To do that the proportion of weights is calculated. +For example, for `node 2` and `node 4` with weights 2 and 8 the distribution would be 20 and 80 percent +respectively. \ No newline at end of file diff --git a/eacl/enums.go b/eacl/enums.go index b2b5353f..8f693ec6 100644 --- a/eacl/enums.go +++ b/eacl/enums.go @@ -1,7 +1,7 @@ package eacl import ( - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" ) // Action taken if ContainerEACL record matched request. diff --git a/eacl/enums_test.go b/eacl/enums_test.go index 29f25181..e283b098 100644 --- a/eacl/enums_test.go +++ b/eacl/enums_test.go @@ -3,7 +3,7 @@ package eacl_test import ( "testing" - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" "github.com/stretchr/testify/require" ) diff --git a/eacl/filter.go b/eacl/filter.go index 4403e5af..af32eae6 100644 --- a/eacl/filter.go +++ b/eacl/filter.go @@ -3,7 +3,7 @@ package eacl import ( "strconv" - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" ) // Filter defines check conditions if request header is matched or not. Matched diff --git a/eacl/filter_test.go b/eacl/filter_test.go index 74b9a109..3a01a32e 100644 --- a/eacl/filter_test.go +++ b/eacl/filter_test.go @@ -4,7 +4,7 @@ import ( "strconv" "testing" - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" "github.com/stretchr/testify/require" ) diff --git a/eacl/record.go b/eacl/record.go index eeb9646e..0165992f 100644 --- a/eacl/record.go +++ b/eacl/record.go @@ -3,7 +3,7 @@ package eacl import ( "crypto/ecdsa" - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" @@ -286,13 +286,13 @@ func equalRecords(r1, r2 Record) bool { return false } - for i := 0; i < len(fs1); i++ { + for i := range fs1 { if !equalFilters(fs1[i], fs2[i]) { return false } } - for i := 0; i < len(ts1); i++ { + for i := range ts1 { if !equalTargets(ts1[i], ts2[i]) { return false } diff --git a/eacl/record_test.go b/eacl/record_test.go index 0bdc37fe..02301daa 100644 --- a/eacl/record_test.go +++ b/eacl/record_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" checksumtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" @@ -225,14 +225,6 @@ func TestReservedRecords(t *testing.T) { key: v2acl.FilterObjectType, value: "TOMBSTONE", }, - { - f: func(r *Record) { - require.True(t, typ.FromString("STORAGE_GROUP")) - r.AddObjectTypeFilter(MatchStringEqual, *typ) - }, - key: v2acl.FilterObjectType, - value: "STORAGE_GROUP", - }, } for n, testCase := range testSuit { diff --git a/eacl/table.go b/eacl/table.go index b16467bf..6d491e95 100644 --- a/eacl/table.go +++ b/eacl/table.go @@ -4,8 +4,8 @@ import ( "crypto/sha256" "fmt" - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" ) @@ -212,7 +212,7 @@ func EqualTables(t1, t2 Table) bool { return false } - for i := 0; i < len(rs1); i++ { + for i := range rs1 { if !equalRecords(rs1[i], rs2[i]) { return false } diff --git a/eacl/table_test.go b/eacl/table_test.go index 4ec110fc..630d3ed5 100644 --- a/eacl/table_test.go +++ b/eacl/table_test.go @@ -4,7 +4,7 @@ import ( "crypto/sha256" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" eacltest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl/test" diff --git a/eacl/target.go b/eacl/target.go index 5e349506..dc6fdc25 100644 --- a/eacl/target.go +++ b/eacl/target.go @@ -4,7 +4,7 @@ import ( "bytes" "crypto/ecdsa" - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" ) @@ -51,7 +51,7 @@ func SetTargetECDSAKeys(t *Target, pubs ...*ecdsa.PublicKey) { binKeys = make([][]byte, 0, ln) } - for i := 0; i < ln; i++ { + for i := range ln { binKeys = append(binKeys, (*keys.PublicKey)(pubs[i]).Bytes()) } @@ -67,7 +67,7 @@ func TargetECDSAKeys(t *Target) []*ecdsa.PublicKey { pubs := make([]*ecdsa.PublicKey, ln) - for i := 0; i < ln; i++ { + for i := range ln { p := new(keys.PublicKey) if p.DecodeBytes(binKeys[i]) == nil { pubs[i] = (*ecdsa.PublicKey)(p) @@ -169,7 +169,7 @@ func equalTargets(t1, t2 Target) bool { return false } - for i := 0; i < len(keys1); i++ { + for i := range keys1 { if !bytes.Equal(keys1[i], keys2[i]) { return false } diff --git a/eacl/target_test.go b/eacl/target_test.go index e2261940..9da4f824 100644 --- a/eacl/target_test.go +++ b/eacl/target_test.go @@ -4,7 +4,7 @@ import ( "crypto/ecdsa" "testing" - v2acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" + v2acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/stretchr/testify/require" ) diff --git a/eacl/test/benchmark_test.go b/eacl/test/benchmark_test.go index 865789b5..e4f91c0d 100644 --- a/eacl/test/benchmark_test.go +++ b/eacl/test/benchmark_test.go @@ -19,7 +19,7 @@ func baseBenchmarkTableBinaryComparison(b *testing.B, factor int) { b.StopTimer() b.ResetTimer() b.StartTimer() - for i := 0; i < b.N; i++ { + for range b.N { got, _ := t.Marshal() if !bytes.Equal(exp, got) { b.Fail() @@ -38,7 +38,7 @@ func baseBenchmarkTableEqualsComparison(b *testing.B, factor int) { b.StopTimer() b.ResetTimer() b.StartTimer() - for i := 0; i < b.N; i++ { + for range b.N { if !eacl.EqualTables(*t, *t2) { b.Fail() } @@ -76,7 +76,7 @@ func TargetN(n int) *eacl.Target { x.SetRole(eacl.RoleSystem) keys := make([][]byte, n) - for i := 0; i < n; i++ { + for i := range n { keys[i] = make([]byte, 32) rand.Read(keys[i]) } @@ -94,7 +94,7 @@ func RecordN(n int) *eacl.Record { x.SetOperation(eacl.OperationRangeHash) x.SetTargets(*TargetN(n)) - for i := 0; i < n; i++ { + for range n { x.AddFilter(eacl.HeaderFromObject, eacl.MatchStringEqual, "", cidtest.ID().EncodeToString()) } @@ -106,7 +106,7 @@ func TableN(n int) *eacl.Table { x.SetCID(cidtest.ID()) - for i := 0; i < n; i++ { + for range n { x.AddRecord(RecordN(n)) } diff --git a/go.mod b/go.mod index 3ede75c8..76ef49eb 100644 --- a/go.mod +++ b/go.mod @@ -1,46 +1,60 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go -go 1.20 +go 1.23.0 require ( - git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44 - git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb + git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 git.frostfs.info/TrueCloudLab/hrw v1.2.1 git.frostfs.info/TrueCloudLab/tzhash v1.8.0 - github.com/antlr4-go/antlr/v4 v4.13.0 - github.com/google/uuid v1.3.0 - github.com/hashicorp/golang-lru/v2 v2.0.2 + github.com/VictoriaMetrics/easyproto v0.1.4 + github.com/antlr4-go/antlr/v4 v4.13.1 + github.com/google/uuid v1.6.0 + github.com/hashicorp/golang-lru/v2 v2.0.7 + github.com/klauspost/reedsolomon v1.12.1 + github.com/mailru/easyjson v0.7.7 github.com/mr-tron/base58 v1.2.0 - github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc - github.com/stretchr/testify v1.8.3 - go.uber.org/zap v1.24.0 - google.golang.org/grpc v1.55.0 - google.golang.org/protobuf v1.30.0 + github.com/multiformats/go-multiaddr v0.15.0 + github.com/nspcc-dev/neo-go v0.106.2 + github.com/stretchr/testify v1.9.0 + go.uber.org/zap v1.27.0 + golang.org/x/sync v0.12.0 + google.golang.org/grpc v1.69.2 + google.golang.org/protobuf v1.36.1 + gopkg.in/yaml.v3 v3.0.1 ) require ( git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect - github.com/benbjohnson/clock v1.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/gorilla/websocket v1.5.0 // indirect - github.com/hashicorp/golang-lru v0.6.0 // indirect - github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect - github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230615193820-9185820289ce // indirect - github.com/nspcc-dev/rfc6979 v0.2.0 // indirect + github.com/golang/snappy v0.0.1 // indirect + github.com/gorilla/websocket v1.5.1 // indirect + github.com/ipfs/go-cid v0.5.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.10 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect + github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect + github.com/nspcc-dev/go-ordered-json v0.0.0-20240301084351-0246b013f8b2 // indirect + github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20240521091047-78685785716d // indirect + github.com/nspcc-dev/rfc6979 v0.2.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect github.com/twmb/murmur3 v1.1.8 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/goleak v1.2.1 // indirect + go.etcd.io/bbolt v1.3.9 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + golang.org/x/crypto v0.36.0 // indirect + golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/text v0.23.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + lukechampine.com/blake3 v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 2f9e78f7..1fd06ca2 100644 --- a/go.sum +++ b/go.sum @@ -1,40 +1,5 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44 h1:v6JqBD/VzZx3QSxbaXnUwnnJ1KEYheU4LzLGr3IhsAE= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230802075510-964c3edb3f44/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI= -git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= -git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= +git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e h1:kcBqZBiFIUBATUqEuvVigtkJJWQ2Gug/eYXn967o3M4= +git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e/go.mod h1:F/fe1OoIDKr5Bz99q4sriuHDuf3aZefZy9ZsCqEtgxc= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc= @@ -43,691 +8,223 @@ git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9m git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc= git.frostfs.info/TrueCloudLab/tzhash v1.8.0 h1:UFMnUIk0Zh17m8rjGHJMqku2hCgaXDqjqZzS4gsb4UA= git.frostfs.info/TrueCloudLab/tzhash v1.8.0/go.mod h1:dhY+oy274hV8wGvGL4MwwMpdL3GYvaX1a8GQZQHvlF8= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= -github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig= -github.com/CityOfZion/neo-go v0.70.1-pre.0.20191212173117-32ac01130d4c/go.mod h1:JtlHfeqLywZLswKIKFnAp+yzezY4Dji9qlfQKB2OD/I= -github.com/CityOfZion/neo-go v0.71.1-pre.0.20200129171427-f773ec69fb84/go.mod h1:FLI526IrRWHmcsO+mHsCbj64pJZhwQFTLJZu+A4PGOA= -github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= -github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= -github.com/abiosoft/ishell/v2 v2.0.2/go.mod h1:E4oTCXfo6QjoCart0QYa5m9w4S+deXs/P/9jA77A9Bs= -github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= -github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521073959-f0d4d129b7f1/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= -github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= -github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/VictoriaMetrics/easyproto v0.1.4 h1:r8cNvo8o6sR4QShBXQd1bKw/VVLSQma/V2KhTBPf+Sc= +github.com/VictoriaMetrics/easyproto v0.1.4/go.mod h1:QlGlzaJnDfFd8Lk6Ci/fuLxfTo3/GThPs2KH23mv710= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/gnark-crypto v0.12.2-0.20231013160410-1f65e75b6dfb h1:f0BMgIjhZy4lSRHCXFbQst85f5agZAjtDMixQqBWNpc= +github.com/consensys/gnark-crypto v0.12.2-0.20231013160410-1f65e75b6dfb/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= -github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4= -github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.2 h1:Dwmkdr5Nc/oBiXgJS3CDHNhJtIHkuZ3DZF5twqnfBdU= -github.com/hashicorp/golang-lru/v2 v2.0.2/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/ipfs/go-cid v0.5.0 h1:goEKKhaGm0ul11IHA7I6p1GmKz8kEYniqFopaB5Otwg= +github.com/ipfs/go-cid v0.5.0/go.mod h1:0L7vmeNXpQpUS9vt+yEARkJ8rOg43DF3iPgn4GIN0mk= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= +github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/klauspost/reedsolomon v1.12.1 h1:NhWgum1efX1x58daOBGCFWcxtEhOhXKKl1HAPQUp03Q= +github.com/klauspost/reedsolomon v1.12.1/go.mod h1:nEi5Kjb6QqtbofI6s+cbG/j1da11c96IBYBSnVGtuBs= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+dBlPhLnuZhBV+DfPEdS2CHWWLp5JTScY3bw= -github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY= -github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= -github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= -github.com/nspcc-dev/dbft v0.0.0-20210721160347-1b03241391ac/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y= -github.com/nspcc-dev/dbft v0.0.0-20220902113116-58a5e763e647/go.mod h1:g9xisXmX9NP9MjioaTe862n9SlZTrP+6PVUWLBYOr98= -github.com/nspcc-dev/go-ordered-json v0.0.0-20210915112629-e1b6cce73d02/go.mod h1:79bEUDEviBHJMFV6Iq6in57FEOCMcRhfQnfaf0ETA5U= -github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 h1:n4ZaFCKt1pQJd7PXoMJabZWK9ejjbLOVrkl/lOUmshg= -github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22/go.mod h1:79bEUDEviBHJMFV6Iq6in57FEOCMcRhfQnfaf0ETA5U= -github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= -github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= -github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM= -github.com/nspcc-dev/neo-go v0.99.4/go.mod h1:mKTolfRUfKjFso5HPvGSQtUZc70n0VKBMs16eGuC5gA= -github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc h1:fySIWvUQsitK5e5qYIHnTDCXuPpwzz89SEUEIyY11sg= -github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc/go.mod h1:s9QhjMC784MWqTURovMbyYduIJc86mnCruxcMiAebpc= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220927123257-24c107e3a262/go.mod h1:23bBw0v6pBYcrWs8CBEEDIEDJNbcFoIh8pGGcf2Vv8s= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230615193820-9185820289ce h1:vLGuUNDkmQrWMa4rr4vTd1u8ULqejWxVmNz1L7ocTEI= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230615193820-9185820289ce/go.mod h1:ZUuXOkdtHZgaC13za/zMgXfQFncZ0jLzfQTe+OsDOtg= -github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= -github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= -github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= -github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= -github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= -github.com/nspcc-dev/neofs-crypto v0.4.0/go.mod h1:6XJ8kbXgOfevbI2WMruOtI+qUJXNwSGM/E9eClXxPHs= -github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211201182451-a5b61c4f6477/go.mod h1:dfMtQWmBHYpl9Dez23TGtIUKiFvCIxUZq/CkSIhEpz4= -github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659/go.mod h1:/jay1lr3w7NQd/VDBkEhkJmDmyPNsu4W+QV2obsUV40= -github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= -github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= -github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= +github.com/multiformats/go-multiaddr v0.15.0 h1:zB/HeaI/apcZiTDwhY5YqMvNVl/oQYvs3XySU+qeAVo= +github.com/multiformats/go-multiaddr v0.15.0/go.mod h1:JSVUmXDjsVFiW7RjIFMP7+Ev+h1DTbiJgVeTV/tcmP0= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= +github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/nspcc-dev/go-ordered-json v0.0.0-20240301084351-0246b013f8b2 h1:mD9hU3v+zJcnHAVmHnZKt3I++tvn30gBj2rP2PocZMk= +github.com/nspcc-dev/go-ordered-json v0.0.0-20240301084351-0246b013f8b2/go.mod h1:U5VfmPNM88P4RORFb6KSUVBdJBDhlqggJZYGXGPxOcc= +github.com/nspcc-dev/neo-go v0.106.2 h1:KXSJ2J5Oacc7LrX3r4jvnC8ihKqHs5NB21q4f2S3r9o= +github.com/nspcc-dev/neo-go v0.106.2/go.mod h1:Ojwfx3/lv0VTeEHMpQ17g0wTnXcCSoFQVq5GEeCZmGo= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20240521091047-78685785716d h1:Vcb7YkZuUSSIC+WF/xV3UDfHbAxZgyT2zGleJP3Ig5k= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20240521091047-78685785716d/go.mod h1:/vrbWSHc7YS1KSYhVOyyeucXW/e+1DkVBOgnBEXUCeY= +github.com/nspcc-dev/rfc6979 v0.2.1 h1:8wWxkamHWFmO790GsewSoKUSJjVnL1fmdRpokU/RgRM= +github.com/nspcc-dev/rfc6979 v0.2.1/go.mod h1:Tk7h5kyUWkhjyO3zUgFFhy1v2vQv3BvQEntakdtqrWc= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= +github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= +github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtbp7r/7QSyGz8mKUbYJBg2+6Cd7OjM8o/GNOcVo= -github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= -go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.etcd.io/bbolt v1.3.9 h1:8x7aARPEXiXbHmtUwAIv7eV2fQFHrLLavdiJ3uzJXoI= +go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= +go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= -go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= +golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= +golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= +google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +lukechampine.com/blake3 v1.4.0 h1:xDbKOZCVbnZsfzM6mHSYcGRHZ3YrLDzqz8XnV4uaD5w= +lukechampine.com/blake3 v1.4.0/go.mod h1:MQJNQCTnR+kwOP/JEZSxj3MaQjp80FOFSNMMHXcSeX0= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/netmap/aggregator.go b/netmap/aggregator.go index 0f577a0d..d0894f16 100644 --- a/netmap/aggregator.go +++ b/netmap/aggregator.go @@ -1,8 +1,6 @@ package netmap -import ( - "sort" -) +import "slices" type ( // aggregator can calculate some value across all netmap @@ -28,7 +26,6 @@ type ( } meanIQRAgg struct { - k float64 arr []float64 } @@ -57,7 +54,7 @@ var ( // capacity and price. func newWeightFunc(capNorm, priceNorm normalizer) weightFunc { return func(n NodeInfo) float64 { - return capNorm.Normalize(float64(n.capacity())) * priceNorm.Normalize(float64(n.Price())) + return capNorm.Normalize(float64(n.capacity)) * priceNorm.Normalize(float64(n.price)) } } @@ -74,16 +71,10 @@ func newMinAgg() aggregator { return new(minAgg) } -// newMeanIQRAgg returns an aggregator which -// computes mean value of values from IQR interval. -func newMeanIQRAgg() aggregator { - return new(meanIQRAgg) -} - // newReverseMinNorm returns a normalizer which // normalize values in range of 0.0 to 1.0 to a minimum value. -func newReverseMinNorm(min float64) normalizer { - return &reverseMinNorm{min: min} +func newReverseMinNorm(minV float64) normalizer { + return &reverseMinNorm{min: minV} } // newSigmoidNorm returns a normalizer which @@ -118,6 +109,10 @@ func (a *minAgg) Compute() float64 { return a.min } +func (a *meanIQRAgg) clear() { + a.arr = a.arr[:0] +} + func (a *meanIQRAgg) Add(n float64) { a.arr = append(a.arr, n) } @@ -128,25 +123,24 @@ func (a *meanIQRAgg) Compute() float64 { return 0 } - sort.Slice(a.arr, func(i, j int) bool { return a.arr[i] < a.arr[j] }) + slices.Sort(a.arr) - var min, max float64 + var minV, maxV float64 const minLn = 4 if l < minLn { - min, max = a.arr[0], a.arr[l-1] + minV, maxV = a.arr[0], a.arr[l-1] } else { start, end := l/minLn, l*3/minLn-1 - iqr := a.k * (a.arr[end] - a.arr[start]) - min, max = a.arr[start]-iqr, a.arr[end]+iqr + minV, maxV = a.arr[start], a.arr[end] } count := 0 sum := float64(0) for _, e := range a.arr { - if e >= min && e <= max { + if e >= minV && e <= maxV { sum += e count++ } diff --git a/netmap/bench_test.go b/netmap/bench_test.go index e0dc7c5d..cd3dfacd 100644 --- a/netmap/bench_test.go +++ b/netmap/bench_test.go @@ -47,7 +47,7 @@ func BenchmarkNetmap_ContainerNodes(b *testing.B) { b.ResetTimer() b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { _, err := nm.ContainerNodes(p, pivot) if err != nil { b.Fatal(err) diff --git a/netmap/context.go b/netmap/context.go index df3c85ba..2d81999b 100644 --- a/netmap/context.go +++ b/netmap/context.go @@ -3,7 +3,7 @@ package netmap import ( "errors" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" "git.frostfs.info/TrueCloudLab/hrw" ) @@ -94,14 +94,14 @@ func (c *context) addUsedNodes(ns ...NodeInfo) { func defaultWeightFunc(ns nodes) weightFunc { mean := newMeanAgg() - min := newMinAgg() + minV := newMinAgg() for i := range ns { - mean.Add(float64(ns[i].capacity())) - min.Add(float64(ns[i].Price())) + mean.Add(float64(ns[i].capacity)) + minV.Add(float64(ns[i].price)) } return newWeightFunc( newSigmoidNorm(mean.Compute()), - newReverseMinNorm(min.Compute())) + newReverseMinNorm(minV.Compute())) } diff --git a/netmap/doc.go b/netmap/doc.go index cea3f483..39122f72 100644 --- a/netmap/doc.go +++ b/netmap/doc.go @@ -19,7 +19,7 @@ Instances can be also used to process FrostFS API V2 protocol messages On client side: - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" var msg netmap.NodeInfo info.WriteToV2(&msg) diff --git a/netmap/filter.go b/netmap/filter.go index 71e101da..9fe346c0 100644 --- a/netmap/filter.go +++ b/netmap/filter.go @@ -3,14 +3,17 @@ package netmap import ( "fmt" "strconv" + "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" ) // mainFilterName is a name of the filter // which points to the whole netmap. const mainFilterName = "*" +const likeWildcard = "*" + // processFilters processes filters and returns error is any of them is invalid. func (c *context) processFilters(p PlacementPolicy) error { for i := range p.filters { @@ -53,7 +56,7 @@ func (c *context) processFilter(f netmap.Filter, top bool) error { } switch op { - case netmap.EQ, netmap.NE: + case netmap.EQ, netmap.NE, netmap.LIKE: case netmap.GT, netmap.GE, netmap.LT, netmap.LE: val := f.GetValue() n, err := strconv.ParseUint(val, 10, 64) @@ -110,6 +113,19 @@ func (c *context) matchKeyValue(f *netmap.Filter, b NodeInfo) bool { switch op := f.GetOp(); op { case netmap.EQ: return b.Attribute(f.GetKey()) == f.GetValue() + case netmap.LIKE: + str, prefix := strings.CutPrefix(f.GetValue(), likeWildcard) + str, suffix := strings.CutSuffix(str, likeWildcard) + if prefix && suffix { + return strings.Contains(b.Attribute(f.GetKey()), str) + } + if prefix && !suffix { + return strings.HasSuffix(b.Attribute(f.GetKey()), str) + } + if !prefix && suffix { + return strings.HasPrefix(b.Attribute(f.GetKey()), str) + } + return b.Attribute(f.GetKey()) == f.GetValue() case netmap.NE: return b.Attribute(f.GetKey()) != f.GetValue() default: @@ -117,9 +133,9 @@ func (c *context) matchKeyValue(f *netmap.Filter, b NodeInfo) bool { switch f.GetKey() { case attrPrice: - attr = b.Price() + attr = b.price case attrCapacity: - attr = b.capacity() + attr = b.capacity default: var err error diff --git a/netmap/filter_test.go b/netmap/filter_test.go index 2b88b3cf..5748959e 100644 --- a/netmap/filter_test.go +++ b/netmap/filter_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" "github.com/stretchr/testify/require" ) diff --git a/netmap/helper_test.go b/netmap/helper_test.go index 3775f18b..de98c967 100644 --- a/netmap/helper_test.go +++ b/netmap/helper_test.go @@ -1,7 +1,7 @@ package netmap import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" ) func newFilter(name string, k, v string, op netmap.Operation, fs ...Filter) (f Filter) { diff --git a/netmap/netmap.go b/netmap/netmap.go index 530b06d4..a5834558 100644 --- a/netmap/netmap.go +++ b/netmap/netmap.go @@ -3,14 +3,14 @@ package netmap import ( "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" "git.frostfs.info/TrueCloudLab/hrw" ) // NetMap represents FrostFS network map. It includes information about all // storage nodes registered in FrostFS the network. // -// NetMap is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap.NetMap +// NetMap is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap.NetMap // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. @@ -96,6 +96,21 @@ func (m NetMap) Epoch() uint64 { return m.epoch } +// Clone returns a copy of NetMap. +func (m *NetMap) Clone() *NetMap { + if m == nil { + return nil + } + dst := NetMap{ + epoch: m.epoch, + nodes: make([]NodeInfo, len(m.nodes)), + } + for i, node := range m.nodes { + dst.nodes[i] = *node.Clone() + } + return &dst +} + // nodes is a slice of NodeInfo instances needed for HRW sorting. type nodes []NodeInfo @@ -113,9 +128,10 @@ func (n nodes) Hash() uint64 { return 0 } -// weights returns slice of nodes weights W. -func (n nodes) weights(wf weightFunc) []float64 { - w := make([]float64, 0, len(n)) +func (n nodes) appendWeightsTo(wf weightFunc, w []float64) []float64 { + if cap(w) < len(n) { + w = make([]float64, 0, len(n)) + } for i := range n { w = append(w, wf(n[i])) } @@ -123,20 +139,12 @@ func (n nodes) weights(wf weightFunc) []float64 { return w } -func flattenNodes(ns []nodes) nodes { - var sz, i int - - for i = range ns { - sz += len(ns[i]) - } - - result := make(nodes, 0, sz) - +// flattenNodes flattens ns nested list and appends the result to the target slice. +func flattenNodes(target nodes, ns []nodes) nodes { for i := range ns { - result = append(result, ns[i]...) + target = append(target, ns[i]...) } - - return result + return target } // PlacementVectors sorts container nodes returned by ContainerNodes method @@ -149,10 +157,13 @@ func (m NetMap) PlacementVectors(vectors [][]NodeInfo, pivot []byte) ([][]NodeIn wf := defaultWeightFunc(m.nodes) result := make([][]NodeInfo, len(vectors)) + var ws []float64 + for i := range vectors { result[i] = make([]NodeInfo, len(vectors[i])) copy(result[i], vectors[i]) - hrw.SortHasherSliceByWeightValue(result[i], nodes(result[i]).weights(wf), h) + ws = nodes(result[i]).appendWeightsTo(wf, ws[:0]) + hrw.SortHasherSliceByWeightValue(result[i], ws, h) } return result, nil @@ -209,6 +220,25 @@ func (m NetMap) SelectFilterNodes(expr *SelectFilterExpr) ([][]NodeInfo, error) return ret, nil } +func countNodes(r netmap.Replica) uint32 { + if r.GetCount() != 0 { + return r.GetCount() + } + return r.GetECDataCount() + r.GetECParityCount() +} + +func (p PlacementPolicy) isUnique() bool { + if p.unique { + return true + } + for _, r := range p.replicas { + if r.GetECDataCount() != 0 || r.GetECParityCount() != 0 { + return true + } + } + return false +} + // ContainerNodes returns two-dimensional list of nodes as a result of applying // given PlacementPolicy to the NetMap. Each line of the list corresponds to a // replica descriptor. Line order corresponds to order of ReplicaDescriptor list @@ -230,6 +260,7 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e return nil, err } + unique := p.isUnique() result := make([][]NodeInfo, len(p.replicas)) // Note that the cached selectors are not used when the policy contains the UNIQUE flag. @@ -240,7 +271,7 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e sName := p.replicas[i].GetSelector() if sName == "" && !(len(p.replicas) == 1 && len(p.selectors) == 1) { var s netmap.Selector - s.SetCount(p.replicas[i].GetCount()) + s.SetCount(countNodes(p.replicas[i])) s.SetFilter(mainFilterName) nodes, err := c.getSelection(s) @@ -248,16 +279,16 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e return nil, err } - result[i] = append(result[i], flattenNodes(nodes)...) + result[i] = flattenNodes(result[i], nodes) - if p.unique { + if unique { c.addUsedNodes(result[i]...) } continue } - if p.unique { + if unique { if c.processedSelectors[sName] == nil { return nil, fmt.Errorf("selector not found: '%s'", sName) } @@ -265,14 +296,14 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e if err != nil { return nil, err } - result[i] = append(result[i], flattenNodes(nodes)...) + result[i] = flattenNodes(result[i], nodes) c.addUsedNodes(result[i]...) } else { nodes, ok := c.selections[sName] if !ok { return nil, fmt.Errorf("selector not found: REPLICA '%s'", sName) } - result[i] = append(result[i], flattenNodes(nodes)...) + result[i] = flattenNodes(result[i], nodes) } } diff --git a/netmap/netmap_test.go b/netmap/netmap_test.go index 7c286a46..5be54127 100644 --- a/netmap/netmap_test.go +++ b/netmap/netmap_test.go @@ -1,9 +1,10 @@ package netmap_test import ( + "bytes" "testing" - v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + v2netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" netmaptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/test" "github.com/stretchr/testify/require" @@ -45,3 +46,28 @@ func TestNetMap_SetEpoch(t *testing.T) { require.EqualValues(t, e, m.Epoch()) } + +func TestNetMap_Clone(t *testing.T) { + nm := new(netmap.NetMap) + nm.SetEpoch(1) + var ni netmap.NodeInfo + ni.SetPublicKey([]byte{1, 2, 3}) + nm.SetNodes([]netmap.NodeInfo{ni}) + + clone := nm.Clone() + + require.True(t, clone != nm) + require.True(t, &(clone.Nodes()[0]) != &(nm.Nodes()[0])) + + var clonev2 v2netmap.NetMap + clone.WriteToV2(&clonev2) + var bufClone []byte + bufClone = clonev2.StableMarshal(bufClone) + + var nmv2 v2netmap.NetMap + nm.WriteToV2(&nmv2) + var bufNM []byte + bufNM = nmv2.StableMarshal(bufNM) + + require.True(t, bytes.Equal(bufClone, bufNM)) +} diff --git a/netmap/network_info.go b/netmap/network_info.go index 186d4331..a270afe5 100644 --- a/netmap/network_info.go +++ b/netmap/network_info.go @@ -6,14 +6,14 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" ) // NetworkInfo groups information about the FrostFS network state. Mainly used to // describe the current state of the network. // -// NetworkInfo is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap.NetworkInfo +// NetworkInfo is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap.NetworkInfo // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. @@ -30,30 +30,24 @@ func (x *NetworkInfo) readFromV2(m netmap.NetworkInfo, checkFieldPresence bool) return errors.New("missing network config") } - if checkFieldPresence && c.NumberOfParameters() <= 0 { + if checkFieldPresence && len(c.Parameters()) == 0 { return errors.New("missing network parameters") } var err error - mNames := make(map[string]struct{}, c.NumberOfParameters()) + mNames := make(map[string]struct{}, len(c.Parameters())) - c.IterateParameters(func(prm *netmap.NetworkParameter) bool { + for _, prm := range c.Parameters() { name := string(prm.GetKey()) _, was := mNames[name] if was { - err = fmt.Errorf("duplicated parameter name: %s", name) - return true + return fmt.Errorf("duplicated parameter name: %s", name) } mNames[name] = struct{}{} switch name { - default: - if len(prm.GetValue()) == 0 { - err = fmt.Errorf("empty attribute value %s", name) - return true - } case configAuditFee, configStoragePrice, @@ -62,6 +56,8 @@ func (x *NetworkInfo) readFromV2(m netmap.NetworkInfo, checkFieldPresence bool) configEpochDuration, configIRCandidateFee, configMaxObjSize, + configMaxECDataCount, + configMaxECParityCount, configWithdrawalFee: _, err = decodeConfigValueUint64(prm.GetValue()) case configHomomorphicHashingDisabled, @@ -70,14 +66,8 @@ func (x *NetworkInfo) readFromV2(m netmap.NetworkInfo, checkFieldPresence bool) } if err != nil { - err = fmt.Errorf("invalid %s parameter: %w", name, err) + return fmt.Errorf("invalid %s parameter: %w", name, err) } - - return err != nil - }) - - if err != nil { - return err } x.m = m @@ -155,41 +145,29 @@ func (x *NetworkInfo) setConfig(name string, val []byte) { return } - found := false - prms := make([]netmap.NetworkParameter, 0, c.NumberOfParameters()) - - c.IterateParameters(func(prm *netmap.NetworkParameter) bool { - found = bytes.Equal(prm.GetKey(), []byte(name)) - if found { - prm.SetValue(val) - } else { - prms = append(prms, *prm) + prms := c.Parameters() + for i := range prms { + if bytes.Equal(prms[i].GetKey(), []byte(name)) { + prms[i].SetValue(val) + return } - - return found - }) - - if !found { - prms = append(prms, netmap.NetworkParameter{}) - prms[len(prms)-1].SetKey([]byte(name)) - prms[len(prms)-1].SetValue(val) - - c.SetParameters(prms...) } + + prms = append(prms, netmap.NetworkParameter{}) + prms[len(prms)-1].SetKey([]byte(name)) + prms[len(prms)-1].SetValue(val) + + c.SetParameters(prms...) } func (x NetworkInfo) configValue(name string) (res []byte) { - x.m.GetNetworkConfig().IterateParameters(func(prm *netmap.NetworkParameter) bool { + for _, prm := range x.m.GetNetworkConfig().Parameters() { if string(prm.GetKey()) == name { - res = prm.GetValue() - - return true + return prm.GetValue() } + } - return false - }) - - return + return nil } // SetRawNetworkParameter sets named FrostFS network parameter whose value is @@ -221,7 +199,7 @@ func (x *NetworkInfo) RawNetworkParameter(name string) []byte { func (x *NetworkInfo) IterateRawNetworkParameters(f func(name string, value []byte)) { c := x.m.GetNetworkConfig() - c.IterateParameters(func(prm *netmap.NetworkParameter) bool { + for _, prm := range c.Parameters() { name := string(prm.GetKey()) switch name { default: @@ -234,13 +212,13 @@ func (x *NetworkInfo) IterateRawNetworkParameters(f func(name string, value []by configEpochDuration, configIRCandidateFee, configMaxObjSize, + configMaxECDataCount, + configMaxECParityCount, configWithdrawalFee, configHomomorphicHashingDisabled, configMaintenanceModeAllowed: } - - return false - }) + } } func (x *NetworkInfo) setConfigUint64(name string, num uint64) { @@ -432,6 +410,34 @@ func (x NetworkInfo) MaxObjectSize() uint64 { return x.configUint64(configMaxObjSize) } +const configMaxECDataCount = "MaxECDataCount" + +// SetMaxECDataCount sets maximum number of data shards for erasure codes. +// +// Zero means no restrictions. +func (x *NetworkInfo) SetMaxECDataCount(dataCount uint64) { + x.setConfigUint64(configMaxECDataCount, dataCount) +} + +// MaxECDataCount returns maximum number of data shards for erasure codes. +func (x NetworkInfo) MaxECDataCount() uint64 { + return x.configUint64(configMaxECDataCount) +} + +const configMaxECParityCount = "MaxECParityCount" + +// SetMaxECParityCount sets maximum number of parity shards for erasure codes. +// +// Zero means no restrictions. +func (x *NetworkInfo) SetMaxECParityCount(parityCount uint64) { + x.setConfigUint64(configMaxECParityCount, parityCount) +} + +// MaxECParityCount returns maximum number of parity shards for erasure codes. +func (x NetworkInfo) MaxECParityCount() uint64 { + return x.configUint64(configMaxECParityCount) +} + const configWithdrawalFee = "WithdrawFee" // SetWithdrawalFee sets fee for withdrawals from the FrostFS accounts that diff --git a/netmap/network_info_test.go b/netmap/network_info_test.go index 54b1b30b..64abe5d3 100644 --- a/netmap/network_info_test.go +++ b/netmap/network_info_test.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" . "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "github.com/stretchr/testify/require" ) @@ -76,16 +76,10 @@ func testConfigValue(t *testing.T, var m netmap.NetworkInfo x.WriteToV2(&m) - require.EqualValues(t, 1, m.GetNetworkConfig().NumberOfParameters()) - found := false - m.GetNetworkConfig().IterateParameters(func(prm *netmap.NetworkParameter) bool { - require.False(t, found) - require.Equal(t, []byte(v2Key), prm.GetKey()) - require.Equal(t, v2Val(exp), prm.GetValue()) - found = true - return false - }) - require.True(t, found) + var p netmap.NetworkParameter + p.SetKey([]byte(v2Key)) + p.SetValue(v2Val(exp)) + require.Equal(t, []netmap.NetworkParameter{p}, m.GetNetworkConfig().Parameters()) } setter(&x, val1) @@ -173,6 +167,32 @@ func TestNetworkInfo_MaxObjectSize(t *testing.T) { ) } +func TestNetworkInfo_MaxECDataCount(t *testing.T) { + testConfigValue(t, + func(x NetworkInfo) any { return x.MaxECDataCount() }, + func(info *NetworkInfo, val any) { info.SetMaxECDataCount(val.(uint64)) }, + uint64(1), uint64(2), + "MaxECDataCount", func(val any) []byte { + data := make([]byte, 8) + binary.LittleEndian.PutUint64(data, val.(uint64)) + return data + }, + ) +} + +func TestNetworkInfo_MaxECParityCount(t *testing.T) { + testConfigValue(t, + func(x NetworkInfo) any { return x.MaxECParityCount() }, + func(info *NetworkInfo, val any) { info.SetMaxECParityCount(val.(uint64)) }, + uint64(1), uint64(2), + "MaxECParityCount", func(val any) []byte { + data := make([]byte, 8) + binary.LittleEndian.PutUint64(data, val.(uint64)) + return data + }, + ) +} + func TestNetworkInfo_WithdrawalFee(t *testing.T) { testConfigValue(t, func(x NetworkInfo) any { return x.WithdrawalFee() }, diff --git a/netmap/node_info.go b/netmap/node_info.go index 8f323f72..ba65daad 100644 --- a/netmap/node_info.go +++ b/netmap/node_info.go @@ -3,11 +3,12 @@ package netmap import ( "errors" "fmt" - "sort" + "iter" + "slices" "strconv" "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" "git.frostfs.info/TrueCloudLab/hrw" ) @@ -18,13 +19,16 @@ import ( // about the nodes is available to all network participants to work with the network // map (mainly to comply with container storage policies). // -// NodeInfo is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap.NodeInfo +// NodeInfo is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap.NodeInfo // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. type NodeInfo struct { m netmap.NodeInfo hash uint64 + + capacity uint64 + price uint64 } // reads NodeInfo from netmap.NodeInfo message. If checkFieldPresence is set, @@ -32,6 +36,7 @@ type NodeInfo struct { // presented field according to FrostFS API V2 protocol. func (x *NodeInfo) readFromV2(m netmap.NodeInfo, checkFieldPresence bool) error { var err error + var capacity, price uint64 binPublicKey := m.GetPublicKey() if checkFieldPresence && len(binPublicKey) == 0 { @@ -49,18 +54,18 @@ func (x *NodeInfo) readFromV2(m netmap.NodeInfo, checkFieldPresence bool) error if key == "" { return fmt.Errorf("empty key of the attribute #%d", i) } else if _, ok := mAttr[key]; ok { - return fmt.Errorf("duplicated attbiuted %s", key) + return fmt.Errorf("duplicate attributes %s", key) } + mAttr[key] = struct{}{} switch { case key == attrCapacity: - _, err = strconv.ParseUint(attributes[i].GetValue(), 10, 64) + capacity, err = strconv.ParseUint(attributes[i].GetValue(), 10, 64) if err != nil { return fmt.Errorf("invalid %s attribute: %w", attrCapacity, err) } case key == attrPrice: - var err error - _, err = strconv.ParseUint(attributes[i].GetValue(), 10, 64) + price, err = strconv.ParseUint(attributes[i].GetValue(), 10, 64) if err != nil { return fmt.Errorf("invalid %s attribute: %w", attrPrice, err) } @@ -73,6 +78,8 @@ func (x *NodeInfo) readFromV2(m netmap.NodeInfo, checkFieldPresence bool) error x.m = m x.hash = hrw.Hash(binPublicKey) + x.capacity = capacity + x.price = price return nil } @@ -200,12 +207,28 @@ func (x NodeInfo) NumberOfNetworkEndpoints() int { // FrostFS system requirements. // // See also SetNetworkEndpoints. +// +// Deprecated: use [NodeInfo.NetworkEndpoints] instead. func (x NodeInfo) IterateNetworkEndpoints(f func(string) bool) { - x.m.IterateAddresses(f) + for s := range x.NetworkEndpoints() { + if f(s) { + return + } + } +} + +// NetworkEndpoints returns an iterator over network endpoints announced by the +// node. +// +// See also SetNetworkEndpoints. +func (x NodeInfo) NetworkEndpoints() iter.Seq[string] { + return x.m.Addresses() } // IterateNetworkEndpoints is an extra-sugared function over IterateNetworkEndpoints // method which allows to unconditionally iterate over all node's network endpoints. +// +// Deprecated: use [NodeInfo.NetworkEndpoints] instead. func IterateNetworkEndpoints(node NodeInfo, f func(string)) { node.IterateNetworkEndpoints(func(addr string) bool { f(addr) @@ -227,14 +250,6 @@ func (x NodeInfo) Hash() uint64 { return hrw.Hash(x.m.GetPublicKey()) } -// less declares "less than" comparison between two NodeInfo instances: -// x1 is less than x2 if it has less Hash(). -// -// Method is needed for internal placement needs. -func less(x1, x2 NodeInfo) bool { - return x1.Hash() < x2.Hash() -} - func (x *NodeInfo) setNumericAttribute(key string, num uint64) { x.SetAttribute(key, strconv.FormatUint(num, 10)) } @@ -243,46 +258,21 @@ func (x *NodeInfo) setNumericAttribute(key string, num uint64) { // price is announced. func (x *NodeInfo) SetPrice(price uint64) { x.setNumericAttribute(attrPrice, price) + x.price = price } // Price returns price set using SetPrice. // // Zero NodeInfo has zero price. func (x NodeInfo) Price() uint64 { - val := x.Attribute(attrPrice) - if val == "" { - return 0 - } - - price, err := strconv.ParseUint(val, 10, 64) - if err != nil { - panic(fmt.Sprintf("unexpected price parsing error %s: %v", val, err)) - } - - return price + return x.price } // SetCapacity sets the storage capacity declared by the node. By default, zero // capacity is announced. func (x *NodeInfo) SetCapacity(capacity uint64) { x.setNumericAttribute(attrCapacity, capacity) -} - -// capacity returns capacity set using SetCapacity. -// -// Zero NodeInfo has zero capacity. -func (x NodeInfo) capacity() uint64 { - val := x.Attribute(attrCapacity) - if val == "" { - return 0 - } - - capacity, err := strconv.ParseUint(val, 10, 64) - if err != nil { - panic(fmt.Sprintf("unexpected capacity parsing error %s: %v", val, err)) - } - - return capacity + x.capacity = capacity } const attrUNLOCODE = "UN-LOCODE" @@ -401,8 +391,22 @@ func (x NodeInfo) NumberOfAttributes() int { return len(x.m.GetAttributes()) } +// Attributes returns an iterator over node attributes. +func (x NodeInfo) Attributes() iter.Seq2[string, string] { + return func(yield func(string, string) bool) { + a := x.m.GetAttributes() + for i := range a { + if !yield(a[i].GetKey(), a[i].GetValue()) { + break + } + } + } +} + // IterateAttributes iterates over all node attributes and passes the into f. // Handler MUST NOT be nil. +// +// Deprecated: use [NodeInfo.Attributes] instead. func (x NodeInfo) IterateAttributes(f func(key, value string)) { a := x.m.GetAttributes() for i := range a { @@ -419,6 +423,17 @@ func (x *NodeInfo) SetAttribute(key, value string) { panic("empty value in SetAttribute") } + // NodeInfo with non-numeric `Price`` or `Capacity` attributes + // is considered invalid by NodeInfo.readFromV2(). + // Here we have no way to signal an error, and panic seems an overkill. + // So, set cached fields only if we can parse the value and 0 parsing fails. + switch key { + case attrPrice: + x.price, _ = strconv.ParseUint(value, 10, 64) + case attrCapacity: + x.capacity, _ = strconv.ParseUint(value, 10, 64) + } + a := x.m.GetAttributes() for i := range a { if a[i].GetKey() == key { @@ -455,15 +470,11 @@ func (x *NodeInfo) SortAttributes() { return } - sort.Slice(as, func(i, j int) bool { - switch strings.Compare(as[i].GetKey(), as[j].GetKey()) { - case -1: - return true - case 1: - return false - default: - return as[i].GetValue() < as[j].GetValue() + slices.SortFunc(as, func(ai, aj netmap.Attribute) int { + if r := strings.Compare(ai.GetKey(), aj.GetKey()); r != 0 { + return r } + return strings.Compare(ai.GetValue(), aj.GetValue()) }) x.m.SetAttributes(as) @@ -472,6 +483,10 @@ func (x *NodeInfo) SortAttributes() { // SetOffline sets the state of the node to "offline". When a node updates // information about itself in the network map, this action is interpreted as // an intention to leave the network. +// +// See also IsOffline. +// +// Deprecated: use SetStatus instead. func (x *NodeInfo) SetOffline() { x.m.SetState(netmap.Offline) } @@ -482,6 +497,8 @@ func (x *NodeInfo) SetOffline() { // mean online). // // See also SetOffline. +// +// Deprecated: use Status instead. func (x NodeInfo) IsOffline() bool { return x.m.GetState() == netmap.Offline } @@ -491,6 +508,8 @@ func (x NodeInfo) IsOffline() bool { // action is interpreted as an intention to enter the network. // // See also IsOnline. +// +// Deprecated: use SetStatus instead. func (x *NodeInfo) SetOnline() { x.m.SetState(netmap.Online) } @@ -501,6 +520,8 @@ func (x *NodeInfo) SetOnline() { // mean offline). // // See also SetOnline. +// +// Deprecated: use Status instead. func (x NodeInfo) IsOnline() bool { return x.m.GetState() == netmap.Online } @@ -510,6 +531,8 @@ func (x NodeInfo) IsOnline() bool { // state declares temporal unavailability for a node. // // See also IsMaintenance. +// +// Deprecated: use SetStatus instead. func (x *NodeInfo) SetMaintenance() { x.m.SetState(netmap.Maintenance) } @@ -519,6 +542,74 @@ func (x *NodeInfo) SetMaintenance() { // Zero NodeInfo has undefined state. // // See also SetMaintenance. +// +// Deprecated: use Status instead. func (x NodeInfo) IsMaintenance() bool { return x.m.GetState() == netmap.Maintenance } + +type NodeState netmap.NodeState + +const ( + UnspecifiedState = NodeState(netmap.UnspecifiedState) + Online = NodeState(netmap.Online) + Offline = NodeState(netmap.Offline) + Maintenance = NodeState(netmap.Maintenance) +) + +// ToV2 converts NodeState to v2. +func (ns NodeState) ToV2() netmap.NodeState { + return netmap.NodeState(ns) +} + +// FromV2 reads NodeState to v2. +func (ns *NodeState) FromV2(state netmap.NodeState) { + *ns = NodeState(state) +} + +// Status returns the current state of the node in the network map. +// +// Zero NodeInfo has an undefined state, neither online nor offline. +func (x NodeInfo) Status() NodeState { + return NodeState(x.m.GetState()) +} + +// SetState updates the state of the node in the network map. +// +// The state determines the node's current status within the network: +// - "online": Indicates the node intends to enter the network. +// - "offline": Indicates the node intends to leave the network. +// - "maintenance": Indicates the node is temporarily unavailable. +// +// See also Status. +func (x *NodeInfo) SetStatus(state NodeState) { + x.m.SetState(netmap.NodeState(state)) +} + +// Clone returns a copy of NodeInfo. +func (x *NodeInfo) Clone() *NodeInfo { + if x == nil { + return nil + } + return &NodeInfo{ + hash: x.hash, + m: *x.m.Clone(), + } +} + +// String implements fmt.Stringer. +// +// String is designed to be human-readable, and its format MAY differ between +// SDK versions. +func (ns NodeState) String() string { + return netmap.NodeState(ns).String() +} + +// IsOnline checks if the current state is "online". +func (ns NodeState) IsOnline() bool { return ns == Online } + +// IsOffline checks if the current state is "offline". +func (ns NodeState) IsOffline() bool { return ns == Offline } + +// IsMaintenance checks if the current state is "maintenance". +func (ns NodeState) IsMaintenance() bool { return ns == Maintenance } diff --git a/netmap/node_info_test.go b/netmap/node_info_test.go index 1d1c0183..65ea0e80 100644 --- a/netmap/node_info_test.go +++ b/netmap/node_info_test.go @@ -1,11 +1,94 @@ package netmap import ( + "fmt" "testing" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/stretchr/testify/require" ) +func TestNodeInfo_NetworkEndpoints(t *testing.T) { + t.Run("empty", func(t *testing.T) { + var n NodeInfo + for range n.NetworkEndpoints() { + t.Fatalf("handler is called, but it shouldn't") + } + }) + + var n NodeInfo + n.SetNetworkEndpoints("1", "2", "3") + + t.Run("break", func(t *testing.T) { + var res []string + for s := range n.NetworkEndpoints() { + if s == "2" { + break + } + res = append(res, s) + } + require.Equal(t, []string{"1"}, res) + }) + t.Run("continue", func(t *testing.T) { + var res []string + for s := range n.NetworkEndpoints() { + if s == "2" { + continue + } + res = append(res, s) + } + require.Equal(t, []string{"1", "3"}, res) + }) + + var res []string + for s := range n.NetworkEndpoints() { + res = append(res, s) + } + require.Equal(t, []string{"1", "2", "3"}, res) +} + +func TestNodeInfo_Attributes(t *testing.T) { + t.Run("empty", func(t *testing.T) { + var n NodeInfo + for range n.Attributes() { + t.Fatalf("handler is called, but it shouldn't") + } + }) + + var n NodeInfo + n.SetAttribute("key1", "value1") + n.SetAttribute("key2", "value2") + n.SetAttribute("key3", "value3") + + t.Run("break", func(t *testing.T) { + var res [][2]string + for k, v := range n.Attributes() { + if k == "key2" { + break + } + res = append(res, [2]string{k, v}) + } + require.Equal(t, [][2]string{{"key1", "value1"}}, res) + }) + t.Run("continue", func(t *testing.T) { + var res [][2]string + for k, v := range n.Attributes() { + if k == "key2" { + continue + } + res = append(res, [2]string{k, v}) + } + require.Equal(t, [][2]string{{"key1", "value1"}, {"key3", "value3"}}, res) + }) + + var res [][2]string + for k, v := range n.Attributes() { + res = append(res, [2]string{k, v}) + } + require.Equal(t, [][2]string{{"key1", "value1"}, {"key2", "value2"}, {"key3", "value3"}}, res) +} + func TestNodeInfo_SetAttribute(t *testing.T) { var n NodeInfo @@ -23,27 +106,75 @@ func TestNodeInfo_SetAttribute(t *testing.T) { require.Equal(t, val, n.Attribute(key)) } +func TestNodeState(t *testing.T) { + m := map[NodeState]netmap.NodeState{ + UnspecifiedState: netmap.UnspecifiedState, + Online: netmap.Online, + Offline: netmap.Offline, + Maintenance: netmap.Maintenance, + } + + t.Run("from sdk to v2", func(t *testing.T) { + for stateSDK, stateV2 := range m { + require.Equal(t, stateV2, stateSDK.ToV2()) + } + }) + + t.Run("from v2 to sdk", func(t *testing.T) { + for stateSDK, stateV2 := range m { + var state NodeState + state.FromV2(stateV2) + require.Equal(t, stateSDK, state) + } + }) +} + func TestNodeInfo_Status(t *testing.T) { - var n NodeInfo + t.Run("deprecated getters/setters", func(t *testing.T) { + var n NodeInfo - require.False(t, n.IsOnline()) - require.False(t, n.IsOffline()) - require.False(t, n.IsMaintenance()) + require.False(t, n.IsOnline()) + require.False(t, n.IsOffline()) + require.False(t, n.IsMaintenance()) - n.SetOnline() - require.True(t, n.IsOnline()) - require.False(t, n.IsOffline()) - require.False(t, n.IsMaintenance()) + n.SetOnline() + require.True(t, n.IsOnline()) + require.False(t, n.IsOffline()) + require.False(t, n.IsMaintenance()) - n.SetOffline() - require.True(t, n.IsOffline()) - require.False(t, n.IsOnline()) - require.False(t, n.IsMaintenance()) + n.SetOffline() + require.True(t, n.IsOffline()) + require.False(t, n.IsOnline()) + require.False(t, n.IsMaintenance()) - n.SetMaintenance() - require.True(t, n.IsMaintenance()) - require.False(t, n.IsOnline()) - require.False(t, n.IsOffline()) + n.SetMaintenance() + require.True(t, n.IsMaintenance()) + require.False(t, n.IsOnline()) + require.False(t, n.IsOffline()) + }) + + t.Run("brand new getters/setters", func(t *testing.T) { + var n NodeInfo + + require.False(t, n.Status().IsOnline()) + require.False(t, n.Status().IsOffline()) + require.False(t, n.Status().IsMaintenance()) + + n.SetStatus(Online) + require.True(t, n.Status().IsOnline()) + require.False(t, n.Status().IsOffline()) + require.False(t, n.Status().IsMaintenance()) + + n.SetStatus(Offline) + require.False(t, n.Status().IsOnline()) + require.True(t, n.Status().IsOffline()) + require.False(t, n.Status().IsMaintenance()) + + n.SetStatus(Maintenance) + require.False(t, n.Status().IsOnline()) + require.False(t, n.Status().IsOffline()) + require.True(t, n.Status().IsMaintenance()) + }) } func TestNodeInfo_ExternalAddr(t *testing.T) { @@ -59,3 +190,94 @@ func TestNodeInfo_ExternalAddr(t *testing.T) { n.SetExternalAddresses(addr[1:]...) require.Equal(t, addr[1:], n.ExternalAddresses()) } + +func TestNodeInfo_Clone(t *testing.T) { + var ni NodeInfo + ni.SetPublicKey([]byte{2, 3}) + + c := ni.Clone() + require.True(t, c != &ni) + require.True(t, &(c.PublicKey()[0]) != &(ni.PublicKey()[0])) +} + +func TestNodeInfo_Unmarshal(t *testing.T) { + pk, err := keys.NewPrivateKey() + require.NoError(t, err) + + attrs := make([]netmap.Attribute, 2) + for i := range attrs { + attrs[i].SetKey(fmt.Sprintf("key%d", i)) + attrs[i].SetValue(fmt.Sprintf("value%d", i)) + } + goodNodeInfo := func() netmap.NodeInfo { + var nodev2 netmap.NodeInfo + nodev2.SetPublicKey(pk.PublicKey().Bytes()) + nodev2.SetAddresses("127.0.0.1:2025") + nodev2.SetState(netmap.Online) + nodev2.SetAttributes(attrs) + return nodev2 + } + + // Check that goodNodeInfo indeed returns good node. + // Otherwise, the whole test is garbage. + require.NoError(t, new(NodeInfo).ReadFromV2(goodNodeInfo())) + + t.Run("empty public key", func(t *testing.T) { + n := goodNodeInfo() + n.SetPublicKey(nil) + require.ErrorContains(t, new(NodeInfo).ReadFromV2(n), "missing public key") + }) + t.Run("missing addresses", func(t *testing.T) { + n := goodNodeInfo() + n.SetAddresses() + require.ErrorContains(t, new(NodeInfo).ReadFromV2(n), "missing network endpoints") + }) + t.Run("empty attribute key", func(t *testing.T) { + n := goodNodeInfo() + + var a netmap.Attribute + a.SetValue("non-empty") + n.SetAttributes(append(attrs, a)) + require.ErrorContains(t, new(NodeInfo).ReadFromV2(n), + fmt.Sprintf("empty key of the attribute #%d", len(attrs))) + }) + t.Run("empty attribute value", func(t *testing.T) { + n := goodNodeInfo() + + var a netmap.Attribute + a.SetKey("non-empty-key") + n.SetAttributes(append(attrs, a)) + require.ErrorContains(t, new(NodeInfo).ReadFromV2(n), + "empty value of the attribute non-empty-key") + }) + t.Run("invalid price attribute", func(t *testing.T) { + n := goodNodeInfo() + + var a netmap.Attribute + a.SetKey(attrPrice) + a.SetValue("not a number") + n.SetAttributes(append(attrs, a)) + require.ErrorContains(t, new(NodeInfo).ReadFromV2(n), + fmt.Sprintf("invalid %s attribute", attrPrice)) + }) + t.Run("invalid capacity attribute", func(t *testing.T) { + n := goodNodeInfo() + + var a netmap.Attribute + a.SetKey(attrCapacity) + a.SetValue("not a number") + n.SetAttributes(append(attrs, a)) + require.ErrorContains(t, new(NodeInfo).ReadFromV2(n), + fmt.Sprintf("invalid %s attribute", attrCapacity)) + }) + t.Run("duplicate attributes", func(t *testing.T) { + n := goodNodeInfo() + + var a netmap.Attribute + a.SetKey("key1") + a.SetValue("value3") + n.SetAttributes(append(attrs, a)) + require.ErrorContains(t, new(NodeInfo).ReadFromV2(n), + "duplicate attributes key1") + }) +} diff --git a/netmap/parser/Query.g4 b/netmap/parser/Query.g4 index 72fa880a..cbdc2bc7 100644 --- a/netmap/parser/Query.g4 +++ b/netmap/parser/Query.g4 @@ -4,10 +4,14 @@ options { tokenVocab = QueryLexer; } -policy: UNIQUE? repStmt+ cbfStmt? selectStmt* filterStmt* EOF; +policy: UNIQUE? (repStmt | ecStmt)+ cbfStmt? selectStmt* filterStmt* EOF; selectFilterExpr: cbfStmt? selectStmt? filterStmt* EOF; +ecStmt: + EC Data = NUMBER1 DOT Parity = NUMBER1 // erasure code configuration + (IN Selector = ident)?; // optional selector name + repStmt: REP Count = NUMBER1 // number of object replicas (IN Selector = ident)?; // optional selector name @@ -15,10 +19,10 @@ repStmt: cbfStmt: CBF BackupFactor = NUMBER1; // container backup factor selectStmt: - SELECT Count = NUMBER1 // number of nodes to select without container backup factor *) - (IN clause? Bucket = ident)? // bucket name - FROM Filter = identWC // filter reference or whole netmap - (AS Name = ident)? // optional selector name + SELECT Count = NUMBER1 // number of nodes to select without container backup factor *) + (IN clause? Bucket = filterKey)? // bucket name + FROM Filter = identWC // filter reference or whole netmap + (AS Name = ident)? // optional selector name ; clause: CLAUSE_SAME | CLAUSE_DISTINCT; // nodes from distinct buckets diff --git a/netmap/parser/Query.interp b/netmap/parser/Query.interp index a8fb219e..6c872547 100644 --- a/netmap/parser/Query.interp +++ b/netmap/parser/Query.interp @@ -6,6 +6,7 @@ null null 'UNIQUE' 'REP' +'EC' 'IN' 'AS' 'CBF' @@ -13,6 +14,7 @@ null 'FROM' 'FILTER' '*' +'.' 'SAME' 'DISTINCT' '(' @@ -32,6 +34,7 @@ OR_OP SIMPLE_OP UNIQUE REP +EC IN AS CBF @@ -39,6 +42,7 @@ SELECT FROM FILTER WILDCARD +DOT CLAUSE_SAME CLAUSE_DISTINCT L_PAREN @@ -53,6 +57,7 @@ WS rule names: policy selectFilterExpr +ecStmt repStmt cbfStmt selectStmt @@ -69,4 +74,4 @@ identWC atn: -[4, 1, 23, 154, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 3, 0, 32, 8, 0, 1, 0, 4, 0, 35, 8, 0, 11, 0, 12, 0, 36, 1, 0, 3, 0, 40, 8, 0, 1, 0, 5, 0, 43, 8, 0, 10, 0, 12, 0, 46, 9, 0, 1, 0, 5, 0, 49, 8, 0, 10, 0, 12, 0, 52, 9, 0, 1, 0, 1, 0, 1, 1, 3, 1, 57, 8, 1, 1, 1, 3, 1, 60, 8, 1, 1, 1, 5, 1, 63, 8, 1, 10, 1, 12, 1, 66, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 74, 8, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 83, 8, 4, 1, 4, 3, 4, 86, 8, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 92, 8, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 107, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 115, 8, 6, 10, 6, 12, 6, 118, 9, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 131, 8, 8, 1, 9, 1, 9, 3, 9, 135, 8, 9, 1, 10, 1, 10, 1, 10, 3, 10, 140, 8, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 3, 13, 148, 8, 13, 1, 14, 1, 14, 3, 14, 152, 8, 14, 1, 14, 0, 1, 12, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 0, 3, 1, 0, 14, 15, 1, 0, 20, 21, 2, 0, 6, 8, 10, 12, 160, 0, 31, 1, 0, 0, 0, 2, 56, 1, 0, 0, 0, 4, 69, 1, 0, 0, 0, 6, 75, 1, 0, 0, 0, 8, 78, 1, 0, 0, 0, 10, 93, 1, 0, 0, 0, 12, 106, 1, 0, 0, 0, 14, 119, 1, 0, 0, 0, 16, 130, 1, 0, 0, 0, 18, 134, 1, 0, 0, 0, 20, 139, 1, 0, 0, 0, 22, 141, 1, 0, 0, 0, 24, 143, 1, 0, 0, 0, 26, 147, 1, 0, 0, 0, 28, 151, 1, 0, 0, 0, 30, 32, 5, 5, 0, 0, 31, 30, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 34, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 39, 1, 0, 0, 0, 38, 40, 3, 6, 3, 0, 39, 38, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 44, 1, 0, 0, 0, 41, 43, 3, 8, 4, 0, 42, 41, 1, 0, 0, 0, 43, 46, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 50, 1, 0, 0, 0, 46, 44, 1, 0, 0, 0, 47, 49, 3, 14, 7, 0, 48, 47, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 53, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 54, 5, 0, 0, 1, 54, 1, 1, 0, 0, 0, 55, 57, 3, 6, 3, 0, 56, 55, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 59, 1, 0, 0, 0, 58, 60, 3, 8, 4, 0, 59, 58, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 64, 1, 0, 0, 0, 61, 63, 3, 14, 7, 0, 62, 61, 1, 0, 0, 0, 63, 66, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 1, 0, 0, 0, 66, 64, 1, 0, 0, 0, 67, 68, 5, 0, 0, 1, 68, 3, 1, 0, 0, 0, 69, 70, 5, 6, 0, 0, 70, 73, 5, 20, 0, 0, 71, 72, 5, 7, 0, 0, 72, 74, 3, 26, 13, 0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 5, 1, 0, 0, 0, 75, 76, 5, 9, 0, 0, 76, 77, 5, 20, 0, 0, 77, 7, 1, 0, 0, 0, 78, 79, 5, 10, 0, 0, 79, 85, 5, 20, 0, 0, 80, 82, 5, 7, 0, 0, 81, 83, 3, 10, 5, 0, 82, 81, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 86, 3, 26, 13, 0, 85, 80, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 88, 5, 11, 0, 0, 88, 91, 3, 28, 14, 0, 89, 90, 5, 8, 0, 0, 90, 92, 3, 26, 13, 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 9, 1, 0, 0, 0, 93, 94, 7, 0, 0, 0, 94, 11, 1, 0, 0, 0, 95, 96, 6, 6, -1, 0, 96, 97, 5, 1, 0, 0, 97, 98, 5, 16, 0, 0, 98, 99, 3, 12, 6, 0, 99, 100, 5, 17, 0, 0, 100, 107, 1, 0, 0, 0, 101, 102, 5, 16, 0, 0, 102, 103, 3, 12, 6, 0, 103, 104, 5, 17, 0, 0, 104, 107, 1, 0, 0, 0, 105, 107, 3, 16, 8, 0, 106, 95, 1, 0, 0, 0, 106, 101, 1, 0, 0, 0, 106, 105, 1, 0, 0, 0, 107, 116, 1, 0, 0, 0, 108, 109, 10, 4, 0, 0, 109, 110, 5, 2, 0, 0, 110, 115, 3, 12, 6, 5, 111, 112, 10, 3, 0, 0, 112, 113, 5, 3, 0, 0, 113, 115, 3, 12, 6, 4, 114, 108, 1, 0, 0, 0, 114, 111, 1, 0, 0, 0, 115, 118, 1, 0, 0, 0, 116, 114, 1, 0, 0, 0, 116, 117, 1, 0, 0, 0, 117, 13, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 119, 120, 5, 12, 0, 0, 120, 121, 3, 12, 6, 0, 121, 122, 5, 8, 0, 0, 122, 123, 3, 26, 13, 0, 123, 15, 1, 0, 0, 0, 124, 125, 5, 18, 0, 0, 125, 131, 3, 26, 13, 0, 126, 127, 3, 18, 9, 0, 127, 128, 5, 4, 0, 0, 128, 129, 3, 20, 10, 0, 129, 131, 1, 0, 0, 0, 130, 124, 1, 0, 0, 0, 130, 126, 1, 0, 0, 0, 131, 17, 1, 0, 0, 0, 132, 135, 3, 26, 13, 0, 133, 135, 5, 22, 0, 0, 134, 132, 1, 0, 0, 0, 134, 133, 1, 0, 0, 0, 135, 19, 1, 0, 0, 0, 136, 140, 3, 26, 13, 0, 137, 140, 3, 22, 11, 0, 138, 140, 5, 22, 0, 0, 139, 136, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0, 139, 138, 1, 0, 0, 0, 140, 21, 1, 0, 0, 0, 141, 142, 7, 1, 0, 0, 142, 23, 1, 0, 0, 0, 143, 144, 7, 2, 0, 0, 144, 25, 1, 0, 0, 0, 145, 148, 3, 24, 12, 0, 146, 148, 5, 19, 0, 0, 147, 145, 1, 0, 0, 0, 147, 146, 1, 0, 0, 0, 148, 27, 1, 0, 0, 0, 149, 152, 3, 26, 13, 0, 150, 152, 5, 13, 0, 0, 151, 149, 1, 0, 0, 0, 151, 150, 1, 0, 0, 0, 152, 29, 1, 0, 0, 0, 20, 31, 36, 39, 44, 50, 56, 59, 64, 73, 82, 85, 91, 106, 114, 116, 130, 134, 139, 147, 151] \ No newline at end of file +[4, 1, 25, 165, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 1, 0, 3, 0, 34, 8, 0, 1, 0, 1, 0, 4, 0, 38, 8, 0, 11, 0, 12, 0, 39, 1, 0, 3, 0, 43, 8, 0, 1, 0, 5, 0, 46, 8, 0, 10, 0, 12, 0, 49, 9, 0, 1, 0, 5, 0, 52, 8, 0, 10, 0, 12, 0, 55, 9, 0, 1, 0, 1, 0, 1, 1, 3, 1, 60, 8, 1, 1, 1, 3, 1, 63, 8, 1, 1, 1, 5, 1, 66, 8, 1, 10, 1, 12, 1, 69, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 79, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 85, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 94, 8, 5, 1, 5, 3, 5, 97, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 103, 8, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 118, 8, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 126, 8, 7, 10, 7, 12, 7, 129, 9, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 142, 8, 9, 1, 10, 1, 10, 3, 10, 146, 8, 10, 1, 11, 1, 11, 1, 11, 3, 11, 151, 8, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 3, 14, 159, 8, 14, 1, 15, 1, 15, 3, 15, 163, 8, 15, 1, 15, 0, 1, 14, 16, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 0, 3, 1, 0, 16, 17, 1, 0, 22, 23, 3, 0, 6, 6, 8, 9, 11, 13, 172, 0, 33, 1, 0, 0, 0, 2, 59, 1, 0, 0, 0, 4, 72, 1, 0, 0, 0, 6, 80, 1, 0, 0, 0, 8, 86, 1, 0, 0, 0, 10, 89, 1, 0, 0, 0, 12, 104, 1, 0, 0, 0, 14, 117, 1, 0, 0, 0, 16, 130, 1, 0, 0, 0, 18, 141, 1, 0, 0, 0, 20, 145, 1, 0, 0, 0, 22, 150, 1, 0, 0, 0, 24, 152, 1, 0, 0, 0, 26, 154, 1, 0, 0, 0, 28, 158, 1, 0, 0, 0, 30, 162, 1, 0, 0, 0, 32, 34, 5, 5, 0, 0, 33, 32, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 37, 1, 0, 0, 0, 35, 38, 3, 6, 3, 0, 36, 38, 3, 4, 2, 0, 37, 35, 1, 0, 0, 0, 37, 36, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 42, 1, 0, 0, 0, 41, 43, 3, 8, 4, 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 47, 1, 0, 0, 0, 44, 46, 3, 10, 5, 0, 45, 44, 1, 0, 0, 0, 46, 49, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 53, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 50, 52, 3, 16, 8, 0, 51, 50, 1, 0, 0, 0, 52, 55, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 56, 1, 0, 0, 0, 55, 53, 1, 0, 0, 0, 56, 57, 5, 0, 0, 1, 57, 1, 1, 0, 0, 0, 58, 60, 3, 8, 4, 0, 59, 58, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 62, 1, 0, 0, 0, 61, 63, 3, 10, 5, 0, 62, 61, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 67, 1, 0, 0, 0, 64, 66, 3, 16, 8, 0, 65, 64, 1, 0, 0, 0, 66, 69, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 70, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 70, 71, 5, 0, 0, 1, 71, 3, 1, 0, 0, 0, 72, 73, 5, 7, 0, 0, 73, 74, 5, 22, 0, 0, 74, 75, 5, 15, 0, 0, 75, 78, 5, 22, 0, 0, 76, 77, 5, 8, 0, 0, 77, 79, 3, 28, 14, 0, 78, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 5, 1, 0, 0, 0, 80, 81, 5, 6, 0, 0, 81, 84, 5, 22, 0, 0, 82, 83, 5, 8, 0, 0, 83, 85, 3, 28, 14, 0, 84, 82, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 7, 1, 0, 0, 0, 86, 87, 5, 10, 0, 0, 87, 88, 5, 22, 0, 0, 88, 9, 1, 0, 0, 0, 89, 90, 5, 11, 0, 0, 90, 96, 5, 22, 0, 0, 91, 93, 5, 8, 0, 0, 92, 94, 3, 12, 6, 0, 93, 92, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 97, 3, 20, 10, 0, 96, 91, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 5, 12, 0, 0, 99, 102, 3, 30, 15, 0, 100, 101, 5, 9, 0, 0, 101, 103, 3, 28, 14, 0, 102, 100, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 11, 1, 0, 0, 0, 104, 105, 7, 0, 0, 0, 105, 13, 1, 0, 0, 0, 106, 107, 6, 7, -1, 0, 107, 108, 5, 1, 0, 0, 108, 109, 5, 18, 0, 0, 109, 110, 3, 14, 7, 0, 110, 111, 5, 19, 0, 0, 111, 118, 1, 0, 0, 0, 112, 113, 5, 18, 0, 0, 113, 114, 3, 14, 7, 0, 114, 115, 5, 19, 0, 0, 115, 118, 1, 0, 0, 0, 116, 118, 3, 18, 9, 0, 117, 106, 1, 0, 0, 0, 117, 112, 1, 0, 0, 0, 117, 116, 1, 0, 0, 0, 118, 127, 1, 0, 0, 0, 119, 120, 10, 4, 0, 0, 120, 121, 5, 2, 0, 0, 121, 126, 3, 14, 7, 5, 122, 123, 10, 3, 0, 0, 123, 124, 5, 3, 0, 0, 124, 126, 3, 14, 7, 4, 125, 119, 1, 0, 0, 0, 125, 122, 1, 0, 0, 0, 126, 129, 1, 0, 0, 0, 127, 125, 1, 0, 0, 0, 127, 128, 1, 0, 0, 0, 128, 15, 1, 0, 0, 0, 129, 127, 1, 0, 0, 0, 130, 131, 5, 13, 0, 0, 131, 132, 3, 14, 7, 0, 132, 133, 5, 9, 0, 0, 133, 134, 3, 28, 14, 0, 134, 17, 1, 0, 0, 0, 135, 136, 5, 20, 0, 0, 136, 142, 3, 28, 14, 0, 137, 138, 3, 20, 10, 0, 138, 139, 5, 4, 0, 0, 139, 140, 3, 22, 11, 0, 140, 142, 1, 0, 0, 0, 141, 135, 1, 0, 0, 0, 141, 137, 1, 0, 0, 0, 142, 19, 1, 0, 0, 0, 143, 146, 3, 28, 14, 0, 144, 146, 5, 24, 0, 0, 145, 143, 1, 0, 0, 0, 145, 144, 1, 0, 0, 0, 146, 21, 1, 0, 0, 0, 147, 151, 3, 28, 14, 0, 148, 151, 3, 24, 12, 0, 149, 151, 5, 24, 0, 0, 150, 147, 1, 0, 0, 0, 150, 148, 1, 0, 0, 0, 150, 149, 1, 0, 0, 0, 151, 23, 1, 0, 0, 0, 152, 153, 7, 1, 0, 0, 153, 25, 1, 0, 0, 0, 154, 155, 7, 2, 0, 0, 155, 27, 1, 0, 0, 0, 156, 159, 3, 26, 13, 0, 157, 159, 5, 21, 0, 0, 158, 156, 1, 0, 0, 0, 158, 157, 1, 0, 0, 0, 159, 29, 1, 0, 0, 0, 160, 163, 3, 28, 14, 0, 161, 163, 5, 14, 0, 0, 162, 160, 1, 0, 0, 0, 162, 161, 1, 0, 0, 0, 163, 31, 1, 0, 0, 0, 22, 33, 37, 39, 42, 47, 53, 59, 62, 67, 78, 84, 93, 96, 102, 117, 125, 127, 141, 145, 150, 158, 162] \ No newline at end of file diff --git a/netmap/parser/Query.tokens b/netmap/parser/Query.tokens index 6376ea25..b873682b 100644 --- a/netmap/parser/Query.tokens +++ b/netmap/parser/Query.tokens @@ -4,38 +4,42 @@ OR_OP=3 SIMPLE_OP=4 UNIQUE=5 REP=6 -IN=7 -AS=8 -CBF=9 -SELECT=10 -FROM=11 -FILTER=12 -WILDCARD=13 -CLAUSE_SAME=14 -CLAUSE_DISTINCT=15 -L_PAREN=16 -R_PAREN=17 -AT=18 -IDENT=19 -NUMBER1=20 -ZERO=21 -STRING=22 -WS=23 +EC=7 +IN=8 +AS=9 +CBF=10 +SELECT=11 +FROM=12 +FILTER=13 +WILDCARD=14 +DOT=15 +CLAUSE_SAME=16 +CLAUSE_DISTINCT=17 +L_PAREN=18 +R_PAREN=19 +AT=20 +IDENT=21 +NUMBER1=22 +ZERO=23 +STRING=24 +WS=25 'NOT'=1 'AND'=2 'OR'=3 'UNIQUE'=5 'REP'=6 -'IN'=7 -'AS'=8 -'CBF'=9 -'SELECT'=10 -'FROM'=11 -'FILTER'=12 -'*'=13 -'SAME'=14 -'DISTINCT'=15 -'('=16 -')'=17 -'@'=18 -'0'=21 +'EC'=7 +'IN'=8 +'AS'=9 +'CBF'=10 +'SELECT'=11 +'FROM'=12 +'FILTER'=13 +'*'=14 +'.'=15 +'SAME'=16 +'DISTINCT'=17 +'('=18 +')'=19 +'@'=20 +'0'=23 diff --git a/netmap/parser/QueryLexer.g4 b/netmap/parser/QueryLexer.g4 index c9b5ae68..200fbb63 100644 --- a/netmap/parser/QueryLexer.g4 +++ b/netmap/parser/QueryLexer.g4 @@ -3,10 +3,11 @@ lexer grammar QueryLexer; NOT_OP : 'NOT'; AND_OP : 'AND'; OR_OP : 'OR'; -SIMPLE_OP : 'EQ' | 'NE' | 'GE' | 'GT' | 'LT' | 'LE'; +SIMPLE_OP : 'EQ' | 'NE' | 'GE' | 'GT' | 'LT' | 'LE' | 'LIKE' ; UNIQUE : 'UNIQUE'; REP : 'REP'; +EC : 'EC'; IN : 'IN'; AS : 'AS'; CBF : 'CBF'; @@ -14,6 +15,7 @@ SELECT : 'SELECT'; FROM : 'FROM'; FILTER : 'FILTER'; WILDCARD : '*'; +DOT : '.'; CLAUSE_SAME : 'SAME'; CLAUSE_DISTINCT : 'DISTINCT'; diff --git a/netmap/parser/QueryLexer.interp b/netmap/parser/QueryLexer.interp index 95db1443..c339bddf 100644 --- a/netmap/parser/QueryLexer.interp +++ b/netmap/parser/QueryLexer.interp @@ -6,6 +6,7 @@ null null 'UNIQUE' 'REP' +'EC' 'IN' 'AS' 'CBF' @@ -13,6 +14,7 @@ null 'FROM' 'FILTER' '*' +'.' 'SAME' 'DISTINCT' '(' @@ -32,6 +34,7 @@ OR_OP SIMPLE_OP UNIQUE REP +EC IN AS CBF @@ -39,6 +42,7 @@ SELECT FROM FILTER WILDCARD +DOT CLAUSE_SAME CLAUSE_DISTINCT L_PAREN @@ -57,6 +61,7 @@ OR_OP SIMPLE_OP UNIQUE REP +EC IN AS CBF @@ -64,6 +69,7 @@ SELECT FROM FILTER WILDCARD +DOT CLAUSE_SAME CLAUSE_DISTINCT L_PAREN @@ -90,4 +96,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 23, 213, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 85, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 5, 18, 152, 8, 18, 10, 18, 12, 18, 155, 9, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 5, 21, 163, 8, 21, 10, 21, 12, 21, 166, 9, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 5, 23, 173, 8, 23, 10, 23, 12, 23, 176, 9, 23, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 182, 8, 23, 10, 23, 12, 23, 185, 9, 23, 1, 23, 3, 23, 188, 8, 23, 1, 24, 1, 24, 1, 24, 3, 24, 193, 8, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 4, 29, 208, 8, 29, 11, 29, 12, 29, 209, 1, 29, 1, 29, 0, 0, 30, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 0, 41, 0, 43, 20, 45, 21, 47, 22, 49, 0, 51, 0, 53, 0, 55, 0, 57, 0, 59, 23, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 220, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 1, 61, 1, 0, 0, 0, 3, 65, 1, 0, 0, 0, 5, 69, 1, 0, 0, 0, 7, 84, 1, 0, 0, 0, 9, 86, 1, 0, 0, 0, 11, 93, 1, 0, 0, 0, 13, 97, 1, 0, 0, 0, 15, 100, 1, 0, 0, 0, 17, 103, 1, 0, 0, 0, 19, 107, 1, 0, 0, 0, 21, 114, 1, 0, 0, 0, 23, 119, 1, 0, 0, 0, 25, 126, 1, 0, 0, 0, 27, 128, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 142, 1, 0, 0, 0, 33, 144, 1, 0, 0, 0, 35, 146, 1, 0, 0, 0, 37, 148, 1, 0, 0, 0, 39, 156, 1, 0, 0, 0, 41, 158, 1, 0, 0, 0, 43, 160, 1, 0, 0, 0, 45, 167, 1, 0, 0, 0, 47, 187, 1, 0, 0, 0, 49, 189, 1, 0, 0, 0, 51, 194, 1, 0, 0, 0, 53, 200, 1, 0, 0, 0, 55, 202, 1, 0, 0, 0, 57, 204, 1, 0, 0, 0, 59, 207, 1, 0, 0, 0, 61, 62, 5, 78, 0, 0, 62, 63, 5, 79, 0, 0, 63, 64, 5, 84, 0, 0, 64, 2, 1, 0, 0, 0, 65, 66, 5, 65, 0, 0, 66, 67, 5, 78, 0, 0, 67, 68, 5, 68, 0, 0, 68, 4, 1, 0, 0, 0, 69, 70, 5, 79, 0, 0, 70, 71, 5, 82, 0, 0, 71, 6, 1, 0, 0, 0, 72, 73, 5, 69, 0, 0, 73, 85, 5, 81, 0, 0, 74, 75, 5, 78, 0, 0, 75, 85, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 85, 5, 69, 0, 0, 78, 79, 5, 71, 0, 0, 79, 85, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 85, 5, 84, 0, 0, 82, 83, 5, 76, 0, 0, 83, 85, 5, 69, 0, 0, 84, 72, 1, 0, 0, 0, 84, 74, 1, 0, 0, 0, 84, 76, 1, 0, 0, 0, 84, 78, 1, 0, 0, 0, 84, 80, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 8, 1, 0, 0, 0, 86, 87, 5, 85, 0, 0, 87, 88, 5, 78, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 81, 0, 0, 90, 91, 5, 85, 0, 0, 91, 92, 5, 69, 0, 0, 92, 10, 1, 0, 0, 0, 93, 94, 5, 82, 0, 0, 94, 95, 5, 69, 0, 0, 95, 96, 5, 80, 0, 0, 96, 12, 1, 0, 0, 0, 97, 98, 5, 73, 0, 0, 98, 99, 5, 78, 0, 0, 99, 14, 1, 0, 0, 0, 100, 101, 5, 65, 0, 0, 101, 102, 5, 83, 0, 0, 102, 16, 1, 0, 0, 0, 103, 104, 5, 67, 0, 0, 104, 105, 5, 66, 0, 0, 105, 106, 5, 70, 0, 0, 106, 18, 1, 0, 0, 0, 107, 108, 5, 83, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110, 5, 76, 0, 0, 110, 111, 5, 69, 0, 0, 111, 112, 5, 67, 0, 0, 112, 113, 5, 84, 0, 0, 113, 20, 1, 0, 0, 0, 114, 115, 5, 70, 0, 0, 115, 116, 5, 82, 0, 0, 116, 117, 5, 79, 0, 0, 117, 118, 5, 77, 0, 0, 118, 22, 1, 0, 0, 0, 119, 120, 5, 70, 0, 0, 120, 121, 5, 73, 0, 0, 121, 122, 5, 76, 0, 0, 122, 123, 5, 84, 0, 0, 123, 124, 5, 69, 0, 0, 124, 125, 5, 82, 0, 0, 125, 24, 1, 0, 0, 0, 126, 127, 5, 42, 0, 0, 127, 26, 1, 0, 0, 0, 128, 129, 5, 83, 0, 0, 129, 130, 5, 65, 0, 0, 130, 131, 5, 77, 0, 0, 131, 132, 5, 69, 0, 0, 132, 28, 1, 0, 0, 0, 133, 134, 5, 68, 0, 0, 134, 135, 5, 73, 0, 0, 135, 136, 5, 83, 0, 0, 136, 137, 5, 84, 0, 0, 137, 138, 5, 73, 0, 0, 138, 139, 5, 78, 0, 0, 139, 140, 5, 67, 0, 0, 140, 141, 5, 84, 0, 0, 141, 30, 1, 0, 0, 0, 142, 143, 5, 40, 0, 0, 143, 32, 1, 0, 0, 0, 144, 145, 5, 41, 0, 0, 145, 34, 1, 0, 0, 0, 146, 147, 5, 64, 0, 0, 147, 36, 1, 0, 0, 0, 148, 153, 3, 41, 20, 0, 149, 152, 3, 39, 19, 0, 150, 152, 3, 41, 20, 0, 151, 149, 1, 0, 0, 0, 151, 150, 1, 0, 0, 0, 152, 155, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 38, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 156, 157, 7, 0, 0, 0, 157, 40, 1, 0, 0, 0, 158, 159, 7, 1, 0, 0, 159, 42, 1, 0, 0, 0, 160, 164, 7, 2, 0, 0, 161, 163, 3, 39, 19, 0, 162, 161, 1, 0, 0, 0, 163, 166, 1, 0, 0, 0, 164, 162, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 44, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 167, 168, 5, 48, 0, 0, 168, 46, 1, 0, 0, 0, 169, 174, 5, 34, 0, 0, 170, 173, 3, 49, 24, 0, 171, 173, 3, 57, 28, 0, 172, 170, 1, 0, 0, 0, 172, 171, 1, 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 188, 5, 34, 0, 0, 178, 183, 5, 39, 0, 0, 179, 182, 3, 49, 24, 0, 180, 182, 3, 55, 27, 0, 181, 179, 1, 0, 0, 0, 181, 180, 1, 0, 0, 0, 182, 185, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, 186, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 186, 188, 5, 39, 0, 0, 187, 169, 1, 0, 0, 0, 187, 178, 1, 0, 0, 0, 188, 48, 1, 0, 0, 0, 189, 192, 5, 92, 0, 0, 190, 193, 7, 3, 0, 0, 191, 193, 3, 51, 25, 0, 192, 190, 1, 0, 0, 0, 192, 191, 1, 0, 0, 0, 193, 50, 1, 0, 0, 0, 194, 195, 5, 117, 0, 0, 195, 196, 3, 53, 26, 0, 196, 197, 3, 53, 26, 0, 197, 198, 3, 53, 26, 0, 198, 199, 3, 53, 26, 0, 199, 52, 1, 0, 0, 0, 200, 201, 7, 4, 0, 0, 201, 54, 1, 0, 0, 0, 202, 203, 8, 5, 0, 0, 203, 56, 1, 0, 0, 0, 204, 205, 8, 6, 0, 0, 205, 58, 1, 0, 0, 0, 206, 208, 7, 7, 0, 0, 207, 206, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 212, 6, 29, 0, 0, 212, 60, 1, 0, 0, 0, 12, 0, 84, 151, 153, 164, 172, 174, 181, 183, 187, 192, 209, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 25, 226, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 93, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 5, 20, 165, 8, 20, 10, 20, 12, 20, 168, 9, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 5, 23, 176, 8, 23, 10, 23, 12, 23, 179, 9, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 5, 25, 186, 8, 25, 10, 25, 12, 25, 189, 9, 25, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 195, 8, 25, 10, 25, 12, 25, 198, 9, 25, 1, 25, 3, 25, 201, 8, 25, 1, 26, 1, 26, 1, 26, 3, 26, 206, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 4, 31, 221, 8, 31, 11, 31, 12, 31, 222, 1, 31, 1, 31, 0, 0, 32, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 0, 45, 0, 47, 22, 49, 23, 51, 24, 53, 0, 55, 0, 57, 0, 59, 0, 61, 0, 63, 25, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 234, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 1, 65, 1, 0, 0, 0, 3, 69, 1, 0, 0, 0, 5, 73, 1, 0, 0, 0, 7, 92, 1, 0, 0, 0, 9, 94, 1, 0, 0, 0, 11, 101, 1, 0, 0, 0, 13, 105, 1, 0, 0, 0, 15, 108, 1, 0, 0, 0, 17, 111, 1, 0, 0, 0, 19, 114, 1, 0, 0, 0, 21, 118, 1, 0, 0, 0, 23, 125, 1, 0, 0, 0, 25, 130, 1, 0, 0, 0, 27, 137, 1, 0, 0, 0, 29, 139, 1, 0, 0, 0, 31, 141, 1, 0, 0, 0, 33, 146, 1, 0, 0, 0, 35, 155, 1, 0, 0, 0, 37, 157, 1, 0, 0, 0, 39, 159, 1, 0, 0, 0, 41, 161, 1, 0, 0, 0, 43, 169, 1, 0, 0, 0, 45, 171, 1, 0, 0, 0, 47, 173, 1, 0, 0, 0, 49, 180, 1, 0, 0, 0, 51, 200, 1, 0, 0, 0, 53, 202, 1, 0, 0, 0, 55, 207, 1, 0, 0, 0, 57, 213, 1, 0, 0, 0, 59, 215, 1, 0, 0, 0, 61, 217, 1, 0, 0, 0, 63, 220, 1, 0, 0, 0, 65, 66, 5, 78, 0, 0, 66, 67, 5, 79, 0, 0, 67, 68, 5, 84, 0, 0, 68, 2, 1, 0, 0, 0, 69, 70, 5, 65, 0, 0, 70, 71, 5, 78, 0, 0, 71, 72, 5, 68, 0, 0, 72, 4, 1, 0, 0, 0, 73, 74, 5, 79, 0, 0, 74, 75, 5, 82, 0, 0, 75, 6, 1, 0, 0, 0, 76, 77, 5, 69, 0, 0, 77, 93, 5, 81, 0, 0, 78, 79, 5, 78, 0, 0, 79, 93, 5, 69, 0, 0, 80, 81, 5, 71, 0, 0, 81, 93, 5, 69, 0, 0, 82, 83, 5, 71, 0, 0, 83, 93, 5, 84, 0, 0, 84, 85, 5, 76, 0, 0, 85, 93, 5, 84, 0, 0, 86, 87, 5, 76, 0, 0, 87, 93, 5, 69, 0, 0, 88, 89, 5, 76, 0, 0, 89, 90, 5, 73, 0, 0, 90, 91, 5, 75, 0, 0, 91, 93, 5, 69, 0, 0, 92, 76, 1, 0, 0, 0, 92, 78, 1, 0, 0, 0, 92, 80, 1, 0, 0, 0, 92, 82, 1, 0, 0, 0, 92, 84, 1, 0, 0, 0, 92, 86, 1, 0, 0, 0, 92, 88, 1, 0, 0, 0, 93, 8, 1, 0, 0, 0, 94, 95, 5, 85, 0, 0, 95, 96, 5, 78, 0, 0, 96, 97, 5, 73, 0, 0, 97, 98, 5, 81, 0, 0, 98, 99, 5, 85, 0, 0, 99, 100, 5, 69, 0, 0, 100, 10, 1, 0, 0, 0, 101, 102, 5, 82, 0, 0, 102, 103, 5, 69, 0, 0, 103, 104, 5, 80, 0, 0, 104, 12, 1, 0, 0, 0, 105, 106, 5, 69, 0, 0, 106, 107, 5, 67, 0, 0, 107, 14, 1, 0, 0, 0, 108, 109, 5, 73, 0, 0, 109, 110, 5, 78, 0, 0, 110, 16, 1, 0, 0, 0, 111, 112, 5, 65, 0, 0, 112, 113, 5, 83, 0, 0, 113, 18, 1, 0, 0, 0, 114, 115, 5, 67, 0, 0, 115, 116, 5, 66, 0, 0, 116, 117, 5, 70, 0, 0, 117, 20, 1, 0, 0, 0, 118, 119, 5, 83, 0, 0, 119, 120, 5, 69, 0, 0, 120, 121, 5, 76, 0, 0, 121, 122, 5, 69, 0, 0, 122, 123, 5, 67, 0, 0, 123, 124, 5, 84, 0, 0, 124, 22, 1, 0, 0, 0, 125, 126, 5, 70, 0, 0, 126, 127, 5, 82, 0, 0, 127, 128, 5, 79, 0, 0, 128, 129, 5, 77, 0, 0, 129, 24, 1, 0, 0, 0, 130, 131, 5, 70, 0, 0, 131, 132, 5, 73, 0, 0, 132, 133, 5, 76, 0, 0, 133, 134, 5, 84, 0, 0, 134, 135, 5, 69, 0, 0, 135, 136, 5, 82, 0, 0, 136, 26, 1, 0, 0, 0, 137, 138, 5, 42, 0, 0, 138, 28, 1, 0, 0, 0, 139, 140, 5, 46, 0, 0, 140, 30, 1, 0, 0, 0, 141, 142, 5, 83, 0, 0, 142, 143, 5, 65, 0, 0, 143, 144, 5, 77, 0, 0, 144, 145, 5, 69, 0, 0, 145, 32, 1, 0, 0, 0, 146, 147, 5, 68, 0, 0, 147, 148, 5, 73, 0, 0, 148, 149, 5, 83, 0, 0, 149, 150, 5, 84, 0, 0, 150, 151, 5, 73, 0, 0, 151, 152, 5, 78, 0, 0, 152, 153, 5, 67, 0, 0, 153, 154, 5, 84, 0, 0, 154, 34, 1, 0, 0, 0, 155, 156, 5, 40, 0, 0, 156, 36, 1, 0, 0, 0, 157, 158, 5, 41, 0, 0, 158, 38, 1, 0, 0, 0, 159, 160, 5, 64, 0, 0, 160, 40, 1, 0, 0, 0, 161, 166, 3, 45, 22, 0, 162, 165, 3, 43, 21, 0, 163, 165, 3, 45, 22, 0, 164, 162, 1, 0, 0, 0, 164, 163, 1, 0, 0, 0, 165, 168, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 42, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 169, 170, 7, 0, 0, 0, 170, 44, 1, 0, 0, 0, 171, 172, 7, 1, 0, 0, 172, 46, 1, 0, 0, 0, 173, 177, 7, 2, 0, 0, 174, 176, 3, 43, 21, 0, 175, 174, 1, 0, 0, 0, 176, 179, 1, 0, 0, 0, 177, 175, 1, 0, 0, 0, 177, 178, 1, 0, 0, 0, 178, 48, 1, 0, 0, 0, 179, 177, 1, 0, 0, 0, 180, 181, 5, 48, 0, 0, 181, 50, 1, 0, 0, 0, 182, 187, 5, 34, 0, 0, 183, 186, 3, 53, 26, 0, 184, 186, 3, 61, 30, 0, 185, 183, 1, 0, 0, 0, 185, 184, 1, 0, 0, 0, 186, 189, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 187, 188, 1, 0, 0, 0, 188, 190, 1, 0, 0, 0, 189, 187, 1, 0, 0, 0, 190, 201, 5, 34, 0, 0, 191, 196, 5, 39, 0, 0, 192, 195, 3, 53, 26, 0, 193, 195, 3, 59, 29, 0, 194, 192, 1, 0, 0, 0, 194, 193, 1, 0, 0, 0, 195, 198, 1, 0, 0, 0, 196, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 199, 1, 0, 0, 0, 198, 196, 1, 0, 0, 0, 199, 201, 5, 39, 0, 0, 200, 182, 1, 0, 0, 0, 200, 191, 1, 0, 0, 0, 201, 52, 1, 0, 0, 0, 202, 205, 5, 92, 0, 0, 203, 206, 7, 3, 0, 0, 204, 206, 3, 55, 27, 0, 205, 203, 1, 0, 0, 0, 205, 204, 1, 0, 0, 0, 206, 54, 1, 0, 0, 0, 207, 208, 5, 117, 0, 0, 208, 209, 3, 57, 28, 0, 209, 210, 3, 57, 28, 0, 210, 211, 3, 57, 28, 0, 211, 212, 3, 57, 28, 0, 212, 56, 1, 0, 0, 0, 213, 214, 7, 4, 0, 0, 214, 58, 1, 0, 0, 0, 215, 216, 8, 5, 0, 0, 216, 60, 1, 0, 0, 0, 217, 218, 8, 6, 0, 0, 218, 62, 1, 0, 0, 0, 219, 221, 7, 7, 0, 0, 220, 219, 1, 0, 0, 0, 221, 222, 1, 0, 0, 0, 222, 220, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, 225, 6, 31, 0, 0, 225, 64, 1, 0, 0, 0, 12, 0, 92, 164, 166, 177, 185, 187, 194, 196, 200, 205, 222, 1, 6, 0, 0] \ No newline at end of file diff --git a/netmap/parser/QueryLexer.tokens b/netmap/parser/QueryLexer.tokens index 6376ea25..b873682b 100644 --- a/netmap/parser/QueryLexer.tokens +++ b/netmap/parser/QueryLexer.tokens @@ -4,38 +4,42 @@ OR_OP=3 SIMPLE_OP=4 UNIQUE=5 REP=6 -IN=7 -AS=8 -CBF=9 -SELECT=10 -FROM=11 -FILTER=12 -WILDCARD=13 -CLAUSE_SAME=14 -CLAUSE_DISTINCT=15 -L_PAREN=16 -R_PAREN=17 -AT=18 -IDENT=19 -NUMBER1=20 -ZERO=21 -STRING=22 -WS=23 +EC=7 +IN=8 +AS=9 +CBF=10 +SELECT=11 +FROM=12 +FILTER=13 +WILDCARD=14 +DOT=15 +CLAUSE_SAME=16 +CLAUSE_DISTINCT=17 +L_PAREN=18 +R_PAREN=19 +AT=20 +IDENT=21 +NUMBER1=22 +ZERO=23 +STRING=24 +WS=25 'NOT'=1 'AND'=2 'OR'=3 'UNIQUE'=5 'REP'=6 -'IN'=7 -'AS'=8 -'CBF'=9 -'SELECT'=10 -'FROM'=11 -'FILTER'=12 -'*'=13 -'SAME'=14 -'DISTINCT'=15 -'('=16 -')'=17 -'@'=18 -'0'=21 +'EC'=7 +'IN'=8 +'AS'=9 +'CBF'=10 +'SELECT'=11 +'FROM'=12 +'FILTER'=13 +'*'=14 +'.'=15 +'SAME'=16 +'DISTINCT'=17 +'('=18 +')'=19 +'@'=20 +'0'=23 diff --git a/netmap/parser/generate.go b/netmap/parser/generate.go index 66a855bd..a11c3fce 100644 --- a/netmap/parser/generate.go +++ b/netmap/parser/generate.go @@ -1,4 +1,5 @@ package parser -// ANTLR can be downloaded from https://www.antlr.org/download/antlr-4.13.0-complete.jar -//go:generate java -Xmx500M -cp "./antlr-4.13.0-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Go -no-listener -visitor QueryLexer.g4 Query.g4 +// You can download ANTLR from https://www.antlr.org/download/antlr-4.13.1-complete.jar, +// then run generate or simply run the dedicated Makefile target like this `make policy`. +//go:generate java -Xmx500M -cp "./antlr-4.13.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool -Dlanguage=Go -no-listener -visitor QueryLexer.g4 Query.g4 diff --git a/netmap/parser/query_base_visitor.go b/netmap/parser/query_base_visitor.go index 981106f5..7fd0bd97 100644 --- a/netmap/parser/query_base_visitor.go +++ b/netmap/parser/query_base_visitor.go @@ -1,4 +1,4 @@ -// Code generated from Query.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from netmap/parser/Query.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser // Query @@ -16,6 +16,10 @@ func (v *BaseQueryVisitor) VisitSelectFilterExpr(ctx *SelectFilterExprContext) i return v.VisitChildren(ctx) } +func (v *BaseQueryVisitor) VisitEcStmt(ctx *EcStmtContext) interface{} { + return v.VisitChildren(ctx) +} + func (v *BaseQueryVisitor) VisitRepStmt(ctx *RepStmtContext) interface{} { return v.VisitChildren(ctx) } diff --git a/netmap/parser/query_lexer.go b/netmap/parser/query_lexer.go index c1ae141a..a392d4c3 100644 --- a/netmap/parser/query_lexer.go +++ b/netmap/parser/query_lexer.go @@ -1,4 +1,4 @@ -// Code generated from QueryLexer.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from netmap/parser/QueryLexer.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser @@ -43,119 +43,125 @@ func querylexerLexerInit() { "DEFAULT_MODE", } staticData.LiteralNames = []string{ - "", "'NOT'", "'AND'", "'OR'", "", "'UNIQUE'", "'REP'", "'IN'", "'AS'", - "'CBF'", "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", - "'('", "')'", "'@'", "", "", "'0'", + "", "'NOT'", "'AND'", "'OR'", "", "'UNIQUE'", "'REP'", "'EC'", "'IN'", + "'AS'", "'CBF'", "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'.'", "'SAME'", + "'DISTINCT'", "'('", "')'", "'@'", "", "", "'0'", } staticData.SymbolicNames = []string{ - "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "IN", - "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", + "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "EC", + "IN", "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "DOT", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", } staticData.RuleNames = []string{ - "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "IN", "AS", - "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", - "L_PAREN", "R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1", - "ZERO", "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE", - "WS", + "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "EC", "IN", + "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "DOT", "CLAUSE_SAME", + "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "Digit", "Nondigit", + "NUMBER1", "ZERO", "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", + "SAFECODEPOINTDOUBLE", "WS", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 0, 23, 213, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, + 4, 0, 25, 226, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, - 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 1, 0, 1, 0, 1, - 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 85, 8, 3, 1, 4, - 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, - 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, - 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, - 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, - 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, - 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 5, 18, 152, 8, - 18, 10, 18, 12, 18, 155, 9, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, - 5, 21, 163, 8, 21, 10, 21, 12, 21, 166, 9, 21, 1, 22, 1, 22, 1, 23, 1, - 23, 1, 23, 5, 23, 173, 8, 23, 10, 23, 12, 23, 176, 9, 23, 1, 23, 1, 23, - 1, 23, 1, 23, 5, 23, 182, 8, 23, 10, 23, 12, 23, 185, 9, 23, 1, 23, 3, - 23, 188, 8, 23, 1, 24, 1, 24, 1, 24, 3, 24, 193, 8, 24, 1, 25, 1, 25, 1, - 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, - 4, 29, 208, 8, 29, 11, 29, 12, 29, 209, 1, 29, 1, 29, 0, 0, 30, 1, 1, 3, - 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, - 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 0, 41, 0, 43, - 20, 45, 21, 47, 22, 49, 0, 51, 0, 53, 0, 55, 0, 57, 0, 59, 23, 1, 0, 8, - 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, - 39, 39, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, - 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, - 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, 32, 32, 220, 0, 1, 1, 0, 0, 0, 0, - 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, - 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, - 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, - 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, - 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, - 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 1, 61, 1, 0, 0, 0, 3, 65, - 1, 0, 0, 0, 5, 69, 1, 0, 0, 0, 7, 84, 1, 0, 0, 0, 9, 86, 1, 0, 0, 0, 11, - 93, 1, 0, 0, 0, 13, 97, 1, 0, 0, 0, 15, 100, 1, 0, 0, 0, 17, 103, 1, 0, - 0, 0, 19, 107, 1, 0, 0, 0, 21, 114, 1, 0, 0, 0, 23, 119, 1, 0, 0, 0, 25, - 126, 1, 0, 0, 0, 27, 128, 1, 0, 0, 0, 29, 133, 1, 0, 0, 0, 31, 142, 1, - 0, 0, 0, 33, 144, 1, 0, 0, 0, 35, 146, 1, 0, 0, 0, 37, 148, 1, 0, 0, 0, - 39, 156, 1, 0, 0, 0, 41, 158, 1, 0, 0, 0, 43, 160, 1, 0, 0, 0, 45, 167, - 1, 0, 0, 0, 47, 187, 1, 0, 0, 0, 49, 189, 1, 0, 0, 0, 51, 194, 1, 0, 0, - 0, 53, 200, 1, 0, 0, 0, 55, 202, 1, 0, 0, 0, 57, 204, 1, 0, 0, 0, 59, 207, - 1, 0, 0, 0, 61, 62, 5, 78, 0, 0, 62, 63, 5, 79, 0, 0, 63, 64, 5, 84, 0, - 0, 64, 2, 1, 0, 0, 0, 65, 66, 5, 65, 0, 0, 66, 67, 5, 78, 0, 0, 67, 68, - 5, 68, 0, 0, 68, 4, 1, 0, 0, 0, 69, 70, 5, 79, 0, 0, 70, 71, 5, 82, 0, - 0, 71, 6, 1, 0, 0, 0, 72, 73, 5, 69, 0, 0, 73, 85, 5, 81, 0, 0, 74, 75, - 5, 78, 0, 0, 75, 85, 5, 69, 0, 0, 76, 77, 5, 71, 0, 0, 77, 85, 5, 69, 0, - 0, 78, 79, 5, 71, 0, 0, 79, 85, 5, 84, 0, 0, 80, 81, 5, 76, 0, 0, 81, 85, - 5, 84, 0, 0, 82, 83, 5, 76, 0, 0, 83, 85, 5, 69, 0, 0, 84, 72, 1, 0, 0, - 0, 84, 74, 1, 0, 0, 0, 84, 76, 1, 0, 0, 0, 84, 78, 1, 0, 0, 0, 84, 80, - 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 8, 1, 0, 0, 0, 86, 87, 5, 85, 0, 0, - 87, 88, 5, 78, 0, 0, 88, 89, 5, 73, 0, 0, 89, 90, 5, 81, 0, 0, 90, 91, - 5, 85, 0, 0, 91, 92, 5, 69, 0, 0, 92, 10, 1, 0, 0, 0, 93, 94, 5, 82, 0, - 0, 94, 95, 5, 69, 0, 0, 95, 96, 5, 80, 0, 0, 96, 12, 1, 0, 0, 0, 97, 98, - 5, 73, 0, 0, 98, 99, 5, 78, 0, 0, 99, 14, 1, 0, 0, 0, 100, 101, 5, 65, - 0, 0, 101, 102, 5, 83, 0, 0, 102, 16, 1, 0, 0, 0, 103, 104, 5, 67, 0, 0, - 104, 105, 5, 66, 0, 0, 105, 106, 5, 70, 0, 0, 106, 18, 1, 0, 0, 0, 107, - 108, 5, 83, 0, 0, 108, 109, 5, 69, 0, 0, 109, 110, 5, 76, 0, 0, 110, 111, - 5, 69, 0, 0, 111, 112, 5, 67, 0, 0, 112, 113, 5, 84, 0, 0, 113, 20, 1, - 0, 0, 0, 114, 115, 5, 70, 0, 0, 115, 116, 5, 82, 0, 0, 116, 117, 5, 79, - 0, 0, 117, 118, 5, 77, 0, 0, 118, 22, 1, 0, 0, 0, 119, 120, 5, 70, 0, 0, - 120, 121, 5, 73, 0, 0, 121, 122, 5, 76, 0, 0, 122, 123, 5, 84, 0, 0, 123, - 124, 5, 69, 0, 0, 124, 125, 5, 82, 0, 0, 125, 24, 1, 0, 0, 0, 126, 127, - 5, 42, 0, 0, 127, 26, 1, 0, 0, 0, 128, 129, 5, 83, 0, 0, 129, 130, 5, 65, - 0, 0, 130, 131, 5, 77, 0, 0, 131, 132, 5, 69, 0, 0, 132, 28, 1, 0, 0, 0, - 133, 134, 5, 68, 0, 0, 134, 135, 5, 73, 0, 0, 135, 136, 5, 83, 0, 0, 136, - 137, 5, 84, 0, 0, 137, 138, 5, 73, 0, 0, 138, 139, 5, 78, 0, 0, 139, 140, - 5, 67, 0, 0, 140, 141, 5, 84, 0, 0, 141, 30, 1, 0, 0, 0, 142, 143, 5, 40, - 0, 0, 143, 32, 1, 0, 0, 0, 144, 145, 5, 41, 0, 0, 145, 34, 1, 0, 0, 0, - 146, 147, 5, 64, 0, 0, 147, 36, 1, 0, 0, 0, 148, 153, 3, 41, 20, 0, 149, - 152, 3, 39, 19, 0, 150, 152, 3, 41, 20, 0, 151, 149, 1, 0, 0, 0, 151, 150, - 1, 0, 0, 0, 152, 155, 1, 0, 0, 0, 153, 151, 1, 0, 0, 0, 153, 154, 1, 0, - 0, 0, 154, 38, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 156, 157, 7, 0, 0, 0, - 157, 40, 1, 0, 0, 0, 158, 159, 7, 1, 0, 0, 159, 42, 1, 0, 0, 0, 160, 164, - 7, 2, 0, 0, 161, 163, 3, 39, 19, 0, 162, 161, 1, 0, 0, 0, 163, 166, 1, - 0, 0, 0, 164, 162, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 44, 1, 0, 0, - 0, 166, 164, 1, 0, 0, 0, 167, 168, 5, 48, 0, 0, 168, 46, 1, 0, 0, 0, 169, - 174, 5, 34, 0, 0, 170, 173, 3, 49, 24, 0, 171, 173, 3, 57, 28, 0, 172, - 170, 1, 0, 0, 0, 172, 171, 1, 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, - 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, - 0, 0, 177, 188, 5, 34, 0, 0, 178, 183, 5, 39, 0, 0, 179, 182, 3, 49, 24, - 0, 180, 182, 3, 55, 27, 0, 181, 179, 1, 0, 0, 0, 181, 180, 1, 0, 0, 0, - 182, 185, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184, - 186, 1, 0, 0, 0, 185, 183, 1, 0, 0, 0, 186, 188, 5, 39, 0, 0, 187, 169, - 1, 0, 0, 0, 187, 178, 1, 0, 0, 0, 188, 48, 1, 0, 0, 0, 189, 192, 5, 92, - 0, 0, 190, 193, 7, 3, 0, 0, 191, 193, 3, 51, 25, 0, 192, 190, 1, 0, 0, - 0, 192, 191, 1, 0, 0, 0, 193, 50, 1, 0, 0, 0, 194, 195, 5, 117, 0, 0, 195, - 196, 3, 53, 26, 0, 196, 197, 3, 53, 26, 0, 197, 198, 3, 53, 26, 0, 198, - 199, 3, 53, 26, 0, 199, 52, 1, 0, 0, 0, 200, 201, 7, 4, 0, 0, 201, 54, - 1, 0, 0, 0, 202, 203, 8, 5, 0, 0, 203, 56, 1, 0, 0, 0, 204, 205, 8, 6, - 0, 0, 205, 58, 1, 0, 0, 0, 206, 208, 7, 7, 0, 0, 207, 206, 1, 0, 0, 0, - 208, 209, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, - 211, 1, 0, 0, 0, 211, 212, 6, 29, 0, 0, 212, 60, 1, 0, 0, 0, 12, 0, 84, - 151, 153, 164, 172, 174, 181, 183, 187, 192, 209, 1, 6, 0, 0, + 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, + 31, 7, 31, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, + 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 93, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, + 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, + 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, + 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, + 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, + 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, + 5, 20, 165, 8, 20, 10, 20, 12, 20, 168, 9, 20, 1, 21, 1, 21, 1, 22, 1, + 22, 1, 23, 1, 23, 5, 23, 176, 8, 23, 10, 23, 12, 23, 179, 9, 23, 1, 24, + 1, 24, 1, 25, 1, 25, 1, 25, 5, 25, 186, 8, 25, 10, 25, 12, 25, 189, 9, + 25, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 195, 8, 25, 10, 25, 12, 25, 198, + 9, 25, 1, 25, 3, 25, 201, 8, 25, 1, 26, 1, 26, 1, 26, 3, 26, 206, 8, 26, + 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, + 30, 1, 30, 1, 31, 4, 31, 221, 8, 31, 11, 31, 12, 31, 222, 1, 31, 1, 31, + 0, 0, 32, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, + 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, + 19, 39, 20, 41, 21, 43, 0, 45, 0, 47, 22, 49, 23, 51, 24, 53, 0, 55, 0, + 57, 0, 59, 0, 61, 0, 63, 25, 1, 0, 8, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, + 97, 122, 1, 0, 49, 57, 9, 0, 34, 34, 39, 39, 47, 47, 92, 92, 98, 98, 102, + 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, + 0, 31, 39, 39, 92, 92, 3, 0, 0, 31, 34, 34, 92, 92, 3, 0, 9, 10, 13, 13, + 32, 32, 234, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, + 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, + 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, + 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, + 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, + 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, + 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 1, 65, 1, 0, 0, 0, 3, 69, + 1, 0, 0, 0, 5, 73, 1, 0, 0, 0, 7, 92, 1, 0, 0, 0, 9, 94, 1, 0, 0, 0, 11, + 101, 1, 0, 0, 0, 13, 105, 1, 0, 0, 0, 15, 108, 1, 0, 0, 0, 17, 111, 1, + 0, 0, 0, 19, 114, 1, 0, 0, 0, 21, 118, 1, 0, 0, 0, 23, 125, 1, 0, 0, 0, + 25, 130, 1, 0, 0, 0, 27, 137, 1, 0, 0, 0, 29, 139, 1, 0, 0, 0, 31, 141, + 1, 0, 0, 0, 33, 146, 1, 0, 0, 0, 35, 155, 1, 0, 0, 0, 37, 157, 1, 0, 0, + 0, 39, 159, 1, 0, 0, 0, 41, 161, 1, 0, 0, 0, 43, 169, 1, 0, 0, 0, 45, 171, + 1, 0, 0, 0, 47, 173, 1, 0, 0, 0, 49, 180, 1, 0, 0, 0, 51, 200, 1, 0, 0, + 0, 53, 202, 1, 0, 0, 0, 55, 207, 1, 0, 0, 0, 57, 213, 1, 0, 0, 0, 59, 215, + 1, 0, 0, 0, 61, 217, 1, 0, 0, 0, 63, 220, 1, 0, 0, 0, 65, 66, 5, 78, 0, + 0, 66, 67, 5, 79, 0, 0, 67, 68, 5, 84, 0, 0, 68, 2, 1, 0, 0, 0, 69, 70, + 5, 65, 0, 0, 70, 71, 5, 78, 0, 0, 71, 72, 5, 68, 0, 0, 72, 4, 1, 0, 0, + 0, 73, 74, 5, 79, 0, 0, 74, 75, 5, 82, 0, 0, 75, 6, 1, 0, 0, 0, 76, 77, + 5, 69, 0, 0, 77, 93, 5, 81, 0, 0, 78, 79, 5, 78, 0, 0, 79, 93, 5, 69, 0, + 0, 80, 81, 5, 71, 0, 0, 81, 93, 5, 69, 0, 0, 82, 83, 5, 71, 0, 0, 83, 93, + 5, 84, 0, 0, 84, 85, 5, 76, 0, 0, 85, 93, 5, 84, 0, 0, 86, 87, 5, 76, 0, + 0, 87, 93, 5, 69, 0, 0, 88, 89, 5, 76, 0, 0, 89, 90, 5, 73, 0, 0, 90, 91, + 5, 75, 0, 0, 91, 93, 5, 69, 0, 0, 92, 76, 1, 0, 0, 0, 92, 78, 1, 0, 0, + 0, 92, 80, 1, 0, 0, 0, 92, 82, 1, 0, 0, 0, 92, 84, 1, 0, 0, 0, 92, 86, + 1, 0, 0, 0, 92, 88, 1, 0, 0, 0, 93, 8, 1, 0, 0, 0, 94, 95, 5, 85, 0, 0, + 95, 96, 5, 78, 0, 0, 96, 97, 5, 73, 0, 0, 97, 98, 5, 81, 0, 0, 98, 99, + 5, 85, 0, 0, 99, 100, 5, 69, 0, 0, 100, 10, 1, 0, 0, 0, 101, 102, 5, 82, + 0, 0, 102, 103, 5, 69, 0, 0, 103, 104, 5, 80, 0, 0, 104, 12, 1, 0, 0, 0, + 105, 106, 5, 69, 0, 0, 106, 107, 5, 67, 0, 0, 107, 14, 1, 0, 0, 0, 108, + 109, 5, 73, 0, 0, 109, 110, 5, 78, 0, 0, 110, 16, 1, 0, 0, 0, 111, 112, + 5, 65, 0, 0, 112, 113, 5, 83, 0, 0, 113, 18, 1, 0, 0, 0, 114, 115, 5, 67, + 0, 0, 115, 116, 5, 66, 0, 0, 116, 117, 5, 70, 0, 0, 117, 20, 1, 0, 0, 0, + 118, 119, 5, 83, 0, 0, 119, 120, 5, 69, 0, 0, 120, 121, 5, 76, 0, 0, 121, + 122, 5, 69, 0, 0, 122, 123, 5, 67, 0, 0, 123, 124, 5, 84, 0, 0, 124, 22, + 1, 0, 0, 0, 125, 126, 5, 70, 0, 0, 126, 127, 5, 82, 0, 0, 127, 128, 5, + 79, 0, 0, 128, 129, 5, 77, 0, 0, 129, 24, 1, 0, 0, 0, 130, 131, 5, 70, + 0, 0, 131, 132, 5, 73, 0, 0, 132, 133, 5, 76, 0, 0, 133, 134, 5, 84, 0, + 0, 134, 135, 5, 69, 0, 0, 135, 136, 5, 82, 0, 0, 136, 26, 1, 0, 0, 0, 137, + 138, 5, 42, 0, 0, 138, 28, 1, 0, 0, 0, 139, 140, 5, 46, 0, 0, 140, 30, + 1, 0, 0, 0, 141, 142, 5, 83, 0, 0, 142, 143, 5, 65, 0, 0, 143, 144, 5, + 77, 0, 0, 144, 145, 5, 69, 0, 0, 145, 32, 1, 0, 0, 0, 146, 147, 5, 68, + 0, 0, 147, 148, 5, 73, 0, 0, 148, 149, 5, 83, 0, 0, 149, 150, 5, 84, 0, + 0, 150, 151, 5, 73, 0, 0, 151, 152, 5, 78, 0, 0, 152, 153, 5, 67, 0, 0, + 153, 154, 5, 84, 0, 0, 154, 34, 1, 0, 0, 0, 155, 156, 5, 40, 0, 0, 156, + 36, 1, 0, 0, 0, 157, 158, 5, 41, 0, 0, 158, 38, 1, 0, 0, 0, 159, 160, 5, + 64, 0, 0, 160, 40, 1, 0, 0, 0, 161, 166, 3, 45, 22, 0, 162, 165, 3, 43, + 21, 0, 163, 165, 3, 45, 22, 0, 164, 162, 1, 0, 0, 0, 164, 163, 1, 0, 0, + 0, 165, 168, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, + 42, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 169, 170, 7, 0, 0, 0, 170, 44, 1, + 0, 0, 0, 171, 172, 7, 1, 0, 0, 172, 46, 1, 0, 0, 0, 173, 177, 7, 2, 0, + 0, 174, 176, 3, 43, 21, 0, 175, 174, 1, 0, 0, 0, 176, 179, 1, 0, 0, 0, + 177, 175, 1, 0, 0, 0, 177, 178, 1, 0, 0, 0, 178, 48, 1, 0, 0, 0, 179, 177, + 1, 0, 0, 0, 180, 181, 5, 48, 0, 0, 181, 50, 1, 0, 0, 0, 182, 187, 5, 34, + 0, 0, 183, 186, 3, 53, 26, 0, 184, 186, 3, 61, 30, 0, 185, 183, 1, 0, 0, + 0, 185, 184, 1, 0, 0, 0, 186, 189, 1, 0, 0, 0, 187, 185, 1, 0, 0, 0, 187, + 188, 1, 0, 0, 0, 188, 190, 1, 0, 0, 0, 189, 187, 1, 0, 0, 0, 190, 201, + 5, 34, 0, 0, 191, 196, 5, 39, 0, 0, 192, 195, 3, 53, 26, 0, 193, 195, 3, + 59, 29, 0, 194, 192, 1, 0, 0, 0, 194, 193, 1, 0, 0, 0, 195, 198, 1, 0, + 0, 0, 196, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 199, 1, 0, 0, 0, + 198, 196, 1, 0, 0, 0, 199, 201, 5, 39, 0, 0, 200, 182, 1, 0, 0, 0, 200, + 191, 1, 0, 0, 0, 201, 52, 1, 0, 0, 0, 202, 205, 5, 92, 0, 0, 203, 206, + 7, 3, 0, 0, 204, 206, 3, 55, 27, 0, 205, 203, 1, 0, 0, 0, 205, 204, 1, + 0, 0, 0, 206, 54, 1, 0, 0, 0, 207, 208, 5, 117, 0, 0, 208, 209, 3, 57, + 28, 0, 209, 210, 3, 57, 28, 0, 210, 211, 3, 57, 28, 0, 211, 212, 3, 57, + 28, 0, 212, 56, 1, 0, 0, 0, 213, 214, 7, 4, 0, 0, 214, 58, 1, 0, 0, 0, + 215, 216, 8, 5, 0, 0, 216, 60, 1, 0, 0, 0, 217, 218, 8, 6, 0, 0, 218, 62, + 1, 0, 0, 0, 219, 221, 7, 7, 0, 0, 220, 219, 1, 0, 0, 0, 221, 222, 1, 0, + 0, 0, 222, 220, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, + 224, 225, 6, 31, 0, 0, 225, 64, 1, 0, 0, 0, 12, 0, 92, 164, 166, 177, 185, + 187, 194, 196, 200, 205, 222, 1, 6, 0, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -202,21 +208,23 @@ const ( QueryLexerSIMPLE_OP = 4 QueryLexerUNIQUE = 5 QueryLexerREP = 6 - QueryLexerIN = 7 - QueryLexerAS = 8 - QueryLexerCBF = 9 - QueryLexerSELECT = 10 - QueryLexerFROM = 11 - QueryLexerFILTER = 12 - QueryLexerWILDCARD = 13 - QueryLexerCLAUSE_SAME = 14 - QueryLexerCLAUSE_DISTINCT = 15 - QueryLexerL_PAREN = 16 - QueryLexerR_PAREN = 17 - QueryLexerAT = 18 - QueryLexerIDENT = 19 - QueryLexerNUMBER1 = 20 - QueryLexerZERO = 21 - QueryLexerSTRING = 22 - QueryLexerWS = 23 + QueryLexerEC = 7 + QueryLexerIN = 8 + QueryLexerAS = 9 + QueryLexerCBF = 10 + QueryLexerSELECT = 11 + QueryLexerFROM = 12 + QueryLexerFILTER = 13 + QueryLexerWILDCARD = 14 + QueryLexerDOT = 15 + QueryLexerCLAUSE_SAME = 16 + QueryLexerCLAUSE_DISTINCT = 17 + QueryLexerL_PAREN = 18 + QueryLexerR_PAREN = 19 + QueryLexerAT = 20 + QueryLexerIDENT = 21 + QueryLexerNUMBER1 = 22 + QueryLexerZERO = 23 + QueryLexerSTRING = 24 + QueryLexerWS = 25 ) diff --git a/netmap/parser/query_parser.go b/netmap/parser/query_parser.go index db19c937..9ea64ffe 100644 --- a/netmap/parser/query_parser.go +++ b/netmap/parser/query_parser.go @@ -1,4 +1,4 @@ -// Code generated from Query.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from netmap/parser/Query.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser // Query @@ -33,88 +33,93 @@ var QueryParserStaticData struct { func queryParserInit() { staticData := &QueryParserStaticData staticData.LiteralNames = []string{ - "", "'NOT'", "'AND'", "'OR'", "", "'UNIQUE'", "'REP'", "'IN'", "'AS'", - "'CBF'", "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", - "'('", "')'", "'@'", "", "", "'0'", + "", "'NOT'", "'AND'", "'OR'", "", "'UNIQUE'", "'REP'", "'EC'", "'IN'", + "'AS'", "'CBF'", "'SELECT'", "'FROM'", "'FILTER'", "'*'", "'.'", "'SAME'", + "'DISTINCT'", "'('", "')'", "'@'", "", "", "'0'", } staticData.SymbolicNames = []string{ - "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "IN", - "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", + "", "NOT_OP", "AND_OP", "OR_OP", "SIMPLE_OP", "UNIQUE", "REP", "EC", + "IN", "AS", "CBF", "SELECT", "FROM", "FILTER", "WILDCARD", "DOT", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", } staticData.RuleNames = []string{ - "policy", "selectFilterExpr", "repStmt", "cbfStmt", "selectStmt", "clause", - "filterExpr", "filterStmt", "expr", "filterKey", "filterValue", "number", - "keyword", "ident", "identWC", + "policy", "selectFilterExpr", "ecStmt", "repStmt", "cbfStmt", "selectStmt", + "clause", "filterExpr", "filterStmt", "expr", "filterKey", "filterValue", + "number", "keyword", "ident", "identWC", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 23, 154, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 25, 165, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, - 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 3, 0, - 32, 8, 0, 1, 0, 4, 0, 35, 8, 0, 11, 0, 12, 0, 36, 1, 0, 3, 0, 40, 8, 0, - 1, 0, 5, 0, 43, 8, 0, 10, 0, 12, 0, 46, 9, 0, 1, 0, 5, 0, 49, 8, 0, 10, - 0, 12, 0, 52, 9, 0, 1, 0, 1, 0, 1, 1, 3, 1, 57, 8, 1, 1, 1, 3, 1, 60, 8, - 1, 1, 1, 5, 1, 63, 8, 1, 10, 1, 12, 1, 66, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, - 1, 2, 1, 2, 3, 2, 74, 8, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 3, - 4, 83, 8, 4, 1, 4, 3, 4, 86, 8, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 92, 8, - 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, - 6, 1, 6, 3, 6, 107, 8, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 115, - 8, 6, 10, 6, 12, 6, 118, 9, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, - 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 131, 8, 8, 1, 9, 1, 9, 3, 9, 135, 8, 9, 1, - 10, 1, 10, 1, 10, 3, 10, 140, 8, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, - 1, 13, 3, 13, 148, 8, 13, 1, 14, 1, 14, 3, 14, 152, 8, 14, 1, 14, 0, 1, - 12, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 0, 3, 1, - 0, 14, 15, 1, 0, 20, 21, 2, 0, 6, 8, 10, 12, 160, 0, 31, 1, 0, 0, 0, 2, - 56, 1, 0, 0, 0, 4, 69, 1, 0, 0, 0, 6, 75, 1, 0, 0, 0, 8, 78, 1, 0, 0, 0, - 10, 93, 1, 0, 0, 0, 12, 106, 1, 0, 0, 0, 14, 119, 1, 0, 0, 0, 16, 130, - 1, 0, 0, 0, 18, 134, 1, 0, 0, 0, 20, 139, 1, 0, 0, 0, 22, 141, 1, 0, 0, - 0, 24, 143, 1, 0, 0, 0, 26, 147, 1, 0, 0, 0, 28, 151, 1, 0, 0, 0, 30, 32, - 5, 5, 0, 0, 31, 30, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, - 33, 35, 3, 4, 2, 0, 34, 33, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 34, 1, - 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 39, 1, 0, 0, 0, 38, 40, 3, 6, 3, 0, 39, - 38, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 44, 1, 0, 0, 0, 41, 43, 3, 8, 4, - 0, 42, 41, 1, 0, 0, 0, 43, 46, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, - 1, 0, 0, 0, 45, 50, 1, 0, 0, 0, 46, 44, 1, 0, 0, 0, 47, 49, 3, 14, 7, 0, - 48, 47, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, - 0, 0, 0, 51, 53, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 54, 5, 0, 0, 1, 54, - 1, 1, 0, 0, 0, 55, 57, 3, 6, 3, 0, 56, 55, 1, 0, 0, 0, 56, 57, 1, 0, 0, - 0, 57, 59, 1, 0, 0, 0, 58, 60, 3, 8, 4, 0, 59, 58, 1, 0, 0, 0, 59, 60, - 1, 0, 0, 0, 60, 64, 1, 0, 0, 0, 61, 63, 3, 14, 7, 0, 62, 61, 1, 0, 0, 0, - 63, 66, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 67, 1, - 0, 0, 0, 66, 64, 1, 0, 0, 0, 67, 68, 5, 0, 0, 1, 68, 3, 1, 0, 0, 0, 69, - 70, 5, 6, 0, 0, 70, 73, 5, 20, 0, 0, 71, 72, 5, 7, 0, 0, 72, 74, 3, 26, - 13, 0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 5, 1, 0, 0, 0, 75, 76, - 5, 9, 0, 0, 76, 77, 5, 20, 0, 0, 77, 7, 1, 0, 0, 0, 78, 79, 5, 10, 0, 0, - 79, 85, 5, 20, 0, 0, 80, 82, 5, 7, 0, 0, 81, 83, 3, 10, 5, 0, 82, 81, 1, - 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 86, 3, 26, 13, 0, - 85, 80, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 88, 5, - 11, 0, 0, 88, 91, 3, 28, 14, 0, 89, 90, 5, 8, 0, 0, 90, 92, 3, 26, 13, - 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 9, 1, 0, 0, 0, 93, 94, 7, - 0, 0, 0, 94, 11, 1, 0, 0, 0, 95, 96, 6, 6, -1, 0, 96, 97, 5, 1, 0, 0, 97, - 98, 5, 16, 0, 0, 98, 99, 3, 12, 6, 0, 99, 100, 5, 17, 0, 0, 100, 107, 1, - 0, 0, 0, 101, 102, 5, 16, 0, 0, 102, 103, 3, 12, 6, 0, 103, 104, 5, 17, - 0, 0, 104, 107, 1, 0, 0, 0, 105, 107, 3, 16, 8, 0, 106, 95, 1, 0, 0, 0, - 106, 101, 1, 0, 0, 0, 106, 105, 1, 0, 0, 0, 107, 116, 1, 0, 0, 0, 108, - 109, 10, 4, 0, 0, 109, 110, 5, 2, 0, 0, 110, 115, 3, 12, 6, 5, 111, 112, - 10, 3, 0, 0, 112, 113, 5, 3, 0, 0, 113, 115, 3, 12, 6, 4, 114, 108, 1, - 0, 0, 0, 114, 111, 1, 0, 0, 0, 115, 118, 1, 0, 0, 0, 116, 114, 1, 0, 0, - 0, 116, 117, 1, 0, 0, 0, 117, 13, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 119, - 120, 5, 12, 0, 0, 120, 121, 3, 12, 6, 0, 121, 122, 5, 8, 0, 0, 122, 123, - 3, 26, 13, 0, 123, 15, 1, 0, 0, 0, 124, 125, 5, 18, 0, 0, 125, 131, 3, - 26, 13, 0, 126, 127, 3, 18, 9, 0, 127, 128, 5, 4, 0, 0, 128, 129, 3, 20, - 10, 0, 129, 131, 1, 0, 0, 0, 130, 124, 1, 0, 0, 0, 130, 126, 1, 0, 0, 0, - 131, 17, 1, 0, 0, 0, 132, 135, 3, 26, 13, 0, 133, 135, 5, 22, 0, 0, 134, - 132, 1, 0, 0, 0, 134, 133, 1, 0, 0, 0, 135, 19, 1, 0, 0, 0, 136, 140, 3, - 26, 13, 0, 137, 140, 3, 22, 11, 0, 138, 140, 5, 22, 0, 0, 139, 136, 1, - 0, 0, 0, 139, 137, 1, 0, 0, 0, 139, 138, 1, 0, 0, 0, 140, 21, 1, 0, 0, - 0, 141, 142, 7, 1, 0, 0, 142, 23, 1, 0, 0, 0, 143, 144, 7, 2, 0, 0, 144, - 25, 1, 0, 0, 0, 145, 148, 3, 24, 12, 0, 146, 148, 5, 19, 0, 0, 147, 145, - 1, 0, 0, 0, 147, 146, 1, 0, 0, 0, 148, 27, 1, 0, 0, 0, 149, 152, 3, 26, - 13, 0, 150, 152, 5, 13, 0, 0, 151, 149, 1, 0, 0, 0, 151, 150, 1, 0, 0, - 0, 152, 29, 1, 0, 0, 0, 20, 31, 36, 39, 44, 50, 56, 59, 64, 73, 82, 85, - 91, 106, 114, 116, 130, 134, 139, 147, 151, + 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, + 1, 0, 3, 0, 34, 8, 0, 1, 0, 1, 0, 4, 0, 38, 8, 0, 11, 0, 12, 0, 39, 1, + 0, 3, 0, 43, 8, 0, 1, 0, 5, 0, 46, 8, 0, 10, 0, 12, 0, 49, 9, 0, 1, 0, + 5, 0, 52, 8, 0, 10, 0, 12, 0, 55, 9, 0, 1, 0, 1, 0, 1, 1, 3, 1, 60, 8, + 1, 1, 1, 3, 1, 63, 8, 1, 1, 1, 5, 1, 66, 8, 1, 10, 1, 12, 1, 69, 9, 1, + 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 79, 8, 2, 1, 3, 1, + 3, 1, 3, 1, 3, 3, 3, 85, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, + 3, 5, 94, 8, 5, 1, 5, 3, 5, 97, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 103, + 8, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, + 1, 7, 1, 7, 3, 7, 118, 8, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, + 126, 8, 7, 10, 7, 12, 7, 129, 9, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, + 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 142, 8, 9, 1, 10, 1, 10, 3, 10, 146, + 8, 10, 1, 11, 1, 11, 1, 11, 3, 11, 151, 8, 11, 1, 12, 1, 12, 1, 13, 1, + 13, 1, 14, 1, 14, 3, 14, 159, 8, 14, 1, 15, 1, 15, 3, 15, 163, 8, 15, 1, + 15, 0, 1, 14, 16, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, + 30, 0, 3, 1, 0, 16, 17, 1, 0, 22, 23, 3, 0, 6, 6, 8, 9, 11, 13, 172, 0, + 33, 1, 0, 0, 0, 2, 59, 1, 0, 0, 0, 4, 72, 1, 0, 0, 0, 6, 80, 1, 0, 0, 0, + 8, 86, 1, 0, 0, 0, 10, 89, 1, 0, 0, 0, 12, 104, 1, 0, 0, 0, 14, 117, 1, + 0, 0, 0, 16, 130, 1, 0, 0, 0, 18, 141, 1, 0, 0, 0, 20, 145, 1, 0, 0, 0, + 22, 150, 1, 0, 0, 0, 24, 152, 1, 0, 0, 0, 26, 154, 1, 0, 0, 0, 28, 158, + 1, 0, 0, 0, 30, 162, 1, 0, 0, 0, 32, 34, 5, 5, 0, 0, 33, 32, 1, 0, 0, 0, + 33, 34, 1, 0, 0, 0, 34, 37, 1, 0, 0, 0, 35, 38, 3, 6, 3, 0, 36, 38, 3, + 4, 2, 0, 37, 35, 1, 0, 0, 0, 37, 36, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, + 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 42, 1, 0, 0, 0, 41, 43, 3, 8, 4, + 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 47, 1, 0, 0, 0, 44, 46, + 3, 10, 5, 0, 45, 44, 1, 0, 0, 0, 46, 49, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, + 47, 48, 1, 0, 0, 0, 48, 53, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 50, 52, 3, + 16, 8, 0, 51, 50, 1, 0, 0, 0, 52, 55, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, + 54, 1, 0, 0, 0, 54, 56, 1, 0, 0, 0, 55, 53, 1, 0, 0, 0, 56, 57, 5, 0, 0, + 1, 57, 1, 1, 0, 0, 0, 58, 60, 3, 8, 4, 0, 59, 58, 1, 0, 0, 0, 59, 60, 1, + 0, 0, 0, 60, 62, 1, 0, 0, 0, 61, 63, 3, 10, 5, 0, 62, 61, 1, 0, 0, 0, 62, + 63, 1, 0, 0, 0, 63, 67, 1, 0, 0, 0, 64, 66, 3, 16, 8, 0, 65, 64, 1, 0, + 0, 0, 66, 69, 1, 0, 0, 0, 67, 65, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 70, + 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 70, 71, 5, 0, 0, 1, 71, 3, 1, 0, 0, 0, + 72, 73, 5, 7, 0, 0, 73, 74, 5, 22, 0, 0, 74, 75, 5, 15, 0, 0, 75, 78, 5, + 22, 0, 0, 76, 77, 5, 8, 0, 0, 77, 79, 3, 28, 14, 0, 78, 76, 1, 0, 0, 0, + 78, 79, 1, 0, 0, 0, 79, 5, 1, 0, 0, 0, 80, 81, 5, 6, 0, 0, 81, 84, 5, 22, + 0, 0, 82, 83, 5, 8, 0, 0, 83, 85, 3, 28, 14, 0, 84, 82, 1, 0, 0, 0, 84, + 85, 1, 0, 0, 0, 85, 7, 1, 0, 0, 0, 86, 87, 5, 10, 0, 0, 87, 88, 5, 22, + 0, 0, 88, 9, 1, 0, 0, 0, 89, 90, 5, 11, 0, 0, 90, 96, 5, 22, 0, 0, 91, + 93, 5, 8, 0, 0, 92, 94, 3, 12, 6, 0, 93, 92, 1, 0, 0, 0, 93, 94, 1, 0, + 0, 0, 94, 95, 1, 0, 0, 0, 95, 97, 3, 20, 10, 0, 96, 91, 1, 0, 0, 0, 96, + 97, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 5, 12, 0, 0, 99, 102, 3, 30, + 15, 0, 100, 101, 5, 9, 0, 0, 101, 103, 3, 28, 14, 0, 102, 100, 1, 0, 0, + 0, 102, 103, 1, 0, 0, 0, 103, 11, 1, 0, 0, 0, 104, 105, 7, 0, 0, 0, 105, + 13, 1, 0, 0, 0, 106, 107, 6, 7, -1, 0, 107, 108, 5, 1, 0, 0, 108, 109, + 5, 18, 0, 0, 109, 110, 3, 14, 7, 0, 110, 111, 5, 19, 0, 0, 111, 118, 1, + 0, 0, 0, 112, 113, 5, 18, 0, 0, 113, 114, 3, 14, 7, 0, 114, 115, 5, 19, + 0, 0, 115, 118, 1, 0, 0, 0, 116, 118, 3, 18, 9, 0, 117, 106, 1, 0, 0, 0, + 117, 112, 1, 0, 0, 0, 117, 116, 1, 0, 0, 0, 118, 127, 1, 0, 0, 0, 119, + 120, 10, 4, 0, 0, 120, 121, 5, 2, 0, 0, 121, 126, 3, 14, 7, 5, 122, 123, + 10, 3, 0, 0, 123, 124, 5, 3, 0, 0, 124, 126, 3, 14, 7, 4, 125, 119, 1, + 0, 0, 0, 125, 122, 1, 0, 0, 0, 126, 129, 1, 0, 0, 0, 127, 125, 1, 0, 0, + 0, 127, 128, 1, 0, 0, 0, 128, 15, 1, 0, 0, 0, 129, 127, 1, 0, 0, 0, 130, + 131, 5, 13, 0, 0, 131, 132, 3, 14, 7, 0, 132, 133, 5, 9, 0, 0, 133, 134, + 3, 28, 14, 0, 134, 17, 1, 0, 0, 0, 135, 136, 5, 20, 0, 0, 136, 142, 3, + 28, 14, 0, 137, 138, 3, 20, 10, 0, 138, 139, 5, 4, 0, 0, 139, 140, 3, 22, + 11, 0, 140, 142, 1, 0, 0, 0, 141, 135, 1, 0, 0, 0, 141, 137, 1, 0, 0, 0, + 142, 19, 1, 0, 0, 0, 143, 146, 3, 28, 14, 0, 144, 146, 5, 24, 0, 0, 145, + 143, 1, 0, 0, 0, 145, 144, 1, 0, 0, 0, 146, 21, 1, 0, 0, 0, 147, 151, 3, + 28, 14, 0, 148, 151, 3, 24, 12, 0, 149, 151, 5, 24, 0, 0, 150, 147, 1, + 0, 0, 0, 150, 148, 1, 0, 0, 0, 150, 149, 1, 0, 0, 0, 151, 23, 1, 0, 0, + 0, 152, 153, 7, 1, 0, 0, 153, 25, 1, 0, 0, 0, 154, 155, 7, 2, 0, 0, 155, + 27, 1, 0, 0, 0, 156, 159, 3, 26, 13, 0, 157, 159, 5, 21, 0, 0, 158, 156, + 1, 0, 0, 0, 158, 157, 1, 0, 0, 0, 159, 29, 1, 0, 0, 0, 160, 163, 3, 28, + 14, 0, 161, 163, 5, 14, 0, 0, 162, 160, 1, 0, 0, 0, 162, 161, 1, 0, 0, + 0, 163, 31, 1, 0, 0, 0, 22, 33, 37, 39, 42, 47, 53, 59, 62, 67, 78, 84, + 93, 96, 102, 117, 125, 127, 141, 145, 150, 158, 162, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -159,42 +164,45 @@ const ( QuerySIMPLE_OP = 4 QueryUNIQUE = 5 QueryREP = 6 - QueryIN = 7 - QueryAS = 8 - QueryCBF = 9 - QuerySELECT = 10 - QueryFROM = 11 - QueryFILTER = 12 - QueryWILDCARD = 13 - QueryCLAUSE_SAME = 14 - QueryCLAUSE_DISTINCT = 15 - QueryL_PAREN = 16 - QueryR_PAREN = 17 - QueryAT = 18 - QueryIDENT = 19 - QueryNUMBER1 = 20 - QueryZERO = 21 - QuerySTRING = 22 - QueryWS = 23 + QueryEC = 7 + QueryIN = 8 + QueryAS = 9 + QueryCBF = 10 + QuerySELECT = 11 + QueryFROM = 12 + QueryFILTER = 13 + QueryWILDCARD = 14 + QueryDOT = 15 + QueryCLAUSE_SAME = 16 + QueryCLAUSE_DISTINCT = 17 + QueryL_PAREN = 18 + QueryR_PAREN = 19 + QueryAT = 20 + QueryIDENT = 21 + QueryNUMBER1 = 22 + QueryZERO = 23 + QuerySTRING = 24 + QueryWS = 25 ) // Query rules. const ( QueryRULE_policy = 0 QueryRULE_selectFilterExpr = 1 - QueryRULE_repStmt = 2 - QueryRULE_cbfStmt = 3 - QueryRULE_selectStmt = 4 - QueryRULE_clause = 5 - QueryRULE_filterExpr = 6 - QueryRULE_filterStmt = 7 - QueryRULE_expr = 8 - QueryRULE_filterKey = 9 - QueryRULE_filterValue = 10 - QueryRULE_number = 11 - QueryRULE_keyword = 12 - QueryRULE_ident = 13 - QueryRULE_identWC = 14 + QueryRULE_ecStmt = 2 + QueryRULE_repStmt = 3 + QueryRULE_cbfStmt = 4 + QueryRULE_selectStmt = 5 + QueryRULE_clause = 6 + QueryRULE_filterExpr = 7 + QueryRULE_filterStmt = 8 + QueryRULE_expr = 9 + QueryRULE_filterKey = 10 + QueryRULE_filterValue = 11 + QueryRULE_number = 12 + QueryRULE_keyword = 13 + QueryRULE_ident = 14 + QueryRULE_identWC = 15 ) // IPolicyContext is an interface to support dynamic dispatch. @@ -209,6 +217,8 @@ type IPolicyContext interface { UNIQUE() antlr.TerminalNode AllRepStmt() []IRepStmtContext RepStmt(i int) IRepStmtContext + AllEcStmt() []IEcStmtContext + EcStmt(i int) IEcStmtContext CbfStmt() ICbfStmtContext AllSelectStmt() []ISelectStmtContext SelectStmt(i int) ISelectStmtContext @@ -300,6 +310,47 @@ func (s *PolicyContext) RepStmt(i int) IRepStmtContext { return t.(IRepStmtContext) } +func (s *PolicyContext) AllEcStmt() []IEcStmtContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IEcStmtContext); ok { + len++ + } + } + + tst := make([]IEcStmtContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IEcStmtContext); ok { + tst[i] = t.(IEcStmtContext) + i++ + } + } + + return tst +} + +func (s *PolicyContext) EcStmt(i int) IEcStmtContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEcStmtContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IEcStmtContext) +} + func (s *PolicyContext) CbfStmt() ICbfStmtContext { var t antlr.RuleContext for _, ctx := range s.GetChildren() { @@ -422,7 +473,7 @@ func (p *Query) Policy() (localctx IPolicyContext) { var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(31) + p.SetState(33) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -431,7 +482,7 @@ func (p *Query) Policy() (localctx IPolicyContext) { if _la == QueryUNIQUE { { - p.SetState(30) + p.SetState(32) p.Match(QueryUNIQUE) if p.HasError() { // Recognition error - abort rule @@ -440,27 +491,46 @@ func (p *Query) Policy() (localctx IPolicyContext) { } } - p.SetState(34) + p.SetState(37) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) - for ok := true; ok; ok = _la == QueryREP { - { - p.SetState(33) - p.RepStmt() + for ok := true; ok; ok = _la == QueryREP || _la == QueryEC { + p.SetState(37) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit } - p.SetState(36) + switch p.GetTokenStream().LA(1) { + case QueryREP: + { + p.SetState(35) + p.RepStmt() + } + + case QueryEC: + { + p.SetState(36) + p.EcStmt() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(39) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) } - p.SetState(39) + p.SetState(42) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -469,12 +539,12 @@ func (p *Query) Policy() (localctx IPolicyContext) { if _la == QueryCBF { { - p.SetState(38) + p.SetState(41) p.CbfStmt() } } - p.SetState(44) + p.SetState(47) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -483,18 +553,18 @@ func (p *Query) Policy() (localctx IPolicyContext) { for _la == QuerySELECT { { - p.SetState(41) + p.SetState(44) p.SelectStmt() } - p.SetState(46) + p.SetState(49) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) } - p.SetState(50) + p.SetState(53) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -503,11 +573,11 @@ func (p *Query) Policy() (localctx IPolicyContext) { for _la == QueryFILTER { { - p.SetState(47) + p.SetState(50) p.FilterStmt() } - p.SetState(52) + p.SetState(55) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -515,7 +585,7 @@ func (p *Query) Policy() (localctx IPolicyContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(53) + p.SetState(56) p.Match(QueryEOF) if p.HasError() { // Recognition error - abort rule @@ -687,7 +757,7 @@ func (p *Query) SelectFilterExpr() (localctx ISelectFilterExprContext) { var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(56) + p.SetState(59) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -696,12 +766,12 @@ func (p *Query) SelectFilterExpr() (localctx ISelectFilterExprContext) { if _la == QueryCBF { { - p.SetState(55) + p.SetState(58) p.CbfStmt() } } - p.SetState(59) + p.SetState(62) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -710,12 +780,12 @@ func (p *Query) SelectFilterExpr() (localctx ISelectFilterExprContext) { if _la == QuerySELECT { { - p.SetState(58) + p.SetState(61) p.SelectStmt() } } - p.SetState(64) + p.SetState(67) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -724,11 +794,11 @@ func (p *Query) SelectFilterExpr() (localctx ISelectFilterExprContext) { for _la == QueryFILTER { { - p.SetState(61) + p.SetState(64) p.FilterStmt() } - p.SetState(66) + p.SetState(69) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -736,7 +806,7 @@ func (p *Query) SelectFilterExpr() (localctx ISelectFilterExprContext) { _la = p.GetTokenStream().LA(1) } { - p.SetState(67) + p.SetState(70) p.Match(QueryEOF) if p.HasError() { // Recognition error - abort rule @@ -757,6 +827,227 @@ errorExit: goto errorExit // Trick to prevent compiler error if the label is not used } +// IEcStmtContext is an interface to support dynamic dispatch. +type IEcStmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // GetData returns the Data token. + GetData() antlr.Token + + // GetParity returns the Parity token. + GetParity() antlr.Token + + // SetData sets the Data token. + SetData(antlr.Token) + + // SetParity sets the Parity token. + SetParity(antlr.Token) + + // GetSelector returns the Selector rule contexts. + GetSelector() IIdentContext + + // SetSelector sets the Selector rule contexts. + SetSelector(IIdentContext) + + // Getter signatures + EC() antlr.TerminalNode + DOT() antlr.TerminalNode + AllNUMBER1() []antlr.TerminalNode + NUMBER1(i int) antlr.TerminalNode + IN() antlr.TerminalNode + Ident() IIdentContext + + // IsEcStmtContext differentiates from other interfaces. + IsEcStmtContext() +} + +type EcStmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser + Data antlr.Token + Parity antlr.Token + Selector IIdentContext +} + +func NewEmptyEcStmtContext() *EcStmtContext { + var p = new(EcStmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_ecStmt + return p +} + +func InitEmptyEcStmtContext(p *EcStmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = QueryRULE_ecStmt +} + +func (*EcStmtContext) IsEcStmtContext() {} + +func NewEcStmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EcStmtContext { + var p = new(EcStmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = QueryRULE_ecStmt + + return p +} + +func (s *EcStmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *EcStmtContext) GetData() antlr.Token { return s.Data } + +func (s *EcStmtContext) GetParity() antlr.Token { return s.Parity } + +func (s *EcStmtContext) SetData(v antlr.Token) { s.Data = v } + +func (s *EcStmtContext) SetParity(v antlr.Token) { s.Parity = v } + +func (s *EcStmtContext) GetSelector() IIdentContext { return s.Selector } + +func (s *EcStmtContext) SetSelector(v IIdentContext) { s.Selector = v } + +func (s *EcStmtContext) EC() antlr.TerminalNode { + return s.GetToken(QueryEC, 0) +} + +func (s *EcStmtContext) DOT() antlr.TerminalNode { + return s.GetToken(QueryDOT, 0) +} + +func (s *EcStmtContext) AllNUMBER1() []antlr.TerminalNode { + return s.GetTokens(QueryNUMBER1) +} + +func (s *EcStmtContext) NUMBER1(i int) antlr.TerminalNode { + return s.GetToken(QueryNUMBER1, i) +} + +func (s *EcStmtContext) IN() antlr.TerminalNode { + return s.GetToken(QueryIN, 0) +} + +func (s *EcStmtContext) Ident() IIdentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentContext) +} + +func (s *EcStmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *EcStmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *EcStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case QueryVisitor: + return t.VisitEcStmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *Query) EcStmt() (localctx IEcStmtContext) { + localctx = NewEcStmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 4, QueryRULE_ecStmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(72) + p.Match(QueryEC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(73) + + var _m = p.Match(QueryNUMBER1) + + localctx.(*EcStmtContext).Data = _m + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(74) + p.Match(QueryDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(75) + + var _m = p.Match(QueryNUMBER1) + + localctx.(*EcStmtContext).Parity = _m + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(78) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == QueryIN { + { + p.SetState(76) + p.Match(QueryIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(77) + + var _x = p.Ident() + + localctx.(*EcStmtContext).Selector = _x + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + // IRepStmtContext is an interface to support dynamic dispatch. type IRepStmtContext interface { antlr.ParserRuleContext @@ -876,12 +1167,12 @@ func (s *RepStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) RepStmt() (localctx IRepStmtContext) { localctx = NewRepStmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 4, QueryRULE_repStmt) + p.EnterRule(localctx, 6, QueryRULE_repStmt) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(69) + p.SetState(80) p.Match(QueryREP) if p.HasError() { // Recognition error - abort rule @@ -889,7 +1180,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { } } { - p.SetState(70) + p.SetState(81) var _m = p.Match(QueryNUMBER1) @@ -899,7 +1190,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { goto errorExit } } - p.SetState(73) + p.SetState(84) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -908,7 +1199,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { if _la == QueryIN { { - p.SetState(71) + p.SetState(82) p.Match(QueryIN) if p.HasError() { // Recognition error - abort rule @@ -916,7 +1207,7 @@ func (p *Query) RepStmt() (localctx IRepStmtContext) { } } { - p.SetState(72) + p.SetState(83) var _x = p.Ident() @@ -1024,10 +1315,10 @@ func (s *CbfStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) CbfStmt() (localctx ICbfStmtContext) { localctx = NewCbfStmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 6, QueryRULE_cbfStmt) + p.EnterRule(localctx, 8, QueryRULE_cbfStmt) p.EnterOuterAlt(localctx, 1) { - p.SetState(75) + p.SetState(86) p.Match(QueryCBF) if p.HasError() { // Recognition error - abort rule @@ -1035,7 +1326,7 @@ func (p *Query) CbfStmt() (localctx ICbfStmtContext) { } } { - p.SetState(76) + p.SetState(87) var _m = p.Match(QueryNUMBER1) @@ -1073,7 +1364,7 @@ type ISelectStmtContext interface { SetCount(antlr.Token) // GetBucket returns the Bucket rule contexts. - GetBucket() IIdentContext + GetBucket() IFilterKeyContext // GetFilter returns the Filter rule contexts. GetFilter() IIdentWCContext @@ -1082,7 +1373,7 @@ type ISelectStmtContext interface { GetName() IIdentContext // SetBucket sets the Bucket rule contexts. - SetBucket(IIdentContext) + SetBucket(IFilterKeyContext) // SetFilter sets the Filter rule contexts. SetFilter(IIdentWCContext) @@ -1097,8 +1388,8 @@ type ISelectStmtContext interface { IdentWC() IIdentWCContext IN() antlr.TerminalNode AS() antlr.TerminalNode - AllIdent() []IIdentContext - Ident(i int) IIdentContext + FilterKey() IFilterKeyContext + Ident() IIdentContext Clause() IClauseContext // IsSelectStmtContext differentiates from other interfaces. @@ -1109,7 +1400,7 @@ type SelectStmtContext struct { antlr.BaseParserRuleContext parser antlr.Parser Count antlr.Token - Bucket IIdentContext + Bucket IFilterKeyContext Filter IIdentWCContext Name IIdentContext } @@ -1145,13 +1436,13 @@ func (s *SelectStmtContext) GetCount() antlr.Token { return s.Count } func (s *SelectStmtContext) SetCount(v antlr.Token) { s.Count = v } -func (s *SelectStmtContext) GetBucket() IIdentContext { return s.Bucket } +func (s *SelectStmtContext) GetBucket() IFilterKeyContext { return s.Bucket } func (s *SelectStmtContext) GetFilter() IIdentWCContext { return s.Filter } func (s *SelectStmtContext) GetName() IIdentContext { return s.Name } -func (s *SelectStmtContext) SetBucket(v IIdentContext) { s.Bucket = v } +func (s *SelectStmtContext) SetBucket(v IFilterKeyContext) { s.Bucket = v } func (s *SelectStmtContext) SetFilter(v IIdentWCContext) { s.Filter = v } @@ -1193,37 +1484,28 @@ func (s *SelectStmtContext) AS() antlr.TerminalNode { return s.GetToken(QueryAS, 0) } -func (s *SelectStmtContext) AllIdent() []IIdentContext { - children := s.GetChildren() - len := 0 - for _, ctx := range children { - if _, ok := ctx.(IIdentContext); ok { - len++ +func (s *SelectStmtContext) FilterKey() IFilterKeyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFilterKeyContext); ok { + t = ctx.(antlr.RuleContext) + break } } - tst := make([]IIdentContext, len) - i := 0 - for _, ctx := range children { - if t, ok := ctx.(IIdentContext); ok { - tst[i] = t.(IIdentContext) - i++ - } + if t == nil { + return nil } - return tst + return t.(IFilterKeyContext) } -func (s *SelectStmtContext) Ident(i int) IIdentContext { +func (s *SelectStmtContext) Ident() IIdentContext { var t antlr.RuleContext - j := 0 for _, ctx := range s.GetChildren() { if _, ok := ctx.(IIdentContext); ok { - if j == i { - t = ctx.(antlr.RuleContext) - break - } - j++ + t = ctx.(antlr.RuleContext) + break } } @@ -1270,12 +1552,12 @@ func (s *SelectStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) SelectStmt() (localctx ISelectStmtContext) { localctx = NewSelectStmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 8, QueryRULE_selectStmt) + p.EnterRule(localctx, 10, QueryRULE_selectStmt) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(78) + p.SetState(89) p.Match(QuerySELECT) if p.HasError() { // Recognition error - abort rule @@ -1283,7 +1565,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(79) + p.SetState(90) var _m = p.Match(QueryNUMBER1) @@ -1293,7 +1575,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { goto errorExit } } - p.SetState(85) + p.SetState(96) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1302,14 +1584,14 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryIN { { - p.SetState(80) + p.SetState(91) p.Match(QueryIN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(82) + p.SetState(93) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1318,22 +1600,22 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryCLAUSE_SAME || _la == QueryCLAUSE_DISTINCT { { - p.SetState(81) + p.SetState(92) p.Clause() } } { - p.SetState(84) + p.SetState(95) - var _x = p.Ident() + var _x = p.FilterKey() localctx.(*SelectStmtContext).Bucket = _x } } { - p.SetState(87) + p.SetState(98) p.Match(QueryFROM) if p.HasError() { // Recognition error - abort rule @@ -1341,13 +1623,13 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(88) + p.SetState(99) var _x = p.IdentWC() localctx.(*SelectStmtContext).Filter = _x } - p.SetState(91) + p.SetState(102) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1356,7 +1638,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { if _la == QueryAS { { - p.SetState(89) + p.SetState(100) p.Match(QueryAS) if p.HasError() { // Recognition error - abort rule @@ -1364,7 +1646,7 @@ func (p *Query) SelectStmt() (localctx ISelectStmtContext) { } } { - p.SetState(90) + p.SetState(101) var _x = p.Ident() @@ -1461,12 +1743,12 @@ func (s *ClauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Clause() (localctx IClauseContext) { localctx = NewClauseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 10, QueryRULE_clause) + p.EnterRule(localctx, 12, QueryRULE_clause) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(93) + p.SetState(104) _la = p.GetTokenStream().LA(1) if !(_la == QueryCLAUSE_SAME || _la == QueryCLAUSE_DISTINCT) { @@ -1693,12 +1975,12 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { localctx = NewFilterExprContext(p, p.GetParserRuleContext(), _parentState) var _prevctx IFilterExprContext = localctx var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. - _startState := 12 - p.EnterRecursionRule(localctx, 12, QueryRULE_filterExpr, _p) + _startState := 14 + p.EnterRecursionRule(localctx, 14, QueryRULE_filterExpr, _p) var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(106) + p.SetState(117) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1707,7 +1989,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { switch p.GetTokenStream().LA(1) { case QueryNOT_OP: { - p.SetState(96) + p.SetState(107) var _m = p.Match(QueryNOT_OP) @@ -1718,7 +2000,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(97) + p.SetState(108) p.Match(QueryL_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1726,14 +2008,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(98) + p.SetState(109) var _x = p.filterExpr(0) localctx.(*FilterExprContext).F1 = _x } { - p.SetState(99) + p.SetState(110) p.Match(QueryR_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1743,7 +2025,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { case QueryL_PAREN: { - p.SetState(101) + p.SetState(112) p.Match(QueryL_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1751,14 +2033,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(102) + p.SetState(113) var _x = p.filterExpr(0) localctx.(*FilterExprContext).Inner = _x } { - p.SetState(103) + p.SetState(114) p.Match(QueryR_PAREN) if p.HasError() { // Recognition error - abort rule @@ -1768,7 +2050,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryAT, QueryIDENT, QuerySTRING: { - p.SetState(105) + p.SetState(116) p.Expr() } @@ -1777,12 +2059,12 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { goto errorExit } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(116) + p.SetState(127) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 16, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -1792,25 +2074,25 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { p.TriggerExitRuleEvent() } _prevctx = localctx - p.SetState(114) + p.SetState(125) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) { case 1: localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr) - p.SetState(108) + p.SetState(119) if !(p.Precpred(p.GetParserRuleContext(), 4)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) goto errorExit } { - p.SetState(109) + p.SetState(120) var _m = p.Match(QueryAND_OP) @@ -1821,7 +2103,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(110) + p.SetState(121) var _x = p.filterExpr(5) @@ -1832,14 +2114,14 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { localctx = NewFilterExprContext(p, _parentctx, _parentState) localctx.(*FilterExprContext).F1 = _prevctx p.PushNewRecursionContext(localctx, _startState, QueryRULE_filterExpr) - p.SetState(111) + p.SetState(122) if !(p.Precpred(p.GetParserRuleContext(), 3)) { p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) goto errorExit } { - p.SetState(112) + p.SetState(123) var _m = p.Match(QueryOR_OP) @@ -1850,7 +2132,7 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } { - p.SetState(113) + p.SetState(124) var _x = p.filterExpr(4) @@ -1862,12 +2144,12 @@ func (p *Query) filterExpr(_p int) (localctx IFilterExprContext) { } } - p.SetState(118) + p.SetState(129) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 16, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -2017,10 +2299,10 @@ func (s *FilterStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) FilterStmt() (localctx IFilterStmtContext) { localctx = NewFilterStmtContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 14, QueryRULE_filterStmt) + p.EnterRule(localctx, 16, QueryRULE_filterStmt) p.EnterOuterAlt(localctx, 1) { - p.SetState(119) + p.SetState(130) p.Match(QueryFILTER) if p.HasError() { // Recognition error - abort rule @@ -2028,14 +2310,14 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { } } { - p.SetState(120) + p.SetState(131) var _x = p.filterExpr(0) localctx.(*FilterStmtContext).Expr = _x } { - p.SetState(121) + p.SetState(132) p.Match(QueryAS) if p.HasError() { // Recognition error - abort rule @@ -2043,7 +2325,7 @@ func (p *Query) FilterStmt() (localctx IFilterStmtContext) { } } { - p.SetState(122) + p.SetState(133) var _x = p.Ident() @@ -2222,8 +2504,8 @@ func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Expr() (localctx IExprContext) { localctx = NewExprContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 16, QueryRULE_expr) - p.SetState(130) + p.EnterRule(localctx, 18, QueryRULE_expr) + p.SetState(141) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2233,7 +2515,7 @@ func (p *Query) Expr() (localctx IExprContext) { case QueryAT: p.EnterOuterAlt(localctx, 1) { - p.SetState(124) + p.SetState(135) p.Match(QueryAT) if p.HasError() { // Recognition error - abort rule @@ -2241,7 +2523,7 @@ func (p *Query) Expr() (localctx IExprContext) { } } { - p.SetState(125) + p.SetState(136) var _x = p.Ident() @@ -2251,14 +2533,14 @@ func (p *Query) Expr() (localctx IExprContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT, QuerySTRING: p.EnterOuterAlt(localctx, 2) { - p.SetState(126) + p.SetState(137) var _x = p.FilterKey() localctx.(*ExprContext).Key = _x } { - p.SetState(127) + p.SetState(138) p.Match(QuerySIMPLE_OP) if p.HasError() { // Recognition error - abort rule @@ -2266,7 +2548,7 @@ func (p *Query) Expr() (localctx IExprContext) { } } { - p.SetState(128) + p.SetState(139) var _x = p.FilterValue() @@ -2378,8 +2660,8 @@ func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) FilterKey() (localctx IFilterKeyContext) { localctx = NewFilterKeyContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 18, QueryRULE_filterKey) - p.SetState(134) + p.EnterRule(localctx, 20, QueryRULE_filterKey) + p.SetState(145) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2389,14 +2671,14 @@ func (p *Query) FilterKey() (localctx IFilterKeyContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(132) + p.SetState(143) p.Ident() } case QuerySTRING: p.EnterOuterAlt(localctx, 2) { - p.SetState(133) + p.SetState(144) p.Match(QuerySTRING) if p.HasError() { // Recognition error - abort rule @@ -2526,8 +2808,8 @@ func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} func (p *Query) FilterValue() (localctx IFilterValueContext) { localctx = NewFilterValueContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 20, QueryRULE_filterValue) - p.SetState(139) + p.EnterRule(localctx, 22, QueryRULE_filterValue) + p.SetState(150) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2537,21 +2819,21 @@ func (p *Query) FilterValue() (localctx IFilterValueContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(136) + p.SetState(147) p.Ident() } case QueryNUMBER1, QueryZERO: p.EnterOuterAlt(localctx, 2) { - p.SetState(137) + p.SetState(148) p.Number() } case QuerySTRING: p.EnterOuterAlt(localctx, 3) { - p.SetState(138) + p.SetState(149) p.Match(QuerySTRING) if p.HasError() { // Recognition error - abort rule @@ -2652,12 +2934,12 @@ func (s *NumberContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Number() (localctx INumberContext) { localctx = NewNumberContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 22, QueryRULE_number) + p.EnterRule(localctx, 24, QueryRULE_number) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(141) + p.SetState(152) _la = p.GetTokenStream().LA(1) if !(_la == QueryNUMBER1 || _la == QueryZERO) { @@ -2776,15 +3058,15 @@ func (s *KeywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Keyword() (localctx IKeywordContext) { localctx = NewKeywordContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 24, QueryRULE_keyword) + p.EnterRule(localctx, 26, QueryRULE_keyword) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(143) + p.SetState(154) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&7616) != 0) { + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&15168) != 0) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) @@ -2892,8 +3174,8 @@ func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) Ident() (localctx IIdentContext) { localctx = NewIdentContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 26, QueryRULE_ident) - p.SetState(147) + p.EnterRule(localctx, 28, QueryRULE_ident) + p.SetState(158) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2903,14 +3185,14 @@ func (p *Query) Ident() (localctx IIdentContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER: p.EnterOuterAlt(localctx, 1) { - p.SetState(145) + p.SetState(156) p.Keyword() } case QueryIDENT: p.EnterOuterAlt(localctx, 2) { - p.SetState(146) + p.SetState(157) p.Match(QueryIDENT) if p.HasError() { // Recognition error - abort rule @@ -3023,8 +3305,8 @@ func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { func (p *Query) IdentWC() (localctx IIdentWCContext) { localctx = NewIdentWCContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 28, QueryRULE_identWC) - p.SetState(151) + p.EnterRule(localctx, 30, QueryRULE_identWC) + p.SetState(162) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3034,14 +3316,14 @@ func (p *Query) IdentWC() (localctx IIdentWCContext) { case QueryREP, QueryIN, QueryAS, QuerySELECT, QueryFROM, QueryFILTER, QueryIDENT: p.EnterOuterAlt(localctx, 1) { - p.SetState(149) + p.SetState(160) p.Ident() } case QueryWILDCARD: p.EnterOuterAlt(localctx, 2) { - p.SetState(150) + p.SetState(161) p.Match(QueryWILDCARD) if p.HasError() { // Recognition error - abort rule @@ -3069,7 +3351,7 @@ errorExit: func (p *Query) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { switch ruleIndex { - case 6: + case 7: var t *FilterExprContext = nil if localctx != nil { t = localctx.(*FilterExprContext) diff --git a/netmap/parser/query_visitor.go b/netmap/parser/query_visitor.go index 7550d99e..559f4161 100644 --- a/netmap/parser/query_visitor.go +++ b/netmap/parser/query_visitor.go @@ -1,4 +1,4 @@ -// Code generated from Query.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from netmap/parser/Query.g4 by ANTLR 4.13.1. DO NOT EDIT. package parser // Query @@ -14,6 +14,9 @@ type QueryVisitor interface { // Visit a parse tree produced by Query#selectFilterExpr. VisitSelectFilterExpr(ctx *SelectFilterExprContext) interface{} + // Visit a parse tree produced by Query#ecStmt. + VisitEcStmt(ctx *EcStmtContext) interface{} + // Visit a parse tree produced by Query#repStmt. VisitRepStmt(ctx *RepStmtContext) interface{} diff --git a/netmap/policy.go b/netmap/policy.go index 5d85897b..735e4f17 100644 --- a/netmap/policy.go +++ b/netmap/policy.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/parser" "github.com/antlr4-go/antlr/v4" ) @@ -16,7 +16,7 @@ import ( // Within itself, PlacementPolicy represents a set of rules to select a subset // of nodes from FrostFS network map - node-candidates for object storage. // -// PlacementPolicy is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap.PlacementPolicy +// PlacementPolicy is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap.PlacementPolicy // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. @@ -34,8 +34,17 @@ type PlacementPolicy struct { func (p *PlacementPolicy) readFromV2(m netmap.PlacementPolicy, checkFieldPresence bool) error { p.replicas = m.GetReplicas() - if checkFieldPresence && len(p.replicas) == 0 { - return errors.New("missing replicas") + if checkFieldPresence { + if len(p.replicas) == 0 { + return errors.New("missing replicas") + } + if len(p.replicas) != 1 { + for i := range p.replicas { + if p.replicas[i].GetECDataCount() != 0 || p.replicas[i].GetECParityCount() != 0 { + return errors.New("erasure code group must be used exclusively") + } + } + } } p.backupFactor = m.GetContainerBackupFactor() @@ -130,6 +139,14 @@ func (r *ReplicaDescriptor) SetNumberOfObjects(c uint32) { r.m.SetCount(c) } +func (r *ReplicaDescriptor) SetECDataCount(v uint32) { + r.m.SetECDataCount(v) +} + +func (r *ReplicaDescriptor) SetECParityCount(v uint32) { + r.m.SetECParityCount(v) +} + // NumberOfObjects returns number set using SetNumberOfObjects. // // Zero ReplicaDescriptor has zero number of objects. @@ -137,6 +154,19 @@ func (r ReplicaDescriptor) NumberOfObjects() uint32 { return r.m.GetCount() } +func (r ReplicaDescriptor) GetECDataCount() uint32 { + return r.m.GetECDataCount() +} + +func (r ReplicaDescriptor) GetECParityCount() uint32 { + return r.m.GetECParityCount() +} + +// TotalECPartCount returns total sum of ECDataCount and ECParityCount. +func (r ReplicaDescriptor) TotalECPartCount() uint32 { + return r.m.GetECDataCount() + r.m.GetECParityCount() +} + // SetSelectorName sets name of the related Selector. // // Zero ReplicaDescriptor references to the root bucket's selector: it contains @@ -170,10 +200,19 @@ func (p PlacementPolicy) NumberOfReplicas() int { // descriptor. Index MUST be in range [0; NumberOfReplicas()). // // Zero PlacementPolicy has no replicas. +// +// Deprecated: Use PlacementPolicy.ReplicaDescriptor(int).NumberOfObjects() instead. func (p PlacementPolicy) ReplicaNumberByIndex(i int) uint32 { return p.replicas[i].GetCount() } +// ReplicaDescriptor returns i-th replica descriptor. Index MUST be in range [0; NumberOfReplicas()). +func (p PlacementPolicy) ReplicaDescriptor(i int) ReplicaDescriptor { + return ReplicaDescriptor{ + m: p.replicas[i], + } +} + // SetContainerBackupFactor sets container backup factor: it controls how deep // FrostFS will search for nodes alternatives to include into container's nodes subset. // @@ -285,6 +324,13 @@ func (x *Filter) setAttribute(key string, op netmap.Operation, val string) { x.m.SetValue(val) } +// Like applies the rule to accept only nodes with attribute like value. +// +// Method SHOULD NOT be called along with other similar methods. +func (x *Filter) Like(key, value string) { + x.setAttribute(key, netmap.LIKE, value) +} + // Equal applies the rule to accept only nodes with the same attribute value. // // Method SHOULD NOT be called along with other similar methods. @@ -393,10 +439,14 @@ func (p PlacementPolicy) WriteStringTo(w io.StringWriter) (err error) { c := p.replicas[i].GetCount() s := p.replicas[i].GetSelector() - if s != "" { - _, err = w.WriteString(fmt.Sprintf("%sREP %d IN %s", delim, c, s)) - } else { + if c != 0 { _, err = w.WriteString(fmt.Sprintf("%sREP %d", delim, c)) + } else { + ecx, ecy := p.replicas[i].GetECDataCount(), p.replicas[i].GetECParityCount() + _, err = w.WriteString(fmt.Sprintf("%sEC %d.%d", delim, ecx, ecy)) + } + if s != "" { + _, err = w.WriteString(fmt.Sprintf(" IN %s", s)) } if err != nil { @@ -630,6 +680,8 @@ var ( "make sure to pair REP and SELECT clauses: \"REP .. IN X\" + \"SELECT ... AS X\"") // errRedundantSelector is returned for errors found by filters policy validator. errRedundantFilter = errors.New("policy: found redundant filter") + // errECFewSelectors is returned when EC keyword is used without UNIQUE keyword. + errECFewSelectors = errors.New("policy: too few nodes to select") ) type policyVisitor struct { @@ -657,11 +709,18 @@ func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) any { pl.unique = ctx.UNIQUE() != nil - repStmts := ctx.AllRepStmt() - pl.replicas = make([]netmap.Replica, 0, len(repStmts)) - - for _, r := range repStmts { - res, ok := r.Accept(p).(*netmap.Replica) + stmts := ctx.GetChildren() + for _, r := range stmts { + var res *netmap.Replica + var ok bool + switch r := r.(type) { + case parser.IRepStmtContext: + res, ok = r.Accept(p).(*netmap.Replica) + case parser.IEcStmtContext: + res, ok = r.Accept(p).(*netmap.Replica) + default: + continue + } if !ok { return nil } @@ -758,6 +817,28 @@ func (p *policyVisitor) VisitRepStmt(ctx *parser.RepStmtContext) any { return rs } +// VisitRepStmt implements parser.QueryVisitor interface. +func (p *policyVisitor) VisitEcStmt(ctx *parser.EcStmtContext) any { + dataCount, err := strconv.ParseUint(ctx.GetData().GetText(), 10, 32) + if err != nil { + return p.reportError(errInvalidNumber) + } + parityCount, err := strconv.ParseUint(ctx.GetParity().GetText(), 10, 32) + if err != nil { + return p.reportError(errInvalidNumber) + } + + rs := new(netmap.Replica) + rs.SetECDataCount(uint32(dataCount)) + rs.SetECParityCount(uint32(parityCount)) + + if sel := ctx.GetSelector(); sel != nil { + rs.SetSelector(sel.GetText()) + } + + return rs +} + // VisitSelectStmt implements parser.QueryVisitor interface. func (p *policyVisitor) VisitSelectStmt(ctx *parser.SelectStmtContext) any { res, err := strconv.ParseUint(ctx.GetCount().GetText(), 10, 32) @@ -910,6 +991,14 @@ func validatePolicy(p PlacementPolicy) error { if seenSelectors[selName] == nil { return fmt.Errorf("%w: '%s'", errUnknownSelector, selName) } + + dataCount := p.replicas[i].GetECDataCount() + parityCount := p.replicas[i].GetECParityCount() + if dataCount != 0 || parityCount != 0 { + if c := seenSelectors[selName].GetCount(); c < dataCount+parityCount { + return fmt.Errorf("%w: %d < %d + %d", errECFewSelectors, c, dataCount, parityCount) + } + } } } @@ -940,10 +1029,14 @@ func operationFromString(s string) (op netmap.Operation) { return } -// escapeString returns single quote wrapped string if it contains special -// characters '-' and whitespace. +// escapeString returns single quote wrapped string. +// Wrapping rules must be kept in sync with QueryLexer.g4. +// Currently only ASCII letters, digits and underscore can be parsed without quotes. func escapeString(s string) string { - if strings.ContainsAny(s, " -\t") { + for _, r := range s { + if 'a' <= r && r <= 'z' || 'A' <= r && r <= 'Z' || '0' <= r && r <= '9' || r == '_' { + continue + } return "'" + s + "'" } return s diff --git a/netmap/policy_decode_test.go b/netmap/policy_decode_test.go index c38b608a..536d66b4 100644 --- a/netmap/policy_decode_test.go +++ b/netmap/policy_decode_test.go @@ -7,43 +7,50 @@ import ( "github.com/stretchr/testify/require" ) -func TestDecodeString(t *testing.T) { - testCases := []string{ - `REP 2 +var validPlacementPolicy = []string{ + `REP 2 CBF 2 SELECT 2 FROM *`, - `REP 1 IN X + `REP 1 IN X CBF 1 SELECT 2 IN SAME Location FROM * AS X`, - `REP 1 IN X + `REP 1 IN X REP 2 IN Y CBF 1 SELECT 2 FROM * AS X SELECT 3 FROM * AS Y`, - `REP 1 IN X + `REP 1 IN X SELECT 2 IN City FROM Good AS X FILTER Country EQ RU AS FromRU FILTER Country EQ EN AS FromEN FILTER @FromRU AND @FromEN AND Rating GT 7 AS Good`, - `REP 7 IN SPB + `REP 7 IN SPB SELECT 1 IN City FROM SPBSSD AS SPB FILTER City EQ SPB AND SSD EQ true OR City EQ SPB AND Rating GE 5 AS SPBSSD`, - `REP 7 IN SPB + `REP 7 IN SPB SELECT 1 IN City FROM SPBSSD AS SPB FILTER NOT (NOT (City EQ SPB) AND SSD EQ true OR City EQ SPB AND Rating GE 5) AS SPBSSD`, - `UNIQUE + `REP 1 IN FNODE +CBF 1 +SELECT 1 FROM F AS FNODE +FILTER Node EQ '10.78.8.11' AS F`, + + `UNIQUE REP 1 REP 1`, - } + `EC 1.2 IN X +SELECT 3 IN City FROM * AS X`, +} +func TestDecodeString(t *testing.T) { var p PlacementPolicy - for _, testCase := range testCases { + for _, testCase := range validPlacementPolicy { require.NoError(t, p.DecodeString(testCase), "unable parse %s", testCase) var b strings.Builder require.NoError(t, p.WriteStringTo(&b)) diff --git a/netmap/policy_fuzz.go b/netmap/policy_fuzz.go new file mode 100644 index 00000000..40088e95 --- /dev/null +++ b/netmap/policy_fuzz.go @@ -0,0 +1,14 @@ +//go:build gofuzz +// +build gofuzz + +package netmap + +func DoFuzzPlacementPolicyDecode(data []byte) int { + p := string(data) + if p == "" { + return 0 + } + var pp PlacementPolicy + _ = pp.DecodeString(p) + return 1 +} diff --git a/netmap/policy_fuzz_test.go b/netmap/policy_fuzz_test.go new file mode 100644 index 00000000..35b69a46 --- /dev/null +++ b/netmap/policy_fuzz_test.go @@ -0,0 +1,17 @@ +//go:build gofuzz +// +build gofuzz + +package netmap + +import ( + "testing" +) + +func FuzzDecodeString(f *testing.F) { + for _, pp := range validPlacementPolicy { + f.Add([]byte(pp)) + } + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzPlacementPolicyDecode(data) + }) +} diff --git a/netmap/policy_test.go b/netmap/policy_test.go index 1d5487b2..bf0c03b6 100644 --- a/netmap/policy_test.go +++ b/netmap/policy_test.go @@ -82,6 +82,13 @@ CBF 1 SELECT 1 FROM Color FILTER (Color EQ Red OR Color EQ Blue OR Color EQ Yellow) AND Color NE Green AS Color`, }, + { + name: "non-ascii attributes in SELECT IN", + input: `REP 1 +CBF 1 +SELECT 1 IN SAME 'Цвет' FROM Colorful +FILTER 'Цвет' EQ 'Красный' OR 'Цвет' EQ 'Синий' AS Colorful`, + }, } for _, tc := range testCases { @@ -122,6 +129,16 @@ func TestDecodeSelectFilterExpr(t *testing.T) { FILTER Color EQ 'Red' AS RedNode FILTER @RedNode AND Shape EQ 'Cirle' AS RedCircleNode `, + ` + CBF 1 + SELECT 1 FROM R + FILTER Color LIKE 'R' AS R + `, + ` + CBF 1 + SELECT 1 IN SAME 'Цвет' FROM Colorful + FILTER 'Цвет' EQ 'Красный' OR 'Цвет' EQ 'Синий' AS Colorful + `, } { _, err := DecodeSelectFilterString(s) require.NoError(t, err) diff --git a/netmap/selector.go b/netmap/selector.go index f9247ff7..d6ea4cdd 100644 --- a/netmap/selector.go +++ b/netmap/selector.go @@ -1,10 +1,11 @@ package netmap import ( + "cmp" "fmt" - "sort" + "slices" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" "git.frostfs.info/TrueCloudLab/hrw" ) @@ -70,12 +71,12 @@ func (c *context) getSelection(s netmap.Selector) ([]nodes, error) { // we also need to have deterministic input to HRW sorting routine. if len(c.hrwSeed) == 0 { if s.GetAttribute() == "" { - sort.Slice(buckets, func(i, j int) bool { - return less(buckets[i].nodes[0], buckets[j].nodes[0]) + slices.SortFunc(buckets, func(b1, b2 nodeAttrPair) int { + return cmp.Compare(b1.nodes[0].Hash(), b2.nodes[0].Hash()) }) } else { - sort.Slice(buckets, func(i, j int) bool { - return buckets[i].attr < buckets[j].attr + slices.SortFunc(buckets, func(b1, b2 nodeAttrPair) int { + return cmp.Compare(b1.attr, b2.attr) }) } } @@ -103,15 +104,17 @@ func (c *context) getSelection(s netmap.Selector) ([]nodes, error) { if len(c.hrwSeed) != 0 { weights := make([]float64, len(res)) + a := new(meanIQRAgg) for i := range res { - weights[i] = calcBucketWeight(res[i], newMeanIQRAgg(), c.weightFunc) + a.clear() + weights[i] = calcBucketWeight(res[i], a, c.weightFunc) } hrw.SortHasherSliceByWeightValue(res, weights, c.hrwSeedHash) } if len(res) < bucketCount { - if len(res) == 0 { + if c.strict && len(res) == 0 { return nil, errNotEnoughNodes } bucketCount = len(res) @@ -168,8 +171,10 @@ func (c *context) getSelectionBase(s netmap.Selector) []nodeAttrPair { } if len(c.hrwSeed) != 0 { + var ws []float64 for i := range result { - hrw.SortHasherSliceByWeightValue(result[i].nodes, result[i].nodes.weights(c.weightFunc), c.hrwSeedHash) + ws = result[i].nodes.appendWeightsTo(c.weightFunc, ws[:0]) + hrw.SortHasherSliceByWeightValue(result[i].nodes, ws, c.hrwSeedHash) } } diff --git a/netmap/selector_test.go b/netmap/selector_test.go index 934ff7e1..a4ca7748 100644 --- a/netmap/selector_test.go +++ b/netmap/selector_test.go @@ -1,16 +1,20 @@ package netmap import ( + "cmp" "crypto/rand" "encoding/binary" "fmt" mrand "math/rand" - "sort" + "reflect" + "slices" "strconv" + "strings" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" "git.frostfs.info/TrueCloudLab/hrw" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -36,7 +40,7 @@ func BenchmarkHRWSort(b *testing.B) { b.Run("sort by index, no weight", func(b *testing.B) { realNodes := make([]nodes, netmapSize) b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { b.StopTimer() copy(realNodes, vectors) b.StartTimer() @@ -47,7 +51,7 @@ func BenchmarkHRWSort(b *testing.B) { b.Run("sort by value, no weight", func(b *testing.B) { realNodes := make([]nodes, netmapSize) b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { b.StopTimer() copy(realNodes, vectors) b.StartTimer() @@ -58,7 +62,7 @@ func BenchmarkHRWSort(b *testing.B) { b.Run("only sort by index", func(b *testing.B) { realNodes := make([]nodes, netmapSize) b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { b.StopTimer() copy(realNodes, vectors) b.StartTimer() @@ -69,7 +73,7 @@ func BenchmarkHRWSort(b *testing.B) { b.Run("sort by value", func(b *testing.B) { realNodes := make([]nodes, netmapSize) b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { b.StopTimer() copy(realNodes, vectors) b.StartTimer() @@ -80,13 +84,13 @@ func BenchmarkHRWSort(b *testing.B) { b.Run("sort by ID, then by index (deterministic)", func(b *testing.B) { realNodes := make([]nodes, netmapSize) b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { b.StopTimer() copy(realNodes, vectors) b.StartTimer() - sort.Slice(vectors, func(i, j int) bool { - return less(vectors[i][0], vectors[j][0]) + slices.SortFunc(vectors, func(vi, vj nodes) int { + return cmp.Compare(vi[0].Hash(), vj[0].Hash()) }) hrw.SortSliceByWeightIndex(realNodes, weights, pivot) } @@ -132,7 +136,7 @@ func BenchmarkPolicyHRWType(b *testing.B) { nm.SetNodes(nodes) b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { _, err := nm.ContainerNodes(p, []byte{1}) if err != nil { b.Fatal() @@ -187,13 +191,13 @@ func TestPlacementPolicy_DeterministicOrder(t *testing.T) { nss[i] = v[i] } - ns := flattenNodes(nss) + ns := flattenNodes(nil, nss) require.Equal(t, 2, len(ns)) return ns[0].Hash(), ns[1].Hash() } a, b := getIndices(t) - for i := 0; i < 10; i++ { + for range 10 { x, y := getIndices(t) require.Equal(t, a, x) require.Equal(t, b, y) @@ -250,6 +254,125 @@ func TestPlacementPolicy_ProcessSelectors(t *testing.T) { } } +func TestPlacementPolicy_PartiallyMissingContainer(t *testing.T) { + s := `REP 2 IN D1OBJ +REP 2 IN D2OBJ +CBF 2 +SELECT 2 FROM PRIMARY AS D1OBJ +SELECT 2 FROM SECONDARY AS D2OBJ +FILTER ClusterName EQ D1OBJ AS PRIMARY +FILTER ClusterName EQ D2OBJ AS SECONDARY` + + var p PlacementPolicy + require.NoError(t, p.DecodeString(s)) + + nodes := []NodeInfo{ + nodeInfoFromAttributes("ClusterName", "D1OBJ", "ID", "1"), + nodeInfoFromAttributes("ClusterName", "D1OBJ", "ID", "2"), + nodeInfoFromAttributes("ClusterName", "D1OBJ", "ID", "3"), + nodeInfoFromAttributes("ClusterName", "D1OBJ", "ID", "4"), + nodeInfoFromAttributes("ClusterName", "D1OBJ", "ID", "5"), + nodeInfoFromAttributes("ClusterName", "D1OBJ", "ID", "6"), + nodeInfoFromAttributes("ClusterName", "D1OBJ", "ID", "7"), + nodeInfoFromAttributes("ClusterName", "D1OBJ", "ID", "8"), + } + + var nm NetMap + nm.SetNodes(nodes) + + res, err := nm.ContainerNodes(p, nil) + require.NoError(t, err) + require.Len(t, res, 2) + require.Len(t, res[0], 4) + require.Len(t, res[1], 0) +} + +func TestPlacementPolicy_Like(t *testing.T) { + nodes := []NodeInfo{ + nodeInfoFromAttributes("Country", "Russia"), + nodeInfoFromAttributes("Country", "Germany"), + nodeInfoFromAttributes("Country", "Belarus"), + } + + var nm NetMap + nm.SetNodes(nodes) + + t.Run("LIKE all", func(t *testing.T) { + ssNamed := []Selector{newSelector("X", "Country", 4, "FromRU", (*Selector).SelectDistinct)} + fsNamed := []Filter{newFilter("FromRU", "Country", "*", netmap.LIKE)} + rsNamed := []ReplicaDescriptor{newReplica(4, "X")} + pNamed := newPlacementPolicy(0, rsNamed, ssNamed, fsNamed) + + n, err := nm.ContainerNodes(pNamed, []byte{1}) + require.NoError(t, err) + + require.Equal(t, 3, len(n[0])) + for _, n := range n[0] { + require.True(t, strings.Contains("GermanyRussiaBelarus", n.Attribute("Country"))) + } + }) + + t.Run("LIKE no wildcard", func(t *testing.T) { + ssNamed := []Selector{newSelector("X", "Country", 1, "FromRU", (*Selector).SelectDistinct)} + fsNamed := []Filter{newFilter("FromRU", "Country", "Russia", netmap.LIKE)} + rsNamed := []ReplicaDescriptor{newReplica(1, "X")} + pNamed := newPlacementPolicy(0, rsNamed, ssNamed, fsNamed) + + n, err := nm.ContainerNodes(pNamed, []byte{1}) + require.NoError(t, err) + + require.Equal(t, 1, len(n[0])) + for _, n := range n[0] { + require.True(t, n.Attribute("Country") == "Russia") + } + }) + + t.Run("LIKE prefix", func(t *testing.T) { + ssNamed := []Selector{newSelector("X", "Country", 1, "FromRU", (*Selector).SelectDistinct)} + fsNamed := []Filter{newFilter("FromRU", "Country", "Ge*", netmap.LIKE)} + rsNamed := []ReplicaDescriptor{newReplica(1, "X")} + pNamed := newPlacementPolicy(0, rsNamed, ssNamed, fsNamed) + + n, err := nm.ContainerNodes(pNamed, []byte{1}) + require.NoError(t, err) + + require.Equal(t, 1, len(n[0])) + for _, n := range n[0] { + require.True(t, n.Attribute("Country") == "Germany") + } + }) + + t.Run("LIKE suffix", func(t *testing.T) { + ssNamed := []Selector{newSelector("X", "Country", 1, "FromRU", (*Selector).SelectDistinct)} + fsNamed := []Filter{newFilter("FromRU", "Country", "*sia", netmap.LIKE)} + rsNamed := []ReplicaDescriptor{newReplica(1, "X")} + pNamed := newPlacementPolicy(0, rsNamed, ssNamed, fsNamed) + + n, err := nm.ContainerNodes(pNamed, []byte{1}) + require.NoError(t, err) + + require.Equal(t, 1, len(n[0])) + for _, n := range n[0] { + require.True(t, n.Attribute("Country") == "Russia") + } + }) + + t.Run("LIKE middle", func(t *testing.T) { + ssNamed := []Selector{newSelector("X", "Country", 2, "FromRU", (*Selector).SelectDistinct)} + fsNamed := []Filter{newFilter("FromRU", "Country", "*us*", netmap.LIKE)} + rsNamed := []ReplicaDescriptor{newReplica(2, "X")} + pNamed := newPlacementPolicy(0, rsNamed, ssNamed, fsNamed) + + n, err := nm.ContainerNodes(pNamed, []byte{1}) + require.NoError(t, err) + + require.Equal(t, 2, len(n[0])) + for _, n := range n[0] { + require.True(t, strings.Contains("RussiaBelarus", n.Attribute("Country"))) + } + }) +} + func TestPlacementPolicy_Unique(t *testing.T) { p := newPlacementPolicy(2, []ReplicaDescriptor{ @@ -264,7 +387,7 @@ func TestPlacementPolicy_Unique(t *testing.T) { var nodes []NodeInfo for i, city := range []string{"Moscow", "Berlin", "Shenzhen"} { - for j := 0; j < 3; j++ { + for j := range 3 { node := nodeInfoFromAttributes("City", city) node.SetPublicKey(binary.BigEndian.AppendUint16(nil, uint16(i*4+j))) nodes = append(nodes, node) @@ -278,7 +401,7 @@ func TestPlacementPolicy_Unique(t *testing.T) { require.NoError(t, err) for i, vi := range v { for _, ni := range vi { - for j := 0; j < i; j++ { + for j := range i { for _, nj := range v[j] { require.NotEqual(t, ni.hash, nj.hash) } @@ -367,7 +490,7 @@ func TestPlacementPolicy_MultiREP(t *testing.T) { for _, additional := range []int{0, 1, 2} { t.Run(fmt.Sprintf("unique=%t, additional=%d", unique, additional), func(t *testing.T) { rs := []ReplicaDescriptor{newReplica(1, "SameRU")} - for i := 0; i < additional; i++ { + for range additional { rs = append(rs, newReplica(1, "")) } @@ -454,6 +577,66 @@ func TestPlacementPolicy_ProcessSelectorsExceptForNodes(t *testing.T) { } } +func TestPlacementPolicy_NonAsciiAttributes(t *testing.T) { + p := newPlacementPolicy( + 1, + []ReplicaDescriptor{ + newReplica(2, "Nodes"), + newReplica(2, "Nodes"), + }, + []Selector{ + newSelector("Nodes", "Цвет", 2, "Colorful", (*Selector).SelectSame), + }, + []Filter{ + newFilter("Colorful", "", "", netmap.OR, + newFilter("", "Цвет", "Красный", netmap.EQ), + newFilter("", "Цвет", "Синий", netmap.EQ), + ), + }, + ) + p.SetUnique(true) + + nodes := []NodeInfo{ + nodeInfoFromAttributes("Цвет", "Красный", "Форма", "Треугольник"), + nodeInfoFromAttributes("Цвет", "Красный", "Форма", "Круг"), + nodeInfoFromAttributes("Цвет", "Синий", "Форма", "Треугольник"), + nodeInfoFromAttributes("Цвет", "Синий", "Форма", "Круг"), + nodeInfoFromAttributes("Свойство", "Мягкий", "Форма", "Треугольник"), + nodeInfoFromAttributes("Свойство", "Теплый", "Форма", "Круг"), + } + for i := range nodes { + nodes[i].SetPublicKey([]byte{byte(i)}) + } + + redNodes := nodes[:2] + blueNodes := nodes[2:4] + + var nm NetMap + nm.SetNodes(nodes) + + pivot := make([]byte, 42) + _, _ = rand.Read(pivot) + + nodesPerReplica, err := nm.ContainerNodes(p, pivot) + require.NoError(t, err) + require.Len(t, nodesPerReplica, 2) + + for i := range nodesPerReplica { + slices.SortFunc(nodesPerReplica[i], func(n1, n2 NodeInfo) int { + pk1, pk2 := string(n1.PublicKey()), string(n2.PublicKey()) + return cmp.Compare(pk1, pk2) + }) + } + + redMatchFirst := reflect.DeepEqual(redNodes, nodesPerReplica[0]) + blueMatchFirst := reflect.DeepEqual(blueNodes, nodesPerReplica[0]) + + redMatchSecond := reflect.DeepEqual(redNodes, nodesPerReplica[1]) + blueMatchSecond := reflect.DeepEqual(blueNodes, nodesPerReplica[1]) + + assert.True(t, redMatchFirst && blueMatchSecond || blueMatchFirst && redMatchSecond) +} + func TestSelector_SetName(t *testing.T) { const name = "some name" var s Selector diff --git a/netmap/yml_test.go b/netmap/yml_test.go index a744a01a..1f834625 100644 --- a/netmap/yml_test.go +++ b/netmap/yml_test.go @@ -84,8 +84,15 @@ func TestPlacementPolicy_Interopability(t *testing.T) { t.Run(name, func(t *testing.T) { v, err := nm.ContainerNodes(tt.Policy, tt.Pivot) if tt.Result == nil { - require.Error(t, err) - require.Contains(t, err.Error(), tt.Error) + if tt.Error != "" { + require.Error(t, err) + require.Contains(t, err.Error(), tt.Error) + } else { + require.Len(t, v, tt.Policy.NumberOfReplicas()) + for i := range v { + require.Len(t, v[i], 0) + } + } } else { require.NoError(t, err) require.Equal(t, srcNodes, tc.Nodes) @@ -130,7 +137,7 @@ func BenchmarkPlacementPolicyInteropability(b *testing.B) { b.Run(name, func(b *testing.B) { b.ReportAllocs() b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { b.StartTimer() v, err := nm.ContainerNodes(tt.Policy, tt.Pivot) b.StopTimer() @@ -173,7 +180,7 @@ func BenchmarkManySelects(b *testing.B) { b.ResetTimer() b.ReportAllocs() - for i := 0; i < b.N; i++ { + for range b.N { _, err = nm.ContainerNodes(tt.Policy, tt.Pivot) if err != nil { b.FailNow() diff --git a/netmap/yml_tests/filter_complex.yml b/netmap/yml_tests/filter_complex.yml index a65fa17c..1abc46ae 100644 --- a/netmap/yml_tests/filter_complex.yml +++ b/netmap/yml_tests/filter_complex.yml @@ -107,7 +107,6 @@ tests: op: EQ value: Value2 filters: [] - error: not enough nodes bad rating: policy: replicas: @@ -157,7 +156,6 @@ tests: op: EQ value: Value2 filters: [] - error: not enough nodes bad param: policy: replicas: @@ -207,4 +205,3 @@ tests: op: EQ value: Value2 filters: [] - error: not enough nodes diff --git a/netmap/yml_tests/filter_invalid_integer.yml b/netmap/yml_tests/filter_invalid_integer.yml index e65ab24d..66742465 100644 --- a/netmap/yml_tests/filter_invalid_integer.yml +++ b/netmap/yml_tests/filter_invalid_integer.yml @@ -24,7 +24,6 @@ tests: op: LE value: '8' filters: [] - error: not enough nodes non-empty string is not casted to a number: policy: replicas: @@ -42,4 +41,3 @@ tests: op: GE value: '0' filters: [] - error: not enough nodes diff --git a/netmap/yml_tests/filter_simple.yml b/netmap/yml_tests/filter_simple.yml index a24814a4..7fdd84a1 100644 --- a/netmap/yml_tests/filter_simple.yml +++ b/netmap/yml_tests/filter_simple.yml @@ -42,7 +42,6 @@ tests: op: GE value: '5' filters: [] - error: not enough nodes GT true: policy: replicas: @@ -79,7 +78,6 @@ tests: op: GT value: '4' filters: [] - error: not enough nodes LE true: policy: replicas: @@ -116,7 +114,6 @@ tests: op: LE value: '3' filters: [] - error: not enough nodes LT true: policy: replicas: @@ -153,7 +150,6 @@ tests: op: LT value: '4' filters: [] - error: not enough nodes EQ true: policy: replicas: @@ -190,7 +186,6 @@ tests: op: EQ value: China filters: [] - error: not enough nodes NE true: policy: replicas: @@ -227,4 +222,3 @@ tests: op: NE value: Germany filters: [] - error: not enough nodes diff --git a/netmap/yml_tests/selector_invalid.yml b/netmap/yml_tests/selector_invalid.yml index d6e3b4e4..9b0a5395 100644 --- a/netmap/yml_tests/selector_invalid.yml +++ b/netmap/yml_tests/selector_invalid.yml @@ -45,4 +45,3 @@ tests: op: EQ value: Moon filters: [] - error: not enough nodes diff --git a/netmap/yml_unmarshal.go b/netmap/yml_unmarshal.go index fa94586e..239bf28b 100644 --- a/netmap/yml_unmarshal.go +++ b/netmap/yml_unmarshal.go @@ -3,7 +3,7 @@ package netmap import ( "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" ) type tempPlacementPolicy struct { @@ -44,15 +44,16 @@ func convertNFilters(temp []tempFilter) []netmap.Filter { } var stringToOperationMap = map[string]netmap.Operation{ - "EQ": netmap.EQ, - "NE": netmap.NE, - "GT": netmap.GT, - "GE": netmap.GE, - "LT": netmap.LT, - "LE": netmap.LE, - "OR": netmap.OR, - "AND": netmap.AND, - "NOT": netmap.NOT, + "EQ": netmap.EQ, + "NE": netmap.NE, + "GT": netmap.GT, + "GE": netmap.GE, + "LT": netmap.LT, + "LE": netmap.LE, + "OR": netmap.OR, + "AND": netmap.AND, + "NOT": netmap.NOT, + "LIKE": netmap.LIKE, } func convertStringToOperation(opStr string) netmap.Operation { diff --git a/object/attribute.go b/object/attribute.go index e4c7f602..8e5bc49b 100644 --- a/object/attribute.go +++ b/object/attribute.go @@ -1,7 +1,7 @@ package object import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" ) // Attribute represents v2-compatible object attribute. diff --git a/object/attribute_test.go b/object/attribute_test.go index eafc3126..5bca44a4 100644 --- a/object/attribute_test.go +++ b/object/attribute_test.go @@ -3,7 +3,7 @@ package object import ( "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" "github.com/stretchr/testify/require" ) diff --git a/object/ecinfo.go b/object/ecinfo.go new file mode 100644 index 00000000..f108b259 --- /dev/null +++ b/object/ecinfo.go @@ -0,0 +1,69 @@ +package object + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" +) + +type ECChunk object.ECChunk + +func (c *ECChunk) SetID(id oid.ID) { + objV2 := new(refs.ObjectID) + id.WriteToV2(objV2) + c.ID = *objV2 +} + +// ToV2 converts ECChunk to v2 ECChunk message. +// +// Nil ECChunk converts to nil. +func (c *ECChunk) ToV2() *object.ECChunk { + return (*object.ECChunk)(c) +} + +func NewECChunkFromV2(v2 *object.ECChunk) *ECChunk { + return (*ECChunk)(v2) +} + +type ECInfo object.ECInfo + +// NewECInfoFromV2 wraps v2 ECInfo message to ECInfo. +// +// Nil object.ECInfo converts to nil. +func NewECInfoFromV2(v2 *object.ECInfo) *ECInfo { + return (*ECInfo)(v2) +} + +// NewECInfo creates and initializes blank ECInfo. +func NewECInfo() *ECInfo { + return NewECInfoFromV2(new(object.ECInfo)) +} + +// ToV2 converts ECInfo to v2 ECInfo message. +// +// Nil ECInfo converts to nil. +func (s *ECInfo) ToV2() *object.ECInfo { + return (*object.ECInfo)(s) +} + +func (s *ECInfo) Marshal() ([]byte, error) { + return (*object.ECInfo)(s).StableMarshal(nil), nil +} + +func (s *ECInfo) Unmarshal(data []byte) error { + return (*object.ECInfo)(s).Unmarshal(data) +} + +// MarshalJSON implements json.Marshaler. +func (s *ECInfo) MarshalJSON() ([]byte, error) { + return (*object.ECInfo)(s).MarshalJSON() +} + +// UnmarshalJSON implements json.Unmarshaler. +func (s *ECInfo) UnmarshalJSON(data []byte) error { + return (*object.ECInfo)(s).UnmarshalJSON(data) +} + +func (s *ECInfo) AddChunk(chunk ECChunk) { + s.Chunks = append(s.Chunks, *chunk.ToV2()) +} diff --git a/object/erasure_code.go b/object/erasure_code.go new file mode 100644 index 00000000..d5fbb976 --- /dev/null +++ b/object/erasure_code.go @@ -0,0 +1,193 @@ +package object + +import ( + "errors" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" +) + +// ECHeader represents erasure coding header. +type ECHeader struct { + parent oid.ID + parentSplitID *SplitID + parentSplitParentID *oid.ID + parentAttributes []Attribute + index uint32 + total uint32 + header []byte + headerLength uint32 +} + +type ECParentInfo struct { + // EC-parent's ID. + ID oid.ID + + // EC-parent's split ID if the parent is a part of Split itself. + SplitID *SplitID + + // EC-parent's parent split ID if the parent is a part of Split itself. + SplitParentID *oid.ID + + // EC-parent's attributes. + Attributes []Attribute +} + +// NewECHeader constructs new erasure coding header. +func NewECHeader(ecParentInfo ECParentInfo, index, total uint32, header []byte, headerLength uint32) *ECHeader { + return &ECHeader{ + parent: ecParentInfo.ID, + parentSplitID: ecParentInfo.SplitID, + parentSplitParentID: ecParentInfo.SplitParentID, + parentAttributes: ecParentInfo.Attributes, + index: index, + total: total, + header: header, + headerLength: headerLength, + } +} + +// WriteToV2 converts SDK structure to v2-api one. +func (e *ECHeader) WriteToV2(h *object.ECHeader) { + var parent refs.ObjectID + e.parent.WriteToV2(&parent) + h.ParentSplitID = e.parentSplitID.ToV2() + + if e.parentSplitParentID != nil { + parentSplitParentID := new(refs.ObjectID) + e.parentSplitParentID.WriteToV2(parentSplitParentID) + h.ParentSplitParentID = parentSplitParentID + } + + h.Parent = &parent + + attrs := make([]object.Attribute, len(e.parentAttributes)) + for i := range e.parentAttributes { + attrs[i] = *e.parentAttributes[i].ToV2() + } + h.ParentAttributes = attrs + + h.Index = e.index + h.Total = e.total + h.Header = e.header + h.HeaderLength = e.headerLength +} + +// ReadFromV2 converts v2-api structure to SDK one. +func (e *ECHeader) ReadFromV2(h *object.ECHeader) error { + if h == nil { + return nil + } + if h.Parent == nil { + return errors.New("empty parent") + } + + attrs := make([]Attribute, len(h.ParentAttributes)) + for i := range h.ParentAttributes { + attrs[i] = *NewAttributeFromV2(&h.ParentAttributes[i]) + } + e.parentAttributes = attrs + + _ = e.parent.ReadFromV2(*h.Parent) + e.parentSplitID = NewSplitIDFromV2(h.ParentSplitID) + if h.ParentSplitParentID != nil { + if e.parentSplitParentID == nil { + e.parentSplitParentID = new(oid.ID) + } + _ = e.parentSplitParentID.ReadFromV2(*h.ParentSplitParentID) + } + e.index = h.Index + e.total = h.Total + e.header = h.Header + e.headerLength = h.HeaderLength + return nil +} + +func (o *Object) ECHeader() *ECHeader { + ec := (*object.Object)(o).GetHeader().GetEC() + if ec == nil { + return nil + } + + h := new(ECHeader) + _ = h.ReadFromV2(ec) + return h +} + +func (o *Object) SetECHeader(ec *ECHeader) { + o.setHeaderField(func(h *object.Header) { + if ec == nil { + h.SetEC(nil) + return + } + + v2 := new(object.ECHeader) + ec.WriteToV2(v2) + h.SetEC(v2) + }) +} + +func (e *ECHeader) Parent() oid.ID { + return e.parent +} + +func (e *ECHeader) SetParent(id oid.ID) { + e.parent = id +} + +func (e *ECHeader) ParentSplitID() *SplitID { + return e.parentSplitID +} + +func (e *ECHeader) SetParentSplitID(parentSplitID *SplitID) { + e.parentSplitID = parentSplitID +} + +func (e *ECHeader) ParentSplitParentID() *oid.ID { + return e.parentSplitParentID +} + +func (e *ECHeader) SetParentSplitParentID(parentSplitParentID *oid.ID) { + e.parentSplitParentID = parentSplitParentID +} + +func (e *ECHeader) ParentAttributes() []Attribute { + return e.parentAttributes +} + +func (e *ECHeader) SetParentAttributes(attrs []Attribute) { + e.parentAttributes = attrs +} + +func (e *ECHeader) Index() uint32 { + return e.index +} + +func (e *ECHeader) SetIndex(i uint32) { + e.index = i +} + +func (e *ECHeader) Total() uint32 { + return e.total +} + +func (e *ECHeader) SetTotal(i uint32) { + e.total = i +} + +func (e *ECHeader) Header() []byte { + return e.header +} + +func (e *ECHeader) SetHeader(header []byte) { + e.header = header +} + +func (e *ECHeader) HeaderLength() uint32 { + return e.headerLength +} + +func (e *ECHeader) SetHeaderLength(l uint32) { + e.headerLength = l +} diff --git a/object/erasurecode/constructor.go b/object/erasurecode/constructor.go new file mode 100644 index 00000000..447372d3 --- /dev/null +++ b/object/erasurecode/constructor.go @@ -0,0 +1,87 @@ +package erasurecode + +import ( + "errors" + + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "github.com/klauspost/reedsolomon" +) + +var ( + // ErrMalformedSlice is returned when a slice of EC chunks is inconsistent. + ErrMalformedSlice = errors.New("inconsistent EC headers") + // ErrInvShardNum is returned from NewConstructor when the number of shards is invalid. + ErrInvShardNum = reedsolomon.ErrInvShardNum + // ErrMaxShardNum is returned from NewConstructor when the number of shards is too big. + ErrMaxShardNum = reedsolomon.ErrMaxShardNum +) + +// MaxShardCount is the maximum number of shards. +const MaxShardCount = 256 + +// Constructor is a wrapper around encoder allowing to reconstruct objects. +// It's methods are not thread-safe. +type Constructor struct { + enc reedsolomon.Encoder + headerLength uint32 + payloadShards [][]byte + headerShards [][]byte +} + +// NewConstructor returns new constructor instance. +func NewConstructor(dataCount int, parityCount int) (*Constructor, error) { + // The library supports up to 65536 shards with some restrictions. + // This can easily result in OOM or panic, thus SDK declares it's own restriction. + if dataCount+parityCount > MaxShardCount { + return nil, ErrMaxShardNum + } + + enc, err := reedsolomon.New(dataCount, parityCount) + if err != nil { + return nil, err + } + return &Constructor{enc: enc}, nil +} + +// clear clears internal state of the constructor, so it can be reused. +func (c *Constructor) clear() { + c.headerLength = 0 + c.payloadShards = nil + c.headerShards = nil +} + +func (c *Constructor) fillHeader(parts []*objectSDK.Object) error { + shards := make([][]byte, len(parts)) + headerLength := 0 + for i := range parts { + if parts[i] == nil { + continue + } + + var err error + headerLength, err = validatePart(parts, i, headerLength) + if err != nil { + return err + } + + shards[i] = parts[i].GetECHeader().Header() + } + + c.headerLength = uint32(headerLength) + c.headerShards = shards + return nil +} + +// fillPayload fills the payload shards. +// Currently there is no case when it can be called without reconstructing header, +// thus fillHeader() must be called before and this function performs no validation. +func (c *Constructor) fillPayload(parts []*objectSDK.Object) { + shards := make([][]byte, len(parts)) + for i := range parts { + if parts[i] == nil { + continue + } + shards[i] = parts[i].Payload() + } + c.payloadShards = shards +} diff --git a/object/erasurecode/constructor_test.go b/object/erasurecode/constructor_test.go new file mode 100644 index 00000000..3268d352 --- /dev/null +++ b/object/erasurecode/constructor_test.go @@ -0,0 +1,31 @@ +package erasurecode_test + +import ( + "testing" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/erasurecode" + "github.com/stretchr/testify/require" +) + +func TestErasureConstruct(t *testing.T) { + t.Run("negative, no panic", func(t *testing.T) { + _, err := erasurecode.NewConstructor(-1, 2) + require.ErrorIs(t, err, erasurecode.ErrInvShardNum) + }) + t.Run("negative, no panic", func(t *testing.T) { + _, err := erasurecode.NewConstructor(2, -1) + require.ErrorIs(t, err, erasurecode.ErrInvShardNum) + }) + t.Run("zero parity", func(t *testing.T) { + _, err := erasurecode.NewConstructor(1, 0) + require.NoError(t, err) + }) + t.Run("max shard num", func(t *testing.T) { + _, err := erasurecode.NewConstructor(erasurecode.MaxShardCount, 0) + require.NoError(t, err) + }) + t.Run("max+1 shard num", func(t *testing.T) { + _, err := erasurecode.NewConstructor(erasurecode.MaxShardCount+1, 0) + require.ErrorIs(t, err, erasurecode.ErrMaxShardNum) + }) +} diff --git a/object/erasurecode/reconstruct.go b/object/erasurecode/reconstruct.go new file mode 100644 index 00000000..ca9767b1 --- /dev/null +++ b/object/erasurecode/reconstruct.go @@ -0,0 +1,146 @@ +package erasurecode + +import ( + "bytes" + "crypto/ecdsa" + "fmt" + + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "github.com/klauspost/reedsolomon" +) + +// Reconstruct returns full object reconstructed from parts. +// All non-nil objects in parts must have EC header with the same `total` field equal to len(parts). +// The slice must contain at least one non nil object. +// Index of the objects in parts must be equal to it's index field in the EC header. +// The parts slice isn't changed and can be used concurrently for reading. +func (c *Constructor) Reconstruct(parts []*objectSDK.Object) (*objectSDK.Object, error) { + res, err := c.ReconstructHeader(parts) + if err != nil { + return nil, err + } + + c.fillPayload(parts) + + payload, err := reconstructExact(c.enc, int(res.PayloadSize()), c.payloadShards) + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrMalformedSlice, err) + } + + res.SetPayload(payload) + return res, nil +} + +// ReconstructHeader returns object header reconstructed from parts. +// All non-nil objects in parts must have EC header with the same `total` field equal to len(parts). +// The slice must contain at least one non nil object. +// Index of the objects in parts must be equal to it's index field in the EC header. +// The parts slice isn't changed and can be used concurrently for reading. +func (c *Constructor) ReconstructHeader(parts []*objectSDK.Object) (*objectSDK.Object, error) { + c.clear() + + if err := c.fillHeader(parts); err != nil { + return nil, err + } + + obj, err := c.reconstructHeader() + if err != nil { + return nil, fmt.Errorf("%w: %w", ErrMalformedSlice, err) + } + return obj, nil +} + +// ReconstructParts reconstructs specific EC parts without reconstructing full object. +// All non-nil objects in parts must have EC header with the same `total` field equal to len(parts). +// The slice must contain at least one non nil object. +// Index of the objects in parts must be equal to it's index field in the EC header. +// Those parts for which corresponding element in required is true must be nil and will be overwritten. +// Because partial reconstruction only makes sense for full objects, all parts must have non-empty payload. +// If key is not nil, all reconstructed parts are signed with this key. +func (c *Constructor) ReconstructParts(parts []*objectSDK.Object, required []bool, key *ecdsa.PrivateKey) error { + if len(required) != len(parts) { + return fmt.Errorf("len(parts) != len(required): %d != %d", len(parts), len(required)) + } + + c.clear() + + if err := c.fillHeader(parts); err != nil { + return err + } + c.fillPayload(parts) + + if err := c.enc.ReconstructSome(c.payloadShards, required); err != nil { + return fmt.Errorf("%w: %w", ErrMalformedSlice, err) + } + if err := c.enc.ReconstructSome(c.headerShards, required); err != nil { + return fmt.Errorf("%w: %w", ErrMalformedSlice, err) + } + + nonNilPart := 0 + for i := range parts { + if parts[i] != nil { + nonNilPart = i + break + } + } + + ec := parts[nonNilPart].GetECHeader() + ecParentInfo := objectSDK.ECParentInfo{ + ID: ec.Parent(), + SplitID: ec.ParentSplitID(), + SplitParentID: ec.ParentSplitParentID(), + Attributes: ec.ParentAttributes(), + } + total := ec.Total() + + for i := range required { + if parts[i] != nil || !required[i] { + continue + } + + part := objectSDK.New() + copyRequiredFields(part, parts[nonNilPart]) + part.SetPayload(c.payloadShards[i]) + part.SetPayloadSize(uint64(len(c.payloadShards[i]))) + part.SetECHeader(objectSDK.NewECHeader(ecParentInfo, uint32(i), total, c.headerShards[i], c.headerLength)) + + if err := setIDWithSignature(part, key); err != nil { + return err + } + parts[i] = part + } + return nil +} + +func (c *Constructor) reconstructHeader() (*objectSDK.Object, error) { + data, err := reconstructExact(c.enc, int(c.headerLength), c.headerShards) + if err != nil { + return nil, err + } + + var obj objectSDK.Object + return &obj, obj.Unmarshal(data) +} + +func reconstructExact(enc reedsolomon.Encoder, size int, shards [][]byte) ([]byte, error) { + if err := enc.ReconstructData(shards); err != nil { + return nil, err + } + + // Technically, this error will be returned from enc.Join(). + // However, allocating based on unvalidated user data is an easy attack vector. + // Preallocating seems to have enough benefits to justify a slight increase in code complexity. + maxSize := 0 + for i := range shards { + maxSize += len(shards[i]) + } + if size > maxSize { + return nil, reedsolomon.ErrShortData + } + + buf := bytes.NewBuffer(make([]byte, 0, size)) + if err := enc.Join(buf, shards, size); err != nil { + return nil, err + } + return buf.Bytes(), nil +} diff --git a/object/erasurecode/reconstruct_test.go b/object/erasurecode/reconstruct_test.go new file mode 100644 index 00000000..8397f441 --- /dev/null +++ b/object/erasurecode/reconstruct_test.go @@ -0,0 +1,284 @@ +package erasurecode_test + +import ( + "context" + "crypto/rand" + "math" + "testing" + + cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/erasurecode" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/stretchr/testify/require" +) + +func TestErasureCodeReconstruct(t *testing.T) { + const payloadSize = 99 + const dataCount = 3 + const parityCount = 2 + + // We would also like to test padding behaviour, + // so ensure padding is done. + require.NotZero(t, payloadSize%(dataCount+parityCount)) + + pk, err := keys.NewPrivateKey() + require.NoError(t, err) + + original := newObject(t, payloadSize, pk) + + c, err := erasurecode.NewConstructor(dataCount, parityCount) + require.NoError(t, err) + + parts, err := c.Split(original, &pk.PrivateKey) + require.NoError(t, err) + + t.Run("reconstruct header", func(t *testing.T) { + original := original.CutPayload() + parts := cloneSlice(parts) + for i := range parts { + parts[i] = parts[i].CutPayload() + } + t.Run("from data", func(t *testing.T) { + parts := cloneSlice(parts) + for i := dataCount; i < dataCount+parityCount; i++ { + parts[i] = nil + } + reconstructed, err := c.ReconstructHeader(parts) + require.NoError(t, err) + verifyReconstruction(t, original, reconstructed) + }) + t.Run("from parity", func(t *testing.T) { + parts := cloneSlice(parts) + for i := range parityCount { + parts[i] = nil + } + reconstructed, err := c.ReconstructHeader(parts) + require.NoError(t, err) + verifyReconstruction(t, original, reconstructed) + + t.Run("not enough shards", func(t *testing.T) { + parts[parityCount] = nil + _, err := c.ReconstructHeader(parts) + require.ErrorIs(t, err, erasurecode.ErrMalformedSlice) + }) + }) + t.Run("only nil parts", func(t *testing.T) { + parts := make([]*objectSDK.Object, len(parts)) + _, err := c.ReconstructHeader(parts) + require.ErrorIs(t, err, erasurecode.ErrMalformedSlice) + }) + t.Run("missing EC header", func(t *testing.T) { + parts := cloneSlice(parts) + parts[0] = deepCopy(t, parts[0]) + parts[0].SetECHeader(nil) + + _, err := c.ReconstructHeader(parts) + require.ErrorIs(t, err, erasurecode.ErrMalformedSlice) + }) + t.Run("invalid index", func(t *testing.T) { + parts := cloneSlice(parts) + parts[0] = deepCopy(t, parts[0]) + + ec := parts[0].GetECHeader() + ec.SetIndex(1) + parts[0].SetECHeader(ec) + + _, err := c.ReconstructHeader(parts) + require.ErrorIs(t, err, erasurecode.ErrMalformedSlice) + }) + t.Run("invalid total", func(t *testing.T) { + parts := cloneSlice(parts) + parts[0] = deepCopy(t, parts[0]) + + ec := parts[0].GetECHeader() + ec.SetTotal(uint32(len(parts) + 1)) + parts[0].SetECHeader(ec) + + _, err := c.ReconstructHeader(parts) + require.ErrorIs(t, err, erasurecode.ErrMalformedSlice) + }) + t.Run("inconsistent header length", func(t *testing.T) { + parts := cloneSlice(parts) + parts[0] = deepCopy(t, parts[0]) + + ec := parts[0].GetECHeader() + ec.SetHeaderLength(ec.HeaderLength() - 1) + parts[0].SetECHeader(ec) + + _, err := c.ReconstructHeader(parts) + require.ErrorIs(t, err, erasurecode.ErrMalformedSlice) + }) + t.Run("invalid header length", func(t *testing.T) { + parts := cloneSlice(parts) + for i := range parts { + parts[i] = deepCopy(t, parts[i]) + + ec := parts[0].GetECHeader() + ec.SetHeaderLength(math.MaxUint32) + parts[0].SetECHeader(ec) + } + + _, err := c.ReconstructHeader(parts) + require.ErrorIs(t, err, erasurecode.ErrMalformedSlice) + }) + }) + t.Run("reconstruct data", func(t *testing.T) { + t.Run("from data", func(t *testing.T) { + parts := cloneSlice(parts) + for i := dataCount; i < dataCount+parityCount; i++ { + parts[i] = nil + } + reconstructed, err := c.Reconstruct(parts) + require.NoError(t, err) + verifyReconstruction(t, original, reconstructed) + }) + t.Run("from parity", func(t *testing.T) { + parts := cloneSlice(parts) + for i := range parityCount { + parts[i] = nil + } + reconstructed, err := c.Reconstruct(parts) + require.NoError(t, err) + verifyReconstruction(t, original, reconstructed) + + t.Run("not enough shards", func(t *testing.T) { + parts[parityCount] = nil + _, err := c.Reconstruct(parts) + require.ErrorIs(t, err, erasurecode.ErrMalformedSlice) + }) + }) + }) + t.Run("reconstruct parts", func(t *testing.T) { + // We would like to also test that ReconstructParts doesn't perform + // excessive work, so ensure this test makes sense. + require.GreaterOrEqual(t, parityCount, 2) + + t.Run("from data", func(t *testing.T) { + oldParts := parts + parts := cloneSlice(parts) + for i := dataCount; i < dataCount+parityCount; i++ { + parts[i] = nil + } + + required := make([]bool, len(parts)) + required[dataCount] = true + + require.NoError(t, c.ReconstructParts(parts, required, nil)) + + old := deepCopy(t, oldParts[dataCount]) + old.SetSignature(nil) + require.Equal(t, old, parts[dataCount]) + + for i := dataCount + 1; i < dataCount+parityCount; i++ { + require.Nil(t, parts[i]) + } + }) + t.Run("from parity", func(t *testing.T) { + oldParts := parts + parts := cloneSlice(parts) + for i := range parityCount { + parts[i] = nil + } + + required := make([]bool, len(parts)) + required[0] = true + + require.NoError(t, c.ReconstructParts(parts, required, nil)) + + old := deepCopy(t, oldParts[0]) + old.SetSignature(nil) + require.Equal(t, old, parts[0]) + + for i := 1; i < parityCount; i++ { + require.Nil(t, parts[i]) + } + }) + }) +} + +func newObject(t *testing.T, size uint64, pk *keys.PrivateKey) *objectSDK.Object { + // Use transformer to form object to avoid potential bugs with yet another helper object creation in tests. + tt := &testTarget{} + p := transformer.NewPayloadSizeLimiter(transformer.Params{ + Key: &pk.PrivateKey, + NextTargetInit: func() transformer.ObjectWriter { return tt }, + NetworkState: dummyEpochSource(123), + MaxSize: size + 1, + WithoutHomomorphicHash: true, + }) + cnr := cidtest.ID() + ver := version.Current() + hdr := objectSDK.New() + hdr.SetContainerID(cnr) + hdr.SetType(objectSDK.TypeRegular) + hdr.SetVersion(&ver) + + var owner user.ID + user.IDFromKey(&owner, pk.PrivateKey.PublicKey) + hdr.SetOwnerID(owner) + + var attr objectSDK.Attribute + attr.SetKey("somekey") + attr.SetValue("somevalue") + hdr.SetAttributes(attr) + + expectedPayload := make([]byte, size) + _, _ = rand.Read(expectedPayload) + writeObject(t, context.Background(), p, hdr, expectedPayload) + require.Len(t, tt.objects, 1) + return tt.objects[0] +} + +func writeObject(t *testing.T, ctx context.Context, target transformer.ChunkedObjectWriter, header *objectSDK.Object, payload []byte) *transformer.AccessIdentifiers { + require.NoError(t, target.WriteHeader(ctx, header)) + + _, err := target.Write(ctx, payload) + require.NoError(t, err) + + ids, err := target.Close(ctx) + require.NoError(t, err) + + return ids +} + +func verifyReconstruction(t *testing.T, original, reconstructed *objectSDK.Object) { + require.True(t, reconstructed.VerifyIDSignature()) + reconstructed.ToV2().SetMarshalData(nil) + original.ToV2().SetMarshalData(nil) + + require.Equal(t, original, reconstructed) +} + +func deepCopy(t *testing.T, obj *objectSDK.Object) *objectSDK.Object { + data, err := obj.Marshal() + require.NoError(t, err) + + res := objectSDK.New() + require.NoError(t, res.Unmarshal(data)) + return res +} + +func cloneSlice[T any](src []T) []T { + dst := make([]T, len(src)) + copy(dst, src) + return dst +} + +type dummyEpochSource uint64 + +func (s dummyEpochSource) CurrentEpoch() uint64 { + return uint64(s) +} + +type testTarget struct { + objects []*objectSDK.Object +} + +func (tt *testTarget) WriteObject(_ context.Context, o *objectSDK.Object) error { + tt.objects = append(tt.objects, o) + return nil // AccessIdentifiers should not be used. +} diff --git a/object/erasurecode/split.go b/object/erasurecode/split.go new file mode 100644 index 00000000..bd173a73 --- /dev/null +++ b/object/erasurecode/split.go @@ -0,0 +1,85 @@ +package erasurecode + +import ( + "crypto/ecdsa" + + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" +) + +// Split splits fully formed object into multiple chunks. +func (c *Constructor) Split(obj *objectSDK.Object, key *ecdsa.PrivateKey) ([]*objectSDK.Object, error) { + c.clear() + + header, err := obj.CutPayload().Marshal() + if err != nil { + return nil, err + } + + headerShards, err := c.encodeRaw(header) + if err != nil { + return nil, err + } + payloadShards, err := c.encodeRaw(obj.Payload()) + if err != nil { + return nil, err + } + + parts := make([]*objectSDK.Object, len(payloadShards)) + parent, _ := obj.ID() + for i := range parts { + chunk := objectSDK.New() + copyRequiredFields(chunk, obj) + chunk.SetPayload(payloadShards[i]) + chunk.SetPayloadSize(uint64(len(payloadShards[i]))) + + var parentSplitParentID *oid.ID + if obj.HasParent() { + splitParentID, ok := obj.Parent().ID() + if ok { + parentSplitParentID = &splitParentID + } + } + + ecParentInfo := objectSDK.ECParentInfo{ + ID: parent, + SplitID: obj.SplitID(), + SplitParentID: parentSplitParentID, + Attributes: obj.Attributes(), + } + + ec := objectSDK.NewECHeader(ecParentInfo, uint32(i), uint32(len(payloadShards)), headerShards[i], uint32(len(header))) + chunk.SetECHeader(ec) + if err := setIDWithSignature(chunk, key); err != nil { + return nil, err + } + + parts[i] = chunk + } + return parts, nil +} + +func setIDWithSignature(obj *objectSDK.Object, key *ecdsa.PrivateKey) error { + objectSDK.CalculateAndSetPayloadChecksum(obj) + + if err := objectSDK.CalculateAndSetID(obj); err != nil { + return err + } + + if key == nil { + return nil + } + + return objectSDK.CalculateAndSetSignature(*key, obj) +} + +func (c *Constructor) encodeRaw(data []byte) ([][]byte, error) { + shards, err := c.enc.Split(data) + if err != nil { + return nil, err + } + if err := c.enc.Encode(shards); err != nil { + return nil, err + } + return shards, nil +} diff --git a/object/erasurecode/split_test.go b/object/erasurecode/split_test.go new file mode 100644 index 00000000..22d9a0af --- /dev/null +++ b/object/erasurecode/split_test.go @@ -0,0 +1,138 @@ +package erasurecode_test + +import ( + "testing" + + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/erasurecode" + oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/stretchr/testify/require" +) + +// The library can behave differently for big shard counts. +// This test checks we support the maximum number of chunks we promise. +func TestSplitMaxShardCount(t *testing.T) { + pk, err := keys.NewPrivateKey() + require.NoError(t, err) + + original := newObject(t, 1024, pk) + + t.Run("only data", func(t *testing.T) { + c, err := erasurecode.NewConstructor(erasurecode.MaxShardCount, 0) + require.NoError(t, err) + + parts, err := c.Split(original, &pk.PrivateKey) + require.NoError(t, err) + require.Len(t, parts, erasurecode.MaxShardCount) + + for _, part := range parts { + require.NoError(t, objectSDK.CheckHeaderVerificationFields(part)) + } + }) + t.Run("data + parity", func(t *testing.T) { + c, err := erasurecode.NewConstructor(1, erasurecode.MaxShardCount-1) + require.NoError(t, err) + + parts, err := c.Split(original, &pk.PrivateKey) + require.NoError(t, err) + require.Len(t, parts, erasurecode.MaxShardCount) + + for _, part := range parts { + require.NoError(t, objectSDK.CheckHeaderVerificationFields(part)) + } + }) + t.Run("ec parents are children of last Split part", func(t *testing.T) { + c, err := erasurecode.NewConstructor(1, erasurecode.MaxShardCount-1) + require.NoError(t, err) + + splitted1 := newObject(t, 1024, pk) + splitted2 := newObject(t, 1024, pk) + + splittedId1, _ := splitted1.ID() + splittedId2, _ := splitted2.ID() + + splitID := objectSDK.NewSplitID() + parent := objectSDK.New() + parent.SetID(oidtest.ID()) + parent.SetChildren(splittedId1, splittedId2) + parent.SetSplitID(splitID) + + splitted1.SetSplitID(splitID) + splitted1.SetParent(parent) + splitted2.SetSplitID(splitID) + splitted2.SetParent(parent) + + parts1, err := c.Split(splitted1, &pk.PrivateKey) + require.NoError(t, err) + require.Len(t, parts1, erasurecode.MaxShardCount) + + for _, part := range parts1 { + require.NoError(t, objectSDK.CheckHeaderVerificationFields(part)) + + require.NotNil(t, part.ECHeader().ParentSplitID()) + require.Equal(t, *splitID, *part.ECHeader().ParentSplitID()) + require.NotNil(t, part.ECHeader().ParentSplitParentID()) + } + + parts2, err := c.Split(splitted2, &pk.PrivateKey) + require.NoError(t, err) + require.Len(t, parts1, erasurecode.MaxShardCount) + + for _, part := range parts2 { + require.NoError(t, objectSDK.CheckHeaderVerificationFields(part)) + + require.NotNil(t, part.ECHeader().ParentSplitID()) + require.Equal(t, *splitID, *part.ECHeader().ParentSplitID()) + require.NotNil(t, part.ECHeader().ParentSplitParentID()) + } + + }) + t.Run("ec parents are children of non-last Split part", func(t *testing.T) { + c, err := erasurecode.NewConstructor(1, erasurecode.MaxShardCount-1) + require.NoError(t, err) + + splitted1 := newObject(t, 1024, pk) + splitted2 := newObject(t, 1024, pk) + + splittedId1, _ := splitted1.ID() + splittedId2, _ := splitted2.ID() + + splitID := objectSDK.NewSplitID() + parent := objectSDK.New() + // Such parent has got no ID. + parent.SetChildren(splittedId1, splittedId2) + parent.SetSplitID(splitID) + + splitted1.SetSplitID(splitID) + splitted1.SetParent(parent) + splitted2.SetSplitID(splitID) + splitted2.SetParent(parent) + + parts1, err := c.Split(splitted1, &pk.PrivateKey) + require.NoError(t, err) + require.Len(t, parts1, erasurecode.MaxShardCount) + + for _, part := range parts1 { + require.NoError(t, objectSDK.CheckHeaderVerificationFields(part)) + + require.NotNil(t, part.ECHeader().ParentSplitID()) + require.Equal(t, *splitID, *part.ECHeader().ParentSplitID()) + require.Nil(t, part.ECHeader().ParentSplitParentID()) + } + + parts2, err := c.Split(splitted2, &pk.PrivateKey) + require.NoError(t, err) + require.Len(t, parts1, erasurecode.MaxShardCount) + + for _, part := range parts2 { + require.NoError(t, objectSDK.CheckHeaderVerificationFields(part)) + + require.NotNil(t, part.ECHeader().ParentSplitID()) + require.Equal(t, *splitID, *part.ECHeader().ParentSplitID()) + require.Nil(t, part.ECHeader().ParentSplitParentID()) + } + + }) + +} diff --git a/object/erasurecode/target.go b/object/erasurecode/target.go new file mode 100644 index 00000000..5cd672b9 --- /dev/null +++ b/object/erasurecode/target.go @@ -0,0 +1,44 @@ +package erasurecode + +import ( + "context" + "crypto/ecdsa" + + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" +) + +// Target accepts regular objects and splits them into erasure-coded chunks. +type Target struct { + c *Constructor + key *ecdsa.PrivateKey + next transformer.ObjectWriter +} + +// ObjectWriter is an interface of the object writer that writes prepared object. +type ObjectWriter interface { + WriteObject(context.Context, *objectSDK.Object) error +} + +// NewTarget returns new target instance. +func NewTarget(c *Constructor, key *ecdsa.PrivateKey, next ObjectWriter) *Target { + return &Target{ + c: c, + key: key, + next: next, + } +} + +// WriteObject implements the transformer.ObjectWriter interface. +func (t *Target) WriteObject(ctx context.Context, obj *objectSDK.Object) error { + parts, err := t.c.Split(obj, t.key) + if err != nil { + return err + } + for i := range parts { + if err := t.next.WriteObject(ctx, parts[i]); err != nil { + return err + } + } + return nil +} diff --git a/object/erasurecode/verify.go b/object/erasurecode/verify.go new file mode 100644 index 00000000..8f1acd4f --- /dev/null +++ b/object/erasurecode/verify.go @@ -0,0 +1,104 @@ +package erasurecode + +import ( + "fmt" + + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" +) + +// Verify verifies that parts are well formed. +// All parts are expected to be non-nil. +// The number of parts must be equal to `total` field of the EC header +// and parts must be sorted by index. +func (c *Constructor) Verify(parts []*objectSDK.Object) error { + c.clear() + + var headerLength int + for i := range parts { + if parts[i] == nil { + return ErrMalformedSlice + } + + var err error + headerLength, err = validatePart(parts, i, headerLength) + if err != nil { + return err + } + } + + p0 := parts[0] + for i := 1; i < len(parts); i++ { + // This part must be kept in sync with copyRequiredFields(). + pi := parts[i] + if p0.OwnerID().Equals(pi.OwnerID()) { + return fmt.Errorf("%w: owner id mismatch: %s != %s", ErrMalformedSlice, p0.OwnerID(), pi.OwnerID()) + } + if p0.Version() == nil && pi.Version() != nil || !p0.Version().Equal(*pi.Version()) { + return fmt.Errorf("%w: version mismatch: %s != %s", ErrMalformedSlice, p0.Version(), pi.Version()) + } + + cnr0, _ := p0.ContainerID() + cnri, _ := pi.ContainerID() + if !cnr0.Equals(cnri) { + return fmt.Errorf("%w: container id mismatch: %s != %s", ErrMalformedSlice, cnr0, cnri) + } + } + + if err := c.fillHeader(parts); err != nil { + return err + } + c.fillPayload(parts) + + ok, err := c.enc.Verify(c.headerShards) + if err != nil { + return err + } + if !ok { + return ErrMalformedSlice + } + + ok, err = c.enc.Verify(c.payloadShards) + if err != nil { + return err + } + if !ok { + return ErrMalformedSlice + } + return nil +} + +// copyRequiredFields sets all fields in dst which are copied from src and shared among all chunks. +// src can be either another chunk of full object. +// dst must be a chunk. +func copyRequiredFields(dst *objectSDK.Object, src *objectSDK.Object) { + dst.SetVersion(src.Version()) + dst.SetOwnerID(src.OwnerID()) + dst.SetCreationEpoch(src.CreationEpoch()) + dst.SetSessionToken(src.SessionToken()) + + cnr, _ := src.ContainerID() + dst.SetContainerID(cnr) +} + +// validatePart makes i-th part is consistent with the rest. +// If headerLength is not zero it is asserted to be equal in the ec header. +// Otherwise, new headerLength is returned. +func validatePart(parts []*objectSDK.Object, i int, headerLength int) (int, error) { + ec := parts[i].GetECHeader() + if ec == nil { + return headerLength, fmt.Errorf("%w: missing EC header", ErrMalformedSlice) + } + if ec.Index() != uint32(i) { + return headerLength, fmt.Errorf("%w: index=%d, ec.index=%d", ErrMalformedSlice, i, ec.Index()) + } + if ec.Total() != uint32(len(parts)) { + return headerLength, fmt.Errorf("%w: len(parts)=%d, total=%d", ErrMalformedSlice, len(parts), ec.Total()) + } + if headerLength == 0 { + return int(ec.HeaderLength()), nil + } + if ec.HeaderLength() != uint32(headerLength) { + return headerLength, fmt.Errorf("%w: header length mismatch %d != %d", ErrMalformedSlice, headerLength, ec.HeaderLength()) + } + return headerLength, nil +} diff --git a/object/error.go b/object/error.go index 96048c28..8db1d94f 100644 --- a/object/error.go +++ b/object/error.go @@ -17,3 +17,21 @@ func (s *SplitInfoError) SplitInfo() *SplitInfo { func NewSplitInfoError(v *SplitInfo) *SplitInfoError { return &SplitInfoError{si: v} } + +type ECInfoError struct { + ei *ECInfo +} + +const ecInfoErrorMsg = "object not found, ec info has been provided" + +func (e *ECInfoError) Error() string { + return ecInfoErrorMsg +} + +func (e *ECInfoError) ECInfo() *ECInfo { + return e.ei +} + +func NewECInfoError(v *ECInfo) *ECInfoError { + return &ECInfoError{ei: v} +} diff --git a/object/error_test.go b/object/error_test.go index a0774b0e..0e4ab4e5 100644 --- a/object/error_test.go +++ b/object/error_test.go @@ -1,9 +1,12 @@ package object_test import ( + "crypto/rand" "errors" "testing" + objectV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "github.com/stretchr/testify/require" ) @@ -31,3 +34,43 @@ func generateSplitInfo() *object.SplitInfo { return si } + +func TestNewECInfoError(t *testing.T) { + var ( + ei = generateECInfo() + + err error = object.NewECInfoError(ei) + expectedErr *object.ECInfoError + ) + + require.True(t, errors.As(err, &expectedErr)) + + eiErr, ok := err.(*object.ECInfoError) + require.True(t, ok) + require.Equal(t, ei, eiErr.ECInfo()) +} + +func generateECInfo() *object.ECInfo { + ei := object.NewECInfo() + ei.Chunks = append(ei.Chunks, objectV2.ECChunk{ + ID: generateV2ID(), + Index: 0, + Total: 2, + }) + ei.Chunks = append(ei.Chunks, objectV2.ECChunk{ + ID: generateV2ID(), + Index: 1, + Total: 2, + }) + return ei +} + +func generateV2ID() refs.ObjectID { + var buf [32]byte + _, _ = rand.Read(buf[:]) + + var id refs.ObjectID + id.SetValue(buf[:]) + + return id +} diff --git a/object/fmt.go b/object/fmt.go index 5e6386d0..3380a7cd 100644 --- a/object/fmt.go +++ b/object/fmt.go @@ -7,7 +7,7 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" diff --git a/object/id/address.go b/object/id/address.go index 6d5f12a7..4c7b5975 100644 --- a/object/id/address.go +++ b/object/id/address.go @@ -5,14 +5,14 @@ import ( "fmt" "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" ) // Address represents global object identifier in FrostFS network. Each object // belongs to exactly one container and is uniquely addressed within the container. // -// Address is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs.Address +// Address is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs.Address // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. diff --git a/object/id/address_test.go b/object/id/address_test.go index 5ae91ca2..4b4a2f28 100644 --- a/object/id/address_test.go +++ b/object/id/address_test.go @@ -3,7 +3,7 @@ package oid_test import ( "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" diff --git a/object/id/id.go b/object/id/id.go index 5ba0c6dc..29e6a3ae 100644 --- a/object/id/id.go +++ b/object/id/id.go @@ -4,8 +4,9 @@ import ( "crypto/ecdsa" "crypto/sha256" "fmt" + "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" "github.com/mr-tron/base58" @@ -13,7 +14,7 @@ import ( // ID represents FrostFS object identifier in a container. // -// ID is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs.ObjectID +// ID is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs.ObjectID // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. @@ -167,3 +168,9 @@ func (id *ID) UnmarshalJSON(data []byte) error { return nil } + +// Cmp returns an integer comparing two base58 encoded object ID lexicographically. +// The result will be 0 if id1 == id2, -1 if id1 < id2, and +1 if id1 > id2. +func (id ID) Cmp(id2 ID) int { + return strings.Compare(id.EncodeToString(), id2.EncodeToString()) +} diff --git a/object/id/id_test.go b/object/id/id_test.go index bdc0b4d7..9df6186d 100644 --- a/object/id/id_test.go +++ b/object/id/id_test.go @@ -3,10 +3,12 @@ package oid import ( "crypto/rand" "crypto/sha256" + "slices" "strconv" + "strings" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "github.com/mr-tron/base58" "github.com/stretchr/testify/require" ) @@ -61,7 +63,7 @@ func TestID_Equal(t *testing.T) { func TestID_Parse(t *testing.T) { t.Run("should parse successful", func(t *testing.T) { - for i := 0; i < 10; i++ { + for i := range 10 { t.Run(strconv.Itoa(i), func(t *testing.T) { cs := randSHA256Checksum(t) str := base58.Encode(cs[:]) @@ -78,7 +80,7 @@ func TestID_Parse(t *testing.T) { }) t.Run("should failure on parse", func(t *testing.T) { - for i := 0; i < 10; i++ { + for i := range 10 { j := i t.Run(strconv.Itoa(j), func(t *testing.T) { cs := []byte{1, 2, 3, 4, 5, byte(j)} @@ -98,7 +100,7 @@ func TestID_String(t *testing.T) { }) t.Run("should be equal", func(t *testing.T) { - for i := 0; i < 10; i++ { + for i := range 10 { t.Run(strconv.Itoa(i), func(t *testing.T) { cs := randSHA256Checksum(t) str := base58.Encode(cs[:]) @@ -180,3 +182,16 @@ func TestID_Encode(t *testing.T) { require.Equal(t, emptyID, id.EncodeToString()) }) } + +func TestID_Cmp(t *testing.T) { + id1 := randID(t) + id2 := randID(t) + id3 := randID(t) + + arr := []ID{id1, id2, id3} + + slices.SortFunc(arr, ID.Cmp) + for i := 1; i < len(arr); i++ { + require.NotEqual(t, strings.Compare(arr[i-1].EncodeToString(), arr[i].EncodeToString()), 1, "array is not sorted correctly") + } +} diff --git a/object/lock.go b/object/lock.go index dd08ebae..4a2063b6 100644 --- a/object/lock.go +++ b/object/lock.go @@ -1,8 +1,8 @@ package object import ( - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" ) diff --git a/object/object.go b/object/object.go index 2685a244..ed551b5c 100644 --- a/object/object.go +++ b/object/object.go @@ -3,10 +3,13 @@ package object import ( "errors" "fmt" + "slices" + "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" @@ -312,6 +315,23 @@ func (o *Object) Attributes() []Attribute { return res } +// UserAttributes returns object user attributes. +func (o *Object) UserAttributes() []Attribute { + attrs := (*object.Object)(o). + GetHeader(). + GetAttributes() + + res := make([]Attribute, 0, len(attrs)) + + for _, attr := range attrs { + if !strings.HasPrefix(attr.GetKey(), container.SysAttributePrefix) { + res = append(res, *NewAttributeFromV2(&attr)) + } + } + + return slices.Clip(res) +} + // SetAttributes sets object attributes. func (o *Object) SetAttributes(v ...Attribute) { attrs := make([]object.Attribute, len(v)) @@ -325,6 +345,32 @@ func (o *Object) SetAttributes(v ...Attribute) { }) } +// SplitHeader returns split header of the object. If it's set, then split header +// defines how the object relates to other objects in a split operation. +func (o *Object) SplitHeader() (splitHeader *SplitHeader) { + if v2 := (*object.Object)(o). + GetHeader(). + GetSplit(); v2 != nil { + splitHeader = NewSplitHeaderFromV2(v2) + } + + return +} + +// SetSplitHeader sets split header. +func (o *Object) SetSplitHeader(v *SplitHeader) { + o.setSplitFields(func(sh *object.SplitHeader) { + v2 := v.ToV2() + + sh.SetParent(v2.GetParent()) + sh.SetPrevious(v2.GetPrevious()) + sh.SetParentHeader(v2.GetParentHeader()) + sh.SetParentSignature(v2.GetParentSignature()) + sh.SetChildren(v2.GetChildren()) + sh.SetSplitID(v2.GetSplitID()) + }) +} + // PreviousID returns identifier of the previous sibling object. func (o *Object) PreviousID() (v oid.ID, isSet bool) { v2 := (*object.Object)(o) @@ -366,6 +412,14 @@ func (o *Object) Children() []oid.ID { return res } +func (o *Object) GetECHeader() *ECHeader { + v2 := (*object.Object)(o).GetHeader().GetEC() + + var ec ECHeader + _ = ec.ReadFromV2(v2) // Errors is checked on unmarshal. + return &ec +} + // SetChildren sets list of the identifiers of the child objects. func (o *Object) SetChildren(v ...oid.ID) { var ( @@ -571,6 +625,7 @@ func (o *Object) CutPayload() *Object { ov2 := new(object.Object) *ov2 = *(*object.Object)(o) ov2.SetPayload(nil) + ov2.SetMarshalData(nil) return (*Object)(ov2) } diff --git a/object/object_test.go b/object/object_test.go index 5e423521..4348105a 100644 --- a/object/object_test.go +++ b/object/object_test.go @@ -3,8 +3,10 @@ package object_test import ( "testing" + v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + objecttest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/test" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" "github.com/stretchr/testify/require" ) @@ -24,3 +26,26 @@ func TestInitCreation(t *testing.T) { require.Equal(t, cnr, cID) require.Equal(t, own, o.OwnerID()) } + +func Test_Attributes(t *testing.T) { + obj := objecttest.Object() + + t.Run("get user attributes", func(t *testing.T) { + // See how we create a test object. It's created with two attributes. + require.Len(t, obj.UserAttributes(), 2) + }) + + userAttrs := obj.UserAttributes() + + sysAttr := *object.NewAttribute() + sysAttr.SetKey(v2container.SysAttributePrefix + "key") + sysAttr.SetValue("value") + + attr := append(userAttrs, sysAttr) + obj.SetAttributes(attr...) + + t.Run("get attributes", func(t *testing.T) { + require.ElementsMatch(t, obj.UserAttributes(), userAttrs) + require.ElementsMatch(t, obj.Attributes(), attr) + }) +} diff --git a/object/patch.go b/object/patch.go new file mode 100644 index 00000000..9c6ddc4c --- /dev/null +++ b/object/patch.go @@ -0,0 +1,111 @@ +package object + +import ( + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" +) + +// Patch is a patch that's applied for an object. +type Patch struct { + // The address of the object for which the patch is being applied. + Address oid.Address + + // The list of new attributes to set in the object's header. + NewAttributes []Attribute + + // If ReplaceAttributes flag is true, then the header's attributes are reset and + // filled with NewAttributes. Otherwise, the attributes are just merged. + ReplaceAttributes bool + + // A new split header which is set to object's header. If `nil`, then split header patching + // is ignored. + NewSplitHeader *SplitHeader + + // Payload patch. If this field is not set, then it assumed such Patch patches only + // header (see NewAttributes, ReplaceAttributes). + PayloadPatch *PayloadPatch +} + +func (p *Patch) ToV2() *v2object.PatchRequestBody { + if p == nil { + return nil + } + + v2 := new(v2object.PatchRequestBody) + + addrV2 := new(refs.Address) + p.Address.WriteToV2(addrV2) + v2.SetAddress(addrV2) + + attrs := make([]v2object.Attribute, len(p.NewAttributes)) + for i := range p.NewAttributes { + attrs[i] = *p.NewAttributes[i].ToV2() + } + v2.SetNewAttributes(attrs) + v2.SetReplaceAttributes(p.ReplaceAttributes) + + v2.SetNewSplitHeader(p.NewSplitHeader.ToV2()) + + v2.SetPatch(p.PayloadPatch.ToV2()) + + return v2 +} + +func (p *Patch) FromV2(patch *v2object.PatchRequestBody) { + if patch == nil { + return + } + + if addr := patch.GetAddress(); addr != nil { + _ = p.Address.ReadFromV2(*addr) + } + + newAttrs := patch.GetNewAttributes() + p.NewAttributes = make([]Attribute, len(newAttrs)) + for i := range newAttrs { + p.NewAttributes[i] = *NewAttributeFromV2(&newAttrs[i]) + } + + p.ReplaceAttributes = patch.GetReplaceAttributes() + + p.NewSplitHeader = NewSplitHeaderFromV2(patch.GetNewSplitHeader()) + + if v2patch := patch.GetPatch(); v2patch != nil { + p.PayloadPatch = new(PayloadPatch) + p.PayloadPatch.FromV2(v2patch) + } +} + +// Patch is a patch that's applied for an object's payload. +type PayloadPatch struct { + // Range of the patch application. + Range *Range + + // Chunk is the payload that replaces (or is appended to) the original object payload. + Chunk []byte +} + +func (p *PayloadPatch) ToV2() *v2object.PatchRequestBodyPatch { + if p == nil { + return nil + } + + v2 := new(v2object.PatchRequestBodyPatch) + + v2.Chunk = p.Chunk + v2.Range = p.Range.ToV2() + + return v2 +} + +func (p *PayloadPatch) FromV2(patch *v2object.PatchRequestBodyPatch) { + if patch == nil { + return + } + + p.Chunk = patch.Chunk + if patch.Range != nil { + p.Range = NewRangeFromV2(patch.Range) + } +} diff --git a/object/patch_test.go b/object/patch_test.go new file mode 100644 index 00000000..84ef4815 --- /dev/null +++ b/object/patch_test.go @@ -0,0 +1,161 @@ +package object + +import ( + "testing" + + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" + oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" + "github.com/stretchr/testify/require" +) + +func TestPatch(t *testing.T) { + t.Run("to v2", func(t *testing.T) { + t.Run("only attributes", func(t *testing.T) { + var p Patch + + var attr1, attr2 Attribute + attr1.SetKey("key1") + attr1.SetValue("val1") + attr2.SetKey("key2") + attr2.SetValue("val2") + + p.Address = oidtest.Address() + p.NewAttributes = []Attribute{attr1, attr2} + p.ReplaceAttributes = true + + v2patch := p.ToV2() + + addr := new(oid.Address) + require.NotNil(t, v2patch.GetAddress()) + addr.ReadFromV2(*v2patch.GetAddress()) + require.True(t, p.Address.Equals(*addr)) + + require.Equal(t, p.ReplaceAttributes, v2patch.GetReplaceAttributes()) + + require.Nil(t, v2patch.GetPatch()) + + require.Len(t, v2patch.GetNewAttributes(), 2) + require.Equal(t, attr1.Key(), v2patch.GetNewAttributes()[0].GetKey()) + require.Equal(t, attr2.Key(), v2patch.GetNewAttributes()[1].GetKey()) + require.Equal(t, attr1.Value(), v2patch.GetNewAttributes()[0].GetValue()) + require.Equal(t, attr2.Value(), v2patch.GetNewAttributes()[1].GetValue()) + }) + + t.Run("with payload patch", func(t *testing.T) { + var p Patch + + var attr1, attr2 Attribute + attr1.SetKey("key1") + attr1.SetValue("val1") + attr2.SetKey("key2") + attr2.SetValue("val2") + + p.Address = oidtest.Address() + p.NewAttributes = []Attribute{attr1, attr2} + p.ReplaceAttributes = true + + rng := &Range{} + rng.SetOffset(100) + rng.SetLength(10) + p.PayloadPatch = &PayloadPatch{ + Range: rng, + Chunk: []byte("payload_patch_chunk"), + } + + v2patch := p.ToV2() + + addr := new(oid.Address) + require.NotNil(t, v2patch.GetAddress()) + addr.ReadFromV2(*v2patch.GetAddress()) + require.True(t, p.Address.Equals(*addr)) + + require.Equal(t, p.ReplaceAttributes, v2patch.GetReplaceAttributes()) + + require.Len(t, v2patch.GetNewAttributes(), 2) + require.Equal(t, attr1.Key(), v2patch.GetNewAttributes()[0].GetKey()) + require.Equal(t, attr2.Key(), v2patch.GetNewAttributes()[1].GetKey()) + require.Equal(t, attr1.Value(), v2patch.GetNewAttributes()[0].GetValue()) + require.Equal(t, attr2.Value(), v2patch.GetNewAttributes()[1].GetValue()) + + require.NotNil(t, v2patch.GetPatch()) + require.NotNil(t, v2patch.GetPatch().Range) + require.Equal(t, uint64(100), v2patch.GetPatch().Range.GetOffset()) + require.Equal(t, uint64(10), v2patch.GetPatch().Range.GetLength()) + require.Equal(t, []byte("payload_patch_chunk"), v2patch.GetPatch().Chunk) + }) + + }) + + t.Run("from v2", func(t *testing.T) { + t.Run("only attributes", func(t *testing.T) { + v2patch := new(v2object.PatchRequestBody) + + address := oidtest.Address() + v2addr := new(refs.Address) + address.WriteToV2(v2addr) + v2patch.SetAddress(v2addr) + + var attr1, attr2 Attribute + attr1.SetKey("key1") + attr1.SetValue("val1") + attr2.SetKey("key2") + attr2.SetValue("val2") + + v2patch.SetNewAttributes([]v2object.Attribute{ + *attr1.ToV2(), *attr2.ToV2(), + }) + v2patch.SetReplaceAttributes(true) + + var p Patch + p.FromV2(v2patch) + + require.Equal(t, address, p.Address) + require.Equal(t, []Attribute{attr1, attr2}, p.NewAttributes) + require.Equal(t, true, p.ReplaceAttributes) + require.Nil(t, p.PayloadPatch) + }) + + t.Run("with payload patch", func(t *testing.T) { + v2patchReqBody := new(v2object.PatchRequestBody) + + address := oidtest.Address() + v2addr := new(refs.Address) + address.WriteToV2(v2addr) + v2patchReqBody.SetAddress(v2addr) + + var attr1, attr2 Attribute + attr1.SetKey("key1") + attr1.SetValue("val1") + attr2.SetKey("key2") + attr2.SetValue("val2") + + v2patchReqBody.SetNewAttributes([]v2object.Attribute{ + *attr1.ToV2(), *attr2.ToV2(), + }) + v2patchReqBody.SetReplaceAttributes(true) + + v2Rng := &v2object.Range{} + v2Rng.SetOffset(13) + v2Rng.SetLength(10) + v2Patch := &v2object.PatchRequestBodyPatch{ + Range: v2Rng, + Chunk: []byte("payload_patch_chunk"), + } + v2patchReqBody.SetPatch(v2Patch) + + var p Patch + p.FromV2(v2patchReqBody) + + require.Equal(t, address, p.Address) + require.Equal(t, []Attribute{attr1, attr2}, p.NewAttributes) + require.Equal(t, true, p.ReplaceAttributes) + require.NotNil(t, p.PayloadPatch) + require.NotNil(t, p.PayloadPatch.Range) + require.Equal(t, uint64(13), p.PayloadPatch.Range.GetOffset()) + require.Equal(t, uint64(10), p.PayloadPatch.Range.GetLength()) + require.Equal(t, []byte("payload_patch_chunk"), p.PayloadPatch.Chunk) + }) + }) +} diff --git a/object/patcher/patcher.go b/object/patcher/patcher.go new file mode 100644 index 00000000..66df9d33 --- /dev/null +++ b/object/patcher/patcher.go @@ -0,0 +1,298 @@ +package patcher + +import ( + "context" + "errors" + "fmt" + "io" + + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" +) + +var ( + ErrOffsetExceedsSize = errors.New("patch offset exceeds object size") + ErrInvalidPatchOffsetOrder = errors.New("invalid patch offset order") + ErrPayloadPatchIsNil = errors.New("nil payload patch") + ErrAttrPatchAlreadyApplied = errors.New("attribute patch already applied") + ErrHeaderPatchAlreadyApplied = errors.New("header patch already applied") + ErrSplitHeaderPatchAppliedWithPayloadPatch = errors.New("split header patch applied with payload patch") +) + +// PatchRes is the result of patch application. +type PatchRes struct { + AccessIdentifiers *transformer.AccessIdentifiers +} + +// PatchApplier is the interface that provides method to apply header and payload patches. +type PatchApplier interface { + // ApplyAttributesPatch applies the patch only for the object's attributes. + // + // ApplyAttributesPatch can't be invoked few times, otherwise it returns `ErrAttrPatchAlreadyApplied` error. + // `ApplyHeaderPatch` and `ApplyAttributesPatch` are mutually exclusive - only one method can be used. + // + // The call is idempotent for the original header if it's invoked with empty `newAttrs` and + // `replaceAttrs = false`. + ApplyAttributesPatch(ctx context.Context, newAttrs []objectSDK.Attribute, replaceAttrs bool) error + + // ApplyHeaderPatch applies the patch only for the object's attributes. + // + // ApplyHeaderPatch can't be invoked few times, otherwise it returns `ErrHeaderPatchAlreadyApplied` error. + // `ApplyHeaderPatch` and `ApplyAttributesPatch` are mutually exclusive - only one method can be used. + // + // The call is idempotent for the original header if it's invoked with `ApplyHeaderPatchPrm` with not set fields. + ApplyHeaderPatch(ctx context.Context, prm ApplyHeaderPatchPrm) error + + // ApplyPayloadPatch applies the patch for the object's payload. + // + // ApplyPayloadPatch returns `ErrSplitHeaderPatchAppliedWithPayloadPatch` when attempting to apply it with a split header patch. + // + // ApplyPayloadPatch returns `ErrPayloadPatchIsNil` error if patch is nil. + ApplyPayloadPatch(ctx context.Context, payloadPatch *objectSDK.PayloadPatch) error + + // Close closes PatchApplier when the patch stream is over. + Close(context.Context) (PatchRes, error) +} + +type ApplyHeaderPatchPrm struct { + NewSplitHeader *objectSDK.SplitHeader + + NewAttributes []objectSDK.Attribute + + ReplaceAttributes bool +} + +// RangeProvider is the interface that provides a method to get original object payload +// by a given range. +type RangeProvider interface { + // GetRange reads an original object payload by the given range. + // The method returns io.Reader over the data range only. This means if the data is read out, + // then GetRange has to be invoked to provide reader over the next range. + GetRange(ctx context.Context, rng *objectSDK.Range) io.Reader +} + +type patcher struct { + rangeProvider RangeProvider + + objectWriter transformer.ChunkedObjectWriter + + currOffset uint64 + + originalPayloadSize uint64 + + hdr *objectSDK.Object + + hdrPatchAlreadyApplied bool + + splitHeaderPatchAlreadyApplied bool + + readerBuffSize int +} + +const ( + DefaultReaderBufferSize = 64 * 1024 +) + +// Params is parameters to initialize patcher. +type Params struct { + // Original object header. + Header *objectSDK.Object + + // Range provider. + RangeProvider RangeProvider + + // ObjectWriter is the writer that writes the patched object. + ObjectWriter transformer.ChunkedObjectWriter + + // The size of the buffer used by the original payload range reader. + // If it's set to <=0, then `DefaultReaderBufferSize` is used. + ReaderBufferSize int +} + +func New(prm Params) PatchApplier { + readerBufferSize := prm.ReaderBufferSize + if readerBufferSize <= 0 { + readerBufferSize = DefaultReaderBufferSize + } + + return &patcher{ + rangeProvider: prm.RangeProvider, + + objectWriter: prm.ObjectWriter, + + hdr: prm.Header, + + originalPayloadSize: prm.Header.PayloadSize(), + + readerBuffSize: readerBufferSize, + } +} + +func (p *patcher) ApplyAttributesPatch(ctx context.Context, newAttrs []objectSDK.Attribute, replaceAttrs bool) error { + defer func() { + p.hdrPatchAlreadyApplied = true + }() + + if p.hdrPatchAlreadyApplied { + return ErrAttrPatchAlreadyApplied + } + + if replaceAttrs { + p.hdr.SetAttributes(newAttrs...) + } else if len(newAttrs) > 0 { + mergedAttrs := mergeAttributes(newAttrs, p.hdr.Attributes()) + p.hdr.SetAttributes(mergedAttrs...) + } + + if err := p.objectWriter.WriteHeader(ctx, p.hdr); err != nil { + return fmt.Errorf("writer header: %w", err) + } + return nil +} + +func (p *patcher) ApplyHeaderPatch(ctx context.Context, prm ApplyHeaderPatchPrm) error { + defer func() { + p.hdrPatchAlreadyApplied = true + }() + + if p.hdrPatchAlreadyApplied { + return ErrHeaderPatchAlreadyApplied + } + + if prm.NewSplitHeader != nil { + p.hdr.SetSplitHeader(prm.NewSplitHeader) + + p.splitHeaderPatchAlreadyApplied = true + } + + if prm.ReplaceAttributes { + p.hdr.SetAttributes(prm.NewAttributes...) + } else if len(prm.NewAttributes) > 0 { + mergedAttrs := mergeAttributes(prm.NewAttributes, p.hdr.Attributes()) + p.hdr.SetAttributes(mergedAttrs...) + } + + if err := p.objectWriter.WriteHeader(ctx, p.hdr); err != nil { + return fmt.Errorf("writer header: %w", err) + } + return nil +} + +func (p *patcher) ApplyPayloadPatch(ctx context.Context, payloadPatch *objectSDK.PayloadPatch) error { + if p.splitHeaderPatchAlreadyApplied { + return ErrSplitHeaderPatchAppliedWithPayloadPatch + } + if payloadPatch == nil { + return ErrPayloadPatchIsNil + } + + if payloadPatch.Range.GetOffset() < p.currOffset { + return fmt.Errorf("%w: current = %d, previous = %d", ErrInvalidPatchOffsetOrder, payloadPatch.Range.GetOffset(), p.currOffset) + } + + if payloadPatch.Range.GetOffset() > p.originalPayloadSize { + return fmt.Errorf("%w: offset = %d, object size = %d", ErrOffsetExceedsSize, payloadPatch.Range.GetOffset(), p.originalPayloadSize) + } + + var err error + if p.currOffset, err = p.applyPatch(ctx, payloadPatch, p.currOffset); err != nil { + return fmt.Errorf("apply patch: %w", err) + } + + return nil +} + +func (p *patcher) Close(ctx context.Context) (PatchRes, error) { + rng := new(objectSDK.Range) + rng.SetOffset(p.currOffset) + rng.SetLength(p.originalPayloadSize - p.currOffset) + + // copy remaining originial payload + if err := p.copyRange(ctx, rng); err != nil { + return PatchRes{}, fmt.Errorf("copy payload: %w", err) + } + + aid, err := p.objectWriter.Close(ctx) + if err != nil { + return PatchRes{}, fmt.Errorf("close object writer: %w", err) + } + + return PatchRes{ + AccessIdentifiers: aid, + }, nil +} + +func (p *patcher) copyRange(ctx context.Context, rng *objectSDK.Range) error { + rdr := p.rangeProvider.GetRange(ctx, rng) + for { + buffOrigPayload := make([]byte, p.readerBuffSize) + n, readErr := rdr.Read(buffOrigPayload) + if readErr != nil { + if readErr != io.EOF { + return fmt.Errorf("read: %w", readErr) + } + } + _, wrErr := p.objectWriter.Write(ctx, buffOrigPayload[:n]) + if wrErr != nil { + return fmt.Errorf("write: %w", wrErr) + } + if readErr == io.EOF { + break + } + } + return nil +} + +func (p *patcher) applyPatch(ctx context.Context, payloadPatch *objectSDK.PayloadPatch, offset uint64) (newOffset uint64, err error) { + newOffset = offset + + // write the original payload chunk before the start of the patch + if payloadPatch.Range.GetOffset() > offset { + rng := new(objectSDK.Range) + rng.SetOffset(offset) + rng.SetLength(payloadPatch.Range.GetOffset() - offset) + + if err = p.copyRange(ctx, rng); err != nil { + err = fmt.Errorf("copy payload: %w", err) + return + } + + newOffset = payloadPatch.Range.GetOffset() + } + + // apply patch + if _, err = p.objectWriter.Write(ctx, payloadPatch.Chunk); err != nil { + return + } + + if payloadPatch.Range.GetLength() > 0 { + newOffset += payloadPatch.Range.GetLength() + } + + return +} + +func mergeAttributes(newAttrs, oldAttrs []objectSDK.Attribute) []objectSDK.Attribute { + attrMap := make(map[string]string, len(newAttrs)) + + for _, attr := range newAttrs { + attrMap[attr.Key()] = attr.Value() + } + + for i := range oldAttrs { + newVal, ok := attrMap[oldAttrs[i].Key()] + if !ok { + continue + } + oldAttrs[i].SetValue(newVal) + delete(attrMap, oldAttrs[i].Key()) + } + + for _, newAttr := range newAttrs { + if _, ok := attrMap[newAttr.Key()]; ok { + oldAttrs = append(oldAttrs, newAttr) + } + } + + return oldAttrs +} diff --git a/object/patcher/patcher_test.go b/object/patcher/patcher_test.go new file mode 100644 index 00000000..4819b591 --- /dev/null +++ b/object/patcher/patcher_test.go @@ -0,0 +1,773 @@ +package patcher + +import ( + "bytes" + "context" + "io" + "testing" + + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" + oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" + "github.com/stretchr/testify/require" +) + +type mockPatchedObjectWriter struct { + obj *objectSDK.Object +} + +func (m *mockPatchedObjectWriter) Write(_ context.Context, chunk []byte) (int, error) { + res := append(m.obj.Payload(), chunk...) + + m.obj.SetPayload(res) + m.obj.SetPayloadSize(uint64(len(res))) + + return len(chunk), nil +} + +func (m *mockPatchedObjectWriter) WriteHeader(_ context.Context, hdr *objectSDK.Object) error { + m.obj.ToV2().SetHeader(hdr.ToV2().GetHeader()) + return nil +} + +func (m *mockPatchedObjectWriter) Close(context.Context) (*transformer.AccessIdentifiers, error) { + return &transformer.AccessIdentifiers{}, nil +} + +type mockRangeProvider struct { + originalObjectPayload []byte +} + +var _ RangeProvider = (*mockRangeProvider)(nil) + +func (m *mockRangeProvider) GetRange(_ context.Context, rng *objectSDK.Range) io.Reader { + offset := rng.GetOffset() + length := rng.GetLength() + + if length == 0 { + return bytes.NewReader(m.originalObjectPayload[offset:]) + } + return bytes.NewReader(m.originalObjectPayload[offset : offset+length]) +} + +func newTestObject() (*objectSDK.Object, oid.Address) { + obj := objectSDK.New() + + addr := oidtest.Address() + obj.SetContainerID(addr.Container()) + obj.SetID(addr.Object()) + + return obj, addr +} + +func rangeWithOffestWithLength(offset, length uint64) *objectSDK.Range { + rng := new(objectSDK.Range) + rng.SetOffset(offset) + rng.SetLength(length) + return rng +} + +func TestPatchRevert(t *testing.T) { + obj, _ := newTestObject() + + modifPatch := &objectSDK.Patch{ + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 0), + + Chunk: []byte("inserted"), + }, + } + + originalObjectPayload := []byte("*******************") + + obj.SetPayload(originalObjectPayload) + obj.SetPayloadSize(uint64(len(originalObjectPayload))) + + exp := []byte("inserted*******************") + + rangeProvider := &mockRangeProvider{ + originalObjectPayload: originalObjectPayload, + } + + patchedObj, _ := newTestObject() + + wr := &mockPatchedObjectWriter{ + obj: patchedObj, + } + + prm := Params{ + Header: obj.CutPayload(), + + RangeProvider: rangeProvider, + + ObjectWriter: wr, + } + + patcher := New(prm) + + err := patcher.ApplyHeaderPatch(context.Background(), ApplyHeaderPatchPrm{ + NewSplitHeader: modifPatch.NewSplitHeader, + NewAttributes: modifPatch.NewAttributes, + ReplaceAttributes: modifPatch.ReplaceAttributes, + }) + require.NoError(t, err) + + err = patcher.ApplyPayloadPatch(context.Background(), modifPatch.PayloadPatch) + require.NoError(t, err) + + _, err = patcher.Close(context.Background()) + require.NoError(t, err) + + require.Equal(t, exp, patchedObj.Payload()) + + revertPatch := &objectSDK.Patch{ + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, uint64(len("inserted"))), + + Chunk: []byte{}, + }, + } + + rangeProvider = &mockRangeProvider{ + originalObjectPayload: exp, + } + + patchedPatchedObj, _ := newTestObject() + + wr = &mockPatchedObjectWriter{ + obj: patchedPatchedObj, + } + + prm = Params{ + Header: patchedObj.CutPayload(), + + RangeProvider: rangeProvider, + + ObjectWriter: wr, + } + + patcher = New(prm) + + err = patcher.ApplyHeaderPatch(context.Background(), ApplyHeaderPatchPrm{ + NewSplitHeader: revertPatch.NewSplitHeader, + NewAttributes: revertPatch.NewAttributes, + ReplaceAttributes: revertPatch.ReplaceAttributes, + }) + require.NoError(t, err) + + err = patcher.ApplyPayloadPatch(context.Background(), revertPatch.PayloadPatch) + require.NoError(t, err) + + _, err = patcher.Close(context.Background()) + require.NoError(t, err) + + require.Equal(t, originalObjectPayload, patchedPatchedObj.Payload()) +} + +func TestPatchRepeatHeaderPatch(t *testing.T) { + obj, _ := newTestObject() + + modifPatch := &objectSDK.Patch{} + + originalObjectPayload := []byte("*******************") + + obj.SetPayload(originalObjectPayload) + obj.SetPayloadSize(uint64(len(originalObjectPayload))) + + rangeProvider := &mockRangeProvider{ + originalObjectPayload: originalObjectPayload, + } + + patchedObj, _ := newTestObject() + + wr := &mockPatchedObjectWriter{ + obj: patchedObj, + } + + prm := Params{ + Header: obj.CutPayload(), + + RangeProvider: rangeProvider, + + ObjectWriter: wr, + } + + patcher := New(prm) + + err := patcher.ApplyHeaderPatch(context.Background(), ApplyHeaderPatchPrm{ + NewSplitHeader: modifPatch.NewSplitHeader, + NewAttributes: modifPatch.NewAttributes, + ReplaceAttributes: modifPatch.ReplaceAttributes, + }) + require.NoError(t, err) + + err = patcher.ApplyHeaderPatch(context.Background(), ApplyHeaderPatchPrm{ + NewSplitHeader: modifPatch.NewSplitHeader, + NewAttributes: modifPatch.NewAttributes, + ReplaceAttributes: modifPatch.ReplaceAttributes, + }) + require.ErrorIs(t, err, ErrHeaderPatchAlreadyApplied) +} + +func TestPatchSplitHeader(t *testing.T) { + obj, _ := newTestObject() + + const ( + splitIDStr = "a59c9f87-14bc-4a61-95d1-7eb10f036163" + parentStr = "9cRjAaPqUt5zaDAjBkSCqFfPdkE8dHJ7mtRupRjPWp6E" + previosStr = "6WaTd9HobT4Z52NnKWHAtjqtQu2Ww5xZwNdT4ptshkKE" + ) + + splitID := objectSDK.NewSplitID() + require.NoError(t, splitID.Parse(splitIDStr)) + + var par, prev oid.ID + require.NoError(t, par.DecodeString(parentStr)) + require.NoError(t, prev.DecodeString(previosStr)) + + splitHdr := objectSDK.NewSplitHeader() + splitHdr.SetSplitID(splitID) + splitHdr.SetParentID(par) + splitHdr.SetPreviousID(prev) + + originalObjectPayload := []byte("*******************") + + obj.SetPayload(originalObjectPayload) + obj.SetPayloadSize(uint64(len(originalObjectPayload))) + + rangeProvider := &mockRangeProvider{ + originalObjectPayload: originalObjectPayload, + } + + t.Run("no payload patch", func(t *testing.T) { + patchedObj, _ := newTestObject() + + wr := &mockPatchedObjectWriter{ + obj: patchedObj, + } + + modifPatch := &objectSDK.Patch{ + NewSplitHeader: splitHdr, + } + + prm := Params{ + Header: obj.CutPayload(), + + RangeProvider: rangeProvider, + + ObjectWriter: wr, + } + + patcher := New(prm) + + err := patcher.ApplyHeaderPatch(context.Background(), ApplyHeaderPatchPrm{ + NewSplitHeader: modifPatch.NewSplitHeader, + NewAttributes: modifPatch.NewAttributes, + ReplaceAttributes: modifPatch.ReplaceAttributes, + }) + require.NoError(t, err) + + splitHdrFromPatchedObj := patchedObj.SplitHeader() + require.NotNil(t, splitHdrFromPatchedObj) + + patchObjParID, isSet := splitHdrFromPatchedObj.ParentID() + require.True(t, isSet) + require.True(t, patchObjParID.Equals(par)) + + patchObjPrevID, isSet := splitHdrFromPatchedObj.PreviousID() + require.True(t, isSet) + require.True(t, patchObjPrevID.Equals(prev)) + + require.Equal(t, splitHdrFromPatchedObj.SplitID().String(), splitID.String()) + }) + + t.Run("with payload patch", func(t *testing.T) { + patchedObj, _ := newTestObject() + + wr := &mockPatchedObjectWriter{ + obj: patchedObj, + } + + modifPatch := &objectSDK.Patch{ + NewSplitHeader: splitHdr, + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(10, 0), + Chunk: []byte(""), + }, + } + + prm := Params{ + Header: obj.CutPayload(), + + RangeProvider: rangeProvider, + + ObjectWriter: wr, + } + + patcher := New(prm) + + err := patcher.ApplyHeaderPatch(context.Background(), ApplyHeaderPatchPrm{ + NewSplitHeader: modifPatch.NewSplitHeader, + NewAttributes: modifPatch.NewAttributes, + ReplaceAttributes: modifPatch.ReplaceAttributes, + }) + require.NoError(t, err) + + splitHdrFromPatchedObj := patchedObj.SplitHeader() + require.NotNil(t, splitHdrFromPatchedObj) + + patchObjParID, isSet := splitHdrFromPatchedObj.ParentID() + require.True(t, isSet) + require.True(t, patchObjParID.Equals(par)) + + patchObjPrevID, isSet := splitHdrFromPatchedObj.PreviousID() + require.True(t, isSet) + require.True(t, patchObjPrevID.Equals(prev)) + + require.Equal(t, splitHdrFromPatchedObj.SplitID().String(), splitID.String()) + + err = patcher.ApplyPayloadPatch(context.Background(), modifPatch.PayloadPatch) + require.Error(t, err, ErrSplitHeaderPatchAppliedWithPayloadPatch) + }) + +} + +func TestPatchEmptyPayloadPatch(t *testing.T) { + obj, _ := newTestObject() + + modifPatch := &objectSDK.Patch{} + + originalObjectPayload := []byte("*******************") + + obj.SetPayload(originalObjectPayload) + obj.SetPayloadSize(uint64(len(originalObjectPayload))) + + rangeProvider := &mockRangeProvider{ + originalObjectPayload: originalObjectPayload, + } + + patchedObj, _ := newTestObject() + + wr := &mockPatchedObjectWriter{ + obj: patchedObj, + } + + prm := Params{ + Header: obj.CutPayload(), + + RangeProvider: rangeProvider, + + ObjectWriter: wr, + } + + patcher := New(prm) + + err := patcher.ApplyHeaderPatch(context.Background(), ApplyHeaderPatchPrm{ + NewSplitHeader: modifPatch.NewSplitHeader, + NewAttributes: modifPatch.NewAttributes, + ReplaceAttributes: modifPatch.ReplaceAttributes, + }) + require.NoError(t, err) + + err = patcher.ApplyPayloadPatch(context.Background(), nil) + require.ErrorIs(t, err, ErrPayloadPatchIsNil) +} + +func newTestAttribute(key, val string) objectSDK.Attribute { + var attr objectSDK.Attribute + attr.SetKey(key) + attr.SetValue(val) + return attr +} + +func TestPatch(t *testing.T) { + for _, test := range []struct { + name string + patches []objectSDK.Patch + originalObjectPayload []byte + patchedPayload []byte + originalHeaderAttributes []objectSDK.Attribute + patchedHeaderAttributes []objectSDK.Attribute + expectedPayloadPatchErr error + }{ + { + name: "invalid offset", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(100, 0), + Chunk: []byte(""), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + expectedPayloadPatchErr: ErrOffsetExceedsSize, + }, + { + name: "invalid following patch offset", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(10, 0), + Chunk: []byte(""), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(7, 0), + Chunk: []byte(""), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + expectedPayloadPatchErr: ErrInvalidPatchOffsetOrder, + }, + { + name: "only header patch", + patches: []objectSDK.Patch{ + { + NewAttributes: []objectSDK.Attribute{ + newTestAttribute("key1", "val2"), + newTestAttribute("key2", "val2"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedHeaderAttributes: []objectSDK.Attribute{ + newTestAttribute("key1", "val2"), + newTestAttribute("key2", "val2"), + }, + }, + { + name: "header and payload", + patches: []objectSDK.Patch{ + { + NewAttributes: []objectSDK.Attribute{ + newTestAttribute("key1", "val2"), + newTestAttribute("key2", "val2"), + }, + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 0), + Chunk: []byte("inserted at the beginning"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("inserted at the beginning0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedHeaderAttributes: []objectSDK.Attribute{ + newTestAttribute("key1", "val2"), + newTestAttribute("key2", "val2"), + }, + }, + { + name: "header only merge attributes", + patches: []objectSDK.Patch{ + { + NewAttributes: []objectSDK.Attribute{ + newTestAttribute("key1", "val2"), + newTestAttribute("key2", "val2-incoming"), + }, + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 0), + Chunk: []byte("inserted at the beginning"), + }, + }, + }, + originalHeaderAttributes: []objectSDK.Attribute{ + newTestAttribute("key2", "to be popped out"), + newTestAttribute("key3", "val3"), + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("inserted at the beginning0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedHeaderAttributes: []objectSDK.Attribute{ + newTestAttribute("key2", "val2-incoming"), + newTestAttribute("key3", "val3"), + newTestAttribute("key1", "val2"), + }, + }, + { + name: "header only then payload", + patches: []objectSDK.Patch{ + { + NewAttributes: []objectSDK.Attribute{ + newTestAttribute("key1", "val2"), + newTestAttribute("key2", "val2"), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 0), + Chunk: []byte("inserted at the beginning"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("inserted at the beginning0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedHeaderAttributes: []objectSDK.Attribute{ + newTestAttribute("key1", "val2"), + newTestAttribute("key2", "val2"), + }, + }, + { + name: "no effect", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 0), + Chunk: []byte(""), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(12, 0), + Chunk: []byte(""), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(20, 0), + Chunk: []byte(""), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + }, + { + name: "insert prefix", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 0), + Chunk: []byte("inserted at the beginning"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("inserted at the beginning0123456789qwertyuiopasdfghjklzxcvbnm"), + }, + { + name: "insert in the middle", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(5, 0), + Chunk: []byte("inserted somewhere in the middle"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("01234inserted somewhere in the middle56789qwertyuiopasdfghjklzxcvbnm"), + }, + { + name: "insert at the end", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(36, 0), + Chunk: []byte("inserted somewhere at the end"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnminserted somewhere at the end"), + }, + { + name: "replace by range", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 12), + Chunk: []byte("just replace"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("just replaceertyuiopasdfghjklzxcvbnm"), + }, + { + name: "replace and insert some bytes", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 11), + Chunk: []byte("replace and append in the middle"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("replace and append in the middlewertyuiopasdfghjklzxcvbnm"), + }, + { + name: "replace and insert some bytes in the middle", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(5, 3), + Chunk: []byte("@@@@@"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("01234@@@@@89qwertyuiopasdfghjklzxcvbnm"), + }, + { + name: "a few patches: prefix, suffix", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(0, 0), + Chunk: []byte("this_will_be_prefix"), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(36, 0), + Chunk: []byte("this_will_be_suffix"), + }, + }, + }, + originalObjectPayload: []byte("0123456789qwertyuiopasdfghjklzxcvbnm"), + patchedPayload: []byte("this_will_be_prefix0123456789qwertyuiopasdfghjklzxcvbnmthis_will_be_suffix"), + }, + { + name: "a few patches: replace and insert some bytes", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(10, 3), + Chunk: []byte("aaaaa"), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(16, 0), + Chunk: []byte("bbbbb"), + }, + }, + }, + originalObjectPayload: []byte("0123456789ABCDEF"), + patchedPayload: []byte("0123456789aaaaaDEFbbbbb"), + }, + { + name: "starting from the same offset", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(8, 3), + Chunk: []byte("1"), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(11, 0), + Chunk: []byte("2"), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(11, 0), + Chunk: []byte("3"), + }, + }, + }, + originalObjectPayload: []byte("abcdefghijklmnop"), + patchedPayload: []byte("abcdefgh123lmnop"), + }, + { + name: "a few patches: various modifiactions", + patches: []objectSDK.Patch{ + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(4, 8), + Chunk: []byte("earliest"), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(13, 0), + Chunk: []byte("known "), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(35, 8), + Chunk: []byte("a small town"), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(62, 6), + Chunk: []byte("tablet"), + }, + }, + { + PayloadPatch: &objectSDK.PayloadPatch{ + Range: rangeWithOffestWithLength(87, 0), + Chunk: []byte("Shar-Kali-Sharri"), + }, + }, + }, + originalObjectPayload: []byte("The ******** mention of Babylon as [insert] appears on a clay ****** from the reign of "), + patchedPayload: []byte("The earliest known mention of Babylon as a small town appears on a clay tablet from the reign of Shar-Kali-Sharri"), + }, + } { + t.Run(test.name, func(t *testing.T) { + rangeProvider := &mockRangeProvider{ + originalObjectPayload: test.originalObjectPayload, + } + + originalObject, _ := newTestObject() + originalObject.SetPayload(test.originalObjectPayload) + originalObject.SetPayloadSize(uint64(len(test.originalObjectPayload))) + originalObject.SetAttributes(test.originalHeaderAttributes...) + + patchedObject, _ := newTestObject() + + wr := &mockPatchedObjectWriter{ + obj: patchedObject, + } + + prm := Params{ + Header: originalObject.CutPayload(), + + RangeProvider: rangeProvider, + + ObjectWriter: wr, + } + + patcher := New(prm) + + for i, patch := range test.patches { + if i == 0 { + _ = patcher.ApplyHeaderPatch(context.Background(), ApplyHeaderPatchPrm{ + NewSplitHeader: patch.NewSplitHeader, + NewAttributes: patch.NewAttributes, + ReplaceAttributes: patch.ReplaceAttributes, + }) + } + + if patch.PayloadPatch == nil { + continue + } + + err := patcher.ApplyPayloadPatch(context.Background(), patch.PayloadPatch) + if err != nil && test.expectedPayloadPatchErr != nil { + require.ErrorIs(t, err, test.expectedPayloadPatchErr) + return + } + require.NoError(t, err) + } + + _, err := patcher.Close(context.Background()) + require.NoError(t, err) + require.Equal(t, test.patchedPayload, patchedObject.Payload()) + + patchedAttrs := append([]objectSDK.Attribute{}, test.patchedHeaderAttributes...) + require.Equal(t, patchedAttrs, patchedObject.Attributes()) + }) + } + +} diff --git a/object/range.go b/object/range.go index 87ad3b78..b929a73e 100644 --- a/object/range.go +++ b/object/range.go @@ -1,7 +1,7 @@ package object import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" ) // Range represents v2-compatible object payload range. diff --git a/object/range_test.go b/object/range_test.go index c8208d85..14500dbf 100644 --- a/object/range_test.go +++ b/object/range_test.go @@ -3,7 +3,7 @@ package object import ( "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" "github.com/stretchr/testify/require" ) diff --git a/object/raw.go b/object/raw.go index 5c91f1d2..c30836a9 100644 --- a/object/raw.go +++ b/object/raw.go @@ -1,7 +1,7 @@ package object import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" ) // RawObject represents v2-compatible FrostFS object that provides diff --git a/object/raw_test.go b/object/raw_test.go index 52ac9dee..914ea111 100644 --- a/object/raw_test.go +++ b/object/raw_test.go @@ -5,7 +5,7 @@ import ( "crypto/sha256" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -303,6 +303,10 @@ func TestObjectEncoding(t *testing.T) { o2 := New() require.NoError(t, o2.UnmarshalJSON(data)) + // New protobuf generator replaces nil payload with []byte{} in setters. + require.Empty(t, o2.Payload()) + o2.SetPayload(nil) + require.Equal(t, o, o2) }) } diff --git a/object/search.go b/object/search.go index f3df6718..9f61ccf9 100644 --- a/object/search.go +++ b/object/search.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strconv" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" @@ -120,6 +120,7 @@ const ( fKeySplitID fKeyPropRoot fKeyPropPhy + fKeyECParent ) func (k filterKey) String() string { @@ -152,6 +153,8 @@ func (k filterKey) String() string { return v2object.FilterPropertyRoot case fKeyPropPhy: return v2object.FilterPropertyPhy + case fKeyECParent: + return v2object.FilterHeaderECParent } } @@ -277,6 +280,10 @@ func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id *SplitID) { f.addReservedFilter(m, fKeySplitID, staticStringer(id.String())) } +func (f *SearchFilters) AddECParentFilter(m SearchMatchType, parentID oid.ID) { + f.addReservedFilter(m, fKeyECParent, staticStringer(parentID.String())) +} + // AddTypeFilter adds filter by object type. func (f *SearchFilters) AddTypeFilter(m SearchMatchType, typ Type) { f.addReservedFilter(m, fKeyType, staticStringer(typ.String())) diff --git a/object/search_test.go b/object/search_test.go index 40df23b5..f113b3cd 100644 --- a/object/search_test.go +++ b/object/search_test.go @@ -5,7 +5,7 @@ import ( "crypto/sha256" "testing" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "github.com/stretchr/testify/require" @@ -160,6 +160,23 @@ func TestSearchFilters_AddSplitIDFilter(t *testing.T) { }) } +func TestSearchFilters_AddECParentFilter(t *testing.T) { + id := testOID() + + fs := new(object.SearchFilters) + fs.AddECParentFilter(object.MatchStringEqual, id) + + t.Run("v2", func(t *testing.T) { + fsV2 := fs.ToV2() + + require.Len(t, fsV2, 1) + + require.Equal(t, v2object.FilterHeaderECParent, fsV2[0].GetKey()) + require.Equal(t, id.String(), fsV2[0].GetValue()) + require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) + }) +} + func TestSearchFilters_AddTypeFilter(t *testing.T) { typ := object.TypeTombstone diff --git a/object/split_header.go b/object/split_header.go new file mode 100644 index 00000000..5cbc2149 --- /dev/null +++ b/object/split_header.go @@ -0,0 +1,124 @@ +package object + +import ( + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" + oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" +) + +// SplitHeader is an object's header component that defines the relationship +// between this object and other objects if the object is part of a split operation. +type SplitHeader object.SplitHeader + +// NewSplitHeaderFromV2 wraps v2 SplitHeader message to SplitHeader. +func NewSplitHeaderFromV2(v2 *object.SplitHeader) *SplitHeader { + return (*SplitHeader)(v2) +} + +// NewSplitHeader creates blank SplitHeader instance. +func NewSplitHeader() *SplitHeader { + return NewSplitHeaderFromV2(new(object.SplitHeader)) +} + +func (sh *SplitHeader) ToV2() *object.SplitHeader { + return (*object.SplitHeader)(sh) +} + +func (sh *SplitHeader) ParentID() (v oid.ID, isSet bool) { + v2 := (*object.SplitHeader)(sh) + if id := v2.GetParent(); id != nil { + _ = v.ReadFromV2(*id) + isSet = true + } + + return +} + +func (sh *SplitHeader) SetParentID(v oid.ID) { + v2 := new(refs.ObjectID) + v.WriteToV2(v2) + (*object.SplitHeader)(sh).SetParent(v2) +} + +func (sh *SplitHeader) PreviousID() (v oid.ID, isSet bool) { + v2 := (*object.SplitHeader)(sh) + if id := v2.GetPrevious(); id != nil { + _ = v.ReadFromV2(*id) + isSet = true + } + + return +} + +func (sh *SplitHeader) SetPreviousID(v oid.ID) { + v2 := new(refs.ObjectID) + v.WriteToV2(v2) + (*object.SplitHeader)(sh).SetPrevious(v2) +} + +func (sh *SplitHeader) ParentSignature() *frostfscrypto.Signature { + v2 := (*object.SplitHeader)(sh) + if parSigV2 := v2.GetParentSignature(); parSigV2 != nil { + parSig := new(frostfscrypto.Signature) + _ = parSig.ReadFromV2(*parSigV2) + } + + return nil +} + +func (sh *SplitHeader) SetParentSignature(v *frostfscrypto.Signature) { + var parSigV2 *refs.Signature + + if v != nil { + parSigV2 = new(refs.Signature) + v.WriteToV2(parSigV2) + } + + (*object.SplitHeader)(sh).SetParentSignature(parSigV2) +} + +func (sh *SplitHeader) ParentHeader() (parentHeader *Object) { + v2 := (*object.SplitHeader)(sh) + + if parHdr := v2.GetParentHeader(); parHdr != nil { + parentHeader = New() + parentHeader.setHeaderField(func(h *object.Header) { + *h = *v2.GetParentHeader() + }) + } + + return +} + +func (sh *SplitHeader) SetParentHeader(parentHeader *Object) { + (*object.SplitHeader)(sh).SetParentHeader(parentHeader.ToV2().GetHeader()) +} + +func (sh *SplitHeader) Children() (res []oid.ID) { + v2 := (*object.SplitHeader)(sh) + if children := v2.GetChildren(); len(children) > 0 { + res = make([]oid.ID, len(children)) + for i := range children { + _ = res[i].ReadFromV2(children[i]) + } + } + + return +} + +func (sh *SplitHeader) SetChildren(children []oid.ID) { + v2Children := make([]refs.ObjectID, len(children)) + for i := range children { + children[i].WriteToV2(&v2Children[i]) + } + (*object.SplitHeader)(sh).SetChildren(v2Children) +} + +func (sh *SplitHeader) SplitID() *SplitID { + return NewSplitIDFromV2((*object.SplitHeader)(sh).GetSplitID()) +} + +func (sh *SplitHeader) SetSplitID(v *SplitID) { + (*object.SplitHeader)(sh).SetSplitID(v.ToV2()) +} diff --git a/object/splitinfo.go b/object/splitinfo.go index c38b2a47..fc3adccc 100644 --- a/object/splitinfo.go +++ b/object/splitinfo.go @@ -4,8 +4,8 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" ) diff --git a/object/splitinfo_test.go b/object/splitinfo_test.go index ba3a54fc..9a4b370f 100644 --- a/object/splitinfo_test.go +++ b/object/splitinfo_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" "testing" - objv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + objv2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "github.com/stretchr/testify/require" diff --git a/object/tombstone.go b/object/tombstone.go index e3326303..cea0b940 100644 --- a/object/tombstone.go +++ b/object/tombstone.go @@ -1,8 +1,8 @@ package object import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tombstone" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" ) diff --git a/object/tombstone_test.go b/object/tombstone_test.go index 98251333..024258ea 100644 --- a/object/tombstone_test.go +++ b/object/tombstone_test.go @@ -5,7 +5,7 @@ import ( "crypto/sha256" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tombstone" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "github.com/stretchr/testify/require" ) @@ -14,7 +14,7 @@ func generateIDList(sz int) []oid.ID { res := make([]oid.ID, sz) cs := [sha256.Size]byte{} - for i := 0; i < sz; i++ { + for i := range sz { var oID oid.ID res[i] = oID diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index 4b27de85..b4695ee3 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -6,6 +6,8 @@ import ( "crypto/sha256" "fmt" + objectV2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" + buffPool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -45,6 +47,7 @@ type Params struct { // functionality. Primary usecases are providing file size when putting an object // with the frostfs-cli or using Content-Length header in gateways. SizeHint uint64 + Pool *buffPool.BufferPool } // NewPayloadSizeLimiter returns ObjectTarget instance that restricts payload length @@ -113,9 +116,14 @@ func fromObject(obj *object.Object) *object.Object { res.SetAttributes(obj.Attributes()...) res.SetType(obj.Type()) - // obj.SetSplitID creates splitHeader but we don't need to do it in case - // of small objects, so we should make nil check. - if obj.SplitID() != nil { + // There are two ways to specify split information: + // 1. Using explicit SplitHeader. Thus, we only propagate whole split information + // if it's already set in the source object (use-case: Patch method). + // 2. Using SplitID - will automatically generate a SplitHeader, but this is not requiered for + // small objects. + if obj.SplitHeader() != nil { + res.SetSplitHeader(obj.SplitHeader()) + } else if obj.SplitID() != nil { res.SetSplitID(obj.SplitID()) } @@ -137,7 +145,13 @@ func (s *payloadSizeLimiter) initializeCurrent() { payloadSize = remaining % s.MaxSize } } - s.payload = make([]byte, 0, payloadSize) + + if s.Pool == nil { + s.payload = make([]byte, 0, payloadSize) + } else { + buffer := s.Pool.Get(uint32(payloadSize)) + s.payload = buffer.Data[:0] + } } func (s *payloadSizeLimiter) initPayloadHashers() { @@ -239,6 +253,7 @@ func (s *payloadSizeLimiter) fillHeader() (*AccessIdentifiers, error) { ParentID: parID, SelfID: id, ParentHeader: parHdr, + Epoch: curEpoch, }, nil } @@ -252,7 +267,7 @@ func (s *payloadSizeLimiter) initializeLinking(parHdr *object.Object) { func (s *payloadSizeLimiter) writeChunk(ctx context.Context, chunk []byte) error { for { // statement is true if the previous write of bytes reached exactly the boundary. - if s.written > 0 && s.written%s.MaxSize == 0 { + if len(chunk) > 0 && s.written > 0 && s.written%s.MaxSize == 0 { if s.written == s.MaxSize { s.prepareFirstChild() } @@ -318,4 +333,11 @@ func (s *payloadSizeLimiter) prepareFirstChild() { s.current.SetAttributes() // attributes will be added to parent in detachParent + + // add expiration epoch to each part + for _, attr := range s.parAttrs { + if attr.Key() == objectV2.SysAttributeExpEpoch { + s.current.SetAttributes(attr) + } + } } diff --git a/object/transformer/transformer_test.go b/object/transformer/transformer_test.go index 97b2b01d..319bf37e 100644 --- a/object/transformer/transformer_test.go +++ b/object/transformer/transformer_test.go @@ -15,6 +15,78 @@ import ( "github.com/stretchr/testify/require" ) +func TestTransformerNonMonotonicWrites(t *testing.T) { + const maxSize = 16 + + tt := new(testTarget) + target, pk := newPayloadSizeLimiter(maxSize, 0, func() ObjectWriter { return tt }) + cnr := cidtest.ID() + hdr := newObject(cnr) + var owner user.ID + user.IDFromKey(&owner, pk.PrivateKey.PublicKey) + hdr.SetOwnerID(owner) + payload := make([]byte, 3*maxSize) + _, _ = rand.Read(payload) + + ctx := context.Background() + require.NoError(t, target.WriteHeader(ctx, hdr)) + + lessThanMaxSizePayload := make([]byte, maxSize/2) + _, _ = rand.Read(lessThanMaxSizePayload) + + _, err := target.Write(ctx, lessThanMaxSizePayload) + require.NoError(t, err) + + moreThanMaxSizePayload := make([]byte, maxSize*1.5) + _, _ = rand.Read(moreThanMaxSizePayload) + + _, err = target.Write(ctx, moreThanMaxSizePayload) + require.NoError(t, err) + + _, err = target.Close(ctx) + require.NoError(t, err) + + require.Equal(t, 3, len(tt.objects)) + require.Equal(t, append(lessThanMaxSizePayload, moreThanMaxSizePayload[:maxSize-len(lessThanMaxSizePayload)]...), tt.objects[0].Payload()) + require.Equal(t, moreThanMaxSizePayload[maxSize-len(lessThanMaxSizePayload):], tt.objects[1].Payload()) + require.Equal(t, 2, len(tt.objects[2].Children())) +} + +func TestTransformerNonEffectiveWrites(t *testing.T) { + const maxSize = 16 + + tt := new(testTarget) + target, pk := newPayloadSizeLimiter(maxSize, 0, func() ObjectWriter { return tt }) + cnr := cidtest.ID() + hdr := newObject(cnr) + var owner user.ID + user.IDFromKey(&owner, pk.PrivateKey.PublicKey) + hdr.SetOwnerID(owner) + payload := make([]byte, 3*maxSize) + _, _ = rand.Read(payload) + + ctx := context.Background() + require.NoError(t, target.WriteHeader(ctx, hdr)) + + _, err := target.Write(ctx, payload) + require.NoError(t, err) + + for range 5 { + // run onto unchanged target state + _, err = target.Write(ctx, []byte{}) + require.NoError(t, err) + } + + _, err = target.Close(ctx) + require.NoError(t, err) + + require.Equal(t, 4, len(tt.objects)) + require.Equal(t, payload[:maxSize], tt.objects[0].Payload()) + require.Equal(t, payload[maxSize:2*maxSize], tt.objects[1].Payload()) + require.Equal(t, payload[2*maxSize:], tt.objects[2].Payload()) + require.Equal(t, 3, len(tt.objects[3].Children())) +} + func TestTransformer(t *testing.T) { const maxSize = 100 @@ -72,7 +144,7 @@ func TestTransformer(t *testing.T) { require.Equal(t, ids.ParentID, &parID) children := tt.objects[i].Children() - for j := 0; j < i; j++ { + for j := range i { id, ok := tt.objects[j].ID() require.True(t, ok) require.Equal(t, id, children[j]) @@ -152,7 +224,7 @@ func benchmarkTransformer(b *testing.B, header *objectSDK.Object, payloadSize, s b.ReportAllocs() b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { f, _ := newPayloadSizeLimiter(maxSize, uint64(sizeHint), func() ObjectWriter { return benchTarget{} }) if err := f.WriteHeader(ctx, header); err != nil { b.Fatalf("write header: %v", err) diff --git a/object/transformer/types.go b/object/transformer/types.go index 212f4537..1cda4251 100644 --- a/object/transformer/types.go +++ b/object/transformer/types.go @@ -14,6 +14,7 @@ type AccessIdentifiers struct { ParentID *oid.ID SelfID oid.ID ParentHeader *object.Object + Epoch uint64 } // EpochSource is a source for the current epoch. diff --git a/object/type.go b/object/type.go index 29328d33..5e247ab3 100644 --- a/object/type.go +++ b/object/type.go @@ -1,7 +1,7 @@ package object import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" ) type Type object.Type diff --git a/object/type_test.go b/object/type_test.go index 5faa936b..7c3360b4 100644 --- a/object/type_test.go +++ b/object/type_test.go @@ -3,7 +3,7 @@ package object_test import ( "testing" - v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" + v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "github.com/stretchr/testify/require" ) diff --git a/pkg/network/address.go b/pkg/network/address.go new file mode 100644 index 00000000..dff8614f --- /dev/null +++ b/pkg/network/address.go @@ -0,0 +1,112 @@ +// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/address.go + +package network + +import ( + "errors" + "fmt" + "net" + "net/url" + "strings" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "github.com/multiformats/go-multiaddr" + manet "github.com/multiformats/go-multiaddr/net" +) + +var errHostIsEmpty = errors.New("host is empty") + +// Address represents the FrostFS node +// network address. +type Address struct { + ma multiaddr.Multiaddr +} + +// URIAddr returns Address as a URI. +// +// Panics if host address cannot be fetched from Address. +// +// See also FromString. +func (a Address) URIAddr() string { + _, host, err := manet.DialArgs(a.ma) + if err != nil { + // the only correct way to construct Address is AddressFromString + // which makes this error appear unexpected + panic(fmt.Errorf("could not get host addr: %w", err)) + } + + if !a.IsTLSEnabled() { + return host + } + + return (&url.URL{ + Scheme: "grpcs", + Host: host, + }).String() +} + +// FromString restores Address from a string representation. +// +// Supports URIAddr, MultiAddr and HostAddr strings. +func (a *Address) FromString(s string) error { + var err error + + a.ma, err = multiaddr.NewMultiaddr(s) + if err != nil { + var ( + host string + hasTLS bool + ) + host, hasTLS, err = client.ParseURI(s) + if err != nil { + host = s + } + + s, err = multiaddrStringFromHostAddr(host) + if err == nil { + a.ma, err = multiaddr.NewMultiaddr(s) + if err == nil && hasTLS { + a.ma = a.ma.AppendComponent(tls) + } + } + } + + return err +} + +// multiaddrStringFromHostAddr converts "localhost:8080" to "/dns4/localhost/tcp/8080". +func multiaddrStringFromHostAddr(host string) (string, error) { + if len(host) == 0 { + return "", errHostIsEmpty + } + + endpoint, port, err := net.SplitHostPort(host) + if err != nil { + return "", err + } + + // Empty address in host `:8080` generates `/dns4//tcp/8080` multiaddr + // which is invalid. It could be `/tcp/8080` but this breaks + // `manet.DialArgs`. The solution is to manually parse it as 0.0.0.0 + if endpoint == "" { + return "/ip4/0.0.0.0/tcp/" + port, nil + } + + var ( + prefix = "/dns4" + addr = endpoint + ) + + if ip := net.ParseIP(endpoint); ip != nil { + addr = ip.String() + if ip.To4() == nil { + prefix = "/ip6" + } else { + prefix = "/ip4" + } + } + + const l4Protocol = "tcp" + + return strings.Join([]string{prefix, addr, l4Protocol, port}, "/"), nil +} diff --git a/pkg/network/address_test.go b/pkg/network/address_test.go new file mode 100644 index 00000000..c6558eb2 --- /dev/null +++ b/pkg/network/address_test.go @@ -0,0 +1,83 @@ +// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/address_test.go + +package network + +import ( + "testing" + + "github.com/multiformats/go-multiaddr" + "github.com/stretchr/testify/require" +) + +func TestAddressFromString(t *testing.T) { + t.Run("valid addresses", func(t *testing.T) { + testcases := []struct { + inp string + exp multiaddr.Multiaddr + }{ + {":8080", buildMultiaddr("/ip4/0.0.0.0/tcp/8080", t)}, + {"example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070", t)}, + {"213.44.87.1:32512", buildMultiaddr("/ip4/213.44.87.1/tcp/32512", t)}, + {"[2004:eb1::1]:8080", buildMultiaddr("/ip6/2004:eb1::1/tcp/8080", t)}, + {"grpc://example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070", t)}, + {"grpcs://example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070/"+tlsProtocolName, t)}, + } + + var addr Address + + for _, testcase := range testcases { + err := addr.FromString(testcase.inp) + require.NoError(t, err) + require.Equal(t, testcase.exp, addr.ma, testcase.inp) + } + }) + t.Run("invalid addresses", func(t *testing.T) { + testCases := []string{ + "wtf://example.com:123", // wrong scheme + "grpc://example.com", // missing port + } + + var addr Address + for _, tc := range testCases { + require.Error(t, addr.FromString(tc)) + } + }) +} + +func TestAddress_HostAddrString(t *testing.T) { + t.Run("valid addresses", func(t *testing.T) { + testcases := []struct { + ma multiaddr.Multiaddr + exp string + }{ + {buildMultiaddr("/dns4/frostfs.bigcorp.com/tcp/8080", t), "frostfs.bigcorp.com:8080"}, + {buildMultiaddr("/ip4/172.16.14.1/tcp/8080", t), "172.16.14.1:8080"}, + {buildMultiaddr("/ip4/192.168.0.1/tcp/8888/tls", t), "grpcs://192.168.0.1:8888"}, + } + + for _, testcase := range testcases { + addr := Address{testcase.ma} + + got := addr.URIAddr() + + require.Equal(t, testcase.exp, got) + } + }) + + t.Run("invalid addresses", func(t *testing.T) { + testcases := []multiaddr.Multiaddr{ + buildMultiaddr("/tcp/8080", t), + } + + for _, testcase := range testcases { + addr := Address{testcase} + require.Panics(t, func() { addr.URIAddr() }) + } + }) +} + +func buildMultiaddr(s string, t *testing.T) multiaddr.Multiaddr { + ma, err := multiaddr.NewMultiaddr(s) + require.NoError(t, err) + return ma +} diff --git a/pkg/network/tls.go b/pkg/network/tls.go new file mode 100644 index 00000000..f30c99e1 --- /dev/null +++ b/pkg/network/tls.go @@ -0,0 +1,18 @@ +// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/tls.go + +package network + +import "github.com/multiformats/go-multiaddr" + +const ( + tlsProtocolName = "tls" +) + +// tls var is used for (un)wrapping other multiaddrs around TLS multiaddr. +var tls, _ = multiaddr.NewComponent(tlsProtocolName, "") + +// IsTLSEnabled searches for wrapped TLS protocol in multiaddr. +func (a Address) IsTLSEnabled() bool { + _, err := a.ma.ValueForProtocol(multiaddr.P_TLS) + return err == nil +} diff --git a/pkg/network/tls_test.go b/pkg/network/tls_test.go new file mode 100644 index 00000000..bfa18b82 --- /dev/null +++ b/pkg/network/tls_test.go @@ -0,0 +1,46 @@ +// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/tls_test.go + +package network + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAddress_TLSEnabled(t *testing.T) { + testCases := [...]struct { + input string + wantTLS bool + }{ + {"/dns4/localhost/tcp/8080", false}, + {"/dns4/localhost/tcp/8080/tls", true}, + {"/tls/dns4/localhost/tcp/8080", true}, + {"grpc://localhost:8080", false}, + {"grpcs://localhost:8080", true}, + } + + var addr Address + + for _, test := range testCases { + err := addr.FromString(test.input) + require.NoError(t, err) + + require.Equal(t, test.wantTLS, addr.IsTLSEnabled(), test.input) + } +} + +func BenchmarkAddressTLSEnabled(b *testing.B) { + var addr Address + err := addr.FromString("/dns4/localhost/tcp/8080/tls") + require.NoError(b, err) + + b.ResetTimer() + b.ReportAllocs() + + var enabled bool + for range b.N { + enabled = addr.IsTLSEnabled() + } + require.True(b, enabled) +} diff --git a/pool/cache.go b/pool/cache.go index 5c398882..05bbcae7 100644 --- a/pool/cache.go +++ b/pool/cache.go @@ -9,21 +9,22 @@ import ( ) type sessionCache struct { - cache *lru.Cache[string, *cacheValue] - currentEpoch atomic.Uint64 + cache *lru.Cache[string, *cacheValue] + currentEpoch atomic.Uint64 + tokenDuration uint64 } type cacheValue struct { token session.Object } -func newCache() (*sessionCache, error) { +func newCache(tokenDuration uint64) (*sessionCache, error) { cache, err := lru.New[string, *cacheValue](100) if err != nil { return nil, err } - return &sessionCache{cache: cache}, nil + return &sessionCache{cache: cache, tokenDuration: tokenDuration}, nil } // Get returns a copy of the session token from the cache without signature @@ -66,8 +67,12 @@ func (c *sessionCache) updateEpoch(newEpoch uint64) { func (c *sessionCache) expired(val *cacheValue) bool { epoch := c.currentEpoch.Load() - // use epoch+1 (clear cache beforehand) to prevent 'expired session token' error right after epoch tick - return val.token.ExpiredAt(epoch + 1) + preExpiredDur := c.tokenDuration / 2 + if preExpiredDur == 0 { + preExpiredDur = 1 + } + + return val.token.ExpiredAt(epoch + preExpiredDur) } func (c *sessionCache) Epoch() uint64 { diff --git a/pool/cache_test.go b/pool/cache_test.go index c1f12c85..d49c4d8a 100644 --- a/pool/cache_test.go +++ b/pool/cache_test.go @@ -20,7 +20,7 @@ func TestSessionCache_GetUnmodifiedToken(t *testing.T) { require.False(t, tok.VerifySignature(), extra) } - cache, err := newCache() + cache, err := newCache(0) require.NoError(t, err) cache.Put(key, target) diff --git a/pool/client.go b/pool/client.go new file mode 100644 index 00000000..78650723 --- /dev/null +++ b/pool/client.go @@ -0,0 +1,1303 @@ +package pool + +import ( + "bytes" + "context" + "crypto/ecdsa" + "errors" + "fmt" + "io" + "sync" + "sync/atomic" + "time" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" + sdkClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" + cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "google.golang.org/grpc" +) + +// errPoolClientUnhealthy is an error to indicate that client in pool is unhealthy. +var errPoolClientUnhealthy = errors.New("pool client unhealthy") + +// clientStatusMonitor count error rate and other statistics for connection. +type clientStatusMonitor struct { + logger *zap.Logger + addr string + healthy *atomic.Uint32 + errorThreshold uint32 + + mu sync.RWMutex // protect counters + currentErrorCount uint32 + overallErrorCount uint64 + methods []*MethodStatus +} + +// values for healthy status of clientStatusMonitor. +const ( + // statusUnhealthyOnRequest is set when communication after dialing to the + // endpoint is failed due to immediate or accumulated errors, connection is + // available and pool should close it before re-establishing connection once again. + statusUnhealthyOnRequest = iota + + // statusHealthy is set when connection is ready to be used by the pool. + statusHealthy +) + +// MethodIndex index of method in list of statuses in clientStatusMonitor. +type MethodIndex int + +const ( + methodBalanceGet MethodIndex = iota + methodContainerPut + methodContainerGet + methodContainerList + methodContainerListStream + methodContainerDelete + methodEndpointInfo + methodNetworkInfo + methodNetMapSnapshot + methodObjectPut + methodObjectDelete + methodObjectGet + methodObjectHead + methodObjectRange + methodObjectPatch + methodSessionCreate + methodAPEManagerAddChain + methodAPEManagerRemoveChain + methodAPEManagerListChains + methodLast +) + +// String implements fmt.Stringer. +func (m MethodIndex) String() string { + switch m { + case methodBalanceGet: + return "balanceGet" + case methodContainerPut: + return "containerPut" + case methodContainerGet: + return "containerGet" + case methodContainerList: + return "containerList" + case methodContainerListStream: + return "containerListStream" + case methodContainerDelete: + return "containerDelete" + case methodEndpointInfo: + return "endpointInfo" + case methodNetworkInfo: + return "networkInfo" + case methodNetMapSnapshot: + return "netMapSnapshot" + case methodObjectPut: + return "objectPut" + case methodObjectPatch: + return "objectPatch" + case methodObjectDelete: + return "objectDelete" + case methodObjectGet: + return "objectGet" + case methodObjectHead: + return "objectHead" + case methodObjectRange: + return "objectRange" + case methodSessionCreate: + return "sessionCreate" + case methodAPEManagerAddChain: + return "apeManagerAddChain" + case methodAPEManagerRemoveChain: + return "apeManagerRemoveChain" + case methodAPEManagerListChains: + return "apeManagerListChains" + case methodLast: + return "it's a system name rather than a method" + default: + return "unknown" + } +} + +func newClientStatusMonitor(logger *zap.Logger, addr string, errorThreshold uint32) clientStatusMonitor { + methods := make([]*MethodStatus, methodLast) + for i := methodBalanceGet; i < methodLast; i++ { + methods[i] = &MethodStatus{name: i.String()} + } + + healthy := new(atomic.Uint32) + healthy.Store(statusHealthy) + + return clientStatusMonitor{ + logger: logger, + addr: addr, + healthy: healthy, + errorThreshold: errorThreshold, + methods: methods, + } +} + +// clientWrapper is used by default, alternative implementations are intended for testing purposes only. +type clientWrapper struct { + clientMutex sync.RWMutex + client *sdkClient.Client + dialed bool + prm wrapperPrm + + clientStatusMonitor +} + +// wrapperPrm is params to create clientWrapper. +type wrapperPrm struct { + logger *zap.Logger + address string + key ecdsa.PrivateKey + dialTimeout time.Duration + streamTimeout time.Duration + errorThreshold uint32 + responseInfoCallback func(sdkClient.ResponseMetaInfo) error + poolRequestInfoCallback func(RequestInfo) + dialOptions []grpc.DialOption + + gracefulCloseOnSwitchTimeout time.Duration +} + +// setAddress sets endpoint to connect in FrostFS network. +func (x *wrapperPrm) setAddress(address string) { + x.address = address +} + +// setKey sets sdkClient.Client private key to be used for the protocol communication by default. +func (x *wrapperPrm) setKey(key ecdsa.PrivateKey) { + x.key = key +} + +// setLogger sets sdkClient.Client logger. +func (x *wrapperPrm) setLogger(logger *zap.Logger) { + x.logger = logger +} + +// setDialTimeout sets the timeout for connection to be established. +func (x *wrapperPrm) setDialTimeout(timeout time.Duration) { + x.dialTimeout = timeout +} + +// setStreamTimeout sets the timeout for individual operations in streaming RPC. +func (x *wrapperPrm) setStreamTimeout(timeout time.Duration) { + x.streamTimeout = timeout +} + +// setErrorThreshold sets threshold after reaching which connection is considered unhealthy +// until Pool.startRebalance routing updates its status. +func (x *wrapperPrm) setErrorThreshold(threshold uint32) { + x.errorThreshold = threshold +} + +// setGracefulCloseOnSwitchTimeout specifies the timeout after which unhealthy client be closed during rebalancing +// if it will become healthy back. +// +// See also setErrorThreshold. +func (x *wrapperPrm) setGracefulCloseOnSwitchTimeout(timeout time.Duration) { + x.gracefulCloseOnSwitchTimeout = timeout +} + +// setPoolRequestCallback sets callback that will be invoked after every pool response. +func (x *wrapperPrm) setPoolRequestCallback(f func(RequestInfo)) { + x.poolRequestInfoCallback = f +} + +// setResponseInfoCallback sets callback that will be invoked after every response. +func (x *wrapperPrm) setResponseInfoCallback(f func(sdkClient.ResponseMetaInfo) error) { + x.responseInfoCallback = f +} + +// setGRPCDialOptions sets the gRPC dial options for new gRPC client connection. +func (x *wrapperPrm) setGRPCDialOptions(opts []grpc.DialOption) { + x.dialOptions = opts +} + +// newWrapper creates a clientWrapper that implements the client interface. +func newWrapper(prm wrapperPrm) *clientWrapper { + var cl sdkClient.Client + prmInit := sdkClient.PrmInit{ + Key: prm.key, + ResponseInfoCallback: prm.responseInfoCallback, + } + + cl.Init(prmInit) + + res := &clientWrapper{ + client: &cl, + clientStatusMonitor: newClientStatusMonitor(prm.logger, prm.address, prm.errorThreshold), + prm: prm, + } + + return res +} + +// dial establishes a connection to the server from the FrostFS network. +// Returns an error describing failure reason. If failed, the client +// SHOULD NOT be used. +func (c *clientWrapper) dial(ctx context.Context) error { + cl, err := c.getClient() + if err != nil { + return err + } + + prmDial := sdkClient.PrmDial{ + Endpoint: c.prm.address, + DialTimeout: c.prm.dialTimeout, + StreamTimeout: c.prm.streamTimeout, + GRPCDialOptions: c.prm.dialOptions, + } + + err = cl.Dial(ctx, prmDial) + c.setDialed(err == nil) + if err != nil { + return err + } + + return nil +} + +// restart recreates and redial inner sdk client. +func (c *clientWrapper) restart(ctx context.Context) error { + var cl sdkClient.Client + prmInit := sdkClient.PrmInit{ + Key: c.prm.key, + ResponseInfoCallback: c.prm.responseInfoCallback, + } + + cl.Init(prmInit) + + prmDial := sdkClient.PrmDial{ + Endpoint: c.prm.address, + DialTimeout: c.prm.dialTimeout, + StreamTimeout: c.prm.streamTimeout, + GRPCDialOptions: c.prm.dialOptions, + } + + // if connection is dialed before, to avoid routine / connection leak, + // pool has to close it and then initialize once again. + if c.isDialed() { + c.scheduleGracefulClose() + } + + err := cl.Dial(ctx, prmDial) + c.setDialed(err == nil) + if err != nil { + return err + } + + c.clientMutex.Lock() + c.client = &cl + c.clientMutex.Unlock() + + return nil +} + +func (c *clientWrapper) isDialed() bool { + c.mu.RLock() + defer c.mu.RUnlock() + return c.dialed +} + +func (c *clientWrapper) setDialed(dialed bool) { + c.mu.Lock() + c.dialed = dialed + c.mu.Unlock() +} + +func (c *clientWrapper) getClient() (*sdkClient.Client, error) { + c.clientMutex.RLock() + defer c.clientMutex.RUnlock() + if c.isHealthy() { + return c.client, nil + } + return nil, errPoolClientUnhealthy +} + +func (c *clientWrapper) getClientRaw() *sdkClient.Client { + c.clientMutex.RLock() + defer c.clientMutex.RUnlock() + return c.client +} + +// balanceGet invokes sdkClient.BalanceGet parse response status to error and return result as is. +func (c *clientWrapper) balanceGet(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error) { + cl, err := c.getClient() + if err != nil { + return accounting.Decimal{}, err + } + + cliPrm := sdkClient.PrmBalanceGet{ + Account: prm.account, + } + + start := time.Now() + res, err := cl.BalanceGet(ctx, cliPrm) + c.incRequests(time.Since(start), methodBalanceGet) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return accounting.Decimal{}, fmt.Errorf("balance get on client: %w", err) + } + + return res.Amount(), nil +} + +// containerPut invokes sdkClient.ContainerPut parse response status to error and return result as is. +// It also waits for the container to appear on the network. +func (c *clientWrapper) containerPut(ctx context.Context, prm PrmContainerPut) (cid.ID, error) { + cl, err := c.getClient() + if err != nil { + return cid.ID{}, err + } + + start := time.Now() + res, err := cl.ContainerPut(ctx, prm.ClientParams) + c.incRequests(time.Since(start), methodContainerPut) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return cid.ID{}, fmt.Errorf("container put on client: %w", err) + } + + if prm.WaitParams == nil { + prm.WaitParams = defaultWaitParams() + } + if err = prm.WaitParams.CheckValidity(); err != nil { + return cid.ID{}, fmt.Errorf("invalid wait parameters: %w", err) + } + + idCnr := res.ID() + + getPrm := PrmContainerGet{ + ContainerID: idCnr, + Session: prm.ClientParams.Session, + } + + err = waitForContainerPresence(ctx, c, getPrm, prm.WaitParams) + if err = c.handleError(ctx, nil, err); err != nil { + return cid.ID{}, fmt.Errorf("wait container presence on client: %w", err) + } + + return idCnr, nil +} + +// containerGet invokes sdkClient.ContainerGet parse response status to error and return result as is. +func (c *clientWrapper) containerGet(ctx context.Context, prm PrmContainerGet) (container.Container, error) { + cl, err := c.getClient() + if err != nil { + return container.Container{}, err + } + + cliPrm := sdkClient.PrmContainerGet{ + ContainerID: &prm.ContainerID, + Session: prm.Session, + } + + start := time.Now() + res, err := cl.ContainerGet(ctx, cliPrm) + c.incRequests(time.Since(start), methodContainerGet) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return container.Container{}, fmt.Errorf("container get on client: %w", err) + } + + return res.Container(), nil +} + +// containerList invokes sdkClient.ContainerList parse response status to error and return result as is. +func (c *clientWrapper) containerList(ctx context.Context, prm PrmContainerList) ([]cid.ID, error) { + cl, err := c.getClient() + if err != nil { + return nil, err + } + + cliPrm := sdkClient.PrmContainerList{ + OwnerID: prm.OwnerID, + Session: prm.Session, + } + + start := time.Now() + res, err := cl.ContainerList(ctx, cliPrm) + c.incRequests(time.Since(start), methodContainerList) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return nil, fmt.Errorf("container list on client: %w", err) + } + return res.Containers(), nil +} + +// PrmListStream groups parameters of ListContainersStream operation. +type PrmListStream struct { + OwnerID user.ID + + Session *session.Container +} + +// ResListStream is designed to read list of object identifiers from FrostFS system. +// +// Must be initialized using Pool.ListContainersStream, any other usage is unsafe. +type ResListStream struct { + r *sdkClient.ContainerListReader + elapsedTimeCallback func(time.Duration) + handleError func(context.Context, apistatus.Status, error) error +} + +// Read reads another list of the container identifiers. +func (x *ResListStream) Read(buf []cid.ID) (int, error) { + start := time.Now() + n, ok := x.r.Read(buf) + x.elapsedTimeCallback(time.Since(start)) + if !ok { + res, err := x.r.Close() + if err == nil { + return n, io.EOF + } + + var status apistatus.Status + if res != nil { + status = res.Status() + } + err = x.handleError(nil, status, err) + + return n, err + } + + return n, nil +} + +// Iterate iterates over the list of found container identifiers. +// f can return true to stop iteration earlier. +// +// Returns an error if container can't be read. +func (x *ResListStream) Iterate(f func(cid.ID) bool) error { + start := time.Now() + err := x.r.Iterate(func(id cid.ID) bool { + x.elapsedTimeCallback(time.Since(start)) + stop := f(id) + start = time.Now() + return stop + }) + return err +} + +// Close ends reading list of the matched containers and returns the result of the operation +// along with the final results. Must be called after using the ResListStream. +func (x *ResListStream) Close() { + _, _ = x.r.Close() +} + +// containerList invokes sdkClient.ContainerList parse response status to error and return result as is. +func (c *clientWrapper) containerListStream(ctx context.Context, prm PrmListStream) (ResListStream, error) { + cl, err := c.getClient() + if err != nil { + return ResListStream{}, err + } + + cliPrm := sdkClient.PrmContainerListStream{ + OwnerID: prm.OwnerID, + Session: prm.Session, + } + + start := time.Now() + cnrRdr, err := cl.ContainerListInit(ctx, cliPrm) + c.incRequests(time.Since(start), methodContainerListStream) + if err = c.handleError(ctx, nil, err); err != nil { + return ResListStream{}, fmt.Errorf("init container listing on client: %w", err) + } + return ResListStream{ + r: cnrRdr, + elapsedTimeCallback: func(elapsed time.Duration) { + c.incRequests(elapsed, methodContainerListStream) + }, + handleError: c.handleError, + }, nil +} + +// containerDelete invokes sdkClient.ContainerDelete parse response status to error. +// It also waits for the container to be removed from the network. +func (c *clientWrapper) containerDelete(ctx context.Context, prm PrmContainerDelete) error { + cl, err := c.getClient() + if err != nil { + return err + } + + cliPrm := sdkClient.PrmContainerDelete{ + ContainerID: &prm.ContainerID, + Session: prm.Session, + } + + start := time.Now() + res, err := cl.ContainerDelete(ctx, cliPrm) + c.incRequests(time.Since(start), methodContainerDelete) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return fmt.Errorf("container delete on client: %w", err) + } + + if prm.WaitParams == nil { + prm.WaitParams = defaultWaitParams() + } + if err := prm.WaitParams.CheckValidity(); err != nil { + return fmt.Errorf("invalid wait parameters: %w", err) + } + + getPrm := PrmContainerGet{ + ContainerID: prm.ContainerID, + Session: prm.Session, + } + + return waitForContainerRemoved(ctx, c, getPrm, prm.WaitParams) +} + +// apeManagerAddChain invokes sdkClient.APEManagerAddChain and parse response status to error. +func (c *clientWrapper) apeManagerAddChain(ctx context.Context, prm PrmAddAPEChain) error { + cl, err := c.getClient() + if err != nil { + return err + } + + cliPrm := sdkClient.PrmAPEManagerAddChain{ + ChainTarget: prm.Target, + Chain: prm.Chain, + } + + start := time.Now() + res, err := cl.APEManagerAddChain(ctx, cliPrm) + c.incRequests(time.Since(start), methodAPEManagerAddChain) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return fmt.Errorf("add chain error: %w", err) + } + + return nil +} + +// apeManagerRemoveChain invokes sdkClient.APEManagerRemoveChain and parse response status to error. +func (c *clientWrapper) apeManagerRemoveChain(ctx context.Context, prm PrmRemoveAPEChain) error { + cl, err := c.getClient() + if err != nil { + return err + } + + cliPrm := sdkClient.PrmAPEManagerRemoveChain{ + ChainTarget: prm.Target, + ChainID: prm.ChainID, + } + + start := time.Now() + res, err := cl.APEManagerRemoveChain(ctx, cliPrm) + c.incRequests(time.Since(start), methodAPEManagerRemoveChain) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return fmt.Errorf("remove chain error: %w", err) + } + + return nil +} + +// apeManagerListChains invokes sdkClient.APEManagerListChains. Returns chains and parsed response status to error. +func (c *clientWrapper) apeManagerListChains(ctx context.Context, prm PrmListAPEChains) ([]ape.Chain, error) { + cl, err := c.getClient() + if err != nil { + return nil, err + } + + cliPrm := sdkClient.PrmAPEManagerListChains{ + ChainTarget: prm.Target, + } + + start := time.Now() + res, err := cl.APEManagerListChains(ctx, cliPrm) + c.incRequests(time.Since(start), methodAPEManagerListChains) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return nil, fmt.Errorf("list chains error: %w", err) + } + + return res.Chains, nil +} + +// endpointInfo invokes sdkClient.EndpointInfo parse response status to error and return result as is. +func (c *clientWrapper) endpointInfo(ctx context.Context, _ prmEndpointInfo) (netmap.NodeInfo, error) { + cl, err := c.getClient() + if err != nil { + return netmap.NodeInfo{}, err + } + + return c.endpointInfoRaw(ctx, cl) +} + +func (c *clientWrapper) healthcheck(ctx context.Context) (netmap.NodeInfo, error) { + cl := c.getClientRaw() + return c.endpointInfoRaw(ctx, cl) +} + +func (c *clientWrapper) endpointInfoRaw(ctx context.Context, cl *sdkClient.Client) (netmap.NodeInfo, error) { + start := time.Now() + res, err := cl.EndpointInfo(ctx, sdkClient.PrmEndpointInfo{}) + c.incRequests(time.Since(start), methodEndpointInfo) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return netmap.NodeInfo{}, fmt.Errorf("endpoint info on client: %w", err) + } + + return res.NodeInfo(), nil +} + +// networkInfo invokes sdkClient.NetworkInfo parse response status to error and return result as is. +func (c *clientWrapper) networkInfo(ctx context.Context, _ prmNetworkInfo) (netmap.NetworkInfo, error) { + cl, err := c.getClient() + if err != nil { + return netmap.NetworkInfo{}, err + } + + start := time.Now() + res, err := cl.NetworkInfo(ctx, sdkClient.PrmNetworkInfo{}) + c.incRequests(time.Since(start), methodNetworkInfo) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return netmap.NetworkInfo{}, fmt.Errorf("network info on client: %w", err) + } + + return res.Info(), nil +} + +// networkInfo invokes sdkClient.NetworkInfo parse response status to error and return result as is. +func (c *clientWrapper) netMapSnapshot(ctx context.Context, _ prmNetMapSnapshot) (netmap.NetMap, error) { + cl, err := c.getClient() + if err != nil { + return netmap.NetMap{}, err + } + + start := time.Now() + res, err := cl.NetMapSnapshot(ctx, sdkClient.PrmNetMapSnapshot{}) + c.incRequests(time.Since(start), methodNetMapSnapshot) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return netmap.NetMap{}, fmt.Errorf("network map snapshot on client: %w", err) + } + + return res.NetMap(), nil +} + +// objectPatch patches object in FrostFS. +func (c *clientWrapper) objectPatch(ctx context.Context, prm PrmObjectPatch) (ResPatchObject, error) { + cl, err := c.getClient() + if err != nil { + return ResPatchObject{}, err + } + + start := time.Now() + pObj, err := cl.ObjectPatchInit(ctx, sdkClient.PrmObjectPatch{ + Address: prm.addr, + Session: prm.stoken, + Key: prm.key, + BearerToken: prm.btoken, + MaxChunkLength: prm.maxPayloadPatchChunkLength, + }) + if err = c.handleError(ctx, nil, err); err != nil { + return ResPatchObject{}, fmt.Errorf("init patching on API client: %w", err) + } + c.incRequests(time.Since(start), methodObjectPatch) + + start = time.Now() + attrPatchSuccess := pObj.PatchAttributes(ctx, prm.newAttrs, prm.replaceAttrs) + c.incRequests(time.Since(start), methodObjectPatch) + + if attrPatchSuccess { + start = time.Now() + _ = pObj.PatchPayload(ctx, prm.rng, prm.payload) + c.incRequests(time.Since(start), methodObjectPatch) + } + + res, err := pObj.Close(ctx) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return ResPatchObject{}, fmt.Errorf("client failure: %w", err) + } + + return ResPatchObject{ObjectID: res.ObjectID()}, nil +} + +// objectPut writes object to FrostFS. +func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (ResPutObject, error) { + if prm.bufferMaxSize == 0 { + prm.bufferMaxSize = defaultBufferMaxSizeForPut + } + + if prm.clientCut { + return c.objectPutClientCut(ctx, prm) + } + + return c.objectPutServerCut(ctx, prm) +} + +func (c *clientWrapper) objectPutServerCut(ctx context.Context, prm PrmObjectPut) (ResPutObject, error) { + cl, err := c.getClient() + if err != nil { + return ResPutObject{}, err + } + + cliPrm := sdkClient.PrmObjectPutInit{ + CopiesNumber: prm.copiesNumber, + Session: prm.stoken, + Key: prm.key, + BearerToken: prm.btoken, + } + + start := time.Now() + wObj, err := cl.ObjectPutInit(ctx, cliPrm) + c.incRequests(time.Since(start), methodObjectPut) + if err = c.handleError(ctx, nil, err); err != nil { + return ResPutObject{}, fmt.Errorf("init writing on API client: %w", err) + } + + if wObj.WriteHeader(ctx, prm.hdr) { + sz := prm.hdr.PayloadSize() + + if data := prm.hdr.Payload(); len(data) > 0 { + if prm.payload != nil { + prm.payload = io.MultiReader(bytes.NewReader(data), prm.payload) + } else { + prm.payload = bytes.NewReader(data) + sz = uint64(len(data)) + } + } + + if prm.payload != nil { + if sz == 0 || sz > prm.bufferMaxSize { + sz = prm.bufferMaxSize + } + + buf := make([]byte, sz) + + var n int + + for { + n, err = prm.payload.Read(buf) + if n > 0 { + start = time.Now() + successWrite := wObj.WritePayloadChunk(ctx, buf[:n]) + c.incRequests(time.Since(start), methodObjectPut) + if !successWrite { + break + } + + continue + } + + if errors.Is(err, io.EOF) { + break + } + + return ResPutObject{}, fmt.Errorf("read payload: %w", c.handleError(ctx, nil, err)) + } + } + } + + res, err := wObj.Close(ctx) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { // here err already carries both status and client errors + return ResPutObject{}, fmt.Errorf("client failure: %w", err) + } + + return ResPutObject{ + ObjectID: res.StoredObjectID(), + Epoch: res.StoredEpoch(), + }, nil +} + +func (c *clientWrapper) objectPutClientCut(ctx context.Context, prm PrmObjectPut) (ResPutObject, error) { + putInitPrm := PrmObjectPutClientCutInit{ + PrmObjectPut: prm, + } + + start := time.Now() + wObj, err := c.objectPutInitTransformer(putInitPrm) + c.incRequests(time.Since(start), methodObjectPut) + if err = c.handleError(ctx, nil, err); err != nil { + return ResPutObject{}, fmt.Errorf("init writing on API client: %w", err) + } + + if wObj.WriteHeader(ctx, prm.hdr) { + sz := prm.hdr.PayloadSize() + + if data := prm.hdr.Payload(); len(data) > 0 { + if prm.payload != nil { + prm.payload = io.MultiReader(bytes.NewReader(data), prm.payload) + } else { + prm.payload = bytes.NewReader(data) + sz = uint64(len(data)) + } + } + + if prm.payload != nil { + if sz == 0 || sz > prm.bufferMaxSize { + sz = prm.bufferMaxSize + } + + buf := make([]byte, sz) + + var n int + + for { + n, err = prm.payload.Read(buf) + if n > 0 { + start = time.Now() + successWrite := wObj.WritePayloadChunk(ctx, buf[:n]) + c.incRequests(time.Since(start), methodObjectPut) + if !successWrite { + break + } + + continue + } + + if errors.Is(err, io.EOF) { + break + } + + return ResPutObject{}, fmt.Errorf("read payload: %w", c.handleError(ctx, nil, err)) + } + } + } + + res, err := wObj.Close(ctx) + var st apistatus.Status + if res != nil { + st = res.Status + } + if err = c.handleError(ctx, st, err); err != nil { // here err already carries both status and client errors + return ResPutObject{}, fmt.Errorf("client failure: %w", err) + } + + return ResPutObject{ + ObjectID: res.OID, + Epoch: res.Epoch, + }, nil +} + +// objectDelete invokes sdkClient.ObjectDelete parse response status to error. +func (c *clientWrapper) objectDelete(ctx context.Context, prm PrmObjectDelete) error { + cl, err := c.getClient() + if err != nil { + return err + } + + cnr := prm.addr.Container() + obj := prm.addr.Object() + + cliPrm := sdkClient.PrmObjectDelete{ + BearerToken: prm.btoken, + Session: prm.stoken, + ContainerID: &cnr, + ObjectID: &obj, + Key: prm.key, + } + + start := time.Now() + res, err := cl.ObjectDelete(ctx, cliPrm) + c.incRequests(time.Since(start), methodObjectDelete) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return fmt.Errorf("delete object on client: %w", err) + } + return nil +} + +// objectGet returns reader for object. +func (c *clientWrapper) objectGet(ctx context.Context, prm PrmObjectGet) (ResGetObject, error) { + cl, err := c.getClient() + if err != nil { + return ResGetObject{}, err + } + + prmCnr := prm.addr.Container() + prmObj := prm.addr.Object() + + cliPrm := sdkClient.PrmObjectGet{ + BearerToken: prm.btoken, + Session: prm.stoken, + ContainerID: &prmCnr, + ObjectID: &prmObj, + Key: prm.key, + } + + var res ResGetObject + + rObj, err := cl.ObjectGetInit(ctx, cliPrm) + if err = c.handleError(ctx, nil, err); err != nil { + return ResGetObject{}, fmt.Errorf("init object reading on client: %w", err) + } + + start := time.Now() + successReadHeader := rObj.ReadHeader(&res.Header) + c.incRequests(time.Since(start), methodObjectGet) + if !successReadHeader { + rObjRes, err := rObj.Close() + var st apistatus.Status + if rObjRes != nil { + st = rObjRes.Status() + } + err = c.handleError(ctx, st, err) + return res, fmt.Errorf("read header: %w", err) + } + + res.Payload = &objectReadCloser{ + reader: rObj, + elapsedTimeCallback: func(elapsed time.Duration) { + c.incRequests(elapsed, methodObjectGet) + }, + } + + return res, nil +} + +// objectHead invokes sdkClient.ObjectHead parse response status to error and return result as is. +func (c *clientWrapper) objectHead(ctx context.Context, prm PrmObjectHead) (object.Object, error) { + cl, err := c.getClient() + if err != nil { + return object.Object{}, err + } + + prmCnr := prm.addr.Container() + prmObj := prm.addr.Object() + + cliPrm := sdkClient.PrmObjectHead{ + BearerToken: prm.btoken, + Session: prm.stoken, + Raw: prm.raw, + ContainerID: &prmCnr, + ObjectID: &prmObj, + Key: prm.key, + } + + var obj object.Object + + start := time.Now() + res, err := cl.ObjectHead(ctx, cliPrm) + c.incRequests(time.Since(start), methodObjectHead) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return obj, fmt.Errorf("read object header via client: %w", err) + } + if !res.ReadHeader(&obj) { + return obj, errors.New("missing object header in response") + } + + return obj, nil +} + +// objectRange returns object range reader. +func (c *clientWrapper) objectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRange, error) { + cl, err := c.getClient() + if err != nil { + return ResObjectRange{}, err + } + + prmCnr := prm.addr.Container() + prmObj := prm.addr.Object() + + cliPrm := sdkClient.PrmObjectRange{ + BearerToken: prm.btoken, + Session: prm.stoken, + ContainerID: &prmCnr, + ObjectID: &prmObj, + Offset: prm.off, + Length: prm.ln, + Key: prm.key, + } + + start := time.Now() + res, err := cl.ObjectRangeInit(ctx, cliPrm) + c.incRequests(time.Since(start), methodObjectRange) + if err = c.handleError(ctx, nil, err); err != nil { + return ResObjectRange{}, fmt.Errorf("init payload range reading on client: %w", err) + } + + return ResObjectRange{ + payload: res, + elapsedTimeCallback: func(elapsed time.Duration) { + c.incRequests(elapsed, methodObjectRange) + }, + }, nil +} + +// objectSearch invokes sdkClient.ObjectSearchInit parse response status to error and return result as is. +func (c *clientWrapper) objectSearch(ctx context.Context, prm PrmObjectSearch) (ResObjectSearch, error) { + cl, err := c.getClient() + if err != nil { + return ResObjectSearch{}, err + } + + cliPrm := sdkClient.PrmObjectSearch{ + ContainerID: &prm.cnrID, + Filters: prm.filters, + Session: prm.stoken, + BearerToken: prm.btoken, + Key: prm.key, + } + + res, err := cl.ObjectSearchInit(ctx, cliPrm) + if err = c.handleError(ctx, nil, err); err != nil { + return ResObjectSearch{}, fmt.Errorf("init object searching on client: %w", err) + } + + return ResObjectSearch{r: res, handleError: c.handleError}, nil +} + +// sessionCreate invokes sdkClient.SessionCreate parse response status to error and return result as is. +func (c *clientWrapper) sessionCreate(ctx context.Context, prm prmCreateSession) (resCreateSession, error) { + cl, err := c.getClient() + if err != nil { + return resCreateSession{}, err + } + + cliPrm := sdkClient.PrmSessionCreate{ + Expiration: prm.exp, + Key: &prm.key, + } + + start := time.Now() + res, err := cl.SessionCreate(ctx, cliPrm) + c.incRequests(time.Since(start), methodSessionCreate) + var st apistatus.Status + if res != nil { + st = res.Status() + } + if err = c.handleError(ctx, st, err); err != nil { + return resCreateSession{}, fmt.Errorf("session creation on client: %w", err) + } + + return resCreateSession{ + id: res.ID(), + sessionKey: res.PublicKey(), + }, nil +} + +func (c *clientStatusMonitor) isHealthy() bool { + return c.healthy.Load() == statusHealthy +} + +func (c *clientStatusMonitor) setHealthy() { + c.healthy.Store(statusHealthy) +} + +func (c *clientStatusMonitor) setUnhealthy() { + c.healthy.Store(statusUnhealthyOnRequest) +} + +func (c *clientStatusMonitor) address() string { + return c.addr +} + +func (c *clientStatusMonitor) incErrorRate() { + c.mu.Lock() + c.currentErrorCount++ + c.overallErrorCount++ + + thresholdReached := c.currentErrorCount >= c.errorThreshold + if thresholdReached { + c.setUnhealthy() + c.currentErrorCount = 0 + } + c.mu.Unlock() + + if thresholdReached { + c.log(zapcore.WarnLevel, "error threshold reached", + zap.String("address", c.addr), zap.Uint32("threshold", c.errorThreshold)) + } +} + +func (c *clientStatusMonitor) incErrorRateToUnhealthy(err error) { + c.mu.Lock() + c.currentErrorCount = 0 + c.overallErrorCount++ + c.setUnhealthy() + c.mu.Unlock() + + c.log(zapcore.WarnLevel, "explicitly mark node unhealthy", zap.String("address", c.addr), zap.Error(err)) +} + +func (c *clientStatusMonitor) log(level zapcore.Level, msg string, fields ...zap.Field) { + if c.logger == nil { + return + } + + c.logger.Log(level, msg, fields...) +} + +func (c *clientStatusMonitor) currentErrorRate() uint32 { + c.mu.RLock() + defer c.mu.RUnlock() + return c.currentErrorCount +} + +func (c *clientStatusMonitor) overallErrorRate() uint64 { + c.mu.RLock() + defer c.mu.RUnlock() + return c.overallErrorCount +} + +func (c *clientStatusMonitor) methodsStatus() []StatusSnapshot { + result := make([]StatusSnapshot, len(c.methods)) + for i, val := range c.methods { + result[i] = val.Snapshot() + } + + return result +} + +func (c *clientWrapper) incRequests(elapsed time.Duration, method MethodIndex) { + methodStat := c.methods[method] + methodStat.IncRequests(elapsed) + if c.prm.poolRequestInfoCallback != nil { + c.prm.poolRequestInfoCallback(RequestInfo{ + Address: c.prm.address, + Method: method, + Elapsed: elapsed, + }) + } +} + +func (c *clientWrapper) close() error { + if !c.isDialed() { + return nil + } + if cl := c.getClientRaw(); cl != nil { + return cl.Close() + } + return nil +} + +func (c *clientWrapper) scheduleGracefulClose() { + cl := c.getClientRaw() + if cl == nil { + return + } + + time.AfterFunc(c.prm.gracefulCloseOnSwitchTimeout, func() { + if err := cl.Close(); err != nil { + c.log(zap.DebugLevel, "close unhealthy client during rebalance", zap.String("address", c.address()), zap.Error(err)) + } + }) +} + +func (c *clientStatusMonitor) handleError(ctx context.Context, st apistatus.Status, err error) error { + if stErr := apistatus.ErrFromStatus(st); stErr != nil { + switch stErr.(type) { + case *apistatus.ServerInternal, + *apistatus.WrongMagicNumber, + *apistatus.SignatureVerification: + c.incErrorRate() + case *apistatus.NodeUnderMaintenance: + c.incErrorRateToUnhealthy(stErr) + } + + if err == nil { + err = stErr + } + + return err + } + + if err != nil { + if needCountError(ctx, err) { + if sdkClient.IsErrNodeUnderMaintenance(err) { + c.incErrorRateToUnhealthy(err) + } else { + c.incErrorRate() + } + } + + return err + } + + return nil +} + +func needCountError(ctx context.Context, err error) bool { + // non-status logic error that could be returned + // from the SDK client; should not be considered + // as a connection error + var siErr *object.SplitInfoError + if errors.As(err, &siErr) { + return false + } + var eiErr *object.ECInfoError + if errors.As(err, &eiErr) { + return false + } + + if ctx != nil && errors.Is(ctx.Err(), context.Canceled) { + return false + } + + return true +} + +// clientBuilder is a type alias of client constructors which open connection +// to the given endpoint. +type clientBuilder = func(endpoint string) client + +// RequestInfo groups info about pool request. +type RequestInfo struct { + Address string + Method MethodIndex + Elapsed time.Duration +} diff --git a/pool/connection_manager.go b/pool/connection_manager.go new file mode 100644 index 00000000..b142529a --- /dev/null +++ b/pool/connection_manager.go @@ -0,0 +1,330 @@ +package pool + +import ( + "context" + "errors" + "fmt" + "math/rand" + "sort" + "sync" + "sync/atomic" + "time" + + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +type innerPool struct { + lock sync.RWMutex + sampler *sampler + clients []client +} + +type connectionManager struct { + innerPools []*innerPool + rebalanceParams rebalanceParameters + clientBuilder clientBuilder + logger *zap.Logger + healthChecker *healthCheck +} + +// newConnectionManager returns an instance of connectionManager configured according to the parameters. +// +// Before using connectionManager, you MUST call Dial. +func newConnectionManager(options InitParameters) (*connectionManager, error) { + if options.key == nil { + return nil, fmt.Errorf("missed required parameter 'Key'") + } + + nodesParams, err := adjustNodeParams(options.nodeParams) + if err != nil { + return nil, err + } + + manager := &connectionManager{ + logger: options.logger, + rebalanceParams: rebalanceParameters{ + nodesParams: nodesParams, + nodeRequestTimeout: options.healthcheckTimeout, + clientRebalanceInterval: options.clientRebalanceInterval, + sessionExpirationDuration: options.sessionExpirationDuration, + }, + clientBuilder: options.clientBuilder, + } + + return manager, nil +} + +func (cm *connectionManager) dial(ctx context.Context) error { + inner := make([]*innerPool, len(cm.rebalanceParams.nodesParams)) + var atLeastOneHealthy bool + + for i, params := range cm.rebalanceParams.nodesParams { + clients := make([]client, len(params.weights)) + for j, addr := range params.addresses { + clients[j] = cm.clientBuilder(addr) + if err := clients[j].dial(ctx); err != nil { + cm.log(zap.WarnLevel, "failed to build client", zap.String("address", addr), zap.Error(err)) + continue + } + atLeastOneHealthy = true + } + source := rand.NewSource(time.Now().UnixNano()) + sampl := newSampler(params.weights, source) + + inner[i] = &innerPool{ + sampler: sampl, + clients: clients, + } + } + + if !atLeastOneHealthy { + return fmt.Errorf("at least one node must be healthy") + } + + cm.innerPools = inner + + cm.healthChecker = newHealthCheck(cm.rebalanceParams.clientRebalanceInterval) + cm.healthChecker.startRebalance(ctx, cm.rebalance) + return nil +} + +func (cm *connectionManager) rebalance(ctx context.Context) { + buffers := make([][]float64, len(cm.rebalanceParams.nodesParams)) + for i, params := range cm.rebalanceParams.nodesParams { + buffers[i] = make([]float64, len(params.weights)) + } + + cm.updateNodesHealth(ctx, buffers) +} + +func (cm *connectionManager) log(level zapcore.Level, msg string, fields ...zap.Field) { + if cm.logger == nil { + return + } + + cm.logger.Log(level, msg, fields...) +} + +func adjustNodeParams(nodeParams []NodeParam) ([]*nodesParam, error) { + if len(nodeParams) == 0 { + return nil, errors.New("no FrostFS peers configured") + } + + nodesParamsMap := make(map[int]*nodesParam) + for _, param := range nodeParams { + nodes, ok := nodesParamsMap[param.priority] + if !ok { + nodes = &nodesParam{priority: param.priority} + } + nodes.addresses = append(nodes.addresses, param.address) + nodes.weights = append(nodes.weights, param.weight) + nodesParamsMap[param.priority] = nodes + } + + nodesParams := make([]*nodesParam, 0, len(nodesParamsMap)) + for _, nodes := range nodesParamsMap { + nodes.weights = adjustWeights(nodes.weights) + nodesParams = append(nodesParams, nodes) + } + + sort.Slice(nodesParams, func(i, j int) bool { + return nodesParams[i].priority < nodesParams[j].priority + }) + + return nodesParams, nil +} + +func (cm *connectionManager) updateNodesHealth(ctx context.Context, buffers [][]float64) { + wg := sync.WaitGroup{} + for i, inner := range cm.innerPools { + wg.Add(1) + + bufferWeights := buffers[i] + go func(i int, _ *innerPool) { + defer wg.Done() + cm.updateInnerNodesHealth(ctx, i, bufferWeights) + }(i, inner) + } + wg.Wait() +} + +func (cm *connectionManager) updateInnerNodesHealth(ctx context.Context, i int, bufferWeights []float64) { + if i > len(cm.innerPools)-1 { + return + } + pool := cm.innerPools[i] + options := cm.rebalanceParams + + healthyChanged := new(atomic.Bool) + wg := sync.WaitGroup{} + + for j, cli := range pool.clients { + wg.Add(1) + go func(j int, cli client) { + defer wg.Done() + + tctx, c := context.WithTimeout(ctx, options.nodeRequestTimeout) + defer c() + + changed, err := restartIfUnhealthy(tctx, cli) + healthy := err == nil + if healthy { + bufferWeights[j] = options.nodesParams[i].weights[j] + } else { + bufferWeights[j] = 0 + } + + if changed { + fields := []zap.Field{zap.String("address", cli.address()), zap.Bool("healthy", healthy)} + if err != nil { + fields = append(fields, zap.String("reason", err.Error())) + } + + cm.log(zap.DebugLevel, "health has changed", fields...) + healthyChanged.Store(true) + } + }(j, cli) + } + wg.Wait() + + if healthyChanged.Load() { + probabilities := adjustWeights(bufferWeights) + source := rand.NewSource(time.Now().UnixNano()) + pool.lock.Lock() + pool.sampler = newSampler(probabilities, source) + pool.lock.Unlock() + } +} + +// restartIfUnhealthy checks healthy status of client and recreate it if status is unhealthy. +// Indicating if status was changed by this function call and returns error that caused unhealthy status. +func restartIfUnhealthy(ctx context.Context, c client) (changed bool, err error) { + defer func() { + if err != nil { + c.setUnhealthy() + } else { + c.setHealthy() + } + }() + + wasHealthy := c.isHealthy() + + if res, err := c.healthcheck(ctx); err == nil { + if res.Status().IsMaintenance() { + return wasHealthy, new(apistatus.NodeUnderMaintenance) + } + + return !wasHealthy, nil + } + + if err = c.restart(ctx); err != nil { + return wasHealthy, err + } + + res, err := c.healthcheck(ctx) + if err != nil { + return wasHealthy, err + } + + if res.Status().IsMaintenance() { + return wasHealthy, new(apistatus.NodeUnderMaintenance) + } + + return !wasHealthy, nil +} + +func adjustWeights(weights []float64) []float64 { + adjusted := make([]float64, len(weights)) + sum := 0.0 + for _, weight := range weights { + sum += weight + } + if sum > 0 { + for i, weight := range weights { + adjusted[i] = weight / sum + } + } + + return adjusted +} + +func (cm *connectionManager) connection() (client, error) { + for _, inner := range cm.innerPools { + cp, err := inner.connection() + if err == nil { + return cp, nil + } + } + + return nil, errors.New("no healthy client") +} + +// iterate iterates over all clients in all innerPools. +func (cm *connectionManager) iterate(cb func(client)) { + for _, inner := range cm.innerPools { + for _, cl := range inner.clients { + if cl.isHealthy() { + cb(cl) + } + } + } +} + +func (p *innerPool) connection() (client, error) { + p.lock.RLock() // need lock because of using p.sampler + defer p.lock.RUnlock() + if len(p.clients) == 1 { + cp := p.clients[0] + if cp.isHealthy() { + return cp, nil + } + return nil, errors.New("no healthy client") + } + attempts := 3 * len(p.clients) + for range attempts { + i := p.sampler.Next() + if cp := p.clients[i]; cp.isHealthy() { + return cp, nil + } + } + + return nil, errors.New("no healthy client") +} + +func (cm connectionManager) Statistic() Statistic { + stat := Statistic{} + for _, inner := range cm.innerPools { + nodes := make([]string, 0, len(inner.clients)) + for _, cl := range inner.clients { + if cl.isHealthy() { + nodes = append(nodes, cl.address()) + } + node := NodeStatistic{ + address: cl.address(), + methods: cl.methodsStatus(), + overallErrors: cl.overallErrorRate(), + currentErrors: cl.currentErrorRate(), + } + stat.nodes = append(stat.nodes, node) + stat.overallErrors += node.overallErrors + } + if len(stat.currentNodes) == 0 { + stat.currentNodes = nodes + } + } + + return stat +} + +func (cm *connectionManager) close() { + cm.healthChecker.stopRebalance() + + // close all clients + for _, pools := range cm.innerPools { + for _, cli := range pools.clients { + _ = cli.close() + } + } +} diff --git a/pool/doc.go b/pool/doc.go index ce7acb24..349b20b7 100644 --- a/pool/doc.go +++ b/pool/doc.go @@ -7,8 +7,7 @@ a weighted random selection of the underlying client to make requests. Create pool instance with 3 nodes connection. This InitParameters will make pool use 192.168.130.71 node while it is healthy. Otherwise, it will make the pool use -192.168.130.72 for 90% of requests and 192.168.130.73 for remaining 10%. -: +192.168.130.72 for 90% of requests and 192.168.130.73 for remaining 10%: var prm pool.InitParameters prm.SetKey(key) diff --git a/pool/healthcheck.go b/pool/healthcheck.go new file mode 100644 index 00000000..2f5dec9e --- /dev/null +++ b/pool/healthcheck.go @@ -0,0 +1,47 @@ +package pool + +import ( + "context" + "time" +) + +type healthCheck struct { + cancel context.CancelFunc + closedCh chan struct{} + + clientRebalanceInterval time.Duration +} + +func newHealthCheck(clientRebalanceInterval time.Duration) *healthCheck { + var h healthCheck + h.clientRebalanceInterval = clientRebalanceInterval + h.closedCh = make(chan struct{}) + return &h +} + +// startRebalance runs loop to monitor connection healthy status. +func (h *healthCheck) startRebalance(ctx context.Context, callback func(ctx context.Context)) { + ctx, cancel := context.WithCancel(ctx) + h.cancel = cancel + + go func() { + ticker := time.NewTicker(h.clientRebalanceInterval) + defer ticker.Stop() + + for { + select { + case <-ctx.Done(): + close(h.closedCh) + return + case <-ticker.C: + callback(ctx) + ticker.Reset(h.clientRebalanceInterval) + } + } + }() +} + +func (h *healthCheck) stopRebalance() { + h.cancel() + <-h.closedCh +} diff --git a/pool/mock_test.go b/pool/mock_test.go index bf4916de..47311083 100644 --- a/pool/mock_test.go +++ b/pool/mock_test.go @@ -7,16 +7,15 @@ import ( "go.uber.org/zap" - sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" + sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" - oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" "github.com/google/uuid" ) @@ -27,11 +26,15 @@ type mockClient struct { errorOnDial bool errorOnCreateSession bool - errorOnEndpointInfo bool + errorOnEndpointInfo error + resOnEndpointInfo netmap.NodeInfo + healthcheckFn func() errorOnNetworkInfo bool stOnGetObject apistatus.Status } +var _ client = (*mockClient)(nil) + func newMockClient(addr string, key ecdsa.PrivateKey) *mockClient { return &mockClient{ key: key, @@ -39,6 +42,16 @@ func newMockClient(addr string, key ecdsa.PrivateKey) *mockClient { } } +func newMockClientHealthy(addr string, key ecdsa.PrivateKey, healthy bool) *mockClient { + m := newMockClient(addr, key) + if healthy { + m.setHealthy() + } else { + m.setUnhealthy() + } + return m +} + func (m *mockClient) setThreshold(threshold uint32) { m.errorThreshold = threshold } @@ -48,11 +61,11 @@ func (m *mockClient) errOnCreateSession() { } func (m *mockClient) errOnEndpointInfo() { - m.errorOnEndpointInfo = true + m.errorOnEndpointInfo = errors.New("error") } func (m *mockClient) errOnNetworkInfo() { - m.errorOnEndpointInfo = true + m.errorOnEndpointInfo = errors.New("error") } func (m *mockClient) errOnDial() { @@ -91,27 +104,40 @@ func (m *mockClient) containerList(context.Context, PrmContainerList) ([]cid.ID, return nil, nil } +func (m *mockClient) containerListStream(context.Context, PrmListStream) (ResListStream, error) { + return ResListStream{}, nil +} + func (m *mockClient) containerDelete(context.Context, PrmContainerDelete) error { return nil } -func (m *mockClient) containerEACL(context.Context, PrmContainerEACL) (eacl.Table, error) { - return eacl.Table{}, nil -} - -func (m *mockClient) containerSetEACL(context.Context, PrmContainerSetEACL) error { +func (m *mockClient) apeManagerAddChain(context.Context, PrmAddAPEChain) error { return nil } -func (m *mockClient) endpointInfo(ctx context.Context, _ prmEndpointInfo) (netmap.NodeInfo, error) { - var ni netmap.NodeInfo +func (m *mockClient) apeManagerRemoveChain(context.Context, PrmRemoveAPEChain) error { + return nil +} - if m.errorOnEndpointInfo { - return ni, m.handleError(ctx, nil, errors.New("error")) +func (m *mockClient) apeManagerListChains(context.Context, PrmListAPEChains) ([]ape.Chain, error) { + return []ape.Chain{}, nil +} + +func (m *mockClient) endpointInfo(ctx context.Context, _ prmEndpointInfo) (netmap.NodeInfo, error) { + if m.errorOnEndpointInfo != nil { + return netmap.NodeInfo{}, m.handleError(ctx, nil, m.errorOnEndpointInfo) } - ni.SetNetworkEndpoints(m.addr) - return ni, nil + m.resOnEndpointInfo.SetNetworkEndpoints(m.addr) + return m.resOnEndpointInfo, nil +} + +func (m *mockClient) healthcheck(ctx context.Context) (netmap.NodeInfo, error) { + if m.healthcheckFn != nil { + m.healthcheckFn() + } + return m.endpointInfo(ctx, prmEndpointInfo{}) } func (m *mockClient) networkInfo(ctx context.Context, _ prmNetworkInfo) (netmap.NetworkInfo, error) { @@ -129,8 +155,12 @@ func (m *mockClient) netMapSnapshot(context.Context, prmNetMapSnapshot) (netmap. return nm, nil } -func (m *mockClient) objectPut(context.Context, PrmObjectPut) (oid.ID, error) { - return oid.ID{}, nil +func (m *mockClient) objectPut(context.Context, PrmObjectPut) (ResPutObject, error) { + return ResPutObject{}, nil +} + +func (m *mockClient) objectPatch(context.Context, PrmObjectPatch) (ResPatchObject, error) { + return ResPatchObject{}, nil } func (m *mockClient) objectDelete(context.Context, PrmObjectDelete) error { @@ -183,16 +213,12 @@ func (m *mockClient) dial(context.Context) error { return nil } -func (m *mockClient) restartIfUnhealthy(ctx context.Context) (healthy bool, changed bool) { - _, err := m.endpointInfo(ctx, prmEndpointInfo{}) - healthy = err == nil - changed = healthy != m.isHealthy() - if healthy { - m.setHealthy() - } else { - m.setUnhealthy() +func (m *mockClient) restart(context.Context) error { + if m.errorOnDial { + return errors.New("restart dial error") } - return + + return nil } func (m *mockClient) close() error { diff --git a/pool/object_put_pool_transformer.go b/pool/object_put_pool_transformer.go index 099a12dd..69559190 100644 --- a/pool/object_put_pool_transformer.go +++ b/pool/object_put_pool_transformer.go @@ -2,6 +2,7 @@ package pool import ( "context" + "fmt" sdkClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" @@ -72,6 +73,7 @@ func (x *objectWriterTransformer) WritePayloadChunk(ctx context.Context, chunk [ type ResObjectPut struct { Status apistatus.Status OID oid.ID + Epoch uint64 } // Close return non nil result in any case. If error occurred, the result contains only buffer for further reusing. @@ -81,8 +83,11 @@ func (x *objectWriterTransformer) Close(ctx context.Context) (*ResObjectPut, err return nil, err } - if ai != nil && ai.ParentID != nil { - x.it.res.OID = *ai.ParentID + if ai != nil { + x.it.res.Epoch = ai.Epoch + if ai.ParentID != nil { + x.it.res.OID = *ai.ParentID + } } return &x.it.res, nil } @@ -128,8 +133,9 @@ func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) err if res != nil { it.res.Status = res.Status() it.res.OID = res.StoredObjectID() + it.res.Epoch = res.StoredEpoch() } - return err + return fmt.Errorf("put as stream '%s': %w", it.address, err) } func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (bool, error) { @@ -146,7 +152,7 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b res, err := it.client.ObjectPutSingle(ctx, cliPrm) if err != nil && status.Code(err) == codes.Unimplemented { - return false, err + return false, fmt.Errorf("address '%s': %w", it.address, err) } if err == nil { @@ -154,11 +160,12 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b it.res = ResObjectPut{ Status: res.Status(), OID: id, + Epoch: res.Epoch(), } if !it.resolveFrostFSErrors && !apistatus.IsSuccessful(it.res.Status) { return true, apistatus.ErrFromStatus(it.res.Status) } return true, nil } - return true, err + return true, fmt.Errorf("try put single '%s': %w", it.address, err) } diff --git a/pool/pool.go b/pool/pool.go index 48f2ee17..53bd587d 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -1,27 +1,22 @@ package pool import ( - "bytes" "context" "crypto/ecdsa" "errors" "fmt" "io" "math" - "math/rand" - "sort" - "sync" - "sync/atomic" "time" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" sdkClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -31,7 +26,6 @@ import ( "github.com/google/uuid" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "go.uber.org/zap" - "go.uber.org/zap/zapcore" "google.golang.org/grpc" ) @@ -47,20 +41,28 @@ type client interface { containerGet(context.Context, PrmContainerGet) (container.Container, error) // see clientWrapper.containerList. containerList(context.Context, PrmContainerList) ([]cid.ID, error) + // see clientWrapper.containerListStream. + containerListStream(context.Context, PrmListStream) (ResListStream, error) // see clientWrapper.containerDelete. containerDelete(context.Context, PrmContainerDelete) error - // see clientWrapper.containerEACL. - containerEACL(context.Context, PrmContainerEACL) (eacl.Table, error) - // see clientWrapper.containerSetEACL. - containerSetEACL(context.Context, PrmContainerSetEACL) error + // see clientWrapper.apeManagerAddChain. + apeManagerAddChain(context.Context, PrmAddAPEChain) error + // see clientWrapper.apeManagerRemoveChain. + apeManagerRemoveChain(context.Context, PrmRemoveAPEChain) error + // see clientWrapper.apeManagerListChains. + apeManagerListChains(context.Context, PrmListAPEChains) ([]ape.Chain, error) // see clientWrapper.endpointInfo. endpointInfo(context.Context, prmEndpointInfo) (netmap.NodeInfo, error) + // see clientWrapper.healthcheck. + healthcheck(ctx context.Context) (netmap.NodeInfo, error) // see clientWrapper.networkInfo. networkInfo(context.Context, prmNetworkInfo) (netmap.NetworkInfo, error) // see clientWrapper.netMapSnapshot netMapSnapshot(context.Context, prmNetMapSnapshot) (netmap.NetMap, error) // see clientWrapper.objectPut. - objectPut(context.Context, PrmObjectPut) (oid.ID, error) + objectPut(context.Context, PrmObjectPut) (ResPutObject, error) + // see clientWrapper.objectPatch. + objectPatch(context.Context, PrmObjectPatch) (ResPatchObject, error) // see clientWrapper.objectDelete. objectDelete(context.Context, PrmObjectDelete) error // see clientWrapper.objectGet. @@ -78,8 +80,8 @@ type client interface { // see clientWrapper.dial. dial(ctx context.Context) error - // see clientWrapper.restartIfUnhealthy. - restartIfUnhealthy(ctx context.Context) (bool, bool) + // see clientWrapper.restart. + restart(ctx context.Context) error // see clientWrapper.close. close() error } @@ -88,10 +90,10 @@ type client interface { type clientStatus interface { // isHealthy checks if the connection can handle requests. isHealthy() bool - // isDialed checks if the connection was created. - isDialed() bool // setUnhealthy marks client as unhealthy. setUnhealthy() + // setHealthy marks client as healthy. + setHealthy() // address return address of endpoint. address() string // currentErrorRate returns current errors rate. @@ -101,1090 +103,7 @@ type clientStatus interface { // overallErrorRate returns the number of all happened errors. overallErrorRate() uint64 // methodsStatus returns statistic for all used methods. - methodsStatus() []statusSnapshot -} - -// errPoolClientUnhealthy is an error to indicate that client in pool is unhealthy. -var errPoolClientUnhealthy = errors.New("pool client unhealthy") - -// clientStatusMonitor count error rate and other statistics for connection. -type clientStatusMonitor struct { - logger *zap.Logger - addr string - healthy *atomic.Uint32 - errorThreshold uint32 - - mu sync.RWMutex // protect counters - currentErrorCount uint32 - overallErrorCount uint64 - methods []*methodStatus -} - -// values for healthy status of clientStatusMonitor. -const ( - // statusUnhealthyOnDial is set when dialing to the endpoint is failed, - // so there is no connection to the endpoint, and pool should not close it - // before re-establishing connection once again. - statusUnhealthyOnDial = iota - - // statusUnhealthyOnRequest is set when communication after dialing to the - // endpoint is failed due to immediate or accumulated errors, connection is - // available and pool should close it before re-establishing connection once again. - statusUnhealthyOnRequest - - // statusHealthy is set when connection is ready to be used by the pool. - statusHealthy -) - -// methodStatus provide statistic for specific method. -type methodStatus struct { - name string - mu sync.RWMutex // protect counters - statusSnapshot -} - -// statusSnapshot is statistic for specific method. -type statusSnapshot struct { - allTime uint64 - allRequests uint64 -} - -// MethodIndex index of method in list of statuses in clientStatusMonitor. -type MethodIndex int - -const ( - methodBalanceGet MethodIndex = iota - methodContainerPut - methodContainerGet - methodContainerList - methodContainerDelete - methodContainerEACL - methodContainerSetEACL - methodEndpointInfo - methodNetworkInfo - methodNetMapSnapshot - methodObjectPut - methodObjectDelete - methodObjectGet - methodObjectHead - methodObjectRange - methodSessionCreate - methodLast -) - -// String implements fmt.Stringer. -func (m MethodIndex) String() string { - switch m { - case methodBalanceGet: - return "balanceGet" - case methodContainerPut: - return "containerPut" - case methodContainerGet: - return "containerGet" - case methodContainerList: - return "containerList" - case methodContainerDelete: - return "containerDelete" - case methodContainerEACL: - return "containerEACL" - case methodContainerSetEACL: - return "containerSetEACL" - case methodEndpointInfo: - return "endpointInfo" - case methodNetworkInfo: - return "networkInfo" - case methodNetMapSnapshot: - return "netMapSnapshot" - case methodObjectPut: - return "objectPut" - case methodObjectDelete: - return "objectDelete" - case methodObjectGet: - return "objectGet" - case methodObjectHead: - return "objectHead" - case methodObjectRange: - return "objectRange" - case methodSessionCreate: - return "sessionCreate" - case methodLast: - return "it's a system name rather than a method" - default: - return "unknown" - } -} - -func newClientStatusMonitor(logger *zap.Logger, addr string, errorThreshold uint32) clientStatusMonitor { - methods := make([]*methodStatus, methodLast) - for i := methodBalanceGet; i < methodLast; i++ { - methods[i] = &methodStatus{name: i.String()} - } - - healthy := new(atomic.Uint32) - healthy.Store(statusHealthy) - - return clientStatusMonitor{ - logger: logger, - addr: addr, - healthy: healthy, - errorThreshold: errorThreshold, - methods: methods, - } -} - -func (m *methodStatus) snapshot() statusSnapshot { - m.mu.RLock() - defer m.mu.RUnlock() - return m.statusSnapshot -} - -func (m *methodStatus) incRequests(elapsed time.Duration) { - m.mu.Lock() - defer m.mu.Unlock() - m.allTime += uint64(elapsed) - m.allRequests++ -} - -// clientWrapper is used by default, alternative implementations are intended for testing purposes only. -type clientWrapper struct { - clientMutex sync.RWMutex - client *sdkClient.Client - prm wrapperPrm - - clientStatusMonitor -} - -// wrapperPrm is params to create clientWrapper. -type wrapperPrm struct { - logger *zap.Logger - address string - key ecdsa.PrivateKey - dialTimeout time.Duration - streamTimeout time.Duration - errorThreshold uint32 - responseInfoCallback func(sdkClient.ResponseMetaInfo) error - poolRequestInfoCallback func(RequestInfo) - dialOptions []grpc.DialOption -} - -// setAddress sets endpoint to connect in FrostFS network. -func (x *wrapperPrm) setAddress(address string) { - x.address = address -} - -// setKey sets sdkClient.Client private key to be used for the protocol communication by default. -func (x *wrapperPrm) setKey(key ecdsa.PrivateKey) { - x.key = key -} - -// setLogger sets sdkClient.Client logger. -func (x *wrapperPrm) setLogger(logger *zap.Logger) { - x.logger = logger -} - -// setDialTimeout sets the timeout for connection to be established. -func (x *wrapperPrm) setDialTimeout(timeout time.Duration) { - x.dialTimeout = timeout -} - -// setStreamTimeout sets the timeout for individual operations in streaming RPC. -func (x *wrapperPrm) setStreamTimeout(timeout time.Duration) { - x.streamTimeout = timeout -} - -// setErrorThreshold sets threshold after reaching which connection is considered unhealthy -// until Pool.startRebalance routing updates its status. -func (x *wrapperPrm) setErrorThreshold(threshold uint32) { - x.errorThreshold = threshold -} - -// setPoolRequestCallback sets callback that will be invoked after every pool response. -func (x *wrapperPrm) setPoolRequestCallback(f func(RequestInfo)) { - x.poolRequestInfoCallback = f -} - -// setResponseInfoCallback sets callback that will be invoked after every response. -func (x *wrapperPrm) setResponseInfoCallback(f func(sdkClient.ResponseMetaInfo) error) { - x.responseInfoCallback = f -} - -// setGRPCDialOptions sets the gRPC dial options for new gRPC client connection. -func (x *wrapperPrm) setGRPCDialOptions(opts []grpc.DialOption) { - x.dialOptions = opts -} - -// newWrapper creates a clientWrapper that implements the client interface. -func newWrapper(prm wrapperPrm) *clientWrapper { - var cl sdkClient.Client - prmInit := sdkClient.PrmInit{ - Key: prm.key, - ResponseInfoCallback: prm.responseInfoCallback, - } - - cl.Init(prmInit) - - res := &clientWrapper{ - client: &cl, - clientStatusMonitor: newClientStatusMonitor(prm.logger, prm.address, prm.errorThreshold), - prm: prm, - } - - return res -} - -// dial establishes a connection to the server from the FrostFS network. -// Returns an error describing failure reason. If failed, the client -// SHOULD NOT be used. -func (c *clientWrapper) dial(ctx context.Context) error { - cl, err := c.getClient() - if err != nil { - return err - } - - prmDial := sdkClient.PrmDial{ - Endpoint: c.prm.address, - DialTimeout: c.prm.dialTimeout, - StreamTimeout: c.prm.streamTimeout, - GRPCDialOptions: c.prm.dialOptions, - } - - if err = cl.Dial(ctx, prmDial); err != nil { - c.setUnhealthyOnDial() - return err - } - - return nil -} - -// restartIfUnhealthy checks healthy status of client and recreate it if status is unhealthy. -// Return current healthy status and indicating if status was changed by this function call. -func (c *clientWrapper) restartIfUnhealthy(ctx context.Context) (healthy, changed bool) { - var wasHealthy bool - if _, err := c.endpointInfo(ctx, prmEndpointInfo{}); err == nil { - return true, false - } else if !errors.Is(err, errPoolClientUnhealthy) { - wasHealthy = true - } - - // if connection is dialed before, to avoid routine / connection leak, - // pool has to close it and then initialize once again. - if c.isDialed() { - _ = c.close() - } - - var cl sdkClient.Client - prmInit := sdkClient.PrmInit{ - Key: c.prm.key, - ResponseInfoCallback: c.prm.responseInfoCallback, - } - - cl.Init(prmInit) - - prmDial := sdkClient.PrmDial{ - Endpoint: c.prm.address, - DialTimeout: c.prm.dialTimeout, - StreamTimeout: c.prm.streamTimeout, - GRPCDialOptions: c.prm.dialOptions, - } - - if err := cl.Dial(ctx, prmDial); err != nil { - c.setUnhealthyOnDial() - return false, wasHealthy - } - - c.clientMutex.Lock() - c.client = &cl - c.clientMutex.Unlock() - - if _, err := cl.EndpointInfo(ctx, sdkClient.PrmEndpointInfo{}); err != nil { - c.setUnhealthy() - return false, wasHealthy - } - - c.setHealthy() - return true, !wasHealthy -} - -func (c *clientWrapper) getClient() (*sdkClient.Client, error) { - c.clientMutex.RLock() - defer c.clientMutex.RUnlock() - if c.isHealthy() { - return c.client, nil - } - return nil, errPoolClientUnhealthy -} - -// balanceGet invokes sdkClient.BalanceGet parse response status to error and return result as is. -func (c *clientWrapper) balanceGet(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error) { - cl, err := c.getClient() - if err != nil { - return accounting.Decimal{}, err - } - - cliPrm := sdkClient.PrmBalanceGet{ - Account: prm.account, - } - - start := time.Now() - res, err := cl.BalanceGet(ctx, cliPrm) - c.incRequests(time.Since(start), methodBalanceGet) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return accounting.Decimal{}, fmt.Errorf("balance get on client: %w", err) - } - - return res.Amount(), nil -} - -// containerPut invokes sdkClient.ContainerPut parse response status to error and return result as is. -// It also waits for the container to appear on the network. -func (c *clientWrapper) containerPut(ctx context.Context, prm PrmContainerPut) (cid.ID, error) { - cl, err := c.getClient() - if err != nil { - return cid.ID{}, err - } - - start := time.Now() - res, err := cl.ContainerPut(ctx, prm.ClientParams) - c.incRequests(time.Since(start), methodContainerPut) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return cid.ID{}, fmt.Errorf("container put on client: %w", err) - } - - if prm.WaitParams == nil { - prm.WaitParams = defaultWaitParams() - } - if err = prm.WaitParams.CheckValidity(); err != nil { - return cid.ID{}, fmt.Errorf("invalid wait parameters: %w", err) - } - - idCnr := res.ID() - - err = waitForContainerPresence(ctx, c, idCnr, prm.WaitParams) - if err = c.handleError(ctx, nil, err); err != nil { - return cid.ID{}, fmt.Errorf("wait container presence on client: %w", err) - } - - return idCnr, nil -} - -// containerGet invokes sdkClient.ContainerGet parse response status to error and return result as is. -func (c *clientWrapper) containerGet(ctx context.Context, prm PrmContainerGet) (container.Container, error) { - cl, err := c.getClient() - if err != nil { - return container.Container{}, err - } - - cliPrm := sdkClient.PrmContainerGet{ - ContainerID: &prm.ContainerID, - } - - start := time.Now() - res, err := cl.ContainerGet(ctx, cliPrm) - c.incRequests(time.Since(start), methodContainerGet) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return container.Container{}, fmt.Errorf("container get on client: %w", err) - } - - return res.Container(), nil -} - -// containerList invokes sdkClient.ContainerList parse response status to error and return result as is. -func (c *clientWrapper) containerList(ctx context.Context, prm PrmContainerList) ([]cid.ID, error) { - cl, err := c.getClient() - if err != nil { - return nil, err - } - - cliPrm := sdkClient.PrmContainerList{ - Account: prm.ownerID, - } - - start := time.Now() - res, err := cl.ContainerList(ctx, cliPrm) - c.incRequests(time.Since(start), methodContainerList) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return nil, fmt.Errorf("container list on client: %w", err) - } - return res.Containers(), nil -} - -// containerDelete invokes sdkClient.ContainerDelete parse response status to error. -// It also waits for the container to be removed from the network. -func (c *clientWrapper) containerDelete(ctx context.Context, prm PrmContainerDelete) error { - cl, err := c.getClient() - if err != nil { - return err - } - - cliPrm := sdkClient.PrmContainerDelete{ - ContainerID: &prm.ContainerID, - Session: prm.Session, - } - - start := time.Now() - res, err := cl.ContainerDelete(ctx, cliPrm) - c.incRequests(time.Since(start), methodContainerDelete) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return fmt.Errorf("container delete on client: %w", err) - } - - if prm.WaitParams == nil { - prm.WaitParams = defaultWaitParams() - } - if err := prm.WaitParams.CheckValidity(); err != nil { - return fmt.Errorf("invalid wait parameters: %w", err) - } - - return waitForContainerRemoved(ctx, c, &prm.ContainerID, prm.WaitParams) -} - -// containerEACL invokes sdkClient.ContainerEACL parse response status to error and return result as is. -func (c *clientWrapper) containerEACL(ctx context.Context, prm PrmContainerEACL) (eacl.Table, error) { - cl, err := c.getClient() - if err != nil { - return eacl.Table{}, err - } - - cliPrm := sdkClient.PrmContainerEACL{ - ContainerID: &prm.ContainerID, - } - - start := time.Now() - res, err := cl.ContainerEACL(ctx, cliPrm) - c.incRequests(time.Since(start), methodContainerEACL) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return eacl.Table{}, fmt.Errorf("get eacl on client: %w", err) - } - - return res.Table(), nil -} - -// containerSetEACL invokes sdkClient.ContainerSetEACL parse response status to error. -// It also waits for the EACL to appear on the network. -func (c *clientWrapper) containerSetEACL(ctx context.Context, prm PrmContainerSetEACL) error { - cl, err := c.getClient() - if err != nil { - return err - } - - cliPrm := sdkClient.PrmContainerSetEACL{ - Table: &prm.Table, - Session: prm.Session, - } - - start := time.Now() - res, err := cl.ContainerSetEACL(ctx, cliPrm) - c.incRequests(time.Since(start), methodContainerSetEACL) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return fmt.Errorf("set eacl on client: %w", err) - } - - if prm.WaitParams == nil { - prm.WaitParams = defaultWaitParams() - } - if err := prm.WaitParams.CheckValidity(); err != nil { - return fmt.Errorf("invalid wait parameters: %w", err) - } - - var cIDp *cid.ID - if cID, set := prm.Table.CID(); set { - cIDp = &cID - } - - err = waitForEACLPresence(ctx, c, cIDp, &prm.Table, prm.WaitParams) - if err = c.handleError(ctx, nil, err); err != nil { - return fmt.Errorf("wait eacl presence on client: %w", err) - } - - return nil -} - -// endpointInfo invokes sdkClient.EndpointInfo parse response status to error and return result as is. -func (c *clientWrapper) endpointInfo(ctx context.Context, _ prmEndpointInfo) (netmap.NodeInfo, error) { - cl, err := c.getClient() - if err != nil { - return netmap.NodeInfo{}, err - } - - start := time.Now() - res, err := cl.EndpointInfo(ctx, sdkClient.PrmEndpointInfo{}) - c.incRequests(time.Since(start), methodEndpointInfo) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return netmap.NodeInfo{}, fmt.Errorf("endpoint info on client: %w", err) - } - - return res.NodeInfo(), nil -} - -// networkInfo invokes sdkClient.NetworkInfo parse response status to error and return result as is. -func (c *clientWrapper) networkInfo(ctx context.Context, _ prmNetworkInfo) (netmap.NetworkInfo, error) { - cl, err := c.getClient() - if err != nil { - return netmap.NetworkInfo{}, err - } - - start := time.Now() - res, err := cl.NetworkInfo(ctx, sdkClient.PrmNetworkInfo{}) - c.incRequests(time.Since(start), methodNetworkInfo) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return netmap.NetworkInfo{}, fmt.Errorf("network info on client: %w", err) - } - - return res.Info(), nil -} - -// networkInfo invokes sdkClient.NetworkInfo parse response status to error and return result as is. -func (c *clientWrapper) netMapSnapshot(ctx context.Context, _ prmNetMapSnapshot) (netmap.NetMap, error) { - cl, err := c.getClient() - if err != nil { - return netmap.NetMap{}, err - } - - start := time.Now() - res, err := cl.NetMapSnapshot(ctx, sdkClient.PrmNetMapSnapshot{}) - c.incRequests(time.Since(start), methodNetMapSnapshot) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return netmap.NetMap{}, fmt.Errorf("network map snapshot on client: %w", err) - } - - return res.NetMap(), nil -} - -// objectPut writes object to FrostFS. -func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { - if prm.bufferMaxSize == 0 { - prm.bufferMaxSize = defaultBufferMaxSizeForPut - } - - if prm.clientCut { - return c.objectPutClientCut(ctx, prm) - } - - return c.objectPutServerCut(ctx, prm) -} - -func (c *clientWrapper) objectPutServerCut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { - cl, err := c.getClient() - if err != nil { - return oid.ID{}, err - } - - cliPrm := sdkClient.PrmObjectPutInit{ - CopiesNumber: prm.copiesNumber, - Session: prm.stoken, - Key: prm.key, - BearerToken: prm.btoken, - } - - start := time.Now() - wObj, err := cl.ObjectPutInit(ctx, cliPrm) - c.incRequests(time.Since(start), methodObjectPut) - if err = c.handleError(ctx, nil, err); err != nil { - return oid.ID{}, fmt.Errorf("init writing on API client: %w", err) - } - - if wObj.WriteHeader(ctx, prm.hdr) { - sz := prm.hdr.PayloadSize() - - if data := prm.hdr.Payload(); len(data) > 0 { - if prm.payload != nil { - prm.payload = io.MultiReader(bytes.NewReader(data), prm.payload) - } else { - prm.payload = bytes.NewReader(data) - sz = uint64(len(data)) - } - } - - if prm.payload != nil { - if sz == 0 || sz > prm.bufferMaxSize { - sz = prm.bufferMaxSize - } - - buf := make([]byte, sz) - - var n int - - for { - n, err = prm.payload.Read(buf) - if n > 0 { - start = time.Now() - successWrite := wObj.WritePayloadChunk(ctx, buf[:n]) - c.incRequests(time.Since(start), methodObjectPut) - if !successWrite { - break - } - - continue - } - - if errors.Is(err, io.EOF) { - break - } - - return oid.ID{}, fmt.Errorf("read payload: %w", c.handleError(ctx, nil, err)) - } - } - } - - res, err := wObj.Close(ctx) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { // here err already carries both status and client errors - return oid.ID{}, fmt.Errorf("client failure: %w", err) - } - - return res.StoredObjectID(), nil -} - -func (c *clientWrapper) objectPutClientCut(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { - putInitPrm := PrmObjectPutClientCutInit{ - PrmObjectPut: prm, - } - - start := time.Now() - wObj, err := c.objectPutInitTransformer(putInitPrm) - c.incRequests(time.Since(start), methodObjectPut) - if err = c.handleError(ctx, nil, err); err != nil { - return oid.ID{}, fmt.Errorf("init writing on API client: %w", err) - } - - if wObj.WriteHeader(ctx, prm.hdr) { - sz := prm.hdr.PayloadSize() - - if data := prm.hdr.Payload(); len(data) > 0 { - if prm.payload != nil { - prm.payload = io.MultiReader(bytes.NewReader(data), prm.payload) - } else { - prm.payload = bytes.NewReader(data) - sz = uint64(len(data)) - } - } - - if prm.payload != nil { - if sz == 0 || sz > prm.bufferMaxSize { - sz = prm.bufferMaxSize - } - - buf := make([]byte, sz) - - var n int - - for { - n, err = prm.payload.Read(buf) - if n > 0 { - start = time.Now() - successWrite := wObj.WritePayloadChunk(ctx, buf[:n]) - c.incRequests(time.Since(start), methodObjectPut) - if !successWrite { - break - } - - continue - } - - if errors.Is(err, io.EOF) { - break - } - - return oid.ID{}, fmt.Errorf("read payload: %w", c.handleError(ctx, nil, err)) - } - } - } - - res, err := wObj.Close(ctx) - var st apistatus.Status - if res != nil { - st = res.Status - } - if err = c.handleError(ctx, st, err); err != nil { // here err already carries both status and client errors - return oid.ID{}, fmt.Errorf("client failure: %w", err) - } - - return res.OID, nil -} - -// objectDelete invokes sdkClient.ObjectDelete parse response status to error. -func (c *clientWrapper) objectDelete(ctx context.Context, prm PrmObjectDelete) error { - cl, err := c.getClient() - if err != nil { - return err - } - - cnr := prm.addr.Container() - obj := prm.addr.Object() - - cliPrm := sdkClient.PrmObjectDelete{ - BearerToken: prm.btoken, - Session: prm.stoken, - ContainerID: &cnr, - ObjectID: &obj, - Key: prm.key, - } - - start := time.Now() - res, err := cl.ObjectDelete(ctx, cliPrm) - c.incRequests(time.Since(start), methodObjectDelete) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return fmt.Errorf("delete object on client: %w", err) - } - return nil -} - -// objectGet returns reader for object. -func (c *clientWrapper) objectGet(ctx context.Context, prm PrmObjectGet) (ResGetObject, error) { - cl, err := c.getClient() - if err != nil { - return ResGetObject{}, err - } - - prmCnr := prm.addr.Container() - prmObj := prm.addr.Object() - - cliPrm := sdkClient.PrmObjectGet{ - BearerToken: prm.btoken, - Session: prm.stoken, - ContainerID: &prmCnr, - ObjectID: &prmObj, - Key: prm.key, - } - - var res ResGetObject - - rObj, err := cl.ObjectGetInit(ctx, cliPrm) - if err = c.handleError(ctx, nil, err); err != nil { - return ResGetObject{}, fmt.Errorf("init object reading on client: %w", err) - } - - start := time.Now() - successReadHeader := rObj.ReadHeader(&res.Header) - c.incRequests(time.Since(start), methodObjectGet) - if !successReadHeader { - rObjRes, err := rObj.Close() - var st apistatus.Status - if rObjRes != nil { - st = rObjRes.Status() - } - err = c.handleError(ctx, st, err) - return res, fmt.Errorf("read header: %w", err) - } - - res.Payload = &objectReadCloser{ - reader: rObj, - elapsedTimeCallback: func(elapsed time.Duration) { - c.incRequests(elapsed, methodObjectGet) - }, - } - - return res, nil -} - -// objectHead invokes sdkClient.ObjectHead parse response status to error and return result as is. -func (c *clientWrapper) objectHead(ctx context.Context, prm PrmObjectHead) (object.Object, error) { - cl, err := c.getClient() - if err != nil { - return object.Object{}, err - } - - prmCnr := prm.addr.Container() - prmObj := prm.addr.Object() - - cliPrm := sdkClient.PrmObjectHead{ - BearerToken: prm.btoken, - Session: prm.stoken, - Raw: prm.raw, - ContainerID: &prmCnr, - ObjectID: &prmObj, - Key: prm.key, - } - - var obj object.Object - - start := time.Now() - res, err := cl.ObjectHead(ctx, cliPrm) - c.incRequests(time.Since(start), methodObjectHead) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return obj, fmt.Errorf("read object header via client: %w", err) - } - if !res.ReadHeader(&obj) { - return obj, errors.New("missing object header in response") - } - - return obj, nil -} - -// objectRange returns object range reader. -func (c *clientWrapper) objectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRange, error) { - cl, err := c.getClient() - if err != nil { - return ResObjectRange{}, err - } - - prmCnr := prm.addr.Container() - prmObj := prm.addr.Object() - - cliPrm := sdkClient.PrmObjectRange{ - BearerToken: prm.btoken, - Session: prm.stoken, - ContainerID: &prmCnr, - ObjectID: &prmObj, - Offset: prm.off, - Length: prm.ln, - Key: prm.key, - } - - start := time.Now() - res, err := cl.ObjectRangeInit(ctx, cliPrm) - c.incRequests(time.Since(start), methodObjectRange) - if err = c.handleError(ctx, nil, err); err != nil { - return ResObjectRange{}, fmt.Errorf("init payload range reading on client: %w", err) - } - - return ResObjectRange{ - payload: res, - elapsedTimeCallback: func(elapsed time.Duration) { - c.incRequests(elapsed, methodObjectRange) - }, - }, nil -} - -// objectSearch invokes sdkClient.ObjectSearchInit parse response status to error and return result as is. -func (c *clientWrapper) objectSearch(ctx context.Context, prm PrmObjectSearch) (ResObjectSearch, error) { - cl, err := c.getClient() - if err != nil { - return ResObjectSearch{}, err - } - - cliPrm := sdkClient.PrmObjectSearch{ - ContainerID: &prm.cnrID, - Filters: prm.filters, - Session: prm.stoken, - BearerToken: prm.btoken, - Key: prm.key, - } - - res, err := cl.ObjectSearchInit(ctx, cliPrm) - if err = c.handleError(ctx, nil, err); err != nil { - return ResObjectSearch{}, fmt.Errorf("init object searching on client: %w", err) - } - - return ResObjectSearch{r: res}, nil -} - -// sessionCreate invokes sdkClient.SessionCreate parse response status to error and return result as is. -func (c *clientWrapper) sessionCreate(ctx context.Context, prm prmCreateSession) (resCreateSession, error) { - cl, err := c.getClient() - if err != nil { - return resCreateSession{}, err - } - - cliPrm := sdkClient.PrmSessionCreate{ - Expiration: prm.exp, - Key: &prm.key, - } - - start := time.Now() - res, err := cl.SessionCreate(ctx, cliPrm) - c.incRequests(time.Since(start), methodSessionCreate) - var st apistatus.Status - if res != nil { - st = res.Status() - } - if err = c.handleError(ctx, st, err); err != nil { - return resCreateSession{}, fmt.Errorf("session creation on client: %w", err) - } - - return resCreateSession{ - id: res.ID(), - sessionKey: res.PublicKey(), - }, nil -} - -func (c *clientStatusMonitor) isHealthy() bool { - return c.healthy.Load() == statusHealthy -} - -func (c *clientStatusMonitor) isDialed() bool { - return c.healthy.Load() != statusUnhealthyOnDial -} - -func (c *clientStatusMonitor) setHealthy() { - c.healthy.Store(statusHealthy) -} - -func (c *clientStatusMonitor) setUnhealthy() { - c.healthy.Store(statusUnhealthyOnRequest) -} - -func (c *clientStatusMonitor) setUnhealthyOnDial() { - c.healthy.Store(statusUnhealthyOnDial) -} - -func (c *clientStatusMonitor) address() string { - return c.addr -} - -func (c *clientStatusMonitor) incErrorRate() { - c.mu.Lock() - c.currentErrorCount++ - c.overallErrorCount++ - - thresholdReached := c.currentErrorCount >= c.errorThreshold - if thresholdReached { - c.setUnhealthy() - c.currentErrorCount = 0 - } - c.mu.Unlock() - - if thresholdReached { - c.log(zapcore.WarnLevel, "error threshold reached", - zap.String("address", c.addr), zap.Uint32("threshold", c.errorThreshold)) - } -} - -func (c *clientStatusMonitor) log(level zapcore.Level, msg string, fields ...zap.Field) { - if c.logger == nil { - return - } - - c.logger.Log(level, msg, fields...) -} - -func (c *clientStatusMonitor) currentErrorRate() uint32 { - c.mu.RLock() - defer c.mu.RUnlock() - return c.currentErrorCount -} - -func (c *clientStatusMonitor) overallErrorRate() uint64 { - c.mu.RLock() - defer c.mu.RUnlock() - return c.overallErrorCount -} - -func (c *clientStatusMonitor) methodsStatus() []statusSnapshot { - result := make([]statusSnapshot, len(c.methods)) - for i, val := range c.methods { - result[i] = val.snapshot() - } - - return result -} - -func (c *clientWrapper) incRequests(elapsed time.Duration, method MethodIndex) { - methodStat := c.methods[method] - methodStat.incRequests(elapsed) - if c.prm.poolRequestInfoCallback != nil { - c.prm.poolRequestInfoCallback(RequestInfo{ - Address: c.prm.address, - Method: method, - Elapsed: elapsed, - }) - } -} - -func (c *clientWrapper) close() error { - if c.client != nil { - return c.client.Close() - } - return nil -} - -func (c *clientStatusMonitor) handleError(ctx context.Context, st apistatus.Status, err error) error { - if err != nil { - if needCountError(ctx, err) { - c.incErrorRate() - } - - return err - } - - err = apistatus.ErrFromStatus(st) - switch err.(type) { - case *apistatus.ServerInternal, - *apistatus.WrongMagicNumber, - *apistatus.SignatureVerification, - *apistatus.NodeUnderMaintenance: - c.incErrorRate() - } - - return err -} - -func needCountError(ctx context.Context, err error) bool { - // non-status logic error that could be returned - // from the SDK client; should not be considered - // as a connection error - var siErr *object.SplitInfoError - if errors.As(err, &siErr) { - return false - } - - if errors.Is(ctx.Err(), context.Canceled) { - return false - } - - return true -} - -// clientBuilder is a type alias of client constructors which open connection -// to the given endpoint. -type clientBuilder = func(endpoint string) client - -// RequestInfo groups info about pool request. -type RequestInfo struct { - Address string - Method MethodIndex - Elapsed time.Duration + methodsStatus() []StatusSnapshot } // InitParameters contains values used to initialize connection Pool. @@ -1202,6 +121,8 @@ type InitParameters struct { dialOptions []grpc.DialOption clientBuilder clientBuilder + + gracefulCloseOnSwitchTimeout time.Duration } // SetKey specifies default key to be used for the protocol communication by default. @@ -1238,6 +159,15 @@ func (x *InitParameters) SetClientRebalanceInterval(interval time.Duration) { x.clientRebalanceInterval = interval } +// SetGracefulCloseOnSwitchTimeout specifies the timeout after which unhealthy client be closed during rebalancing +// if it will become healthy back. +// Generally this param should be less than client rebalance interval (see SetClientRebalanceInterval). +// +// See also SetErrorThreshold. +func (x *InitParameters) SetGracefulCloseOnSwitchTimeout(timeout time.Duration) { + x.gracefulCloseOnSwitchTimeout = timeout +} + // SetSessionExpirationDuration specifies the session token lifetime in epochs. func (x *InitParameters) SetSessionExpirationDuration(expirationDuration uint64) { x.sessionExpirationDuration = expirationDuration @@ -1312,6 +242,9 @@ func (x *NodeParam) SetPriority(priority int) { } // Priority returns priority of the node. +// Requests will be served by nodes subset with the highest priority (the smaller value - the higher priority). +// If there are no healthy nodes in subsets with current or higher priority, requests will be served +// by nodes subset with lower priority. func (x *NodeParam) Priority() int { return x.priority } @@ -1327,6 +260,7 @@ func (x *NodeParam) Address() string { } // SetWeight specifies weight of the node. +// Weights used to adjust requests' distribution between nodes with the same priority. func (x *NodeParam) SetWeight(weight float64) { x.weight = weight } @@ -1370,7 +304,7 @@ func (x *WaitParams) checkForPositive() { } } -// CheckForValid checks if all wait params are non-negative. +// CheckValidity checks if all wait params are non-negative. func (x *WaitParams) CheckValidity() error { if x.Timeout <= 0 { return errors.New("timeout cannot be negative") @@ -1501,6 +435,53 @@ func (x *PrmObjectPut) setNetworkInfo(ni netmap.NetworkInfo) { x.networkInfo = ni } +// PrmObjectPatch groups parameters of PatchObject operation. +type PrmObjectPatch struct { + prmCommon + + addr oid.Address + + rng *object.Range + + payload io.Reader + + newAttrs []object.Attribute + + replaceAttrs bool + + maxPayloadPatchChunkLength int +} + +// SetAddress sets the address of the object that is patched. +func (x *PrmObjectPatch) SetAddress(addr oid.Address) { + x.addr = addr +} + +// SetRange sets the patch's range. +func (x *PrmObjectPatch) SetRange(rng *object.Range) { + x.rng = rng +} + +// SetPayloadReader sets a payload reader. +func (x *PrmObjectPatch) SetPayloadReader(payload io.Reader) { + x.payload = payload +} + +// SetRange sets the new attributes to the patch. +func (x *PrmObjectPatch) SetNewAttributes(newAttrs []object.Attribute) { + x.newAttrs = newAttrs +} + +// SetRange sets the replace attributes flag to the patch. +func (x *PrmObjectPatch) SetReplaceAttributes(replaceAttrs bool) { + x.replaceAttrs = replaceAttrs +} + +// SetMaxPayloadPatchChunkSize sets a max buf size to read the patch's payload. +func (x *PrmObjectPatch) SetMaxPayloadPatchChunkSize(maxPayloadPatchChunkSize int) { + x.maxPayloadPatchChunkLength = maxPayloadPatchChunkSize +} + // PrmObjectDelete groups parameters of DeleteObject operation. type PrmObjectDelete struct { prmCommon @@ -1624,6 +605,8 @@ func (x *PrmContainerPut) SetWaitParams(waitParams WaitParams) { // PrmContainerGet groups parameters of GetContainer operation. type PrmContainerGet struct { ContainerID cid.ID + + Session *session.Container } // SetContainerID specifies identifier of the container to be read. @@ -1635,12 +618,16 @@ func (prm *PrmContainerGet) SetContainerID(cnrID cid.ID) { // PrmContainerList groups parameters of ListContainers operation. type PrmContainerList struct { - ownerID user.ID + OwnerID user.ID + + Session *session.Container } // SetOwnerID specifies identifier of the FrostFS account to list the containers. +// +// Deprecated: Use PrmContainerList.OwnerID instead. func (x *PrmContainerList) SetOwnerID(ownerID user.ID) { - x.ownerID = ownerID + x.OwnerID = ownerID } // PrmContainerDelete groups parameters of DeleteContainer operation. @@ -1676,53 +663,20 @@ func (x *PrmContainerDelete) SetWaitParams(waitParams WaitParams) { x.WaitParams = &waitParams } -// PrmContainerEACL groups parameters of GetEACL operation. -type PrmContainerEACL struct { - ContainerID cid.ID +type PrmAddAPEChain struct { + Target ape.ChainTarget + + Chain ape.Chain } -// SetContainerID specifies identifier of the FrostFS container to read the eACL table. -func (x *PrmContainerEACL) SetContainerID(cnrID cid.ID) { - x.ContainerID = cnrID +type PrmRemoveAPEChain struct { + Target ape.ChainTarget + + ChainID ape.ChainID } -// PrmContainerSetEACL groups parameters of SetEACL operation. -type PrmContainerSetEACL struct { - Table eacl.Table - - Session *session.Container - - WaitParams *WaitParams -} - -// SetTable sets structure of container's extended ACL to be used as a -// parameter of the base client's operation. -// -// See git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client.PrmContainerSetEACL.SetTable. -// -// Deprecated: Use PrmContainerSetEACL.Table instead. -func (x *PrmContainerSetEACL) SetTable(table eacl.Table) { - x.Table = table -} - -// WithinSession specifies session to be used as a parameter of the base -// client's operation. -// -// See git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client.PrmContainerSetEACL.WithinSession. -// -// Deprecated: Use PrmContainerSetEACL.Session instead. -func (x *PrmContainerSetEACL) WithinSession(s session.Container) { - x.Session = &s -} - -// SetWaitParams specifies timeout params to complete operation. -// If not provided the default one will be used. -// Panics if any of the wait params isn't positive. -// -// Deprecated: Use PrmContainerSetEACL.WaitParams instead. -func (x *PrmContainerSetEACL) SetWaitParams(waitParams WaitParams) { - waitParams.checkForPositive() - x.WaitParams = &waitParams +type PrmListAPEChains struct { + Target ape.ChainTarget } // PrmBalanceGet groups parameters of Balance operation. @@ -1790,67 +744,50 @@ type resCreateSession struct { // // See pool package overview to get some examples. type Pool struct { - innerPools []*innerPool - key *ecdsa.PrivateKey - cancel context.CancelFunc - closedCh chan struct{} - cache *sessionCache - stokenDuration uint64 - rebalanceParams rebalanceParameters - clientBuilder clientBuilder - logger *zap.Logger + manager *connectionManager + logger *zap.Logger + key *ecdsa.PrivateKey + cache *sessionCache + stokenDuration uint64 maxObjectSize uint64 } -type innerPool struct { - lock sync.RWMutex - sampler *sampler - clients []client -} - const ( - defaultSessionTokenExpirationDuration = 100 // in blocks + defaultSessionTokenExpirationDuration = 100 // in epochs defaultErrorThreshold = 100 - defaultRebalanceInterval = 15 * time.Second - defaultHealthcheckTimeout = 4 * time.Second - defaultDialTimeout = 5 * time.Second - defaultStreamTimeout = 10 * time.Second + defaultGracefulCloseOnSwitchTimeout = 10 * time.Second + defaultRebalanceInterval = 15 * time.Second + defaultHealthcheckTimeout = 4 * time.Second + defaultDialTimeout = 5 * time.Second + defaultStreamTimeout = 10 * time.Second defaultBufferMaxSizeForPut = 3 * 1024 * 1024 // 3 MB ) -// NewPool creates connection pool using parameters. +// NewPool returns an instance of Pool configured according to the parameters. +// +// Before using Pool, you MUST call Dial. func NewPool(options InitParameters) (*Pool, error) { - if options.key == nil { - return nil, fmt.Errorf("missed required parameter 'Key'") - } - - nodesParams, err := adjustNodeParams(options.nodeParams) - if err != nil { - return nil, err - } - - cache, err := newCache() + cache, err := newCache(options.sessionExpirationDuration) if err != nil { return nil, fmt.Errorf("couldn't create cache: %w", err) } fillDefaultInitParams(&options, cache) + manager, err := newConnectionManager(options) + if err != nil { + return nil, err + } + pool := &Pool{ - key: options.key, cache: cache, + key: options.key, logger: options.logger, + manager: manager, stokenDuration: options.sessionExpirationDuration, - rebalanceParams: rebalanceParameters{ - nodesParams: nodesParams, - nodeRequestTimeout: options.healthcheckTimeout, - clientRebalanceInterval: options.clientRebalanceInterval, - sessionExpirationDuration: options.sessionExpirationDuration, - }, - clientBuilder: options.clientBuilder, } return pool, nil @@ -1865,66 +802,39 @@ func NewPool(options InitParameters) (*Pool, error) { // // See also InitParameters.SetClientRebalanceInterval. func (p *Pool) Dial(ctx context.Context) error { - inner := make([]*innerPool, len(p.rebalanceParams.nodesParams)) - var atLeastOneHealthy bool - - for i, params := range p.rebalanceParams.nodesParams { - clients := make([]client, len(params.weights)) - for j, addr := range params.addresses { - clients[j] = p.clientBuilder(addr) - if err := clients[j].dial(ctx); err != nil { - p.log(zap.WarnLevel, "failed to build client", zap.String("address", addr), zap.Error(err)) - continue - } - - var st session.Object - err := initSessionForDuration(ctx, &st, clients[j], p.rebalanceParams.sessionExpirationDuration, *p.key, false) - if err != nil { - clients[j].setUnhealthy() - p.log(zap.WarnLevel, "failed to create frostfs session token for client", - zap.String("address", addr), zap.Error(err)) - continue - } - - _ = p.cache.Put(formCacheKey(addr, p.key, false), st) - atLeastOneHealthy = true - } - source := rand.NewSource(time.Now().UnixNano()) - sampl := newSampler(params.weights, source) - - inner[i] = &innerPool{ - sampler: sampl, - clients: clients, - } + err := p.manager.dial(ctx) + if err != nil { + return err } + var atLeastOneHealthy bool + p.manager.iterate(func(cl client) { + var st session.Object + err := initSessionForDuration(ctx, &st, cl, p.manager.rebalanceParams.sessionExpirationDuration, *p.key, false) + if err != nil { + if p.logger != nil { + p.logger.Log(zap.WarnLevel, "failed to create frostfs session token for client", + zap.String("address", cl.address()), zap.Error(err)) + } + return + } + + _ = p.cache.Put(formCacheKey(cl.address(), p.key, false), st) + atLeastOneHealthy = true + }) + if !atLeastOneHealthy { return fmt.Errorf("at least one node must be healthy") } - ctx, cancel := context.WithCancel(ctx) - p.cancel = cancel - p.closedCh = make(chan struct{}) - p.innerPools = inner - ni, err := p.NetworkInfo(ctx) if err != nil { return fmt.Errorf("get network info for max object size: %w", err) } p.maxObjectSize = ni.MaxObjectSize() - - go p.startRebalance(ctx) return nil } -func (p *Pool) log(level zapcore.Level, msg string, fields ...zap.Field) { - if p.logger == nil { - return - } - - p.logger.Log(level, msg, fields...) -} - func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { if params.sessionExpirationDuration == 0 { params.sessionExpirationDuration = defaultSessionTokenExpirationDuration @@ -1938,6 +848,10 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { params.clientRebalanceInterval = defaultRebalanceInterval } + if params.gracefulCloseOnSwitchTimeout <= 0 { + params.gracefulCloseOnSwitchTimeout = defaultGracefulCloseOnSwitchTimeout + } + if params.healthcheckTimeout <= 0 { params.healthcheckTimeout = defaultHealthcheckTimeout } @@ -1950,6 +864,10 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { params.nodeStreamTimeout = defaultStreamTimeout } + if cache.tokenDuration == 0 { + cache.tokenDuration = defaultSessionTokenExpirationDuration + } + if params.isMissingClientBuilder() { params.setClientBuilder(func(addr string) client { var prm wrapperPrm @@ -1959,6 +877,7 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { prm.setDialTimeout(params.nodeDialTimeout) prm.setStreamTimeout(params.nodeStreamTimeout) prm.setErrorThreshold(params.errorThreshold) + prm.setGracefulCloseOnSwitchTimeout(params.gracefulCloseOnSwitchTimeout) prm.setPoolRequestCallback(params.requestCallback) prm.setGRPCDialOptions(params.dialOptions) prm.setResponseInfoCallback(func(info sdkClient.ResponseMetaInfo) error { @@ -1970,160 +889,6 @@ func fillDefaultInitParams(params *InitParameters, cache *sessionCache) { } } -func adjustNodeParams(nodeParams []NodeParam) ([]*nodesParam, error) { - if len(nodeParams) == 0 { - return nil, errors.New("no FrostFS peers configured") - } - - nodesParamsMap := make(map[int]*nodesParam) - for _, param := range nodeParams { - nodes, ok := nodesParamsMap[param.priority] - if !ok { - nodes = &nodesParam{priority: param.priority} - } - nodes.addresses = append(nodes.addresses, param.address) - nodes.weights = append(nodes.weights, param.weight) - nodesParamsMap[param.priority] = nodes - } - - nodesParams := make([]*nodesParam, 0, len(nodesParamsMap)) - for _, nodes := range nodesParamsMap { - nodes.weights = adjustWeights(nodes.weights) - nodesParams = append(nodesParams, nodes) - } - - sort.Slice(nodesParams, func(i, j int) bool { - return nodesParams[i].priority < nodesParams[j].priority - }) - - return nodesParams, nil -} - -// startRebalance runs loop to monitor connection healthy status. -func (p *Pool) startRebalance(ctx context.Context) { - ticker := time.NewTimer(p.rebalanceParams.clientRebalanceInterval) - buffers := make([][]float64, len(p.rebalanceParams.nodesParams)) - for i, params := range p.rebalanceParams.nodesParams { - buffers[i] = make([]float64, len(params.weights)) - } - - for { - select { - case <-ctx.Done(): - close(p.closedCh) - return - case <-ticker.C: - p.updateNodesHealth(ctx, buffers) - ticker.Reset(p.rebalanceParams.clientRebalanceInterval) - } - } -} - -func (p *Pool) updateNodesHealth(ctx context.Context, buffers [][]float64) { - wg := sync.WaitGroup{} - for i, inner := range p.innerPools { - wg.Add(1) - - bufferWeights := buffers[i] - go func(i int, innerPool *innerPool) { - defer wg.Done() - p.updateInnerNodesHealth(ctx, i, bufferWeights) - }(i, inner) - } - wg.Wait() -} - -func (p *Pool) updateInnerNodesHealth(ctx context.Context, i int, bufferWeights []float64) { - if i > len(p.innerPools)-1 { - return - } - pool := p.innerPools[i] - options := p.rebalanceParams - - healthyChanged := new(atomic.Bool) - wg := sync.WaitGroup{} - - for j, cli := range pool.clients { - wg.Add(1) - go func(j int, cli client) { - defer wg.Done() - - tctx, c := context.WithTimeout(ctx, options.nodeRequestTimeout) - defer c() - - healthy, changed := cli.restartIfUnhealthy(tctx) - if healthy { - bufferWeights[j] = options.nodesParams[i].weights[j] - } else { - bufferWeights[j] = 0 - p.cache.DeleteByPrefix(cli.address()) - } - - if changed { - p.log(zap.DebugLevel, "health has changed", - zap.String("address", cli.address()), zap.Bool("healthy", healthy)) - healthyChanged.Store(true) - } - }(j, cli) - } - wg.Wait() - - if healthyChanged.Load() { - probabilities := adjustWeights(bufferWeights) - source := rand.NewSource(time.Now().UnixNano()) - pool.lock.Lock() - pool.sampler = newSampler(probabilities, source) - pool.lock.Unlock() - } -} - -func adjustWeights(weights []float64) []float64 { - adjusted := make([]float64, len(weights)) - sum := 0.0 - for _, weight := range weights { - sum += weight - } - if sum > 0 { - for i, weight := range weights { - adjusted[i] = weight / sum - } - } - - return adjusted -} - -func (p *Pool) connection() (client, error) { - for _, inner := range p.innerPools { - cp, err := inner.connection() - if err == nil { - return cp, nil - } - } - - return nil, errors.New("no healthy client") -} - -func (p *innerPool) connection() (client, error) { - p.lock.RLock() // need lock because of using p.sampler - defer p.lock.RUnlock() - if len(p.clients) == 1 { - cp := p.clients[0] - if cp.isHealthy() { - return cp, nil - } - return nil, errors.New("no healthy client") - } - attempts := 3 * len(p.clients) - for k := 0; k < attempts; k++ { - i := p.sampler.Next() - if cp := p.clients[i]; cp.isHealthy() { - return cp, nil - } - } - - return nil, errors.New("no healthy client") -} - func formCacheKey(address string, key *ecdsa.PrivateKey, clientCut bool) string { k := keys.PrivateKey{PrivateKey: *key} @@ -2214,32 +979,33 @@ type callContext struct { sessionClientCut bool } -func (p *Pool) initCallContext(ctx *callContext, cfg prmCommon, prmCtx prmContext) error { - cp, err := p.connection() +func (p *Pool) initCall(ctxCall *callContext, cfg prmCommon, prmCtx prmContext) error { + p.fillAppropriateKey(&cfg) + cp, err := p.manager.connection() if err != nil { return err } - ctx.key = cfg.key - if ctx.key == nil { + ctxCall.key = cfg.key + if ctxCall.key == nil { // use pool key if caller didn't specify its own - ctx.key = p.key + ctxCall.key = p.key } - ctx.endpoint = cp.address() - ctx.client = cp + ctxCall.endpoint = cp.address() + ctxCall.client = cp - if ctx.sessionTarget != nil && cfg.stoken != nil { - ctx.sessionTarget(*cfg.stoken) + if ctxCall.sessionTarget != nil && cfg.stoken != nil { + ctxCall.sessionTarget(*cfg.stoken) } // note that we don't override session provided by the caller - ctx.sessionDefault = cfg.stoken == nil && prmCtx.defaultSession - if ctx.sessionDefault { - ctx.sessionVerb = prmCtx.verb - ctx.sessionCnr = prmCtx.cnr - ctx.sessionObjSet = prmCtx.objSet - ctx.sessionObjs = prmCtx.objs + ctxCall.sessionDefault = cfg.stoken == nil && prmCtx.defaultSession + if ctxCall.sessionDefault { + ctxCall.sessionVerb = prmCtx.verb + ctxCall.sessionCnr = prmCtx.cnr + ctxCall.sessionObjSet = prmCtx.objSet + ctxCall.sessionObjs = prmCtx.objs } return err @@ -2304,10 +1070,54 @@ func (p *Pool) fillAppropriateKey(prm *prmCommon) { } } +// ResPutObject is designed to provide identifier and creation epoch of the saved object. +type ResPutObject struct { + ObjectID oid.ID + Epoch uint64 +} + +// ResPatchObject is designed to provide identifier for the saved patched object. +type ResPatchObject struct { + ObjectID oid.ID +} + +// PatchObject patches an object through a remote server using FrostFS API protocol. +func (p *Pool) PatchObject(ctx context.Context, prm PrmObjectPatch) (ResPatchObject, error) { + var prmCtx prmContext + prmCtx.useDefaultSession() + prmCtx.useVerb(session.VerbObjectPatch) + prmCtx.useContainer(prm.addr.Container()) + + var ctxCall callContext + if err := p.initCall(&ctxCall, prm.prmCommon, prmCtx); err != nil { + return ResPatchObject{}, fmt.Errorf("init call context: %w", err) + } + + if ctxCall.sessionDefault { + ctxCall.sessionTarget = prm.UseSession + if err := p.openDefaultSession(ctx, &ctxCall); err != nil { + return ResPatchObject{}, fmt.Errorf("open default session: %w", err) + } + } + + res, err := ctxCall.client.objectPatch(ctx, prm) + if err != nil { + // removes session token from cache in case of token error + p.checkSessionTokenErr(err, ctxCall.endpoint) + return ResPatchObject{}, fmt.Errorf("init patching on API client %s: %w", ctxCall.endpoint, err) + } + + return res, nil +} + +// LatestReceivedEpoch returns the epoch number extracted from the metadata +// of responses received from the client pool's most recent request. +func (p *Pool) LatestReceivedEpoch() uint64 { + return p.cache.Epoch() +} + // PutObject writes an object through a remote server using FrostFS API protocol. -// -// Main return value MUST NOT be processed on an erroneous return. -func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) { +func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (ResPutObject, error) { cnr, _ := prm.hdr.ContainerID() var prmCtx prmContext @@ -2315,18 +1125,16 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) prmCtx.useVerb(session.VerbObjectPut) prmCtx.useContainer(cnr) - p.fillAppropriateKey(&prm.prmCommon) - var ctxCall callContext ctxCall.sessionClientCut = prm.clientCut - if err := p.initCallContext(&ctxCall, prm.prmCommon, prmCtx); err != nil { - return oid.ID{}, fmt.Errorf("init call context: %w", err) + if err := p.initCall(&ctxCall, prm.prmCommon, prmCtx); err != nil { + return ResPutObject{}, fmt.Errorf("init call context: %w", err) } if ctxCall.sessionDefault { ctxCall.sessionTarget = prm.UseSession if err := p.openDefaultSession(ctx, &ctxCall); err != nil { - return oid.ID{}, fmt.Errorf("open default session: %w", err) + return ResPutObject{}, fmt.Errorf("open default session: %w", err) } } @@ -2337,14 +1145,14 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) prm.setNetworkInfo(ni) } - id, err := ctxCall.client.objectPut(ctx, prm) + res, err := ctxCall.client.objectPut(ctx, prm) if err != nil { // removes session token from cache in case of token error p.checkSessionTokenErr(err, ctxCall.endpoint) - return id, fmt.Errorf("init writing on API client %s: %w", ctxCall.endpoint, err) + return ResPutObject{}, fmt.Errorf("init writing on API client %s: %w", ctxCall.endpoint, err) } - return id, nil + return res, nil } // DeleteObject marks an object for deletion from the container using FrostFS API protocol. @@ -2372,12 +1180,10 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error { } } - p.fillAppropriateKey(&prm.prmCommon) - var cc callContext cc.sessionTarget = prm.UseSession - err := p.initCallContext(&cc, prm.prmCommon, prmCtx) + err := p.initCall(&cc, prm.prmCommon, prmCtx) if err != nil { return err } @@ -2418,17 +1224,13 @@ type ResGetObject struct { } // GetObject reads object header and initiates reading an object payload through a remote server using FrostFS API protocol. -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, error) { - p.fillAppropriateKey(&prm.prmCommon) - var cc callContext cc.sessionTarget = prm.UseSession var res ResGetObject - err := p.initCallContext(&cc, prm.prmCommon, prmContext{}) + err := p.initCall(&cc, prm.prmCommon, prmContext{}) if err != nil { return res, err } @@ -2443,17 +1245,13 @@ func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, e } // HeadObject reads object header through a remote server using FrostFS API protocol. -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object, error) { - p.fillAppropriateKey(&prm.prmCommon) - var cc callContext cc.sessionTarget = prm.UseSession var obj object.Object - err := p.initCallContext(&cc, prm.prmCommon, prmContext{}) + err := p.initCall(&cc, prm.prmCommon, prmContext{}) if err != nil { return obj, err } @@ -2494,17 +1292,13 @@ func (x *ResObjectRange) Close() error { // ObjectRange initiates reading an object's payload range through a remote // server using FrostFS API protocol. -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRange, error) { - p.fillAppropriateKey(&prm.prmCommon) - var cc callContext cc.sessionTarget = prm.UseSession var res ResObjectRange - err := p.initCallContext(&cc, prm.prmCommon, prmContext{}) + err := p.initCall(&cc, prm.prmCommon, prmContext{}) if err != nil { return res, err } @@ -2522,18 +1316,25 @@ func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (ResObjectRa // // Must be initialized using Pool.SearchObjects, any other usage is unsafe. type ResObjectSearch struct { - r *sdkClient.ObjectListReader + r *sdkClient.ObjectListReader + handleError func(context.Context, apistatus.Status, error) error } // Read reads another list of the object identifiers. func (x *ResObjectSearch) Read(buf []oid.ID) (int, error) { n, ok := x.r.Read(buf) if !ok { - _, err := x.r.Close() + res, err := x.r.Close() if err == nil { return n, io.EOF } + var status apistatus.Status + if res != nil { + status = res.Status() + } + err = x.handleError(nil, status, err) + return n, err } @@ -2558,17 +1359,13 @@ func (x *ResObjectSearch) Close() { // // The call only opens the transmission channel, explicit fetching of matched objects // is done using the ResObjectSearch. Resulting reader must be finally closed. -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (ResObjectSearch, error) { - p.fillAppropriateKey(&prm.prmCommon) - var cc callContext cc.sessionTarget = prm.UseSession var res ResObjectSearch - err := p.initCallContext(&cc, prm.prmCommon, prmContext{}) + err := p.initCall(&cc, prm.prmCommon, prmContext{}) if err != nil { return res, err } @@ -2590,10 +1387,8 @@ func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (ResObjec // waiting timeout: 120s // // Success can be verified by reading by identifier (see GetContainer). -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) PutContainer(ctx context.Context, prm PrmContainerPut) (cid.ID, error) { - cp, err := p.connection() + cp, err := p.manager.connection() if err != nil { return cid.ID{}, err } @@ -2607,10 +1402,8 @@ func (p *Pool) PutContainer(ctx context.Context, prm PrmContainerPut) (cid.ID, e } // GetContainer reads FrostFS container by ID. -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) GetContainer(ctx context.Context, prm PrmContainerGet) (container.Container, error) { - cp, err := p.connection() + cp, err := p.manager.connection() if err != nil { return container.Container{}, err } @@ -2625,7 +1418,7 @@ func (p *Pool) GetContainer(ctx context.Context, prm PrmContainerGet) (container // ListContainers requests identifiers of the account-owned containers. func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid.ID, error) { - cp, err := p.connection() + cp, err := p.manager.connection() if err != nil { return nil, err } @@ -2638,6 +1431,22 @@ func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid. return cnrIDs, nil } +// ListContainersStream requests identifiers of the account-owned containers. +func (p *Pool) ListContainersStream(ctx context.Context, prm PrmListStream) (ResListStream, error) { + var res ResListStream + cp, err := p.manager.connection() + if err != nil { + return res, err + } + + res, err = cp.containerListStream(ctx, prm) + if err != nil { + return res, fmt.Errorf("list containers stream via client '%s': %w", cp.address(), err) + } + + return res, nil +} + // DeleteContainer sends request to remove the FrostFS container and waits for the operation to complete. // // Waiting parameters can be specified using SetWaitParams. If not called, defaults are used: @@ -2647,7 +1456,7 @@ func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid. // // Success can be verified by reading by identifier (see GetContainer). func (p *Pool) DeleteContainer(ctx context.Context, prm PrmContainerDelete) error { - cp, err := p.connection() + cp, err := p.manager.connection() if err != nil { return err } @@ -2660,50 +1469,54 @@ func (p *Pool) DeleteContainer(ctx context.Context, prm PrmContainerDelete) erro return nil } -// GetEACL reads eACL table of the FrostFS container. -// -// Main return value MUST NOT be processed on an erroneous return. -func (p *Pool) GetEACL(ctx context.Context, prm PrmContainerEACL) (eacl.Table, error) { - cp, err := p.connection() - if err != nil { - return eacl.Table{}, err - } - - eaclResult, err := cp.containerEACL(ctx, prm) - if err != nil { - return eacl.Table{}, fmt.Errorf("get EACL via client '%s': %w", cp.address(), err) - } - - return eaclResult, nil -} - -// SetEACL sends request to update eACL table of the FrostFS container and waits for the operation to complete. -// -// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used: -// -// polling interval: 5s -// waiting timeout: 120s -// -// Success can be verified by reading by identifier (see GetEACL). -func (p *Pool) SetEACL(ctx context.Context, prm PrmContainerSetEACL) error { - cp, err := p.connection() +// AddAPEChain sends a request to set APE chain rules for a target (basically, for a container). +func (p *Pool) AddAPEChain(ctx context.Context, prm PrmAddAPEChain) error { + cp, err := p.manager.connection() if err != nil { return err } - err = cp.containerSetEACL(ctx, prm) + err = cp.apeManagerAddChain(ctx, prm) if err != nil { - return fmt.Errorf("set EACL via client '%s': %w", cp.address(), err) + return fmt.Errorf("add ape chain via client '%s': %w", cp.address(), err) } return nil } +// RemoveAPEChain sends a request to remove APE chain rules for a target. +func (p *Pool) RemoveAPEChain(ctx context.Context, prm PrmRemoveAPEChain) error { + cp, err := p.manager.connection() + if err != nil { + return err + } + + err = cp.apeManagerRemoveChain(ctx, prm) + if err != nil { + return fmt.Errorf("remove ape chain via client '%s': %w", cp.address(), err) + } + + return nil +} + +// ListAPEChains sends a request to list APE chains rules for a target. +func (p *Pool) ListAPEChains(ctx context.Context, prm PrmListAPEChains) ([]ape.Chain, error) { + cp, err := p.manager.connection() + if err != nil { + return nil, err + } + + chains, err := cp.apeManagerListChains(ctx, prm) + if err != nil { + return nil, fmt.Errorf("list ape chains via client '%s': %w", cp.address(), err) + } + + return chains, nil +} + // Balance requests current balance of the FrostFS account. -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (accounting.Decimal, error) { - cp, err := p.connection() + cp, err := p.manager.connection() if err != nil { return accounting.Decimal{}, err } @@ -2718,66 +1531,19 @@ func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (accounting.Decim // Statistic returns connection statistics. func (p Pool) Statistic() Statistic { - stat := Statistic{} - for _, inner := range p.innerPools { - nodes := make([]string, 0, len(inner.clients)) - inner.lock.RLock() - for _, cl := range inner.clients { - if cl.isHealthy() { - nodes = append(nodes, cl.address()) - } - node := NodeStatistic{ - address: cl.address(), - methods: cl.methodsStatus(), - overallErrors: cl.overallErrorRate(), - currentErrors: cl.currentErrorRate(), - } - stat.nodes = append(stat.nodes, node) - stat.overallErrors += node.overallErrors - } - inner.lock.RUnlock() - if len(stat.currentNodes) == 0 { - stat.currentNodes = nodes - } - } - - return stat + return p.manager.Statistic() } // waitForContainerPresence waits until the container is found on the FrostFS network. -func waitForContainerPresence(ctx context.Context, cli client, cnrID cid.ID, waitParams *WaitParams) error { - var prm PrmContainerGet - prm.SetContainerID(cnrID) - +func waitForContainerPresence(ctx context.Context, cli client, prm PrmContainerGet, waitParams *WaitParams) error { return waitFor(ctx, waitParams, func(ctx context.Context) bool { _, err := cli.containerGet(ctx, prm) return err == nil }) } -// waitForEACLPresence waits until the container eacl is applied on the FrostFS network. -func waitForEACLPresence(ctx context.Context, cli client, cnrID *cid.ID, table *eacl.Table, waitParams *WaitParams) error { - var prm PrmContainerEACL - if cnrID != nil { - prm.ContainerID = *cnrID - } - - return waitFor(ctx, waitParams, func(ctx context.Context) bool { - eaclTable, err := cli.containerEACL(ctx, prm) - if err == nil { - return eacl.EqualTables(*table, eaclTable) - } - return false - }) -} - // waitForContainerRemoved waits until the container is removed from the FrostFS network. -func waitForContainerRemoved(ctx context.Context, cli client, cnrID *cid.ID, waitParams *WaitParams) error { - var prm PrmContainerGet - if cnrID != nil { - prm.SetContainerID(*cnrID) - } - +func waitForContainerRemoved(ctx context.Context, cli client, prm PrmContainerGet, waitParams *WaitParams) error { return waitFor(ctx, waitParams, func(ctx context.Context) bool { _, err := cli.containerGet(ctx, prm) return sdkClient.IsErrContainerNotFound(err) @@ -2808,10 +1574,8 @@ func waitFor(ctx context.Context, params *WaitParams, condition func(context.Con } // NetworkInfo requests information about the FrostFS network of which the remote server is a part. -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) NetworkInfo(ctx context.Context) (netmap.NetworkInfo, error) { - cp, err := p.connection() + cp, err := p.manager.connection() if err != nil { return netmap.NetworkInfo{}, err } @@ -2825,10 +1589,8 @@ func (p *Pool) NetworkInfo(ctx context.Context) (netmap.NetworkInfo, error) { } // NetMapSnapshot requests information about the FrostFS network map. -// -// Main return value MUST NOT be processed on an erroneous return. func (p *Pool) NetMapSnapshot(ctx context.Context) (netmap.NetMap, error) { - cp, err := p.connection() + cp, err := p.manager.connection() if err != nil { return netmap.NetMap{}, err } @@ -2843,17 +1605,7 @@ func (p *Pool) NetMapSnapshot(ctx context.Context) (netmap.NetMap, error) { // Close closes the Pool and releases all the associated resources. func (p *Pool) Close() { - p.cancel() - <-p.closedCh - - // close all clients - for _, pools := range p.innerPools { - for _, cli := range pools.clients { - if cli.isDialed() { - _ = cli.close() - } - } - } + p.manager.close() } // SyncContainerWithNetwork applies network configuration received via @@ -2894,12 +1646,13 @@ func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tok _, err := p.HeadObject(ctx, prm) var errSplit *object.SplitInfoError + var errECInfo *object.ECInfoError switch { case errors.As(err, &errSplit): return errSplit.SplitInfo(), nil - case err == nil: - return nil, relations.ErrNoSplitInfo + case err == nil || errors.As(err, &errECInfo): + return nil, fmt.Errorf("failed to get raw object header %w", relations.ErrNoSplitInfo) default: return nil, fmt.Errorf("failed to get raw object header: %w", err) } diff --git a/pool/pool_test.go b/pool/pool_test.go index e953aba7..e6af6643 100644 --- a/pool/pool_test.go +++ b/pool/pool_test.go @@ -4,13 +4,13 @@ import ( "context" "crypto/ecdsa" "errors" - "strconv" + "math/rand" "testing" "time" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" - cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" @@ -18,6 +18,8 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/stretchr/testify/require" "go.uber.org/zap" + "go.uber.org/zap/zaptest" + "go.uber.org/zap/zaptest/observer" ) func TestBuildPoolClientFailed(t *testing.T) { @@ -102,7 +104,7 @@ func TestBuildPoolOneNodeFailed(t *testing.T) { expectedAuthKey := frostfsecdsa.PublicKey(clientKeys[1].PublicKey) condition := func() bool { - cp, err := clientPool.connection() + cp, err := clientPool.manager.connection() if err != nil { return false } @@ -139,7 +141,7 @@ func TestOneNode(t *testing.T) { require.NoError(t, err) t.Cleanup(pool.Close) - cp, err := pool.connection() + cp, err := pool.manager.connection() require.NoError(t, err) st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) expectedAuthKey := frostfsecdsa.PublicKey(key1.PublicKey) @@ -169,7 +171,7 @@ func TestTwoNodes(t *testing.T) { require.NoError(t, err) t.Cleanup(pool.Close) - cp, err := pool.connection() + cp, err := pool.manager.connection() require.NoError(t, err) st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, assertAuthKeyForAny(st, clientKeys)) @@ -218,19 +220,191 @@ func TestOneOfTwoFailed(t *testing.T) { err = pool.Dial(context.Background()) require.NoError(t, err) - require.NoError(t, err) t.Cleanup(pool.Close) time.Sleep(2 * time.Second) - for i := 0; i < 5; i++ { - cp, err := pool.connection() + for range 5 { + cp, err := pool.manager.connection() require.NoError(t, err) st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, assertAuthKeyForAny(st, clientKeys)) } } +func TestUpdateNodesHealth(t *testing.T) { + ctx := context.Background() + key := newPrivateKey(t) + + for _, tc := range []struct { + name string + wasHealthy bool + willHealthy bool + prepareCli func(*mockClient) + }{ + { + name: "healthy, maintenance, unhealthy", + wasHealthy: true, + willHealthy: false, + prepareCli: func(c *mockClient) { c.resOnEndpointInfo.SetStatus(netmap.Maintenance) }, + }, + { + name: "unhealthy, maintenance, unhealthy", + wasHealthy: false, + willHealthy: false, + prepareCli: func(c *mockClient) { c.resOnEndpointInfo.SetStatus(netmap.Maintenance) }, + }, + { + name: "healthy, no error, healthy", + wasHealthy: true, + willHealthy: true, + prepareCli: func(c *mockClient) { c.resOnEndpointInfo.SetStatus(netmap.Online) }, + }, + { + name: "unhealthy, no error, healthy", + wasHealthy: false, + willHealthy: true, + prepareCli: func(c *mockClient) { c.resOnEndpointInfo.SetStatus(netmap.Online) }, + }, + { + name: "healthy, error, failed restart, unhealthy", + wasHealthy: true, + willHealthy: false, + prepareCli: func(c *mockClient) { + c.errOnEndpointInfo() + c.errorOnDial = true + }, + }, + { + name: "unhealthy, error, failed restart, unhealthy", + wasHealthy: false, + willHealthy: false, + prepareCli: func(c *mockClient) { + c.errOnEndpointInfo() + c.errorOnDial = true + }, + }, + { + name: "healthy, error, restart, error, unhealthy", + wasHealthy: true, + willHealthy: false, + prepareCli: func(c *mockClient) { c.errOnEndpointInfo() }, + }, + { + name: "unhealthy, error, restart, error, unhealthy", + wasHealthy: false, + willHealthy: false, + prepareCli: func(c *mockClient) { c.errOnEndpointInfo() }, + }, + { + name: "healthy, error, restart, maintenance, unhealthy", + wasHealthy: true, + willHealthy: false, + prepareCli: func(c *mockClient) { + healthError := true + c.healthcheckFn = func() { + if healthError { + c.errorOnEndpointInfo = errors.New("error") + } else { + c.errorOnEndpointInfo = nil + c.resOnEndpointInfo.SetStatus(netmap.Maintenance) + } + healthError = !healthError + } + }, + }, + { + name: "unhealthy, error, restart, maintenance, unhealthy", + wasHealthy: false, + willHealthy: false, + prepareCli: func(c *mockClient) { + healthError := true + c.healthcheckFn = func() { + if healthError { + c.errorOnEndpointInfo = errors.New("error") + } else { + c.errorOnEndpointInfo = nil + c.resOnEndpointInfo.SetStatus(netmap.Maintenance) + } + healthError = !healthError + } + }, + }, + { + name: "healthy, error, restart, healthy", + wasHealthy: true, + willHealthy: true, + prepareCli: func(c *mockClient) { + healthError := true + c.healthcheckFn = func() { + if healthError { + c.errorOnEndpointInfo = errors.New("error") + } else { + c.errorOnEndpointInfo = nil + } + healthError = !healthError + } + }, + }, + { + name: "unhealthy, error, restart, healthy", + wasHealthy: false, + willHealthy: true, + prepareCli: func(c *mockClient) { + healthError := true + c.healthcheckFn = func() { + if healthError { + c.errorOnEndpointInfo = errors.New("error") + } else { + c.errorOnEndpointInfo = nil + } + healthError = !healthError + } + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + cli := newMockClientHealthy("peer0", *key, tc.wasHealthy) + tc.prepareCli(cli) + p, log := newPool(t, cli) + + p.manager.updateNodesHealth(ctx, [][]float64{{1}}) + + changed := tc.wasHealthy != tc.willHealthy + require.Equalf(t, tc.willHealthy, cli.isHealthy(), "healthy status should be: %v", tc.willHealthy) + require.Equalf(t, changed, log.Len() == 1, "healthy status should be changed: %v", changed) + }) + } +} + +func newPool(t *testing.T, cli *mockClient) (*Pool, *observer.ObservedLogs) { + log, observedLog := getObservedLogger() + + cache, err := newCache(0) + require.NoError(t, err) + + return &Pool{ + cache: cache, + key: newPrivateKey(t), + manager: &connectionManager{ + innerPools: []*innerPool{{ + sampler: newSampler([]float64{1}, rand.NewSource(0)), + clients: []client{cli}, + }}, + healthChecker: newHealthCheck(200 * time.Millisecond), + rebalanceParams: rebalanceParameters{ + nodesParams: []*nodesParam{{1, []string{"peer0"}, []float64{1}}}, + nodeRequestTimeout: time.Second, + }, + logger: log}, + }, observedLog +} + +func getObservedLogger() (*zap.Logger, *observer.ObservedLogs) { + loggerCore, observedLog := observer.New(zap.DebugLevel) + return zap.New(loggerCore), observedLog +} + func TestTwoFailed(t *testing.T) { var clientKeys []*ecdsa.PrivateKey mockClientBuilder := func(addr string) client { @@ -260,7 +434,7 @@ func TestTwoFailed(t *testing.T) { time.Sleep(2 * time.Second) - _, err = pool.connection() + _, err = pool.manager.connection() require.Error(t, err) require.Contains(t, err.Error(), "no healthy") } @@ -294,7 +468,7 @@ func TestSessionCache(t *testing.T) { t.Cleanup(pool.Close) // cache must contain session token - cp, err := pool.connection() + cp, err := pool.manager.connection() require.NoError(t, err) st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, st.AssertAuthKey(&expectedAuthKey)) @@ -307,7 +481,7 @@ func TestSessionCache(t *testing.T) { require.Error(t, err) // cache must not contain session token - cp, err = pool.connection() + cp, err = pool.manager.connection() require.NoError(t, err) _, ok := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.False(t, ok) @@ -319,7 +493,7 @@ func TestSessionCache(t *testing.T) { require.NoError(t, err) // cache must contain session token - cp, err = pool.connection() + cp, err = pool.manager.connection() require.NoError(t, err) st, _ = pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, st.AssertAuthKey(&expectedAuthKey)) @@ -363,7 +537,7 @@ func TestPriority(t *testing.T) { expectedAuthKey1 := frostfsecdsa.PublicKey(clientKeys[0].PublicKey) firstNode := func() bool { - cp, err := pool.connection() + cp, err := pool.manager.connection() require.NoError(t, err) st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) return st.AssertAuthKey(&expectedAuthKey1) @@ -371,7 +545,7 @@ func TestPriority(t *testing.T) { expectedAuthKey2 := frostfsecdsa.PublicKey(clientKeys[1].PublicKey) secondNode := func() bool { - cp, err := pool.connection() + cp, err := pool.manager.connection() require.NoError(t, err) st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) return st.AssertAuthKey(&expectedAuthKey2) @@ -408,7 +582,7 @@ func TestSessionCacheWithKey(t *testing.T) { require.NoError(t, err) // cache must contain session token - cp, err := pool.connection() + cp, err := pool.manager.connection() require.NoError(t, err) st, _ := pool.cache.Get(formCacheKey(cp.address(), pool.key, false)) require.True(t, st.AssertAuthKey(&expectedAuthKey)) @@ -461,9 +635,8 @@ func TestSessionTokenOwner(t *testing.T) { cc.sessionTarget = func(tok session.Object) { tkn = tok } - err = p.initCallContext(&cc, prm, prmCtx) + err = p.initCall(&cc, prm, prmCtx) require.NoError(t, err) - err = p.openDefaultSession(ctx, &cc) require.NoError(t, err) require.True(t, tkn.VerifySignature()) @@ -480,9 +653,7 @@ func TestWaitPresence(t *testing.T) { cancel() }() - var idCnr cid.ID - - err := waitForContainerPresence(ctx, mockCli, idCnr, &WaitParams{ + err := waitForContainerPresence(ctx, mockCli, PrmContainerGet{}, &WaitParams{ Timeout: 120 * time.Second, PollInterval: 5 * time.Second, }) @@ -492,8 +663,8 @@ func TestWaitPresence(t *testing.T) { t.Run("context deadline exceeded", func(t *testing.T) { ctx := context.Background() - var idCnr cid.ID - err := waitForContainerPresence(ctx, mockCli, idCnr, &WaitParams{ + + err := waitForContainerPresence(ctx, mockCli, PrmContainerGet{}, &WaitParams{ Timeout: 500 * time.Millisecond, PollInterval: 5 * time.Second, }) @@ -503,8 +674,8 @@ func TestWaitPresence(t *testing.T) { t.Run("ok", func(t *testing.T) { ctx := context.Background() - var idCnr cid.ID - err := waitForContainerPresence(ctx, mockCli, idCnr, &WaitParams{ + + err := waitForContainerPresence(ctx, mockCli, PrmContainerGet{}, &WaitParams{ Timeout: 10 * time.Second, PollInterval: 500 * time.Millisecond, }) @@ -517,7 +688,7 @@ func TestStatusMonitor(t *testing.T) { monitor.errorThreshold = 3 count := 10 - for i := 0; i < count; i++ { + for range count { monitor.incErrorRate() } @@ -532,13 +703,6 @@ func TestStatusMonitor(t *testing.T) { isHealthy bool description string }{ - { - action: func(m *clientStatusMonitor) { m.setUnhealthyOnDial() }, - status: statusUnhealthyOnDial, - isDialed: false, - isHealthy: false, - description: "set unhealthy on dial", - }, { action: func(m *clientStatusMonitor) { m.setUnhealthy() }, status: statusUnhealthyOnRequest, @@ -557,7 +721,6 @@ func TestStatusMonitor(t *testing.T) { for _, tc := range cases { tc.action(&monitor) require.Equal(t, tc.status, monitor.healthy.Load()) - require.Equal(t, tc.isDialed, monitor.isDialed()) require.Equal(t, tc.isHealthy, monitor.isHealthy()) } }) @@ -565,19 +728,22 @@ func TestStatusMonitor(t *testing.T) { func TestHandleError(t *testing.T) { ctx := context.Background() - monitor := newClientStatusMonitor(zap.NewExample(), "", 10) + log := zaptest.NewLogger(t) canceledCtx, cancel := context.WithCancel(context.Background()) cancel() - for i, tc := range []struct { - ctx context.Context - status apistatus.Status - err error - expectedError bool - countError bool + for _, tc := range []struct { + name string + ctx context.Context + status apistatus.Status + err error + expectedError bool + countError bool + markedUnhealthy bool }{ { + name: "no error, no status", ctx: ctx, status: nil, err: nil, @@ -585,6 +751,7 @@ func TestHandleError(t *testing.T) { countError: false, }, { + name: "no error, success status", ctx: ctx, status: new(apistatus.SuccessDefaultV2), err: nil, @@ -592,6 +759,7 @@ func TestHandleError(t *testing.T) { countError: false, }, { + name: "error, success status", ctx: ctx, status: new(apistatus.SuccessDefaultV2), err: errors.New("error"), @@ -599,6 +767,7 @@ func TestHandleError(t *testing.T) { countError: true, }, { + name: "error, no status", ctx: ctx, status: nil, err: errors.New("error"), @@ -606,6 +775,7 @@ func TestHandleError(t *testing.T) { countError: true, }, { + name: "no error, object not found status", ctx: ctx, status: new(apistatus.ObjectNotFound), err: nil, @@ -613,6 +783,26 @@ func TestHandleError(t *testing.T) { countError: false, }, { + name: "object not found error, object not found status", + ctx: ctx, + status: new(apistatus.ObjectNotFound), + err: &apistatus.ObjectNotFound{}, + expectedError: true, + countError: false, + }, + { + name: "eacl not found error, no status", + ctx: ctx, + status: nil, + err: &apistatus.EACLNotFound{}, + expectedError: true, + // we expect error be counted because status is nil + // currently we assume that DisableFrostFSErrorResolution be always false for pool + // and status be checked first in handleError + countError: true, + }, + { + name: "no error, internal status", ctx: ctx, status: new(apistatus.ServerInternal), err: nil, @@ -620,6 +810,7 @@ func TestHandleError(t *testing.T) { countError: true, }, { + name: "no error, wrong magic status", ctx: ctx, status: new(apistatus.WrongMagicNumber), err: nil, @@ -627,6 +818,7 @@ func TestHandleError(t *testing.T) { countError: true, }, { + name: "no error, signature verification status", ctx: ctx, status: new(apistatus.SignatureVerification), err: nil, @@ -634,20 +826,33 @@ func TestHandleError(t *testing.T) { countError: true, }, { - ctx: ctx, - status: new(apistatus.SignatureVerification), - err: nil, - expectedError: true, - countError: true, + name: "no error, maintenance status", + ctx: ctx, + status: new(apistatus.NodeUnderMaintenance), + err: nil, + expectedError: true, + countError: true, + markedUnhealthy: true, }, { - ctx: ctx, - status: new(apistatus.NodeUnderMaintenance), - err: nil, - expectedError: true, - countError: true, + name: "maintenance error, no status", + ctx: ctx, + status: nil, + err: &apistatus.NodeUnderMaintenance{}, + expectedError: true, + countError: true, + markedUnhealthy: true, }, { + name: "no error, invalid argument status", + ctx: ctx, + status: new(apistatus.InvalidArgument), + err: nil, + expectedError: true, + countError: false, + }, + { + name: "context canceled error, no status", ctx: canceledCtx, status: nil, err: errors.New("error"), @@ -655,8 +860,9 @@ func TestHandleError(t *testing.T) { countError: false, }, } { - t.Run(strconv.Itoa(i), func(t *testing.T) { - errCount := monitor.currentErrorRate() + t.Run(tc.name, func(t *testing.T) { + monitor := newClientStatusMonitor(log, "", 10) + errCount := monitor.overallErrorRate() err := monitor.handleError(tc.ctx, tc.status, tc.err) if tc.expectedError { require.Error(t, err) @@ -666,7 +872,10 @@ func TestHandleError(t *testing.T) { if tc.countError { errCount++ } - require.Equal(t, errCount, monitor.currentErrorRate()) + require.Equal(t, errCount, monitor.overallErrorRate()) + if tc.markedUnhealthy { + require.False(t, monitor.isHealthy()) + } }) } } @@ -710,15 +919,15 @@ func TestSwitchAfterErrorThreshold(t *testing.T) { require.NoError(t, err) t.Cleanup(pool.Close) - for i := 0; i < errorThreshold; i++ { - conn, err := pool.connection() + for range errorThreshold { + conn, err := pool.manager.connection() require.NoError(t, err) require.Equal(t, nodes[0].address, conn.address()) _, err = conn.objectGet(ctx, PrmObjectGet{}) require.Error(t, err) } - conn, err := pool.connection() + conn, err := pool.manager.connection() require.NoError(t, err) require.Equal(t, nodes[1].address, conn.address()) _, err = conn.objectGet(ctx, PrmObjectGet{}) diff --git a/pool/sampler.go b/pool/sampler.go index f5b66354..95d875ba 100644 --- a/pool/sampler.go +++ b/pool/sampler.go @@ -1,13 +1,18 @@ package pool -import "math/rand" +import ( + "math/rand" + "sync" +) // sampler implements weighted random number generation using Vose's Alias // Method (https://www.keithschwarz.com/darts-dice-coins/). type sampler struct { + mu sync.Mutex randomGenerator *rand.Rand - probabilities []float64 - alias []int + + probabilities []float64 + alias []int } // newSampler creates new sampler with a given set of probabilities using @@ -25,7 +30,7 @@ func newSampler(probabilities []float64, source rand.Source) *sampler { sampler.alias = make([]int, n) // Compute scaled probabilities. p := make([]float64, n) - for i := 0; i < n; i++ { + for i := range n { p[i] = probabilities[i] * float64(n) } for i, pi := range p { @@ -58,10 +63,16 @@ func newSampler(probabilities []float64, source rand.Source) *sampler { } // Next returns the next (not so) random number from sampler. +// This method is safe for concurrent use by multiple goroutines. func (g *sampler) Next() int { n := len(g.alias) + + g.mu.Lock() i := g.randomGenerator.Intn(n) - if g.randomGenerator.Float64() < g.probabilities[i] { + f := g.randomGenerator.Float64() + g.mu.Unlock() + + if f < g.probabilities[i] { return i } return g.alias[i] diff --git a/pool/sampler_test.go b/pool/sampler_test.go index 5ea23260..b0860b1f 100644 --- a/pool/sampler_test.go +++ b/pool/sampler_test.go @@ -32,7 +32,7 @@ func TestSamplerStability(t *testing.T) { for _, tc := range cases { sampler := newSampler(tc.probabilities, rand.NewSource(0)) res := make([]int, len(tc.probabilities)) - for i := 0; i < COUNT; i++ { + for range COUNT { res[sampler.Next()]++ } @@ -47,9 +47,6 @@ func TestHealthyReweight(t *testing.T) { buffer = make([]float64, len(weights)) ) - cache, err := newCache() - require.NoError(t, err) - client1 := newMockClient(names[0], *newPrivateKey(t)) client1.errOnDial() @@ -59,22 +56,20 @@ func TestHealthyReweight(t *testing.T) { sampler: newSampler(weights, rand.NewSource(0)), clients: []client{client1, client2}, } - p := &Pool{ + cm := &connectionManager{ innerPools: []*innerPool{inner}, - cache: cache, - key: newPrivateKey(t), rebalanceParams: rebalanceParameters{nodesParams: []*nodesParam{{weights: weights}}}, } // check getting first node connection before rebalance happened - connection0, err := p.connection() + connection0, err := cm.connection() require.NoError(t, err) mock0 := connection0.(*mockClient) require.Equal(t, names[0], mock0.address()) - p.updateInnerNodesHealth(context.TODO(), 0, buffer) + cm.updateInnerNodesHealth(context.TODO(), 0, buffer) - connection1, err := p.connection() + connection1, err := cm.connection() require.NoError(t, err) mock1 := connection1.(*mockClient) require.Equal(t, names[1], mock1.address()) @@ -84,10 +79,10 @@ func TestHealthyReweight(t *testing.T) { inner.clients[0] = newMockClient(names[0], *newPrivateKey(t)) inner.lock.Unlock() - p.updateInnerNodesHealth(context.TODO(), 0, buffer) + cm.updateInnerNodesHealth(context.TODO(), 0, buffer) inner.sampler = newSampler(weights, rand.NewSource(0)) - connection0, err = p.connection() + connection0, err = cm.connection() require.NoError(t, err) mock0 = connection0.(*mockClient) require.Equal(t, names[0], mock0.address()) @@ -108,12 +103,12 @@ func TestHealthyNoReweight(t *testing.T) { newMockClient(names[1], *newPrivateKey(t)), }, } - p := &Pool{ + cm := &connectionManager{ innerPools: []*innerPool{inner}, rebalanceParams: rebalanceParameters{nodesParams: []*nodesParam{{weights: weights}}}, } - p.updateInnerNodesHealth(context.TODO(), 0, buffer) + cm.updateInnerNodesHealth(context.TODO(), 0, buffer) inner.lock.RLock() defer inner.lock.RUnlock() diff --git a/pool/statistic.go b/pool/statistic.go index 5f1cfad9..b9c24303 100644 --- a/pool/statistic.go +++ b/pool/statistic.go @@ -2,6 +2,7 @@ package pool import ( "errors" + "sync" "time" ) @@ -46,7 +47,7 @@ func (s Statistic) Node(address string) (*NodeStatistic, error) { // NodeStatistic is metrics of certain connections. type NodeStatistic struct { address string - methods []statusSnapshot + methods []StatusSnapshot overallErrors uint64 currentErrors uint32 } @@ -96,21 +97,16 @@ func (n NodeStatistic) AverageListContainer() time.Duration { return n.averageTime(methodContainerList) } +// AverageListContainerStream returns average time to perform ContainerListStream request. +func (n NodeStatistic) AverageListContainerStream() time.Duration { + return n.averageTime(methodContainerListStream) +} + // AverageDeleteContainer returns average time to perform ContainerDelete request. func (n NodeStatistic) AverageDeleteContainer() time.Duration { return n.averageTime(methodContainerDelete) } -// AverageGetContainerEACL returns average time to perform ContainerEACL request. -func (n NodeStatistic) AverageGetContainerEACL() time.Duration { - return n.averageTime(methodContainerEACL) -} - -// AverageSetContainerEACL returns average time to perform ContainerSetEACL request. -func (n NodeStatistic) AverageSetContainerEACL() time.Duration { - return n.averageTime(methodContainerSetEACL) -} - // AverageEndpointInfo returns average time to perform EndpointInfo request. func (n NodeStatistic) AverageEndpointInfo() time.Duration { return n.averageTime(methodEndpointInfo) @@ -158,3 +154,48 @@ func (n NodeStatistic) averageTime(method MethodIndex) time.Duration { } return time.Duration(stat.allTime / stat.allRequests) } + +// MethodStatus provide statistic for specific method. +type MethodStatus struct { + name string + mu sync.RWMutex // protect counters + snapshot StatusSnapshot +} + +func NewMethodStatus(name string) *MethodStatus { + return &MethodStatus{name: name} +} + +func (m *MethodStatus) Snapshot() StatusSnapshot { + m.mu.RLock() + defer m.mu.RUnlock() + return m.snapshot +} + +func (m *MethodStatus) IncRequests(elapsed time.Duration) { + m.mu.Lock() + defer m.mu.Unlock() + m.snapshot.allTime += uint64(elapsed) + m.snapshot.allRequests++ +} + +func (m *MethodStatus) Reset() { + m.mu.Lock() + defer m.mu.Unlock() + m.snapshot.allTime = 0 + m.snapshot.allRequests = 0 +} + +// StatusSnapshot is statistic for specific method. +type StatusSnapshot struct { + allTime uint64 + allRequests uint64 +} + +func (s StatusSnapshot) AllRequests() uint64 { + return s.allRequests +} + +func (s StatusSnapshot) AllTime() uint64 { + return s.allTime +} diff --git a/pool/tree/circuitbreaker.go b/pool/tree/circuitbreaker.go new file mode 100644 index 00000000..82615a66 --- /dev/null +++ b/pool/tree/circuitbreaker.go @@ -0,0 +1,82 @@ +package tree + +import ( + "errors" + "sync" + "time" +) + +type ( + circuitBreaker struct { + breakDuration time.Duration + threshold int + + mu sync.RWMutex + state map[uint64]state + } + + state struct { + counter int + breakTimestamp time.Time + } +) + +var ErrCBClosed = errors.New("circuit breaker is closed") + +func newCircuitBreaker(breakDuration time.Duration, threshold int) *circuitBreaker { + return &circuitBreaker{ + breakDuration: breakDuration, + threshold: threshold, + state: make(map[uint64]state), + } +} + +func (cb *circuitBreaker) checkBreak(id uint64) error { + cb.mu.RLock() + s, ok := cb.state[id] + cb.mu.RUnlock() + + if ok && time.Since(s.breakTimestamp) < cb.breakDuration { + return ErrCBClosed + } + + return nil +} + +func (cb *circuitBreaker) openBreak(id uint64) { + cb.mu.Lock() + defer cb.mu.Unlock() + delete(cb.state, id) +} + +func (cb *circuitBreaker) incError(id uint64) { + cb.mu.Lock() + defer cb.mu.Unlock() + + s := cb.state[id] + + s.counter++ + if s.counter >= cb.threshold { + s.counter = cb.threshold + if time.Since(s.breakTimestamp) >= cb.breakDuration { + s.breakTimestamp = time.Now() + } + } + + cb.state[id] = s +} + +func (cb *circuitBreaker) Do(id uint64, f func() error) error { + if err := cb.checkBreak(id); err != nil { + return err + } + + err := f() + if err == nil { + cb.openBreak(id) + } else { + cb.incError(id) + } + + return err +} diff --git a/pool/tree/circuitbreaker_test.go b/pool/tree/circuitbreaker_test.go new file mode 100644 index 00000000..c616d1b6 --- /dev/null +++ b/pool/tree/circuitbreaker_test.go @@ -0,0 +1,68 @@ +package tree + +import ( + "errors" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestCircuitBreaker(t *testing.T) { + remoteErr := errors.New("service is being synchronized") + breakDuration := 1 * time.Second + threshold := 10 + cb := newCircuitBreaker(breakDuration, threshold) + + // Hit threshold + for i := 0; i < threshold; i++ { + err := cb.Do(1, func() error { return remoteErr }) + require.ErrorIs(t, err, remoteErr) + } + + // Different client should not be affected by threshold + require.NoError(t, cb.Do(2, func() error { return nil })) + + // Immediate request should return circuit breaker error + require.ErrorIs(t, cb.Do(1, func() error { return nil }), ErrCBClosed) + + // Request after breakDuration should be ok + time.Sleep(breakDuration) + require.NoError(t, cb.Do(1, func() error { return nil })) + + // Try hitting threshold one more time after break duration + for i := 0; i < threshold; i++ { + err := cb.Do(1, func() error { return remoteErr }) + require.ErrorIs(t, err, remoteErr) + } + + // Immediate request should return circuit breaker error + require.ErrorIs(t, cb.Do(1, func() error { return nil }), ErrCBClosed) +} + +func TestCircuitBreakerNoBlock(t *testing.T) { + remoteErr := errors.New("service is being synchronized") + funcDuration := 200 * time.Millisecond + threshold := 100 + cb := newCircuitBreaker(10*funcDuration, threshold) + + slowFunc := func() error { + time.Sleep(funcDuration) + return remoteErr + } + + for i := 0; i < threshold; i++ { + // run in multiple goroutines Do function + go func() { + cb.Do(1, slowFunc) + }() + } + + time.Sleep(funcDuration) + + // eventually at most after one more func duration circuit breaker will be + // closed and not blocked by slow func execution under mutex + require.Eventually(t, func() bool { + return errors.Is(cb.Do(1, func() error { return nil }), ErrCBClosed) + }, funcDuration, funcDuration/10) +} diff --git a/pool/tree/client.go b/pool/tree/client.go index 476026f4..b7682d9b 100644 --- a/pool/tree/client.go +++ b/pool/tree/client.go @@ -6,20 +6,22 @@ import ( "errors" "fmt" "sync" + "time" - apiClient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" - grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + rpcclient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tree" "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" ) type treeClient struct { - mu sync.RWMutex - address string - opts []grpc.DialOption - conn *grpc.ClientConn - service grpcService.TreeServiceClient + mu sync.RWMutex + address string + opts []grpc.DialOption + client *rpcclient.Client + nodeDialTimeout time.Duration + streamTimeout time.Duration + healthy bool } @@ -27,10 +29,12 @@ type treeClient struct { var ErrUnhealthyEndpoint = errors.New("unhealthy endpoint") // newTreeClient creates new tree client with auto dial. -func newTreeClient(addr string, opts ...grpc.DialOption) *treeClient { +func newTreeClient(addr string, opts []grpc.DialOption, dialTimeout time.Duration, streamTimeout time.Duration) *treeClient { return &treeClient{ - address: addr, - opts: opts, + address: addr, + opts: opts, + nodeDialTimeout: dialTimeout, + streamTimeout: streamTimeout, } } @@ -38,17 +42,18 @@ func (c *treeClient) dial(ctx context.Context) error { c.mu.Lock() defer c.mu.Unlock() - if c.conn != nil { + if c.client != nil { return fmt.Errorf("couldn't dial '%s': connection already established", c.address) } var err error - if c.conn, c.service, err = dialClient(ctx, c.address, c.opts...); err != nil { - return err + c.client, err = c.createClient() + if err != nil { + return fmt.Errorf("couldn't dial '%s': %w", c.address, err) } - if _, err = c.service.Healthcheck(ctx, &grpcService.HealthcheckRequest{}); err != nil { - return fmt.Errorf("healthcheck tree service: %w", err) + if _, err = rpcapi.Healthcheck(c.client, &tree.HealthcheckRequest{}, rpcclient.WithContext(ctx)); err != nil { + return fmt.Errorf("healthcheck tree service '%s': %w", c.address, err) } c.healthy = true @@ -60,14 +65,14 @@ func (c *treeClient) redialIfNecessary(ctx context.Context) (healthHasChanged bo c.mu.Lock() defer c.mu.Unlock() - if c.conn == nil { - if c.conn, c.service, err = dialClient(ctx, c.address, c.opts...); err != nil { + if c.client == nil { + if c.client, err = c.createClient(); err != nil { return false, err } } wasHealthy := c.healthy - if _, err = c.service.Healthcheck(ctx, &grpcService.HealthcheckRequest{}); err != nil { + if _, err = rpcapi.Healthcheck(c.client, &tree.HealthcheckRequest{}, rpcclient.WithContext(ctx)); err != nil { c.healthy = false return wasHealthy, fmt.Errorf("healthcheck tree service: %w", err) } @@ -77,39 +82,26 @@ func (c *treeClient) redialIfNecessary(ctx context.Context) (healthHasChanged bo return !wasHealthy, nil } -func dialClient(ctx context.Context, addr string, clientOptions ...grpc.DialOption) (*grpc.ClientConn, grpcService.TreeServiceClient, error) { - host, tlsEnable, err := apiClient.ParseURI(addr) - if err != nil { - return nil, nil, fmt.Errorf("parse address: %w", err) - } +func (c *treeClient) createClient() (*rpcclient.Client, error) { + cli := rpcclient.New(append( + rpcclient.WithNetworkURIAddress(c.address, &tls.Config{}), + rpcclient.WithDialTimeout(c.nodeDialTimeout), + rpcclient.WithRWTimeout(c.streamTimeout), + rpcclient.WithGRPCDialOptions(c.opts), + )...) - creds := insecure.NewCredentials() - if tlsEnable { - creds = credentials.NewTLS(&tls.Config{}) - } - - options := []grpc.DialOption{grpc.WithTransportCredentials(creds)} - - // the order is matter, we want client to be able to overwrite options. - opts := append(options, clientOptions...) - - conn, err := grpc.DialContext(ctx, host, opts...) - if err != nil { - return nil, nil, fmt.Errorf("grpc dial node tree service: %w", err) - } - - return conn, grpcService.NewTreeServiceClient(conn), nil + return cli, nil } -func (c *treeClient) serviceClient() (grpcService.TreeServiceClient, error) { +func (c *treeClient) serviceClient() (*rpcclient.Client, error) { c.mu.RLock() defer c.mu.RUnlock() - if c.conn == nil || !c.healthy { + if c.client == nil || !c.healthy { return nil, fmt.Errorf("%w: '%s'", ErrUnhealthyEndpoint, c.address) } - return c.service, nil + return c.client, nil } func (c *treeClient) endpoint() string { @@ -132,9 +124,12 @@ func (c *treeClient) close() error { c.mu.Lock() defer c.mu.Unlock() - if c.conn == nil { + if c.client == nil || c.client.Conn() == nil { return nil } - - return c.conn.Close() + err := c.client.Conn().Close() + if err != nil { + return fmt.Errorf("address '%s': %w", c.address, err) + } + return nil } diff --git a/pool/tree/pool.go b/pool/tree/pool.go index bffe6e97..dd5d8262 100644 --- a/pool/tree/pool.go +++ b/pool/tree/pool.go @@ -10,9 +10,13 @@ import ( "sync" "time" + rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc" + rpcclient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tree" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pkg/network" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" - grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "go.uber.org/zap" "go.uber.org/zap/zapcore" @@ -20,10 +24,22 @@ import ( ) const ( - defaultRebalanceInterval = 15 * time.Second - defaultHealthcheckTimeout = 4 * time.Second - defaultDialTimeout = 5 * time.Second - defaultStreamTimeout = 10 * time.Second + defaultRebalanceInterval = 15 * time.Second + defaultHealthcheckTimeout = 4 * time.Second + defaultDialTimeout = 5 * time.Second + defaultStreamTimeout = 10 * time.Second + defaultCircuitBreakerDuration = 10 * time.Second + defaultCircuitBreakerTreshold = 10 +) + +// SubTreeSort defines an order of nodes returned from GetSubTree RPC. +type SubTreeSort int32 + +const ( + // NoneOrder does not specify order of nodes returned in GetSubTree RPC. + NoneOrder SubTreeSort = iota + // AscendingOrder specifies ascending alphabetical order of nodes based on FilePath attribute. + AscendingOrder ) var ( @@ -41,7 +57,7 @@ var ( // This interface is expected to have exactly one production implementation - treeClient. // Others are expected to be for test purposes only. type client interface { - serviceClient() (grpcService.TreeServiceClient, error) + serviceClient() (*rpcclient.Client, error) endpoint() string isHealthy() bool setHealthy(bool) @@ -61,6 +77,14 @@ type InitParameters struct { nodeParams []pool.NodeParam dialOptions []grpc.DialOption maxRequestAttempts int + netMapInfoSource NetMapInfoSource + circuitBreakerThreshold int + circuitBreakerDuration time.Duration +} + +type NetMapInfoSource interface { + NetMapSnapshot(ctx context.Context) (netmap.NetMap, error) + PlacementPolicy(ctx context.Context, cnrID cid.ID) (netmap.PlacementPolicy, error) } // Pool represents virtual connection to the FrostFS tree services network to communicate @@ -68,7 +92,7 @@ type InitParameters struct { // due to their unavailability. // // Pool can be created and initialized using NewPool function. -// Before executing the FrostFS tree operations using the Pool, connection to the +// Before executing the FrostFS tree operations using the Pool without netMapInfoSource, connection to the // servers MUST BE correctly established (see Dial method). type Pool struct { innerPools []*innerPool @@ -78,16 +102,27 @@ type Pool struct { rebalanceParams rebalanceParameters dialOptions []grpc.DialOption logger *zap.Logger + methods []*pool.MethodStatus maxRequestAttempts int + streamTimeout time.Duration + nodeDialTimeout time.Duration - startIndicesMtx sync.RWMutex + netMapInfoSource NetMapInfoSource + + // mutex protects clientMap and startIndices + mutex sync.RWMutex + // clientMap will be used if netMapInfoSource is set + clientMap map[uint64]client // startIndices points to the client from which the next request will be executed. // Since clients are stored in innerPool field we have to use two indices. // These indices being changed during: // * rebalance procedure (see Pool.startRebalance) // * retry in case of request failure (see Pool.requestWithRetry) + // startIndices will be used if netMapInfoSource is not set startIndices [2]int + // circuit breaker for dial operations when netmap is being used + cb *circuitBreaker } type innerPool struct { @@ -116,9 +151,10 @@ type GetNodesParams struct { type GetSubTreeParams struct { CID cid.ID TreeID string - RootID uint64 + RootID []uint64 Depth uint32 BearerToken []byte + Order SubTreeSort } // AddNodeParams groups parameters of Pool.AddNode operation. @@ -158,52 +194,108 @@ type RemoveNodeParams struct { BearerToken []byte } +// MethodIndex index of method in list of statuses in Pool. +type MethodIndex int + +const ( + methodGetNodes MethodIndex = iota + methodGetSubTree + methodAddNode + methodAddNodeByPath + methodMoveNode + methodRemoveNode + methodLast +) + +// String implements fmt.Stringer. +func (m MethodIndex) String() string { + switch m { + case methodGetNodes: + return "getNodes" + case methodAddNode: + return "addNode" + case methodGetSubTree: + return "getSubTree" + case methodAddNodeByPath: + return "addNodeByPath" + case methodMoveNode: + return "moveNode" + case methodRemoveNode: + return "removeNode" + default: + return "unknown" + } +} + // NewPool creates connection pool using parameters. func NewPool(options InitParameters) (*Pool, error) { if options.key == nil { return nil, fmt.Errorf("missed required parameter 'Key'") } - nodesParams, err := adjustNodeParams(options.nodeParams) - if err != nil { - return nil, err - } - fillDefaultInitParams(&options) + methods := make([]*pool.MethodStatus, methodLast) + for i := methodGetNodes; i < methodLast; i++ { + methods[i] = pool.NewMethodStatus(i.String()) + } + p := &Pool{ key: options.key, logger: options.logger, dialOptions: options.dialOptions, rebalanceParams: rebalanceParameters{ - nodesGroup: nodesParams, nodeRequestTimeout: options.healthcheckTimeout, clientRebalanceInterval: options.clientRebalanceInterval, }, maxRequestAttempts: options.maxRequestAttempts, + streamTimeout: options.nodeStreamTimeout, + nodeDialTimeout: options.nodeDialTimeout, + methods: methods, + netMapInfoSource: options.netMapInfoSource, + clientMap: make(map[uint64]client), + cb: newCircuitBreaker( + options.circuitBreakerDuration, + options.circuitBreakerThreshold, + ), + } + + if options.netMapInfoSource == nil { + nodesParams, err := adjustNodeParams(options.nodeParams) + if err != nil { + return nil, err + } + p.rebalanceParams.nodesGroup = nodesParams } return p, nil } -// Dial establishes a connection to the tree servers from the FrostFS network. +// Dial may not be called and will have no effect if netMapInfoSource is set. +// See also InitParameters.SetNetMapInfoSource +// +// Otherwise, Dial establishes a connection to the tree servers from the FrostFS network. // It also starts a routine that checks the health of the nodes and // updates the weights of the nodes for balancing. // Returns an error describing failure reason. // -// If failed, the Pool SHOULD NOT be used. +// If failed and netMapInfoSource is not set, the Pool SHOULD NOT be used. // // See also InitParameters.SetClientRebalanceInterval. func (p *Pool) Dial(ctx context.Context) error { + if p.netMapInfoSource != nil { + return nil + } + inner := make([]*innerPool, len(p.rebalanceParams.nodesGroup)) var atLeastOneHealthy bool for i, nodes := range p.rebalanceParams.nodesGroup { clients := make([]client, len(nodes)) for j, node := range nodes { - clients[j] = newTreeClient(node.Address(), p.dialOptions...) + clients[j] = newTreeClient(node.Address(), p.dialOptions, p.nodeDialTimeout, p.streamTimeout) if err := clients[j].dial(ctx); err != nil { - p.log(zap.WarnLevel, "failed to dial tree client", zap.String("address", node.Address()), zap.Error(err)) + p.log(zap.WarnLevel, "failed to dial tree client", zap.Error(err)) continue } @@ -278,46 +370,62 @@ func (x *InitParameters) SetMaxRequestAttempts(maxAttempts int) { x.maxRequestAttempts = maxAttempts } +// SetNetMapInfoSource sets implementation of interface to get current net map and container placement policy. +// If set, AddNode will have no effect. +func (x *InitParameters) SetNetMapInfoSource(netMapInfoSource NetMapInfoSource) { + x.netMapInfoSource = netMapInfoSource +} + +// SetCircuitBreakerThreshold sets number of consecutive failed connection before +// circuit is considered closed and therefore return error immediately. +func (x *InitParameters) SetCircuitBreakerThreshold(circuitBreakerThreshold int) { + x.circuitBreakerThreshold = circuitBreakerThreshold +} + +// SetCircuitBreakerDuration sets duration for circuit to be considered closed. +// This effectively limits to one new connection try per duration. +func (x *InitParameters) SetCircuitBreakerDuration(circuitBreakerDuration time.Duration) { + x.circuitBreakerDuration = circuitBreakerDuration +} + // GetNodes invokes eponymous method from TreeServiceClient. // // Can return predefined errors: // * ErrNodeNotFound // * ErrNodeAccessDenied. -func (p *Pool) GetNodes(ctx context.Context, prm GetNodesParams) ([]*grpcService.GetNodeByPathResponse_Info, error) { - request := &grpcService.GetNodeByPathRequest{ - Body: &grpcService.GetNodeByPathRequest_Body{ - ContainerId: prm.CID[:], - TreeId: prm.TreeID, - Path: prm.Path, - Attributes: prm.Meta, - PathAttribute: prm.PathAttribute, - LatestOnly: prm.LatestOnly, - AllAttributes: prm.AllAttrs, - BearerToken: prm.BearerToken, - }, - } +func (p *Pool) GetNodes(ctx context.Context, prm GetNodesParams) ([]*tree.GetNodeByPathResponseInfo, error) { + body := new(tree.GetNodeByPathRequestBody) + body.SetContainerID(prm.CID) + body.SetTreeID(prm.TreeID) + body.SetPath(prm.Path) + body.SetAttributes(prm.Meta) + body.SetPathAttribute(prm.PathAttribute) + body.SetAllAttributes(prm.AllAttrs) + body.SetLatestOnly(prm.LatestOnly) + body.SetBearerToken(prm.BearerToken) - if err := p.signRequest(request.Body, func(key, sign []byte) { - request.Signature = &grpcService.Signature{ - Key: key, - Sign: sign, - } - }); err != nil { + request := new(tree.GetNodeByPathRequest) + request.SetBody(body) + + start := time.Now() + if err := p.signRequest(request); err != nil { return nil, err } - var resp *grpcService.GetNodeByPathResponse - if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) { - resp, inErr = client.GetNodeByPath(ctx, request) + var resp *tree.GetNodeByPathResponse + err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) (inErr error) { + resp, inErr = rpcapi.GetNodeByPath(client, request, rpcclient.WithContext(ctx)) // Pool wants to do retry 'GetNodeByPath' request if result is empty. // Empty result is expected due to delayed tree service sync. // Return an error there to trigger retry and ignore it after, // to keep compatibility with 'GetNodeByPath' implementation. - if inErr == nil && len(resp.Body.Nodes) == 0 { + if inErr == nil && len(resp.GetBody().GetNodes()) == 0 { return errNodeEmptyResult } return handleError("failed to get node by path", inErr) - }); err != nil && !errors.Is(err, errNodeEmptyResult) { + }) + p.methods[methodGetNodes].IncRequests(time.Since(start)) + if err != nil && !errors.Is(err, errNodeEmptyResult) { return nil, err } @@ -328,43 +436,63 @@ func (p *Pool) GetNodes(ctx context.Context, prm GetNodesParams) ([]*grpcService // // Must be initialized using Pool.GetSubTree, any other usage is unsafe. type SubTreeReader struct { - cli grpcService.TreeService_GetSubTreeClient + cli *rpcapi.GetSubTreeResponseReader + probe *tree.GetSubTreeResponseBody } // Read reads another list of the subtree nodes. -func (x *SubTreeReader) Read(buf []*grpcService.GetSubTreeResponse_Body) (int, error) { - for i := 0; i < len(buf); i++ { - resp, err := x.cli.Recv() +func (x *SubTreeReader) Read(buf []*tree.GetSubTreeResponseBody) (int, error) { + i := 0 + if x.probe != nil && len(buf) != 0 { + buf[0] = x.probe + x.probe = nil + i = 1 + } + for ; i < len(buf); i++ { + var resp tree.GetSubTreeResponse + err := x.cli.Read(&resp) if err == io.EOF { return i, io.EOF } else if err != nil { return i, handleError("failed to get sub tree", err) } - buf[i] = resp.Body + buf[i] = resp.GetBody() } return len(buf), nil } // ReadAll reads all nodes subtree nodes. -func (x *SubTreeReader) ReadAll() ([]*grpcService.GetSubTreeResponse_Body, error) { - var res []*grpcService.GetSubTreeResponse_Body +func (x *SubTreeReader) ReadAll() ([]*tree.GetSubTreeResponseBody, error) { + var res []*tree.GetSubTreeResponseBody + if x.probe != nil { + res = append(res, x.probe) + x.probe = nil + } for { - resp, err := x.cli.Recv() + var resp tree.GetSubTreeResponse + err := x.cli.Read(&resp) if err == io.EOF { break } else if err != nil { return nil, handleError("failed to get sub tree", err) } - res = append(res, resp.Body) + res = append(res, resp.GetBody()) } return res, nil } // Next gets the next node from subtree. -func (x *SubTreeReader) Next() (*grpcService.GetSubTreeResponse_Body, error) { - resp, err := x.cli.Recv() +func (x *SubTreeReader) Next() (*tree.GetSubTreeResponseBody, error) { + if x.probe != nil { + res := x.probe + x.probe = nil + return res, nil + } + + var resp tree.GetSubTreeResponse + err := x.cli.Read(&resp) if err == io.EOF { return nil, io.EOF } @@ -372,7 +500,7 @@ func (x *SubTreeReader) Next() (*grpcService.GetSubTreeResponse_Body, error) { return nil, handleError("failed to get sub tree", err) } - return resp.Body, nil + return resp.GetBody(), nil } // GetSubTree invokes eponymous method from TreeServiceClient. @@ -381,37 +509,49 @@ func (x *SubTreeReader) Next() (*grpcService.GetSubTreeResponse_Body, error) { // * ErrNodeNotFound // * ErrNodeAccessDenied. func (p *Pool) GetSubTree(ctx context.Context, prm GetSubTreeParams) (*SubTreeReader, error) { - request := &grpcService.GetSubTreeRequest{ - Body: &grpcService.GetSubTreeRequest_Body{ - ContainerId: prm.CID[:], - TreeId: prm.TreeID, - RootId: prm.RootID, - Depth: prm.Depth, - BearerToken: prm.BearerToken, - OrderBy: &grpcService.GetSubTreeRequest_Body_Order{ - Direction: grpcService.GetSubTreeRequest_Body_Order_Asc, - }, - }, + body := new(tree.GetSubTreeRequestBody) + body.SetContainerID(prm.CID[:]) + body.SetTreeID(prm.TreeID) + body.SetBearerToken(prm.BearerToken) + body.SetDepth(prm.Depth) + body.SetRootID(prm.RootID) + + orderBy := new(tree.GetSubTreeRequestBodyOrder) + switch prm.Order { + case AscendingOrder: + orderBy.SetDirection(tree.GetSubTreeRequestBodyOrderAsc) + default: + orderBy.SetDirection(tree.GetSubTreeRequestBodyOrderNone) + } + body.SetOrderBy(orderBy) + + request := new(tree.GetSubTreeRequest) + request.SetBody(body) + + start := time.Now() + if err := p.signRequest(request); err != nil { + return nil, err } - if err := p.signRequest(request.Body, func(key, sign []byte) { - request.Signature = &grpcService.Signature{ - Key: key, - Sign: sign, + var cli *rpcapi.GetSubTreeResponseReader + var probeBody *tree.GetSubTreeResponseBody + err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) (inErr error) { + cli, inErr = rpcapi.GetSubTree(client, request, rpcclient.WithContext(ctx)) + if inErr != nil { + return handleError("failed to get sub tree client", inErr) } - }); err != nil { + + probe := &tree.GetSubTreeResponse{} + inErr = cli.Read(probe) + probeBody = probe.GetBody() + return handleError("failed to get first resp from sub tree client", inErr) + }) + p.methods[methodGetSubTree].IncRequests(time.Since(start)) + if err != nil { return nil, err } - var cli grpcService.TreeService_GetSubTreeClient - if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) { - cli, inErr = client.GetSubTree(ctx, request) - return handleError("failed to get sub tree client", inErr) - }); err != nil { - return nil, err - } - - return &SubTreeReader{cli: cli}, nil + return &SubTreeReader{cli: cli, probe: probeBody}, nil } // AddNode invokes eponymous method from TreeServiceClient. @@ -420,33 +560,32 @@ func (p *Pool) GetSubTree(ctx context.Context, prm GetSubTreeParams) (*SubTreeRe // * ErrNodeNotFound // * ErrNodeAccessDenied. func (p *Pool) AddNode(ctx context.Context, prm AddNodeParams) (uint64, error) { - request := &grpcService.AddRequest{ - Body: &grpcService.AddRequest_Body{ - ContainerId: prm.CID[:], - TreeId: prm.TreeID, - ParentId: prm.Parent, - Meta: metaToKV(prm.Meta), - BearerToken: prm.BearerToken, - }, - } - if err := p.signRequest(request.Body, func(key, sign []byte) { - request.Signature = &grpcService.Signature{ - Key: key, - Sign: sign, - } - }); err != nil { + body := new(tree.AddRequestBody) + body.SetTreeID(prm.TreeID) + body.SetBearerToken(prm.BearerToken) + body.SetContainerID(prm.CID[:]) + body.SetMeta(metaToKV(prm.Meta)) + body.SetParentID(prm.Parent) + + request := new(tree.AddRequest) + request.SetBody(body) + + start := time.Now() + if err := p.signRequest(request); err != nil { return 0, err } - var resp *grpcService.AddResponse - if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) { - resp, inErr = client.Add(ctx, request) + var resp *tree.AddResponse + err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) (inErr error) { + resp, inErr = rpcapi.Add(client, request, rpcclient.WithContext(ctx)) return handleError("failed to add node", inErr) - }); err != nil { + }) + p.methods[methodAddNode].IncRequests(time.Since(start)) + if err != nil { return 0, err } - return resp.GetBody().GetNodeId(), nil + return resp.GetBody().GetNodeID(), nil } // AddNodeByPath invokes eponymous method from TreeServiceClient. @@ -455,43 +594,41 @@ func (p *Pool) AddNode(ctx context.Context, prm AddNodeParams) (uint64, error) { // * ErrNodeNotFound // * ErrNodeAccessDenied. func (p *Pool) AddNodeByPath(ctx context.Context, prm AddNodeByPathParams) (uint64, error) { - request := &grpcService.AddByPathRequest{ - Body: &grpcService.AddByPathRequest_Body{ - ContainerId: prm.CID[:], - TreeId: prm.TreeID, - Path: prm.Path, - Meta: metaToKV(prm.Meta), - PathAttribute: prm.PathAttribute, - BearerToken: prm.BearerToken, - }, - } + body := new(tree.AddByPathRequestBody) + body.SetTreeID(prm.TreeID) + body.SetBearerToken(prm.BearerToken) + body.SetContainerID(prm.CID[:]) + body.SetMeta(metaToKV(prm.Meta)) + body.SetPathAttribute(prm.PathAttribute) + body.SetPath(prm.Path) - if err := p.signRequest(request.Body, func(key, sign []byte) { - request.Signature = &grpcService.Signature{ - Key: key, - Sign: sign, - } - }); err != nil { + request := new(tree.AddByPathRequest) + request.SetBody(body) + + start := time.Now() + if err := p.signRequest(request); err != nil { return 0, err } - var resp *grpcService.AddByPathResponse - if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) { - resp, inErr = client.AddByPath(ctx, request) + var resp *tree.AddByPathResponse + err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) (inErr error) { + resp, inErr = rpcapi.AddByPath(client, request, rpcclient.WithContext(ctx)) return handleError("failed to add node by path", inErr) - }); err != nil { + }) + p.methods[methodAddNodeByPath].IncRequests(time.Since(start)) + if err != nil { return 0, err } - body := resp.GetBody() - if body == nil { + respBody := resp.GetBody() + if respBody == nil { return 0, errors.New("nil body in tree service response") - } else if len(body.Nodes) == 0 { + } else if len(respBody.GetNodes()) == 0 { return 0, errors.New("empty list of added nodes in tree service response") } // The first node is the leaf that we add, according to tree service docs. - return body.Nodes[0], nil + return respBody.GetNodes()[0], nil } // MoveNode invokes eponymous method from TreeServiceClient. @@ -500,32 +637,31 @@ func (p *Pool) AddNodeByPath(ctx context.Context, prm AddNodeByPathParams) (uint // * ErrNodeNotFound // * ErrNodeAccessDenied. func (p *Pool) MoveNode(ctx context.Context, prm MoveNodeParams) error { - request := &grpcService.MoveRequest{ - Body: &grpcService.MoveRequest_Body{ - ContainerId: prm.CID[:], - TreeId: prm.TreeID, - NodeId: prm.NodeID, - ParentId: prm.ParentID, - Meta: metaToKV(prm.Meta), - BearerToken: prm.BearerToken, - }, - } + body := new(tree.MoveRequestBody) + body.SetTreeID(prm.TreeID) + body.SetBearerToken(prm.BearerToken) + body.SetContainerID(prm.CID[:]) + body.SetMeta(metaToKV(prm.Meta)) + body.SetNodeID(prm.NodeID) + body.SetParentID(prm.ParentID) - if err := p.signRequest(request.Body, func(key, sign []byte) { - request.Signature = &grpcService.Signature{ - Key: key, - Sign: sign, - } - }); err != nil { + request := new(tree.MoveRequest) + request.SetBody(body) + + start := time.Now() + if err := p.signRequest(request); err != nil { return err } - return p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) error { - if _, err := client.Move(ctx, request); err != nil { + err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) error { + if _, err := rpcapi.Move(client, request, rpcclient.WithContext(ctx)); err != nil { return handleError("failed to move node", err) } return nil }) + p.methods[methodMoveNode].IncRequests(time.Since(start)) + + return err } // RemoveNode invokes eponymous method from TreeServiceClient. @@ -534,29 +670,29 @@ func (p *Pool) MoveNode(ctx context.Context, prm MoveNodeParams) error { // * ErrNodeNotFound // * ErrNodeAccessDenied. func (p *Pool) RemoveNode(ctx context.Context, prm RemoveNodeParams) error { - request := &grpcService.RemoveRequest{ - Body: &grpcService.RemoveRequest_Body{ - ContainerId: prm.CID[:], - TreeId: prm.TreeID, - NodeId: prm.NodeID, - BearerToken: prm.BearerToken, - }, - } - if err := p.signRequest(request.Body, func(key, sign []byte) { - request.Signature = &grpcService.Signature{ - Key: key, - Sign: sign, - } - }); err != nil { + body := new(tree.RemoveRequestBody) + body.SetTreeID(prm.TreeID) + body.SetBearerToken(prm.BearerToken) + body.SetContainerID(prm.CID[:]) + body.SetNodeID(prm.NodeID) + + request := new(tree.RemoveRequest) + request.SetBody(body) + + start := time.Now() + if err := p.signRequest(request); err != nil { return err } - return p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) error { - if _, err := client.Remove(ctx, request); err != nil { + err := p.requestWithRetry(ctx, prm.CID, func(client *rpcclient.Client) error { + if _, err := rpcapi.Remove(client, request, rpcclient.WithContext(ctx)); err != nil { return handleError("failed to remove node", err) } return nil }) + p.methods[methodRemoveNode].IncRequests(time.Since(start)) + + return err } // Close closes the Pool and releases all the associated resources. @@ -574,26 +710,59 @@ func (p *Pool) Close() error { } } + if closeErr := p.closeClientMapConnections(); closeErr != nil { + err = closeErr + } + return err } +func (p *Pool) closeClientMapConnections() (err error) { + p.mutex.Lock() + defer p.mutex.Unlock() + + for _, cl := range p.clientMap { + if closeErr := cl.close(); closeErr != nil { + p.log(zapcore.ErrorLevel, "close client connection", zap.Error(closeErr)) + err = closeErr + } + } + + return err +} + +// Statistic returns tree pool statistics. +func (p *Pool) Statistic() Statistic { + stat := Statistic{make([]pool.StatusSnapshot, len(p.methods))} + + for i, method := range p.methods { + stat.methods[i] = method.Snapshot() + method.Reset() + } + + return stat +} + func handleError(msg string, err error) error { if err == nil { return nil } if strings.Contains(err.Error(), "not found") { return fmt.Errorf("%w: %s", ErrNodeNotFound, err.Error()) - } else if strings.Contains(err.Error(), "is denied by") { + } else if strings.Contains(err.Error(), "denied") { return fmt.Errorf("%w: %s", ErrNodeAccessDenied, err.Error()) } return fmt.Errorf("%s: %w", msg, err) } -func metaToKV(meta map[string]string) []*grpcService.KeyValue { - result := make([]*grpcService.KeyValue, 0, len(meta)) +func metaToKV(meta map[string]string) []*tree.KeyValue { + result := make([]*tree.KeyValue, 0, len(meta)) for key, value := range meta { - result = append(result, &grpcService.KeyValue{Key: key, Value: []byte(value)}) + kv := new(tree.KeyValue) + kv.SetKey(key) + kv.SetValue([]byte(value)) + result = append(result, kv) } return result @@ -642,6 +811,14 @@ func fillDefaultInitParams(params *InitParameters) { if params.maxRequestAttempts <= 0 { params.maxRequestAttempts = len(params.nodeParams) } + + if params.circuitBreakerDuration <= 0 { + params.circuitBreakerDuration = defaultCircuitBreakerDuration + } + + if params.circuitBreakerThreshold <= 0 { + params.circuitBreakerThreshold = defaultCircuitBreakerTreshold + } } func (p *Pool) log(level zapcore.Level, msg string, fields ...zap.Field) { @@ -677,7 +854,7 @@ func (p *Pool) updateNodesHealth(ctx context.Context, buffers [][]bool) { for i, inner := range p.innerPools { wg.Add(1) - go func(i int, innerPool *innerPool) { + go func(i int, _ *innerPool) { defer wg.Done() p.updateInnerNodesHealth(ctx, i, buffers[i]) }(i, inner) @@ -729,23 +906,27 @@ func (p *Pool) updateInnerNodesHealth(ctx context.Context, i int, buffer []bool) } func (p *Pool) getStartIndices() (int, int) { - p.startIndicesMtx.RLock() - defer p.startIndicesMtx.RUnlock() + p.mutex.RLock() + defer p.mutex.RUnlock() return p.startIndices[0], p.startIndices[1] } func (p *Pool) setStartIndices(i, j int) { - p.startIndicesMtx.Lock() + p.mutex.Lock() p.startIndices[0] = i p.startIndices[1] = j - p.startIndicesMtx.Unlock() + p.mutex.Unlock() } -func (p *Pool) requestWithRetry(ctx context.Context, fn func(client grpcService.TreeServiceClient) error) error { +func (p *Pool) requestWithRetry(ctx context.Context, cnrID cid.ID, fn func(client *rpcclient.Client) error) error { + if p.netMapInfoSource != nil { + return p.requestWithRetryContainerNodes(ctx, cnrID, fn) + } + var ( err, finErr error - cl grpcService.TreeServiceClient + cl *rpcclient.Client ) reqID := GetRequestID(ctx) @@ -776,6 +957,11 @@ LOOP: if startI != indexI || startJ != indexJ { p.setStartIndices(indexI, indexJ) } + + if err != nil { + err = fmt.Errorf("address %s: %w", p.innerPools[indexI].clients[indexJ].endpoint(), err) + } + return err } @@ -789,10 +975,152 @@ LOOP: return finErr } +func (p *Pool) requestWithRetryContainerNodes(ctx context.Context, cnrID cid.ID, fn func(client *rpcclient.Client) error) error { + var ( + err, finErr error + cl *rpcclient.Client + ) + + reqID := GetRequestID(ctx) + + netMap, err := p.netMapInfoSource.NetMapSnapshot(ctx) + if err != nil { + return fmt.Errorf("get net map: %w", err) + } + + policy, err := p.netMapInfoSource.PlacementPolicy(ctx, cnrID) + if err != nil { + return fmt.Errorf("get container placement policy: %w", err) + } + + cnrNodes, err := netMap.ContainerNodes(policy, cnrID[:]) + if err != nil { + return fmt.Errorf("get container nodes: %w", err) + } + + cnrNodes, err = netMap.PlacementVectors(cnrNodes, cnrID[:]) + if err != nil { + return fmt.Errorf("get placement vectors: %w", err) + } + + attempts := p.maxRequestAttempts + +LOOP: + for _, cnrNodeGroup := range cnrNodes { + for _, cnrNode := range cnrNodeGroup { + if attempts == 0 { + break LOOP + } + + treeCl, ok := p.getClientFromMap(cnrNode.Hash()) + if !ok { + err = p.cb.Do(cnrNode.Hash(), func() error { + treeCl, err = p.getNewTreeClient(ctx, cnrNode) + return err + }) + if err != nil { + finErr = finalError(finErr, err) + p.log(zap.DebugLevel, "failed to create tree client", zap.String("request_id", reqID), zap.Int("remaining attempts", attempts)) + continue + } + + treeCl = p.addClientToMap(cnrNode.Hash(), treeCl) + } + attempts-- + + if cl, err = treeCl.serviceClient(); err == nil { + err = fn(cl) + } + if shouldRedial(ctx, err) { + p.deleteClientFromMap(cnrNode.Hash()) + } + if !shouldTryAgain(err) { + if err != nil { + err = fmt.Errorf("address %s: %w", treeCl.endpoint(), err) + } + + return err + } + + finErr = finalError(finErr, err) + p.log(zap.DebugLevel, "tree request error", zap.String("request_id", reqID), zap.Int("remaining attempts", attempts), + zap.String("address", treeCl.endpoint()), zap.Error(err)) + } + } + + return finErr +} + +func (p *Pool) getClientFromMap(hash uint64) (client, bool) { + p.mutex.RLock() + defer p.mutex.RUnlock() + + cl, ok := p.clientMap[hash] + return cl, ok +} + +func (p *Pool) addClientToMap(hash uint64, cl client) client { + p.mutex.Lock() + defer p.mutex.Unlock() + + if old, ok := p.clientMap[hash]; ok { + _ = cl.close() + return old + } + p.clientMap[hash] = cl + return cl +} + +func (p *Pool) deleteClientFromMap(hash uint64) { + p.mutex.Lock() + if cli, ok := p.clientMap[hash]; ok { + _ = cli.close() + delete(p.clientMap, hash) + } + p.mutex.Unlock() +} + +func (p *Pool) getNewTreeClient(ctx context.Context, node netmap.NodeInfo) (*treeClient, error) { + for endpoint := range node.NetworkEndpoints() { + var addr network.Address + if err := addr.FromString(endpoint); err != nil { + p.log(zap.WarnLevel, "can't parse endpoint", zap.String("endpoint", endpoint), zap.Error(err)) + continue + } + + newTreeCl := newTreeClient(addr.URIAddr(), p.dialOptions, p.nodeDialTimeout, p.streamTimeout) + if err := newTreeCl.dial(ctx); err != nil { + p.log(zap.WarnLevel, "failed to dial tree client", zap.Error(err)) + + // We have to close connection here after failed `dial()`. + // This is NOT necessary in object pool and regular tree pool without netmap support, because: + // - object pool uses SDK object client which closes connection during `dial()` call by itself, + // - regular tree pool is going to reuse connection by calling `redialIfNecessary()`. + // Tree pool with netmap support does not operate with background goroutine, so we have to close connection immediately. + if err = newTreeCl.close(); err != nil { + p.log(zap.WarnLevel, "failed to close recently dialed tree client", zap.Error(err)) + } + + continue + } + + return newTreeCl, nil + } + + return nil, fmt.Errorf("tree client wasn't initialized") +} + func shouldTryAgain(err error) bool { return !(err == nil || errors.Is(err, ErrNodeAccessDenied)) } +func shouldRedial(ctx context.Context, err error) bool { + if err == nil || errors.Is(err, ErrNodeAccessDenied) || errors.Is(err, ErrNodeNotFound) || errors.Is(err, errNodeEmptyResult) || errors.Is(ctx.Err(), context.Canceled) { + return false + } + return true +} + func prioErr(err error) int { switch { case err == nil: diff --git a/pool/tree/pool_server_test.go b/pool/tree/pool_server_test.go new file mode 100644 index 00000000..01373dad --- /dev/null +++ b/pool/tree/pool_server_test.go @@ -0,0 +1,345 @@ +package tree + +import ( + "bytes" + "context" + "errors" + "io" + "net" + "runtime" + "strconv" + "testing" + + apinetmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap" + apitree "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tree" + cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" + tree "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +type mockTreeServer struct { + id int + srv *grpc.Server + lis net.Listener + key *keys.PrivateKey + + healthy bool + addCounter int + + getSubTreeError error + getSubTreeResponses []*tree.GetSubTreeResponse_Body + getSubTreeCounter int +} + +type mockNetmapSource struct { + servers []*mockTreeServer + policy string +} + +func (m *mockNetmapSource) NetMapSnapshot(context.Context) (netmap.NetMap, error) { + nm := netmap.NetMap{} + nodes := make([]netmap.NodeInfo, len(m.servers)) + for i, server := range m.servers { + ni := apinetmap.NodeInfo{} + ni.SetAddresses(server.lis.Addr().String()) + ni.SetPublicKey(server.key.PublicKey().Bytes()) + err := nodes[i].ReadFromV2(ni) // no other way to set address field in netmap.NodeInfo + if err != nil { + return nm, err + } + nodes[i].SetAttribute("id", strconv.Itoa(server.id)) + } + nm.SetNodes(nodes) + return nm, nil +} + +func (m *mockNetmapSource) PlacementPolicy(context.Context, cid.ID) (netmap.PlacementPolicy, error) { + p := netmap.PlacementPolicy{} + return p, p.DecodeString(m.policy) +} + +func (m *mockTreeServer) Serve() { + go m.srv.Serve(m.lis) +} + +func (m *mockTreeServer) Stop() { + m.srv.Stop() +} + +func (m *mockTreeServer) Addr() string { + return m.lis.Addr().String() +} + +func (m *mockTreeServer) Add(context.Context, *tree.AddRequest) (*tree.AddResponse, error) { + m.addCounter++ + return &tree.AddResponse{}, nil +} + +func (m *mockTreeServer) AddByPath(context.Context, *tree.AddByPathRequest) (*tree.AddByPathResponse, error) { + panic("implement me") +} + +func (m *mockTreeServer) Remove(context.Context, *tree.RemoveRequest) (*tree.RemoveResponse, error) { + panic("implement me") +} + +func (m *mockTreeServer) Move(context.Context, *tree.MoveRequest) (*tree.MoveResponse, error) { + panic("implement me") +} + +func (m *mockTreeServer) GetNodeByPath(context.Context, *tree.GetNodeByPathRequest) (*tree.GetNodeByPathResponse, error) { + panic("implement me") +} + +func (m *mockTreeServer) GetSubTree(_ *tree.GetSubTreeRequest, s tree.TreeService_GetSubTreeServer) error { + m.getSubTreeCounter++ + + if m.getSubTreeError != nil { + return m.getSubTreeError + } + + for i := range m.getSubTreeResponses { + if err := s.Send(&tree.GetSubTreeResponse{ + Body: m.getSubTreeResponses[i], + }); err != nil { + return err + } + } + + return nil +} + +func (m *mockTreeServer) TreeList(context.Context, *tree.TreeListRequest) (*tree.TreeListResponse, error) { + panic("implement me") +} + +func (m *mockTreeServer) Apply(context.Context, *tree.ApplyRequest) (*tree.ApplyResponse, error) { + panic("implement me") +} + +func (m *mockTreeServer) GetOpLog(*tree.GetOpLogRequest, tree.TreeService_GetOpLogServer) error { + panic("implement me") +} + +func (m *mockTreeServer) Healthcheck(context.Context, *tree.HealthcheckRequest) (*tree.HealthcheckResponse, error) { + if m.healthy { + return new(tree.HealthcheckResponse), nil + } + return nil, errors.New("not healthy") +} + +func createTestServer(t *testing.T, id int) *mockTreeServer { + lis, err := net.Listen("tcp", "127.0.0.1:0") + require.NoError(t, err) + + key, err := keys.NewPrivateKey() + require.NoError(t, err) + + res := &mockTreeServer{ + id: id, + srv: grpc.NewServer(), + lis: lis, + key: key, + healthy: true, + } + + tree.RegisterTreeServiceServer(res.srv, res) + + return res +} + +func preparePoolWithNetmapSource(t *testing.T, n int, p string) (*Pool, []*mockTreeServer, *mockNetmapSource) { + poolInitParams := InitParameters{} + + servers := make([]*mockTreeServer, n) + for i := range servers { + servers[i] = createTestServer(t, i) + servers[i].healthy = true + servers[i].Serve() + poolInitParams.AddNode(pool.NewNodeParam(1, servers[i].Addr(), 1)) + } + + source := &mockNetmapSource{ + servers: servers, + policy: p, + } + + key, err := keys.NewPrivateKey() + require.NoError(t, err) + poolInitParams.SetKey(key) + poolInitParams.SetNetMapInfoSource(source) + + cli, err := NewPool(poolInitParams) + require.NoError(t, err) + + return cli, servers, source +} + +func sortServers(ctx context.Context, servers []*mockTreeServer, source *mockNetmapSource, cnr cid.ID) ([]*mockTreeServer, error) { + res := make([]*mockTreeServer, len(servers)) + snapshot, err := source.NetMapSnapshot(ctx) + if err != nil { + return nil, err + } + + policy, err := source.PlacementPolicy(ctx, cnr) + if err != nil { + return nil, err + } + + cnrNodes, err := snapshot.ContainerNodes(policy, cnr[:]) + if err != nil { + return nil, err + } + + priorityNodes, err := snapshot.PlacementVectors(cnrNodes, cnr[:]) + if err != nil { + return nil, err + } + + // find servers based on public key and store pointers in res + index := 0 + for i := range priorityNodes { + for j := range priorityNodes[i] { + key := priorityNodes[i][j].PublicKey() + for k := range servers { + if bytes.Equal(servers[k].key.PublicKey().Bytes(), key) { + res[index] = servers[k] + index++ + break + } + } + } + } + + return res, nil +} + +func TestConnectionLeak(t *testing.T) { + const ( + numberOfNodes = 4 + placementPolicy = "REP 2" + ) + + // Initialize gRPC servers and create pool with netmap source + treePool, servers, source := preparePoolWithNetmapSource(t, numberOfNodes, placementPolicy) + for i := range servers { + defer servers[i].Stop() + } + + cnr := cidtest.ID() + ctx := context.Background() + + // Make priority node for cnr unhealthy, so it is going to be redialled on every request + sortedServers, err := sortServers(ctx, servers, source, cnr) + require.NoError(t, err) + sortedServers[0].healthy = false + + // Make RPC and check that pool switched to healthy server + _, err = treePool.AddNode(context.Background(), AddNodeParams{CID: cnr}) + require.NoError(t, err) + require.Equal(t, 0, sortedServers[0].addCounter) // unhealthy + require.Equal(t, 1, sortedServers[1].addCounter) // healthy + + // Check that go routines are not leaked during multiple requests + routinesBefore := runtime.NumGoroutine() + for i := 0; i < 1000; i++ { + _, err = treePool.AddNode(context.Background(), AddNodeParams{CID: cnr}) + require.NoError(t, err) + } + // not more than 1 extra goroutine is created due to async operations + require.LessOrEqual(t, runtime.NumGoroutine()-routinesBefore, 1) +} + +func TestStreamRetry(t *testing.T) { + const ( + numberOfNodes = 4 + placementPolicy = "REP 2" + ) + + expected := []*tree.GetSubTreeResponse_Body{ + { + NodeId: []uint64{1}, + }, + { + NodeId: []uint64{2}, + }, + { + NodeId: []uint64{3}, + }, + } + + // Initialize gRPC servers and create pool with netmap source + treePool, servers, source := preparePoolWithNetmapSource(t, numberOfNodes, placementPolicy) + defer func() { + for i := range servers { + servers[i].Stop() + } + }() + + cnr := cidtest.ID() + ctx := context.Background() + + sortedServers, err := sortServers(ctx, servers, source, cnr) + require.NoError(t, err) + + // Return expected response in last priority node, others return error + for i := range sortedServers { + if i == len(sortedServers)-1 { + sortedServers[i].getSubTreeResponses = expected + } else { + sortedServers[i].getSubTreeError = errors.New("tree not found") + } + } + + t.Run("read all", func(t *testing.T) { + reader, err := treePool.GetSubTree(ctx, GetSubTreeParams{CID: cnr}) + require.NoError(t, err) + + data, err := reader.ReadAll() + require.NoError(t, err) + + require.Len(t, data, len(expected)) + for i := range expected { + require.EqualValues(t, expected[i].GetNodeId(), data[i].GetNodeID()) + } + }) + + t.Run("next", func(t *testing.T) { + reader, err := treePool.GetSubTree(ctx, GetSubTreeParams{CID: cnr}) + require.NoError(t, err) + + for i := range expected { + resp, err := reader.Next() + require.NoError(t, err) + require.Equal(t, expected[i].GetNodeId(), resp.GetNodeID()) + } + + _, err = reader.Next() + require.Error(t, io.EOF, err) + }) + + t.Run("read", func(t *testing.T) { + reader, err := treePool.GetSubTree(ctx, GetSubTreeParams{CID: cnr}) + require.NoError(t, err) + + buf := make([]*apitree.GetSubTreeResponseBody, len(expected)) + _, err = reader.Read(buf) + require.NoError(t, err) + + require.Len(t, buf, len(expected)) + for i := range expected { + require.EqualValues(t, expected[i].GetNodeId(), buf[i].GetNodeID()) + } + }) + + for i := range servers { + // check we retried every available node in the pool three times + require.Equal(t, 3, servers[i].getSubTreeCounter) + } +} diff --git a/pool/tree/pool_signature.go b/pool/tree/pool_signature.go index 0b3a2f6d..f0d890a0 100644 --- a/pool/tree/pool_signature.go +++ b/pool/tree/pool_signature.go @@ -1,25 +1,36 @@ package tree import ( - crypto "git.frostfs.info/TrueCloudLab/frostfs-crypto" - "google.golang.org/protobuf/proto" + frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" + tree "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" ) -func (p *Pool) signData(buf []byte, f func(key, sign []byte)) error { - sign, err := crypto.Sign(&p.key.PrivateKey, buf) +type message interface { + SignedDataSize() int + ReadSignedData([]byte) ([]byte, error) + GetSignature() *tree.Signature + SetSignature(*tree.Signature) error +} + +// signMessage uses the pool key and signs any protobuf +// message that was generated for the TreeService by the +// protoc-gen-go-frostfs generator. Returns any errors directly. +func (p *Pool) signRequest(m message) error { + binBody, err := m.ReadSignedData(nil) if err != nil { return err } - f(p.key.PublicKey().Bytes(), sign) - return nil -} - -func (p *Pool) signRequest(requestBody proto.Message, f func(key, sign []byte)) error { - buf, err := proto.Marshal(requestBody) + keySDK := frostfsecdsa.Signer(p.key.PrivateKey) + data, err := keySDK.Sign(binBody) if err != nil { return err } - return p.signData(buf, f) + rawPub := make([]byte, keySDK.Public().MaxEncodedSize()) + rawPub = rawPub[:keySDK.Public().Encode(rawPub)] + return m.SetSignature(&tree.Signature{ + Key: rawPub, + Sign: data, + }) } diff --git a/pool/tree/pool_test.go b/pool/tree/pool_test.go index f85b656f..5814a77c 100644 --- a/pool/tree/pool_test.go +++ b/pool/tree/pool_test.go @@ -5,8 +5,15 @@ import ( "errors" "testing" + rpcClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client" + apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" + cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" + netmaptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/test" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" - grpcService "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" + "git.frostfs.info/TrueCloudLab/hrw" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" ) @@ -14,12 +21,14 @@ import ( type treeClientMock struct { address string err bool + used bool } -func (t *treeClientMock) serviceClient() (grpcService.TreeServiceClient, error) { +func (t *treeClientMock) serviceClient() (*rpcClient.Client, error) { if t.err { return nil, errors.New("serviceClient() mock error") } + t.used = true return nil, nil } @@ -50,6 +59,23 @@ func (t *treeClientMock) close() error { return nil } +type netMapInfoMock struct { + netMap netmap.NetMap + policy netmap.PlacementPolicy + err error +} + +func (n *netMapInfoMock) NetMapSnapshot(context.Context) (netmap.NetMap, error) { + if n.err != nil { + return netmap.NetMap{}, n.err + } + return n.netMap, nil +} + +func (n *netMapInfoMock) PlacementPolicy(context.Context, cid.ID) (netmap.PlacementPolicy, error) { + return n.policy, nil +} + func TestHandleError(t *testing.T) { defaultError := errors.New("default error") for _, tc := range []struct { @@ -68,6 +94,10 @@ func TestHandleError(t *testing.T) { err: errors.New("something is denied by some acl rule"), expectedError: ErrNodeAccessDenied, }, + { + err: &apistatus.APEManagerAccessDenied{}, + expectedError: ErrNodeAccessDenied, + }, } { t.Run("", func(t *testing.T) { err := handleError("err message", tc.err) @@ -94,19 +124,19 @@ func TestRetry(t *testing.T) { maxRequestAttempts: lenNodes, } - makeFn := func(client grpcService.TreeServiceClient) error { + makeFn := func(client *rpcClient.Client) error { return nil } t.Run("first ok", func(t *testing.T) { - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.NoError(t, err) checkIndicesAndReset(t, p, 0, 0) }) t.Run("first failed", func(t *testing.T) { setErrors(p, "node00") - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.NoError(t, err) checkIndicesAndReset(t, p, 0, 1) }) @@ -114,7 +144,7 @@ func TestRetry(t *testing.T) { t.Run("all failed", func(t *testing.T) { setErrors(p, nodes[0]...) setErrors(p, nodes[1]...) - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.Error(t, err) checkIndicesAndReset(t, p, 0, 0) }) @@ -122,13 +152,13 @@ func TestRetry(t *testing.T) { t.Run("round", func(t *testing.T) { setErrors(p, nodes[0][0], nodes[0][1]) setErrors(p, nodes[1]...) - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.NoError(t, err) checkIndices(t, p, 0, 2) resetClientsErrors(p) setErrors(p, nodes[0][2], nodes[0][3]) - err = p.requestWithRetry(ctx, makeFn) + err = p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.NoError(t, err) checkIndicesAndReset(t, p, 0, 0) }) @@ -136,14 +166,14 @@ func TestRetry(t *testing.T) { t.Run("group switch", func(t *testing.T) { setErrors(p, nodes[0]...) setErrors(p, nodes[1][0]) - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.NoError(t, err) checkIndicesAndReset(t, p, 1, 1) }) t.Run("group round", func(t *testing.T) { setErrors(p, nodes[0][1:]...) - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.NoError(t, err) checkIndicesAndReset(t, p, 0, 0) }) @@ -151,7 +181,7 @@ func TestRetry(t *testing.T) { t.Run("group round switch", func(t *testing.T) { setErrors(p, nodes[0]...) p.setStartIndices(0, 1) - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.NoError(t, err) checkIndicesAndReset(t, p, 1, 0) }) @@ -159,14 +189,14 @@ func TestRetry(t *testing.T) { t.Run("no panic group switch", func(t *testing.T) { setErrors(p, nodes[1]...) p.setStartIndices(1, 0) - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.NoError(t, err) checkIndicesAndReset(t, p, 0, 0) }) t.Run("error empty result", func(t *testing.T) { errNodes, index := 2, 0 - err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) error { + err := p.requestWithRetry(ctx, cidtest.ID(), func(client *rpcClient.Client) error { if index < errNodes { index++ return errNodeEmptyResult @@ -179,7 +209,7 @@ func TestRetry(t *testing.T) { t.Run("error not found", func(t *testing.T) { errNodes, index := 2, 0 - err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) error { + err := p.requestWithRetry(ctx, cidtest.ID(), func(client *rpcClient.Client) error { if index < errNodes { index++ return ErrNodeNotFound @@ -192,7 +222,7 @@ func TestRetry(t *testing.T) { t.Run("error access denied", func(t *testing.T) { var index int - err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) error { + err := p.requestWithRetry(ctx, cidtest.ID(), func(client *rpcClient.Client) error { index++ return ErrNodeAccessDenied }) @@ -206,7 +236,7 @@ func TestRetry(t *testing.T) { p.maxRequestAttempts = 2 setErrors(p, nodes[0]...) setErrors(p, nodes[1]...) - err := p.requestWithRetry(ctx, makeFn) + err := p.requestWithRetry(ctx, cidtest.ID(), makeFn) require.Error(t, err) checkIndicesAndReset(t, p, 0, 2) p.maxRequestAttempts = oldVal @@ -268,6 +298,140 @@ func TestRebalance(t *testing.T) { }) } +func TestRetryContainerNodes(t *testing.T) { + ctx := context.Background() + nodesCount := 3 + policy := getPlacementPolicy(uint32(nodesCount)) + p := &Pool{ + logger: zaptest.NewLogger(t), + maxRequestAttempts: nodesCount, + } + + var nm netmap.NetMap + for i := 0; i < nodesCount; i++ { + key, err := keys.NewPrivateKey() + require.NoError(t, err) + nm.SetNodes(append(nm.Nodes(), getNodeInfo(key.Bytes()))) + } + p.netMapInfoSource = &netMapInfoMock{netMap: nm, policy: policy} + + cnrID := cidtest.ID() + cnrNodes, err := nm.ContainerNodes(policy, cnrID[:]) + require.NoError(t, err) + cnrNodes, err = nm.PlacementVectors(cnrNodes, cnrID[:]) + require.NoError(t, err) + require.Len(t, cnrNodes, 1) + require.Len(t, cnrNodes[0], nodesCount) + + makeFn := func(client *rpcClient.Client) error { + return nil + } + + t.Run("first ok", func(t *testing.T) { + p.clientMap = makeClientMap(cnrNodes[0]) + err = p.requestWithRetry(ctx, cnrID, makeFn) + require.NoError(t, err) + checkClientsUsage(t, p, cnrNodes[0][0]) + checkClientsPresence(t, p, cnrNodes[0]...) + }) + + t.Run("first failed", func(t *testing.T) { + p.clientMap = makeClientMap(cnrNodes[0]) + setClientMapErrors(p, cnrNodes[0][0]) + err = p.requestWithRetry(ctx, cnrID, makeFn) + require.NoError(t, err) + checkClientsUsage(t, p, cnrNodes[0][1]) + checkClientsPresence(t, p, cnrNodes[0][1:]...) + }) + + t.Run("first two failed", func(t *testing.T) { + p.clientMap = makeClientMap(cnrNodes[0]) + setClientMapErrors(p, cnrNodes[0][0], cnrNodes[0][1]) + err = p.requestWithRetry(ctx, cnrID, makeFn) + require.NoError(t, err) + checkClientsUsage(t, p, cnrNodes[0][2]) + checkClientsPresence(t, p, cnrNodes[0][2]) + }) + + t.Run("all failed", func(t *testing.T) { + p.clientMap = makeClientMap(cnrNodes[0]) + setClientMapErrors(p, cnrNodes[0][0], cnrNodes[0][1], cnrNodes[0][2]) + err = p.requestWithRetry(ctx, cnrID, makeFn) + require.Error(t, err) + checkClientsUsage(t, p) + checkClientsPresence(t, p) + }) + + t.Run("error empty result", func(t *testing.T) { + p.clientMap = makeClientMap(cnrNodes[0]) + errNodes, index := 2, 0 + err = p.requestWithRetry(ctx, cnrID, func(client *rpcClient.Client) error { + if index < errNodes { + index++ + return errNodeEmptyResult + } + return nil + }) + require.NoError(t, err) + checkClientsUsage(t, p, cnrNodes[0][:errNodes+1]...) + checkClientsPresence(t, p, cnrNodes[0]...) + }) + + t.Run("error not found", func(t *testing.T) { + p.clientMap = makeClientMap(cnrNodes[0]) + errNodes, index := 2, 0 + err = p.requestWithRetry(ctx, cnrID, func(client *rpcClient.Client) error { + if index < errNodes { + index++ + return ErrNodeNotFound + } + return nil + }) + require.NoError(t, err) + checkClientsUsage(t, p, cnrNodes[0][:errNodes+1]...) + checkClientsPresence(t, p, cnrNodes[0]...) + }) + + t.Run("error access denied", func(t *testing.T) { + p.clientMap = makeClientMap(cnrNodes[0]) + var index int + err = p.requestWithRetry(ctx, cnrID, func(client *rpcClient.Client) error { + index++ + return ErrNodeAccessDenied + }) + require.ErrorIs(t, err, ErrNodeAccessDenied) + require.Equal(t, 1, index) + checkClientsUsage(t, p, cnrNodes[0][0]) + checkClientsPresence(t, p, cnrNodes[0]...) + }) + + t.Run("limit attempts", func(t *testing.T) { + p.clientMap = makeClientMap(cnrNodes[0]) + p.maxRequestAttempts = 2 + setClientMapErrors(p, cnrNodes[0][0], cnrNodes[0][1]) + err = p.requestWithRetry(ctx, cnrID, makeFn) + require.Error(t, err) + checkClientsUsage(t, p) + checkClientsPresence(t, p, cnrNodes[0][2]) + p.maxRequestAttempts = nodesCount + }) +} + +func TestDeleteClientTwice(t *testing.T) { + p := Pool{ + clientMap: makeClientMap([]netmap.NodeInfo{netmaptest.NodeInfo()}), + } + // emulate concurrent requests as consecutive requests + // to delete the same client from the map twice + for idToDelete := range p.clientMap { + p.deleteClientFromMap(idToDelete) + require.NotPanics(t, func() { + p.deleteClientFromMap(idToDelete) + }) + } + require.Empty(t, p.clientMap) +} + func makeInnerPool(nodes [][]string) []*innerPool { res := make([]*innerPool, len(nodes)) @@ -354,3 +518,59 @@ func containsStr(list []string, item string) bool { return false } + +func makeClientMap(nodes []netmap.NodeInfo) map[uint64]client { + res := make(map[uint64]client, len(nodes)) + for _, node := range nodes { + res[hrw.Hash(node.PublicKey())] = &treeClientMock{} + } + return res +} + +func checkClientsPresence(t *testing.T, p *Pool, nodes ...netmap.NodeInfo) { + require.Len(t, p.clientMap, len(nodes)) + for _, node := range nodes { + require.NotNil(t, p.clientMap[hrw.Hash(node.PublicKey())]) + } +} + +func checkClientsUsage(t *testing.T, p *Pool, nodes ...netmap.NodeInfo) { + for hash, cl := range p.clientMap { + if containsHash(nodes, hash) { + require.True(t, cl.(*treeClientMock).used) + } else { + require.False(t, cl.(*treeClientMock).used) + } + } +} + +func setClientMapErrors(p *Pool, nodes ...netmap.NodeInfo) { + for hash, cl := range p.clientMap { + if containsHash(nodes, hash) { + cl.(*treeClientMock).err = true + } + } +} + +func containsHash(list []netmap.NodeInfo, hash uint64) bool { + for i := range list { + if hrw.Hash(list[i].PublicKey()) == hash { + return true + } + } + + return false +} + +func getPlacementPolicy(replicas uint32) (p netmap.PlacementPolicy) { + var r netmap.ReplicaDescriptor + r.SetNumberOfObjects(replicas) + p.AddReplicas([]netmap.ReplicaDescriptor{r}...) + return p +} + +func getNodeInfo(key []byte) netmap.NodeInfo { + var node netmap.NodeInfo + node.SetPublicKey(key) + return node +} diff --git a/pool/tree/service/service.pb.go b/pool/tree/service/service.pb.go index 63f3e714..f439e3f2 100644 --- a/pool/tree/service/service.pb.go +++ b/pool/tree/service/service.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.21.9 +// protoc-gen-go v1.33.0 +// protoc v4.25.0 // source: pkg/services/tree/service.proto package tree @@ -1979,8 +1979,8 @@ type GetSubTreeRequest_Body struct { ContainerId []byte `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // The name of the tree. TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"` - // ID of the root node of a subtree. - RootId uint64 `protobuf:"varint,3,opt,name=root_id,json=rootId,proto3" json:"root_id,omitempty"` + // IDs of the root nodes of a subtree forest. + RootId []uint64 `protobuf:"varint,3,rep,name=root_id,json=rootId,proto3" json:"root_id,omitempty"` // Optional depth of the traversal. Zero means return only root. // Maximum depth is 10. Depth uint32 `protobuf:"varint,4,opt,name=depth,proto3" json:"depth,omitempty"` @@ -2036,11 +2036,11 @@ func (x *GetSubTreeRequest_Body) GetTreeId() string { return "" } -func (x *GetSubTreeRequest_Body) GetRootId() uint64 { +func (x *GetSubTreeRequest_Body) GetRootId() []uint64 { if x != nil { return x.RootId } - return 0 + return nil } func (x *GetSubTreeRequest_Body) GetDepth() uint32 { @@ -2117,11 +2117,11 @@ type GetSubTreeResponse_Body struct { unknownFields protoimpl.UnknownFields // ID of the node. - NodeId uint64 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + NodeId []uint64 `protobuf:"varint,1,rep,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` // ID of the parent. - ParentId uint64 `protobuf:"varint,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` + ParentId []uint64 `protobuf:"varint,2,rep,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` // Time node was first added to a tree. - Timestamp uint64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Timestamp []uint64 `protobuf:"varint,3,rep,name=timestamp,proto3" json:"timestamp,omitempty"` // Node meta-information. Meta []*KeyValue `protobuf:"bytes,4,rep,name=meta,proto3" json:"meta,omitempty"` } @@ -2158,25 +2158,25 @@ func (*GetSubTreeResponse_Body) Descriptor() ([]byte, []int) { return file_pkg_services_tree_service_proto_rawDescGZIP(), []int{11, 0} } -func (x *GetSubTreeResponse_Body) GetNodeId() uint64 { +func (x *GetSubTreeResponse_Body) GetNodeId() []uint64 { if x != nil { return x.NodeId } - return 0 + return nil } -func (x *GetSubTreeResponse_Body) GetParentId() uint64 { +func (x *GetSubTreeResponse_Body) GetParentId() []uint64 { if x != nil { return x.ParentId } - return 0 + return nil } -func (x *GetSubTreeResponse_Body) GetTimestamp() uint64 { +func (x *GetSubTreeResponse_Body) GetTimestamp() []uint64 { if x != nil { return x.Timestamp } - return 0 + return nil } func (x *GetSubTreeResponse_Body) GetMeta() []*KeyValue { @@ -2742,173 +2742,175 @@ var file_pkg_services_tree_service_proto_rawDesc = []byte{ 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, - 0x73, 0x22, 0xbf, 0x03, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, + 0x73, 0x22, 0xc3, 0x03, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0xc8, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0xcc, 0x02, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, - 0x07, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, - 0x72, 0x6f, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0x21, 0x0a, 0x0c, - 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, - 0x3d, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, - 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, - 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x1a, 0x73, - 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x74, 0x72, 0x65, - 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x2e, 0x44, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x1e, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x73, - 0x63, 0x10, 0x01, 0x22, 0xf6, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, - 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, - 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x7e, 0x0a, 0x04, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, - 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, 0x65, - 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x9b, 0x01, 0x0a, - 0x0f, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, - 0x29, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x10, 0x54, - 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, - 0x18, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0xdb, 0x01, 0x0a, 0x0c, 0x41, 0x70, - 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, - 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, - 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, - 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x6f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, - 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, - 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x09, 0x6f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x09, 0x6f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x6c, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, - 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, - 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, - 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe2, 0x01, - 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, + 0x07, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, + 0x10, 0x00, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, + 0x70, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, + 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x42, 0x79, 0x1a, 0x73, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x09, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1e, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, + 0x0a, 0x03, 0x41, 0x73, 0x63, 0x10, 0x01, 0x22, 0x83, 0x02, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, + 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, + 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x1a, 0x8a, 0x01, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1b, 0x0a, 0x07, 0x6e, 0x6f, 0x64, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x06, + 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x08, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x65, 0x74, + 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4b, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x9b, 0x01, + 0x0a, 0x0f, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, + 0x1a, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x1a, 0x70, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, + 0x1a, 0x29, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, - 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, - 0x65, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0xa7, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, - 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0x8c, 0x01, 0x0a, 0x10, + 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x1a, 0x18, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0xdb, 0x01, 0x0a, 0x0c, 0x41, + 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x33, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x2b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, - 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x80, 0x01, 0x0a, - 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, - 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, - 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, - 0x7e, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, - 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, - 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, - 0xd6, 0x04, 0x0a, 0x0b, 0x54, 0x72, 0x65, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x2a, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x10, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, - 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, - 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x41, - 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, - 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, - 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x12, 0x13, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, - 0x0a, 0x04, 0x4d, 0x6f, 0x76, 0x65, 0x12, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x6f, - 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x74, 0x72, 0x65, 0x65, - 0x2e, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, - 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1a, - 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, - 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x74, 0x72, 0x65, - 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x75, - 0x62, 0x54, 0x72, 0x65, 0x65, 0x12, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, - 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, - 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x39, 0x0a, 0x08, 0x54, 0x72, - 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, - 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, - 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x12, - 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4f, 0x70, - 0x4c, 0x6f, 0x67, 0x12, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x72, 0x65, - 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, - 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, - 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, - 0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2f, 0x74, 0x72, 0x65, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x6f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x09, 0x6f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x09, 0x6f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x6c, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x62, 0x6f, 0x64, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, + 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, + 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe2, + 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x1a, 0x70, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, + 0x74, 0x72, 0x65, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, + 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0xa7, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, + 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, + 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x33, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x12, 0x2b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x4d, 0x6f, + 0x76, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x80, 0x01, + 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, + 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x22, 0x7e, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, + 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2d, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x74, + 0x72, 0x65, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, + 0x32, 0xd6, 0x04, 0x0a, 0x0b, 0x54, 0x72, 0x65, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x2a, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x10, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, + 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x09, + 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x42, 0x79, 0x50, 0x61, + 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x13, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x72, 0x65, 0x65, + 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2d, 0x0a, 0x04, 0x4d, 0x6f, 0x76, 0x65, 0x12, 0x11, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x4d, + 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x74, 0x72, 0x65, + 0x65, 0x2e, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, + 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, + 0x1a, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x74, 0x72, + 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x42, 0x79, 0x50, 0x61, 0x74, 0x68, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, + 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x12, 0x17, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, + 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x54, 0x72, 0x65, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x39, 0x0a, 0x08, 0x54, + 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, + 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x54, 0x72, 0x65, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, + 0x12, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4f, + 0x70, 0x4c, 0x6f, 0x67, 0x12, 0x15, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, + 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x74, 0x72, + 0x65, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, + 0x2e, 0x74, 0x72, 0x65, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, + 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, + 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, + 0x66, 0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2f, 0x74, 0x72, 0x65, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/pool/tree/service/service_frostfs.pb.go b/pool/tree/service/service_frostfs.pb.go new file mode 100644 index 00000000..a9a48b93 --- /dev/null +++ b/pool/tree/service/service_frostfs.pb.go @@ -0,0 +1,1887 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package tree + +import ( + binary "encoding/binary" + protowire "google.golang.org/protobuf/encoding/protowire" +) + +import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + size += proto.StringSize(2, x.TreeId) + size += proto.UInt64Size(3, x.ParentId) + for i := range x.Meta { + size += proto.NestedStructureSize(4, x.Meta[i]) + } + size += proto.BytesSize(5, x.BearerToken) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *AddRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + offset += proto.StringMarshal(2, buf[offset:], x.TreeId) + offset += proto.UInt64Marshal(3, buf[offset:], x.ParentId) + for i := range x.Meta { + offset += proto.NestedStructureMarshal(4, buf[offset:], x.Meta[i]) + } + offset += proto.BytesMarshal(5, buf[offset:], x.BearerToken) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *AddRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *AddRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *AddRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *AddRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.NodeId) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *AddResponse_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.UInt64Marshal(1, buf[offset:], x.NodeId) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *AddResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *AddResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *AddResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *AddResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddByPathRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + size += proto.StringSize(2, x.TreeId) + size += proto.StringSize(3, x.PathAttribute) + size += proto.RepeatedStringSize(4, x.Path) + for i := range x.Meta { + size += proto.NestedStructureSize(5, x.Meta[i]) + } + size += proto.BytesSize(6, x.BearerToken) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *AddByPathRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + offset += proto.StringMarshal(2, buf[offset:], x.TreeId) + offset += proto.StringMarshal(3, buf[offset:], x.PathAttribute) + offset += proto.RepeatedStringMarshal(4, buf[offset:], x.Path) + for i := range x.Meta { + offset += proto.NestedStructureMarshal(5, buf[offset:], x.Meta[i]) + } + offset += proto.BytesMarshal(6, buf[offset:], x.BearerToken) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddByPathRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *AddByPathRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *AddByPathRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *AddByPathRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *AddByPathRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddByPathResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + var n int + n, _ = proto.RepeatedUInt64Size(1, x.Nodes) + size += n + size += proto.UInt64Size(2, x.ParentId) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *AddByPathResponse_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.RepeatedUInt64Marshal(1, buf[offset:], x.Nodes) + offset += proto.UInt64Marshal(2, buf[offset:], x.ParentId) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *AddByPathResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *AddByPathResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *AddByPathResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *AddByPathResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *AddByPathResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RemoveRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + size += proto.StringSize(2, x.TreeId) + size += proto.UInt64Size(3, x.NodeId) + size += proto.BytesSize(4, x.BearerToken) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *RemoveRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + offset += proto.StringMarshal(2, buf[offset:], x.TreeId) + offset += proto.UInt64Marshal(3, buf[offset:], x.NodeId) + offset += proto.BytesMarshal(4, buf[offset:], x.BearerToken) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RemoveRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *RemoveRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *RemoveRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *RemoveRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *RemoveRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RemoveResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *RemoveResponse_Body) StableMarshal(buf []byte) []byte { + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *RemoveResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *RemoveResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *RemoveResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *RemoveResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *RemoveResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *MoveRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + size += proto.StringSize(2, x.TreeId) + size += proto.UInt64Size(3, x.ParentId) + size += proto.UInt64Size(4, x.NodeId) + for i := range x.Meta { + size += proto.NestedStructureSize(5, x.Meta[i]) + } + size += proto.BytesSize(6, x.BearerToken) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *MoveRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + offset += proto.StringMarshal(2, buf[offset:], x.TreeId) + offset += proto.UInt64Marshal(3, buf[offset:], x.ParentId) + offset += proto.UInt64Marshal(4, buf[offset:], x.NodeId) + for i := range x.Meta { + offset += proto.NestedStructureMarshal(5, buf[offset:], x.Meta[i]) + } + offset += proto.BytesMarshal(6, buf[offset:], x.BearerToken) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *MoveRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *MoveRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *MoveRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *MoveRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *MoveRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *MoveResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *MoveResponse_Body) StableMarshal(buf []byte) []byte { + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *MoveResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *MoveResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *MoveResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *MoveResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *MoveResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetNodeByPathRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + size += proto.StringSize(2, x.TreeId) + size += proto.StringSize(3, x.PathAttribute) + size += proto.RepeatedStringSize(4, x.Path) + size += proto.RepeatedStringSize(5, x.Attributes) + size += proto.BoolSize(6, x.LatestOnly) + size += proto.BoolSize(7, x.AllAttributes) + size += proto.BytesSize(8, x.BearerToken) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetNodeByPathRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + offset += proto.StringMarshal(2, buf[offset:], x.TreeId) + offset += proto.StringMarshal(3, buf[offset:], x.PathAttribute) + offset += proto.RepeatedStringMarshal(4, buf[offset:], x.Path) + offset += proto.RepeatedStringMarshal(5, buf[offset:], x.Attributes) + offset += proto.BoolMarshal(6, buf[offset:], x.LatestOnly) + offset += proto.BoolMarshal(7, buf[offset:], x.AllAttributes) + offset += proto.BytesMarshal(8, buf[offset:], x.BearerToken) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetNodeByPathRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetNodeByPathRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *GetNodeByPathRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *GetNodeByPathRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *GetNodeByPathRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetNodeByPathResponse_Info) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.NodeId) + size += proto.UInt64Size(2, x.Timestamp) + for i := range x.Meta { + size += proto.NestedStructureSize(3, x.Meta[i]) + } + size += proto.UInt64Size(4, x.ParentId) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetNodeByPathResponse_Info) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.UInt64Marshal(1, buf[offset:], x.NodeId) + offset += proto.UInt64Marshal(2, buf[offset:], x.Timestamp) + for i := range x.Meta { + offset += proto.NestedStructureMarshal(3, buf[offset:], x.Meta[i]) + } + offset += proto.UInt64Marshal(4, buf[offset:], x.ParentId) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetNodeByPathResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + for i := range x.Nodes { + size += proto.NestedStructureSize(1, x.Nodes[i]) + } + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetNodeByPathResponse_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + for i := range x.Nodes { + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Nodes[i]) + } + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetNodeByPathResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetNodeByPathResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *GetNodeByPathResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *GetNodeByPathResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *GetNodeByPathResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetSubTreeRequest_Body_Order) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.EnumSize(1, int32(x.Direction)) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetSubTreeRequest_Body_Order) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.EnumMarshal(1, buf[offset:], int32(x.Direction)) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetSubTreeRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + size += proto.StringSize(2, x.TreeId) + for i := range x.RootId { + size += protowire.SizeGroup(protowire.Number(3), protowire.SizeVarint(x.RootId[i])) + } + size += proto.UInt32Size(4, x.Depth) + size += proto.BytesSize(5, x.BearerToken) + size += proto.NestedStructureSize(6, x.OrderBy) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetSubTreeRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + offset += proto.StringMarshal(2, buf[offset:], x.TreeId) + for i := range x.RootId { + { + prefix := protowire.EncodeTag(protowire.Number(3), protowire.VarintType) + offset += binary.PutUvarint(buf[offset:], uint64(prefix)) + offset += binary.PutUvarint(buf[offset:], x.RootId[i]) + } + } + offset += proto.UInt32Marshal(4, buf[offset:], x.Depth) + offset += proto.BytesMarshal(5, buf[offset:], x.BearerToken) + offset += proto.NestedStructureMarshal(6, buf[offset:], x.OrderBy) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetSubTreeRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetSubTreeRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *GetSubTreeRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *GetSubTreeRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *GetSubTreeRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetSubTreeResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + for i := range x.NodeId { + size += protowire.SizeGroup(protowire.Number(1), protowire.SizeVarint(x.NodeId[i])) + } + for i := range x.ParentId { + size += protowire.SizeGroup(protowire.Number(2), protowire.SizeVarint(x.ParentId[i])) + } + for i := range x.Timestamp { + size += protowire.SizeGroup(protowire.Number(3), protowire.SizeVarint(x.Timestamp[i])) + } + for i := range x.Meta { + size += proto.NestedStructureSize(4, x.Meta[i]) + } + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetSubTreeResponse_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + for i := range x.NodeId { + { + prefix := protowire.EncodeTag(protowire.Number(1), protowire.VarintType) + offset += binary.PutUvarint(buf[offset:], uint64(prefix)) + offset += binary.PutUvarint(buf[offset:], x.NodeId[i]) + } + } + for i := range x.ParentId { + { + prefix := protowire.EncodeTag(protowire.Number(2), protowire.VarintType) + offset += binary.PutUvarint(buf[offset:], uint64(prefix)) + offset += binary.PutUvarint(buf[offset:], x.ParentId[i]) + } + } + for i := range x.Timestamp { + { + prefix := protowire.EncodeTag(protowire.Number(3), protowire.VarintType) + offset += binary.PutUvarint(buf[offset:], uint64(prefix)) + offset += binary.PutUvarint(buf[offset:], x.Timestamp[i]) + } + } + for i := range x.Meta { + offset += proto.NestedStructureMarshal(4, buf[offset:], x.Meta[i]) + } + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetSubTreeResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetSubTreeResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *GetSubTreeResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *GetSubTreeResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *GetSubTreeResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *TreeListRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *TreeListRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *TreeListRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *TreeListRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *TreeListRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *TreeListRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *TreeListRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *TreeListResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.RepeatedStringSize(1, x.Ids) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *TreeListResponse_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.RepeatedStringMarshal(1, buf[offset:], x.Ids) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *TreeListResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *TreeListResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *TreeListResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *TreeListResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *TreeListResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ApplyRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + size += proto.StringSize(2, x.TreeId) + size += proto.NestedStructureSize(3, x.Operation) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *ApplyRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + offset += proto.StringMarshal(2, buf[offset:], x.TreeId) + offset += proto.NestedStructureMarshal(3, buf[offset:], x.Operation) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ApplyRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *ApplyRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *ApplyRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *ApplyRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *ApplyRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ApplyResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *ApplyResponse_Body) StableMarshal(buf []byte) []byte { + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *ApplyResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *ApplyResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *ApplyResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *ApplyResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *ApplyResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetOpLogRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.ContainerId) + size += proto.StringSize(2, x.TreeId) + size += proto.UInt64Size(3, x.Height) + size += proto.UInt64Size(4, x.Count) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetOpLogRequest_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.ContainerId) + offset += proto.StringMarshal(2, buf[offset:], x.TreeId) + offset += proto.UInt64Marshal(3, buf[offset:], x.Height) + offset += proto.UInt64Marshal(4, buf[offset:], x.Count) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetOpLogRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetOpLogRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *GetOpLogRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *GetOpLogRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *GetOpLogRequest) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetOpLogResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Operation) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetOpLogResponse_Body) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Operation) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *GetOpLogResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *GetOpLogResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *GetOpLogResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *GetOpLogResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *GetOpLogResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HealthcheckResponse_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *HealthcheckResponse_Body) StableMarshal(buf []byte) []byte { + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HealthcheckResponse) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *HealthcheckResponse) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *HealthcheckResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *HealthcheckResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *HealthcheckResponse) SetSignature(sig *Signature) { + x.Signature = sig +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HealthcheckRequest_Body) StableSize() (size int) { + if x == nil { + return 0 + } + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *HealthcheckRequest_Body) StableMarshal(buf []byte) []byte { + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *HealthcheckRequest) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.NestedStructureSize(1, x.Body) + size += proto.NestedStructureSize(2, x.Signature) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *HealthcheckRequest) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body) + offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature) + return buf +} + +// ReadSignedData fills buf with signed data of x. +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *HealthcheckRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SignedDataSize returns size of the request signed data in bytes. +// +// Structures with the same field values have the same signed data size. +func (x *HealthcheckRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf), nil +} + +func (x *HealthcheckRequest) SetSignature(sig *Signature) { + x.Signature = sig +} diff --git a/pool/tree/service/service_grpc.pb.go b/pool/tree/service/service_grpc.pb.go index 2c082895..4c293a4c 100644 --- a/pool/tree/service/service_grpc.pb.go +++ b/pool/tree/service/service_grpc.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.9 +// - protoc-gen-go-grpc v1.4.0 +// - protoc v4.25.0 // source: pkg/services/tree/service.proto package tree @@ -18,8 +18,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( TreeService_Add_FullMethodName = "/tree.TreeService/Add" @@ -70,8 +70,9 @@ func NewTreeServiceClient(cc grpc.ClientConnInterface) TreeServiceClient { } func (c *treeServiceClient) Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*AddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AddResponse) - err := c.cc.Invoke(ctx, TreeService_Add_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, TreeService_Add_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -79,8 +80,9 @@ func (c *treeServiceClient) Add(ctx context.Context, in *AddRequest, opts ...grp } func (c *treeServiceClient) AddByPath(ctx context.Context, in *AddByPathRequest, opts ...grpc.CallOption) (*AddByPathResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AddByPathResponse) - err := c.cc.Invoke(ctx, TreeService_AddByPath_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, TreeService_AddByPath_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -88,8 +90,9 @@ func (c *treeServiceClient) AddByPath(ctx context.Context, in *AddByPathRequest, } func (c *treeServiceClient) Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RemoveResponse) - err := c.cc.Invoke(ctx, TreeService_Remove_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, TreeService_Remove_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -97,8 +100,9 @@ func (c *treeServiceClient) Remove(ctx context.Context, in *RemoveRequest, opts } func (c *treeServiceClient) Move(ctx context.Context, in *MoveRequest, opts ...grpc.CallOption) (*MoveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(MoveResponse) - err := c.cc.Invoke(ctx, TreeService_Move_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, TreeService_Move_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -106,8 +110,9 @@ func (c *treeServiceClient) Move(ctx context.Context, in *MoveRequest, opts ...g } func (c *treeServiceClient) GetNodeByPath(ctx context.Context, in *GetNodeByPathRequest, opts ...grpc.CallOption) (*GetNodeByPathResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetNodeByPathResponse) - err := c.cc.Invoke(ctx, TreeService_GetNodeByPath_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, TreeService_GetNodeByPath_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -115,11 +120,12 @@ func (c *treeServiceClient) GetNodeByPath(ctx context.Context, in *GetNodeByPath } func (c *treeServiceClient) GetSubTree(ctx context.Context, in *GetSubTreeRequest, opts ...grpc.CallOption) (TreeService_GetSubTreeClient, error) { - stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[0], TreeService_GetSubTree_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[0], TreeService_GetSubTree_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &treeServiceGetSubTreeClient{stream} + x := &treeServiceGetSubTreeClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -147,8 +153,9 @@ func (x *treeServiceGetSubTreeClient) Recv() (*GetSubTreeResponse, error) { } func (c *treeServiceClient) TreeList(ctx context.Context, in *TreeListRequest, opts ...grpc.CallOption) (*TreeListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(TreeListResponse) - err := c.cc.Invoke(ctx, TreeService_TreeList_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, TreeService_TreeList_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -156,8 +163,9 @@ func (c *treeServiceClient) TreeList(ctx context.Context, in *TreeListRequest, o } func (c *treeServiceClient) Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ApplyResponse) - err := c.cc.Invoke(ctx, TreeService_Apply_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, TreeService_Apply_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -165,11 +173,12 @@ func (c *treeServiceClient) Apply(ctx context.Context, in *ApplyRequest, opts .. } func (c *treeServiceClient) GetOpLog(ctx context.Context, in *GetOpLogRequest, opts ...grpc.CallOption) (TreeService_GetOpLogClient, error) { - stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[1], TreeService_GetOpLog_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[1], TreeService_GetOpLog_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &treeServiceGetOpLogClient{stream} + x := &treeServiceGetOpLogClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -197,8 +206,9 @@ func (x *treeServiceGetOpLogClient) Recv() (*GetOpLogResponse, error) { } func (c *treeServiceClient) Healthcheck(ctx context.Context, in *HealthcheckRequest, opts ...grpc.CallOption) (*HealthcheckResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(HealthcheckResponse) - err := c.cc.Invoke(ctx, TreeService_Healthcheck_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, TreeService_Healthcheck_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -373,7 +383,7 @@ func _TreeService_GetSubTree_Handler(srv interface{}, stream grpc.ServerStream) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(TreeServiceServer).GetSubTree(m, &treeServiceGetSubTreeServer{stream}) + return srv.(TreeServiceServer).GetSubTree(m, &treeServiceGetSubTreeServer{ServerStream: stream}) } type TreeService_GetSubTreeServer interface { @@ -430,7 +440,7 @@ func _TreeService_GetOpLog_Handler(srv interface{}, stream grpc.ServerStream) er if err := stream.RecvMsg(m); err != nil { return err } - return srv.(TreeServiceServer).GetOpLog(m, &treeServiceGetOpLogServer{stream}) + return srv.(TreeServiceServer).GetOpLog(m, &treeServiceGetOpLogServer{ServerStream: stream}) } type TreeService_GetOpLogServer interface { diff --git a/pool/tree/service/types.pb.go b/pool/tree/service/types.pb.go index b4d6981e..6464ccb7 100644 --- a/pool/tree/service/types.pb.go +++ b/pool/tree/service/types.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.21.9 +// protoc-gen-go v1.33.0 +// protoc v4.25.0 // source: pkg/services/tree/types.proto package tree diff --git a/pool/tree/service/types_frostfs.pb.go b/pool/tree/service/types_frostfs.pb.go new file mode 100644 index 00000000..a8dfba31 --- /dev/null +++ b/pool/tree/service/types_frostfs.pb.go @@ -0,0 +1,106 @@ +// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. + +package tree + +import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto" + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *KeyValue) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.StringSize(1, x.Key) + size += proto.BytesSize(2, x.Value) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *KeyValue) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.StringMarshal(1, buf[offset:], x.Key) + offset += proto.BytesMarshal(2, buf[offset:], x.Value) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *LogMove) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.UInt64Size(1, x.ParentId) + size += proto.BytesSize(2, x.Meta) + size += proto.UInt64Size(3, x.ChildId) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *LogMove) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.UInt64Marshal(1, buf[offset:], x.ParentId) + offset += proto.BytesMarshal(2, buf[offset:], x.Meta) + offset += proto.UInt64Marshal(3, buf[offset:], x.ChildId) + return buf +} + +// StableSize returns the size of x in protobuf format. +// +// Structures with the same field values have the same binary size. +func (x *Signature) StableSize() (size int) { + if x == nil { + return 0 + } + size += proto.BytesSize(1, x.Key) + size += proto.BytesSize(2, x.Sign) + return size +} + +// StableMarshal marshals x in protobuf binary format with stable field order. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *Signature) StableMarshal(buf []byte) []byte { + if x == nil { + return []byte{} + } + if buf == nil { + buf = make([]byte, x.StableSize()) + } + var offset int + offset += proto.BytesMarshal(1, buf[offset:], x.Key) + offset += proto.BytesMarshal(2, buf[offset:], x.Sign) + return buf +} diff --git a/pool/tree/statistic.go b/pool/tree/statistic.go new file mode 100644 index 00000000..9f565fa2 --- /dev/null +++ b/pool/tree/statistic.go @@ -0,0 +1,51 @@ +package tree + +import ( + "time" + + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" +) + +// Statistic is metrics of the tree pool. +type Statistic struct { + methods []pool.StatusSnapshot +} + +func (s *Statistic) Requests() (requests uint64) { + for _, val := range s.methods { + requests += val.AllRequests() + } + return requests +} + +func (s *Statistic) AverageGetNodes() time.Duration { + return s.averageTime(methodGetNodes) +} + +func (s *Statistic) AverageGetSubTree() time.Duration { + return s.averageTime(methodGetSubTree) +} + +func (s *Statistic) AverageAddNode() time.Duration { + return s.averageTime(methodAddNode) +} + +func (s *Statistic) AverageAddNodeByPath() time.Duration { + return s.averageTime(methodAddNodeByPath) +} + +func (s *Statistic) AverageMoveNode() time.Duration { + return s.averageTime(methodMoveNode) +} + +func (s *Statistic) AverageRemoveNode() time.Duration { + return s.averageTime(methodRemoveNode) +} + +func (s *Statistic) averageTime(method MethodIndex) time.Duration { + stat := s.methods[method] + if stat.AllRequests() == 0 { + return 0 + } + return time.Duration(stat.AllTime() / stat.AllRequests()) +} diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 00000000..a7b6100a --- /dev/null +++ b/prepare.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "usage: ./prepare.sh path/to/frostfs-api" + exit 1 +fi + +API_GO_PATH=$(pwd)/api +API_PATH=$1 + +# MOVE FILES FROM API REPO +cd "$API_PATH" || exit 1 +ARGS=$(find ./ -name '*.proto' -not -path './bin/*') +for file in $ARGS; do + dir=$(dirname "$file") + mkdir -p "$API_GO_PATH/$dir/grpc" + cp -r "$dir"/* "$API_GO_PATH/$dir/grpc" +done + +# MODIFY FILES +cd "$API_GO_PATH" || exit 1 +ARGS2=$(find ./ -name '*.proto' -not -path './bin/*') +for file in $ARGS2; do + echo "$file" + sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"\1\/grpc\/\2\.proto\";/" $file + sed -i "s/api-go\\/v2/sdk-go\\/api/" $file + sed -i "s/import \"/import \"api\//" $file +done + + +cd "$API_GO_PATH/.." || exit 1 +# COMPILE +make protoc + +# REMOVE PROTO DEFINITIONS +ARGS=$(find ./$prefix -name '*.proto' -not -path './util/*' -not -path './bin/*') +for file in $ARGS; do + rm "$file" +done diff --git a/session/common.go b/session/common.go index b103b596..3d7308f1 100644 --- a/session/common.go +++ b/session/common.go @@ -6,8 +6,8 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" diff --git a/session/container.go b/session/container.go index 45c5ff8c..463523bd 100644 --- a/session/container.go +++ b/session/container.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" @@ -18,7 +18,7 @@ import ( // limited validity period, and applies to a strictly defined set of operations. // See methods for details. // -// Container is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session.Token +// Container is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session.Token // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. diff --git a/session/container_test.go b/session/container_test.go index d906482a..fcf152d3 100644 --- a/session/container_test.go +++ b/session/container_test.go @@ -1,14 +1,15 @@ package session_test import ( + "bytes" "crypto/rand" "fmt" "math" mrand "math/rand" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" @@ -17,7 +18,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" "github.com/google/uuid" - "github.com/nspcc-dev/neo-go/pkg/util/slice" "github.com/stretchr/testify/require" ) @@ -179,7 +179,7 @@ func TestContainerProtocolV2(t *testing.T) { breakSign: func(m *v2session.Token) { body := m.GetBody() key := body.GetSessionKey() - cp := slice.Copy(key) + cp := bytes.Clone(key) cp[len(cp)-1]++ body.SetSessionKey(cp) }, diff --git a/session/doc.go b/session/doc.go index 12ec0c47..98858f73 100644 --- a/session/doc.go +++ b/session/doc.go @@ -28,7 +28,7 @@ Instances can be also used to process FrostFS API V2 protocol messages On client side: - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" var msg session.Token tok.WriteToV2(&msg) diff --git a/session/object.go b/session/object.go index 86ea7cb2..385ca034 100644 --- a/session/object.go +++ b/session/object.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" ) @@ -17,7 +17,7 @@ import ( // limited validity period, and applies to a strictly defined set of operations. // See methods for details. // -// Object is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session.Token +// Object is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session.Token // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. @@ -237,6 +237,7 @@ const ( VerbObjectDelete // Delete rpc VerbObjectRange // GetRange rpc VerbObjectRangeHash // GetRangeHash rpc + VerbObjectPatch // Patch rpc ) // ForVerb specifies the object operation of the session scope. Each diff --git a/session/object_test.go b/session/object_test.go index 1df0f76b..4d207738 100644 --- a/session/object_test.go +++ b/session/object_test.go @@ -1,14 +1,15 @@ package session_test import ( + "bytes" "crypto/ecdsa" "fmt" "math" "math/rand" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" + v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" @@ -19,7 +20,6 @@ import ( usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" "github.com/google/uuid" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neo-go/pkg/util/slice" "github.com/stretchr/testify/require" ) @@ -200,7 +200,7 @@ func TestObjectProtocolV2(t *testing.T) { breakSign: func(m *v2session.Token) { body := m.GetBody() key := body.GetSessionKey() - cp := slice.Copy(key) + cp := bytes.Clone(key) cp[len(cp)-1]++ body.SetSessionKey(cp) }, @@ -599,6 +599,7 @@ func TestObject_ForVerb(t *testing.T) { session.VerbObjectRangeHash: v2session.ObjectVerbRangeHash, session.VerbObjectRange: v2session.ObjectVerbRange, session.VerbObjectDelete: v2session.ObjectVerbDelete, + session.VerbObjectPatch: v2session.ObjectVerbPatch, } { val.ForVerb(from) diff --git a/syncTree.sh b/syncTree.sh index 90eeba72..d3d2ab80 100755 --- a/syncTree.sh +++ b/syncTree.sh @@ -1,6 +1,6 @@ #!/bin/bash -REVISION="b3695411d907c3c65485bab04f9ff8479a72906b" +REVISION="00a88b99368d7141380f65d9cb446f1e4771ba01" echo "tree service revision ${REVISION}" @@ -9,11 +9,6 @@ echo "tree service revision ${REVISION}" FILES=$(curl -s https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/${REVISION}/pkg/services/tree | sed -n "s,.*\"/TrueCloudLab/frostfs-node/src/commit/${REVISION}/pkg/services/tree/\([^.]*\.pb\.go\)\".*,\1,p") for file in $FILES; do - if [[ $file == *"frostfs"* ]]; then - echo "skip '$file'" - continue - else - echo "sync '$file' in tree service" - fi + echo "sync '$file' in tree service" curl -s "https://git.frostfs.info/TrueCloudLab/frostfs-node/raw/commit/${REVISION}/pkg/services/tree/${file}" -o "./pool/tree/service/${file}" done diff --git a/user/doc.go b/user/doc.go index 4809e4a3..d4e0b4b1 100644 --- a/user/doc.go +++ b/user/doc.go @@ -39,7 +39,7 @@ Instances can be also used to process FrostFS API protocol messages On client side: - import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" var msg refs.OwnerID id.WriteToV2(&msg) diff --git a/user/id.go b/user/id.go index 8535b01c..c77ae677 100644 --- a/user/id.go +++ b/user/id.go @@ -4,28 +4,28 @@ import ( "bytes" "errors" "fmt" + "strings" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/util" ) -const idSize = 25 - -var zeroSlice = bytes.Repeat([]byte{0}, idSize) +// idFullSize is the size of ID in bytes, including prefix and checksum. +const idFullSize = util.Uint160Size + 5 // ID identifies users of the FrostFS system. // -// ID is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs.OwnerID +// ID is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs.OwnerID // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. Zero ID is not valid, // so it MUST be initialized using some modifying function (e.g. SetScriptHash, // IDFromKey, etc.). type ID struct { - w []byte + w util.Uint160 } // ReadFromV2 reads ID from the refs.OwnerID message. Returns an error if @@ -33,22 +33,7 @@ type ID struct { // // See also WriteToV2. func (x *ID) ReadFromV2(m refs.OwnerID) error { - w := m.GetValue() - if len(w) != idSize { - return fmt.Errorf("invalid length %d, expected %d", len(w), idSize) - } - - if w[0] != address.NEO3Prefix { - return fmt.Errorf("invalid prefix byte 0x%X, expected 0x%X", w[0], address.NEO3Prefix) - } - - if !bytes.Equal(w[21:], hash.Checksum(w[:21])) { - return errors.New("checksum mismatch") - } - - x.w = w - - return nil + return x.setUserID(m.GetValue()) } // WriteToV2 writes ID to the refs.OwnerID message. @@ -56,20 +41,17 @@ func (x *ID) ReadFromV2(m refs.OwnerID) error { // // See also ReadFromV2. func (x ID) WriteToV2(m *refs.OwnerID) { - m.SetValue(x.w) + m.SetValue(x.WalletBytes()) } // SetScriptHash forms user ID from wallet address scripthash. func (x *ID) SetScriptHash(scriptHash util.Uint160) { - if cap(x.w) < idSize { - x.w = make([]byte, idSize) - } else if len(x.w) < idSize { - x.w = x.w[:idSize] - } + x.w = scriptHash +} - x.w[0] = address.Prefix - copy(x.w[1:], scriptHash.BytesBE()) - copy(x.w[21:], hash.Checksum(x.w[:21])) +// ScriptHash calculates and returns script hash of ID. +func (x *ID) ScriptHash() util.Uint160 { + return x.w } // WalletBytes returns FrostFS user ID as Neo3 wallet address in a binary format. @@ -78,14 +60,18 @@ func (x *ID) SetScriptHash(scriptHash util.Uint160) { // // See also Neo3 wallet docs. func (x ID) WalletBytes() []byte { - return x.w + v := make([]byte, idFullSize) + v[0] = address.Prefix + copy(v[1:], x.w[:]) + copy(v[21:], hash.Checksum(v[:21])) + return v } // EncodeToString encodes ID into FrostFS API V2 protocol string. // // See also DecodeString. func (x ID) EncodeToString() string { - return base58.Encode(x.w) + return base58.Encode(x.WalletBytes()) } // DecodeString decodes FrostFS API V2 protocol string. Returns an error @@ -95,14 +81,11 @@ func (x ID) EncodeToString() string { // // See also EncodeToString. func (x *ID) DecodeString(s string) error { - var err error - - x.w, err = base58.Decode(s) + w, err := base58.Decode(s) if err != nil { return fmt.Errorf("decode base58: %w", err) } - - return nil + return x.setUserID(w) } // String implements fmt.Stringer. @@ -116,10 +99,34 @@ func (x ID) String() string { // Equals defines a comparison relation between two ID instances. func (x ID) Equals(x2 ID) bool { - return bytes.Equal(x.w, x2.w) + return x.w == x2.w } // IsEmpty returns True, if ID is empty value. func (x ID) IsEmpty() bool { - return bytes.Equal(zeroSlice, x.w) + return x.w == util.Uint160{} +} + +func (x *ID) setUserID(w []byte) error { + if len(w) != idFullSize { + return fmt.Errorf("invalid length %d, expected %d", len(w), idFullSize) + } + + if w[0] != address.NEO3Prefix { + return fmt.Errorf("invalid prefix byte 0x%X, expected 0x%X", w[0], address.NEO3Prefix) + } + + if !bytes.Equal(w[21:], hash.Checksum(w[:21])) { + return errors.New("checksum mismatch") + } + + copy(x.w[:], w[1:21]) + + return nil +} + +// Cmp returns an integer comparing two base58 encoded user ID lexicographically. +// The result will be 0 if id1 == id2, -1 if id1 < id2, and +1 if id1 > id2. +func (x ID) Cmp(x2 ID) int { + return strings.Compare(x.EncodeToString(), x2.EncodeToString()) } diff --git a/user/id_test.go b/user/id_test.go index 6b1d0f89..c253336b 100644 --- a/user/id_test.go +++ b/user/id_test.go @@ -1,15 +1,18 @@ package user_test import ( + "bytes" "crypto/rand" + "slices" + "strings" "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" . "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" "github.com/mr-tron/base58" + "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/nspcc-dev/neo-go/pkg/util/slice" "github.com/stretchr/testify/require" ) @@ -47,6 +50,18 @@ func TestID_SetScriptHash(t *testing.T) { require.True(t, id2.Equals(id)) } +func TestID_ScriptHash(t *testing.T) { + userID := usertest.ID() + + scriptHash := userID.ScriptHash() + + ownerAddress := userID.EncodeToString() + decodedScriptHash, err := address.StringToUint160(ownerAddress) + require.NoError(t, err) + + require.True(t, scriptHash.Equals(decodedScriptHash)) +} + func TestV2_ID(t *testing.T) { id := usertest.ID() var m refs.OwnerID @@ -70,7 +85,7 @@ func TestV2_ID(t *testing.T) { }) t.Run("invalid prefix", func(t *testing.T) { - val := slice.Copy(val) + val := bytes.Clone(val) val[0]++ m.SetValue(val) @@ -80,7 +95,7 @@ func TestV2_ID(t *testing.T) { }) t.Run("invalid checksum", func(t *testing.T) { - val := slice.Copy(val) + val := bytes.Clone(val) val[21]++ m.SetValue(val) @@ -119,3 +134,16 @@ func TestID_Equal(t *testing.T) { require.True(t, id3.Equals(id1)) // commutativity require.False(t, id1.Equals(id2)) } + +func TestID_Cmp(t *testing.T) { + id1 := usertest.ID() + id2 := usertest.ID() + id3 := usertest.ID() + + arr := []ID{id1, id2, id3} + + slices.SortFunc(arr, ID.Cmp) + for i := 1; i < len(arr); i++ { + require.NotEqual(t, strings.Compare(arr[i-1].EncodeToString(), arr[i].EncodeToString()), 1, "array is not sorted correctly") + } +} diff --git a/version/version.go b/version/version.go index 47e61c89..24119665 100644 --- a/version/version.go +++ b/version/version.go @@ -3,12 +3,12 @@ package version import ( "fmt" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" ) // Version represents revision number in SemVer scheme. // -// Version is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs.Version +// Version is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs.Version // message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. diff --git a/version/version_test.go b/version/version_test.go index fdf2b6ab..97cec9a5 100644 --- a/version/version_test.go +++ b/version/version_test.go @@ -3,7 +3,7 @@ package version import ( "testing" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs" "github.com/stretchr/testify/require" )