Compare commits
No commits in common. "master" and "buff_pool" have entirely different histories.
400 changed files with 2642 additions and 89240 deletions
|
@ -13,7 +13,7 @@ jobs:
|
|||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.23'
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Run commit format checker
|
||||
uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3
|
||||
|
|
|
@ -11,7 +11,7 @@ jobs:
|
|||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.23'
|
||||
go-version: '1.21'
|
||||
cache: true
|
||||
|
||||
- name: Install linters
|
||||
|
@ -25,7 +25,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go_versions: [ '1.22', '1.23' ]
|
||||
go_versions: [ '1.20', '1.21' ]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
3
.gitattributes
vendored
3
.gitattributes
vendored
|
@ -2,6 +2,3 @@
|
|||
/pkg/policy/parser/generate.go diff
|
||||
**/*.interp -diff
|
||||
**/*.tokens -diff
|
||||
/**/*.pb.go -diff -merge
|
||||
/**/*.pb.go linguist-generated=true
|
||||
/go.sum -diff
|
||||
|
|
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
* @TrueCloudLab/storage-core @TrueCloudLab/storage-services
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -23,7 +23,7 @@ coverage.txt
|
|||
coverage.html
|
||||
|
||||
# antlr tool jar
|
||||
antlr*.jar
|
||||
antlr-*.jar
|
||||
|
||||
# tempfiles
|
||||
.cache
|
||||
|
|
|
@ -12,8 +12,7 @@ run:
|
|||
# output configuration options
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||
formats:
|
||||
- format: tab
|
||||
format: tab
|
||||
|
||||
# all available settings of specific linters
|
||||
linters-settings:
|
||||
|
@ -52,7 +51,7 @@ linters:
|
|||
- bidichk
|
||||
- durationcheck
|
||||
- exhaustive
|
||||
- copyloopvar
|
||||
- exportloopref
|
||||
- gofmt
|
||||
- goimports
|
||||
- misspell
|
||||
|
@ -63,7 +62,5 @@ linters:
|
|||
- funlen
|
||||
- gocognit
|
||||
- contextcheck
|
||||
- protogetter
|
||||
- intrange
|
||||
disable-all: true
|
||||
fast: false
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
.* @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-services-committers @TrueCloudLab/storage-services-developers
|
||||
.forgejo/.* @potyarkin
|
||||
Makefile @potyarkin
|
|
@ -1,4 +1,4 @@
|
|||
FROM golang:1.22
|
||||
FROM golang:1.21
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install make openjdk-17-jre -y
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install make openjdk-11-jre -y
|
||||
WORKDIR /work
|
||||
|
|
85
Makefile
85
Makefile
|
@ -1,81 +1,17 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
ANTLR_VERSION=4.13.1
|
||||
ANTLR_VERSION="4.13.0"
|
||||
TMP_DIR := .cache
|
||||
LINT_VERSION ?= 1.61.0
|
||||
TRUECLOUDLAB_LINT_VERSION ?= 0.0.7
|
||||
LINT_VERSION ?= 1.56.2
|
||||
TRUECLOUDLAB_LINT_VERSION ?= 0.0.2
|
||||
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_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:
|
||||
@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)
|
||||
|
||||
|
||||
# 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 \
|
||||
--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:
|
||||
@printf "⇒ Download requirements: "
|
||||
|
@ -117,8 +53,7 @@ format:
|
|||
|
||||
policy:
|
||||
@wget -q https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar -O antlr4-tool.jar
|
||||
@java -Xmx500M -cp antlr4-tool.jar org.antlr.v4.Tool -Dlanguage=Go \
|
||||
-no-listener -visitor netmap/parser/Query.g4 netmap/parser/QueryLexer.g4
|
||||
@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
|
||||
|
||||
# Run `make %` in truecloudlab/frostfs-sdk-go container(Golang+Java)
|
||||
docker/%:
|
||||
|
@ -142,15 +77,3 @@ 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
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package accounting
|
||||
|
||||
import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting"
|
||||
import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting"
|
||||
|
||||
// Decimal represents decimal number for accounting operations.
|
||||
//
|
||||
// Decimal is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting.Decimal
|
||||
// Decimal is mutually compatible with git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting.Decimal
|
||||
// message. See ReadFromV2 / WriteToV2 methods.
|
||||
//
|
||||
// Instances can be created using built-in var declaration.
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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-sdk-go/api/accounting"
|
||||
import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting"
|
||||
|
||||
var msg accounting.Decimal
|
||||
dec.WriteToV2(&msg)
|
||||
|
|
52
ape/chain.go
52
ape/chain.go
|
@ -1,52 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
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()
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
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)
|
||||
})
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
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)
|
||||
}
|
|
@ -1,424 +0,0 @@
|
|||
// 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() {}
|
|
@ -1,45 +0,0 @@
|
|||
//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
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
//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)
|
||||
})
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,178 +0,0 @@
|
|||
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)
|
||||
}
|
|
@ -1,559 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
// 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",
|
||||
}
|
|
@ -1,544 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,186 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
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) },
|
||||
)
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
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()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
|
@ -1,592 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
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"
|
||||
)
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,70 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,350 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
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) },
|
||||
)
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
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
|
||||
}
|
426
api/acl/types.go
426
api/acl/types.go
|
@ -1,426 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,376 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,383 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
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) },
|
||||
)
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,358 +0,0 @@
|
|||
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)
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,265 +0,0 @@
|
|||
// 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",
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,205 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
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) },
|
||||
)
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,226 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
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)
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
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())
|
||||
}
|
|
@ -1,899 +0,0 @@
|
|||
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)
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,383 +0,0 @@
|
|||
// 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",
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,447 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,469 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,407 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
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) },
|
||||
)
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
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
|
||||
)
|
|
@ -1,15 +0,0 @@
|
|||
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,
|
||||
)
|
||||
}
|
|
@ -1,240 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,514 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,148 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,148 +0,0 @@
|
|||
// 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
|
||||
}
|
|
@ -1,916 +0,0 @@
|
|||
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)
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,251 +0,0 @@
|
|||
// 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",
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,62 +0,0 @@
|
|||
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))
|
||||
}
|
|
@ -1,576 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
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) },
|
||||
)
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,335 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,783 +0,0 @@
|
|||
package netmap
|
||||
|
||||
import (
|
||||
"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
|
||||
}
|
||||
|
||||
func (ni *NodeInfo) GetPublicKey() []byte {
|
||||
if ni != nil {
|
||||
return ni.publicKey
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ni *NodeInfo) SetPublicKey(v []byte) {
|
||||
ni.publicKey = v
|
||||
}
|
||||
|
||||
// GetAddress returns node's network address.
|
||||
//
|
||||
// Deprecated: use IterateAddresses.
|
||||
func (ni *NodeInfo) GetAddress() (addr string) {
|
||||
ni.IterateAddresses(func(s string) bool {
|
||||
addr = s
|
||||
return true
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// SetAddress sets node's network address.
|
||||
//
|
||||
// Deprecated: use SetAddresses.
|
||||
func (ni *NodeInfo) SetAddress(v string) {
|
||||
ni.SetAddresses(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
|
||||
}
|
||||
|
||||
// IterateAddresses iterates over network addresses of the node.
|
||||
// Breaks iteration on f's true return.
|
||||
//
|
||||
// Handler should not be nil.
|
||||
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
|
||||
}
|
||||
|
||||
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.
|
||||
func (x *NetworkConfig) NumberOfParameters() int {
|
||||
if x != nil {
|
||||
return len(x.ps)
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// IterateParameters iterates over network parameters.
|
||||
// Breaks iteration on f's true return.
|
||||
//
|
||||
// Handler must not be nil.
|
||||
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
|
||||
}
|
|
@ -1,187 +0,0 @@
|
|||
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
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
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()))
|
||||
})
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
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()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,58 +0,0 @@
|
|||
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 = ""
|
||||
)
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue