Compare commits

..

No commits in common. "master" and "fix/patch/1" have entirely different histories.

162 changed files with 4007 additions and 4685 deletions

View file

@ -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

View file

@ -11,7 +11,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.23'
go-version: '1.20'
cache: true
- name: golangci-lint
@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_versions: [ '1.22', '1.23' ]
go_versions: [ '1.19', '1.20' ]
fail-fast: false
steps:
- uses: actions/checkout@v3
@ -47,7 +47,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.23'
go-version: '1.20'
cache: true
- name: Run tests

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.idea
bin
temp
/vendor/

View file

@ -50,7 +50,7 @@ linters:
- bidichk
- durationcheck
- exhaustive
- copyloopvar
- exportloopref
- gofmt
- goimports
- misspell

View file

@ -37,6 +37,6 @@ repos:
language: system
- repo: https://github.com/golangci/golangci-lint
rev: v1.60.3
rev: v1.56.2
hooks:
- id: golangci-lint

View file

@ -47,4 +47,4 @@ Initial public release.
This project is a fork of [NeoFS](https://github.com/nspcc-dev/neofs-api-go) from version v2.14.0.
To see CHANGELOG for older versions, refer to https://github.com/nspcc-dev/neofs-api-go/blob/master/CHANGELOG.md.
[Unreleased]: https://git.frostfs.info/TrueCloudLab/frostfs-api-go/compare/v2.16.0...master
[Unreleased]: https://github.com/TrueCloudLab/compare/v2.15.0...master

View file

@ -3,8 +3,8 @@
First, thank you for contributing! We love and encourage pull requests from
everyone. Please follow the guidelines:
- Check the open [issues](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/issues) and
[pull requests](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/pulls) for existing
- Check the open [issues](https://github.com/TrueCloudLab/frostfs-api-go/issues) and
[pull requests](https://github.com/TrueCloudLab/frostfs-api-go/pulls) for existing
discussions.
- Open an issue first, to discuss a new feature or enhancement.
@ -26,18 +26,18 @@ send a pull request. We encourage pull requests to discuss code changes. Here
are the steps in details:
### Set up your GitHub Repository
Fork [FrostFS node upstream](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/fork) source
Fork [FrostFS node upstream](https://github.com/TrueCloudLab/frostfs-api-go/fork) source
repository to your own personal repository. Copy the URL of your fork (you will
need it for the `git clone` command below).
```sh
$ git clone https://git.frostfs.info/TrueCloudLab/frostfs-api-go
$ git clone https://github.com/TrueCloudLab/frostfs-api-go
```
### Set up git remote as ``upstream``
```sh
$ cd frostfs-api-go
$ git remote add upstream https://git.frostfs.info/TrueCloudLab/frostfs-api-go
$ git remote add upstream https://github.com/TrueCloudLab/frostfs-api-go
$ git fetch upstream
$ git merge upstream/master
...

View file

@ -2,19 +2,8 @@
SHELL = bash
VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 --dirty --always)
PROTOC_VERSION ?= 27.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 fmts fumpt imports protoc test lint version help $(BIN)/protogen protoc-test
.PHONY: dep fmts fumpt imports protoc test lint version help
# Pull go dependencies
dep:
@ -34,7 +23,7 @@ fmts: fumpt imports
# Reformat imports
imports:
@echo "⇒ Processing goimports check"
@for f in `find . -type f -name '*.go' -not -name '*.pb.go' -prune`; do \
@for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \
goimports -w $$f; \
done
@ -43,48 +32,21 @@ fumpt:
@echo "⇒ Processing gofumpt check"
@gofumpt -l -w .
# 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
@GOPRIVATE=github.com/TrueCloudLab go mod vendor
# Install specific version for protobuf lib
@go list -f '{{.Path}}/...@{{.Version}}' -m google.golang.org/protobuf | xargs go install -v
# Protoc generate
@for f in `find . -type f -name '*.proto' -not -path './bin/*' -not -path './util/proto/test/*'`; do \
@for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \
echo "⇒ Processing $$f "; \
$(PROTOC_DIR)/bin/protoc \
--proto_path=.:$(PROTOC_DIR)/include:/usr/local/include \
--plugin=protoc-gen-go-frostfs=$(abspath ./bin/protogen) \
--go-frostfs_out=fuzz=true:. \
--go-frostfs_opt=paths=source_relative \
protoc \
--proto_path=.:./vendor:/usr/local/include \
--go_out=. --go_opt=paths=source_relative \
--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 \
./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=Mutil/proto/test/test.proto=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/test/custom \
--go-frostfs_opt=module=git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 \
--go-frostfs_out=. --go-frostfs_opt=paths=import \
./util/proto/test/test.proto
rm -rf vendor
# Run Unit Test with go test
test: GOFLAGS ?= "-count=1"

View file

@ -6,20 +6,22 @@
</p>
---
![Tests](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/badges/workflows/tests.yml/badge.svg)
[![Report](https://goreportcard.com/badge/git.frostfs.info/TrueCloudLab/frostfs-api-go)](https://goreportcard.com/report/git.frostfs.info/TrueCloudLab/frostfs-api-go)
[![Release](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/badges/release.svg)](https://git.frostfs.info/TrueCloudLab/frostfs-api-go)
![Tests](https://github.com/TrueCloudLab/frostfs-api-go/workflows/frostfs-api-go%20tests/badge.svg)
[![codecov](https://codecov.io/gh/TrueCloudLab/frostfs-api-go/branch/master/graph/badge.svg)](https://codecov.io/gh/TrueCloudLab/frostfs-api-go)
[![Report](https://goreportcard.com/badge/github.com/TrueCloudLab/frostfs-api-go)](https://goreportcard.com/report/github.com/TrueCloudLab/frostfs-api-go)
[![GitHub release](https://img.shields.io/github/release/TrueCloudLab/frostfs-api-go.svg)](https://github.com/TrueCloudLab/frostfs-api-go)
![GitHub license](https://img.shields.io/github/license/TrueCloudLab/frostfs-api-go.svg?style=popout)
# Overview
Go implementation of recent [FrostFS API](https://git.frostfs.info/TrueCloudLab/frostfs-api)
versions. For a more high-level SDK see [FrostFS SDK](https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go).
Go implementation of recent [FrostFS API](https://github.com/TrueCloudLab/frostfs-api)
versions. For a more high-level SDK see [FrostFS SDK](https://github.com/TrueCloudLab/frostfs-sdk-go).
## Frostfs-Api compatibility
|frostfs-api-go version|supported frostfs-api versions|
|:------------------:|:--------------------------:|
|v2.14.x|[v2.14.0](https://git.frostfs.info/TrueCloudLab/frostfs-api/releases/tag/v2.14.0)|
|v2.14.x|[v2.14.0](https://github.com/TrueCloudLab/frostfs-api/releases/tag/v2.14.0)|
## Contributing

View file

@ -0,0 +1,46 @@
package accounting
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetOwnerId sets identifier of the account owner.
func (m *BalanceRequest_Body) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetBody sets body of the request.
func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *BalanceRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *BalanceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetBalance sets balance value of the response.
func (m *BalanceResponse_Body) SetBalance(v *Decimal) {
m.Balance = v
}
// SetBody sets body of the response.
func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *BalanceResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *BalanceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}

BIN
accounting/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,45 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
func DoFuzzProtoBalanceRequest(data []byte) int {
msg := new(BalanceRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBalanceRequest(data []byte) int {
msg := new(BalanceRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoBalanceResponse(data []byte) int {
msg := new(BalanceResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBalanceResponse(data []byte) int {
msg := new(BalanceResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,31 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
import (
testing "testing"
)
func FuzzProtoBalanceRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBalanceRequest(data)
})
}
func FuzzJSONBalanceRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBalanceRequest(data)
})
}
func FuzzProtoBalanceResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBalanceResponse(data)
})
}
func FuzzJSONBalanceResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBalanceResponse(data)
})
}

Binary file not shown.

11
accounting/grpc/types.go Normal file
View file

@ -0,0 +1,11 @@
package accounting
// SetValue sets value of the decimal number.
func (m *Decimal) SetValue(v int64) {
m.Value = v
}
// SetPrecision sets precision of the decimal number.
func (m *Decimal) SetPrecision(v uint32) {
m.Precision = v
}

BIN
accounting/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,26 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
func DoFuzzProtoDecimal(data []byte) int {
msg := new(Decimal)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDecimal(data []byte) int {
msg := new(Decimal)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,21 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
import (
testing "testing"
)
func FuzzProtoDecimal(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDecimal(data)
})
}
func FuzzJSONDecimal(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDecimal(data)
})
}

View file

@ -32,7 +32,7 @@ func BenchmarkTable_ToGRPCMessage(b *testing.B) {
b.Run("to grpc message", func(b *testing.B) {
b.ReportAllocs()
for range b.N {
for i := 0; i < b.N; i++ {
raw := tb.ToGRPCMessage()
if len(tb.GetRecords()) != len(raw.(*aclGrpc.EACLTable).Records) {
b.FailNow()
@ -41,7 +41,7 @@ func BenchmarkTable_ToGRPCMessage(b *testing.B) {
})
b.Run("from grpc message", func(b *testing.B) {
b.ReportAllocs()
for range b.N {
for i := 0; i < b.N; i++ {
tb := new(acl.Table)
if tb.FromGRPCMessage(raw) != nil {
b.FailNow()

View file

@ -187,29 +187,31 @@ func (f *HeaderFilter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func HeaderFiltersToGRPC(fs []HeaderFilter) (res []acl.EACLRecord_Filter) {
func HeaderFiltersToGRPC(fs []HeaderFilter) (res []*acl.EACLRecord_Filter) {
if fs != nil {
res = make([]acl.EACLRecord_Filter, 0, len(fs))
res = make([]*acl.EACLRecord_Filter, 0, len(fs))
for i := range fs {
res = append(res, *fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter))
res = append(res, fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter))
}
}
return
}
func HeaderFiltersFromGRPC(fs []acl.EACLRecord_Filter) (res []HeaderFilter, err error) {
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 fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
}
}
}
return
}
@ -239,29 +241,31 @@ func (t *Target) FromGRPCMessage(m grpc.Message) error {
return nil
}
func TargetsToGRPC(ts []Target) (res []acl.EACLRecord_Target) {
func TargetsToGRPC(ts []Target) (res []*acl.EACLRecord_Target) {
if ts != nil {
res = make([]acl.EACLRecord_Target, 0, len(ts))
res = make([]*acl.EACLRecord_Target, 0, len(ts))
for i := range ts {
res = append(res, *ts[i].ToGRPCMessage().(*acl.EACLRecord_Target))
res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord_Target))
}
}
return
}
func TargetsFromGRPC(fs []acl.EACLRecord_Target) (res []Target, err error) {
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 fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
}
}
}
return
}
@ -305,29 +309,31 @@ func (r *Record) FromGRPCMessage(m grpc.Message) error {
return nil
}
func RecordsToGRPC(ts []Record) (res []acl.EACLRecord) {
func RecordsToGRPC(ts []Record) (res []*acl.EACLRecord) {
if ts != nil {
res = make([]acl.EACLRecord, 0, len(ts))
res = make([]*acl.EACLRecord, 0, len(ts))
for i := range ts {
res = append(res, *ts[i].ToGRPCMessage().(*acl.EACLRecord))
res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord))
}
}
return
}
func RecordsFromGRPC(fs []acl.EACLRecord) (res []Record, err error) {
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 fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
}
}
}
return
}
@ -423,9 +429,9 @@ func (c *APEOverride) ToGRPCMessage() grpc.Message {
m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
if len(c.chains) > 0 {
apeChains := make([]apeGRPC.Chain, len(c.chains))
apeChains := make([]*apeGRPC.Chain, len(c.chains))
for i := range c.chains {
apeChains[i] = *c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
apeChains[i] = c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
}
m.SetChains(apeChains)
}
@ -453,7 +459,7 @@ func (c *APEOverride) FromGRPCMessage(m grpc.Message) error {
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 {
if err := c.chains[i].FromGRPCMessage(apeChains[i]); err != nil {
return err
}
}
@ -472,7 +478,7 @@ func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message {
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))
m.SetAPEOverride(bt.apeOverride.ToGRPCMessage().(*acl.BearerToken_Body_APEOverride))
}
return m

193
acl/grpc/types.go Normal file
View file

@ -0,0 +1,193 @@
package acl
import (
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
)
// SetVersion sets version of EACL rules in table.
func (m *EACLTable) SetVersion(v *refs.Version) {
m.Version = v
}
// SetContainerId sets container identifier of the eACL table.
func (m *EACLTable) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetRecords sets record list of the eACL table.
func (m *EACLTable) SetRecords(v []*EACLRecord) {
m.Records = v
}
// SetOperation sets operation of the eACL record.
func (m *EACLRecord) SetOperation(v Operation) {
m.Operation = v
}
// SetAction sets action of the eACL record.
func (m *EACLRecord) SetAction(v Action) {
m.Action = v
}
// SetFilters sets filter list of the eACL record.
func (m *EACLRecord) SetFilters(v []*EACLRecord_Filter) {
m.Filters = v
}
// SetTargets sets target list of the eACL record.
func (m *EACLRecord) SetTargets(v []*EACLRecord_Target) {
m.Targets = v
}
// SetHeaderType sets header type of the eACL filter.
func (m *EACLRecord_Filter) SetHeaderType(v HeaderType) {
m.HeaderType = v
}
// SetMatchType sets match type of the eACL filter.
func (m *EACLRecord_Filter) SetMatchType(v MatchType) {
m.MatchType = v
}
// SetKey sets key of the eACL filter.
func (m *EACLRecord_Filter) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the eACL filter.
func (m *EACLRecord_Filter) SetValue(v string) {
m.Value = v
}
// SetRole sets target group of the eACL target.
func (m *EACLRecord_Target) SetRole(v Role) {
m.Role = v
}
// SetKeys of the eACL target.
func (m *EACLRecord_Target) SetKeys(v [][]byte) {
m.Keys = v
}
// SetEaclTable sets eACL table of the bearer token.
func (m *BearerToken_Body) SetEaclTable(v *EACLTable) {
m.EaclTable = v
}
func (m *BearerToken_Body) SetAPEOverride(v *BearerToken_Body_APEOverride) {
m.ApeOverride = v
}
func (m *BearerToken_Body_APEOverride) SetChains(v []*ape.Chain) {
m.Chains = v
}
func (m *BearerToken_Body_APEOverride) SetTarget(v *ape.ChainTarget) {
m.Target = v
}
// SetOwnerId sets identifier of the bearer token owner.
func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetLifetime sets lifetime of the bearer token.
func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) {
m.Lifetime = v
}
// SetAllowImpersonate allows impersonate.
func (m *BearerToken_Body) SetAllowImpersonate(v bool) {
m.AllowImpersonate = v
}
// SetBody sets bearer token body.
func (m *BearerToken) SetBody(v *BearerToken_Body) {
m.Body = v
}
// SetSignature sets bearer token signature.
func (m *BearerToken) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetExp sets epoch number of the token expiration.
func (m *BearerToken_Body_TokenLifetime) SetExp(v uint64) {
m.Exp = v
}
// SetNbf sets starting epoch number of the token.
func (m *BearerToken_Body_TokenLifetime) SetNbf(v uint64) {
m.Nbf = v
}
// SetIat sets the number of the epoch in which the token was issued.
func (m *BearerToken_Body_TokenLifetime) SetIat(v uint64) {
m.Iat = v
}
// 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 {
i, ok := Action_value[s]
if ok {
*x = Action(i)
}
return ok
}
// 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 {
i, ok := Role_value[s]
if ok {
*x = Role(i)
}
return ok
}
// 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 {
i, ok := Operation_value[s]
if ok {
*x = Operation(i)
}
return ok
}
// 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 {
i, ok := MatchType_value[s]
if ok {
*x = MatchType(i)
}
return ok
}
// 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 {
i, ok := HeaderType_value[s]
if ok {
*x = HeaderType(i)
}
return ok
}

BIN
acl/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,64 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package acl
func DoFuzzProtoEACLRecord(data []byte) int {
msg := new(EACLRecord)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONEACLRecord(data []byte) int {
msg := new(EACLRecord)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoEACLTable(data []byte) int {
msg := new(EACLTable)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONEACLTable(data []byte) int {
msg := new(EACLTable)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoBearerToken(data []byte) int {
msg := new(BearerToken)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBearerToken(data []byte) int {
msg := new(BearerToken)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,41 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package acl
import (
testing "testing"
)
func FuzzProtoEACLRecord(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoEACLRecord(data)
})
}
func FuzzJSONEACLRecord(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONEACLRecord(data)
})
}
func FuzzProtoEACLTable(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoEACLTable(data)
})
}
func FuzzJSONEACLTable(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONEACLTable(data)
})
}
func FuzzProtoBearerToken(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBearerToken(data)
})
}
func FuzzJSONBearerToken(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBearerToken(data)
})
}

View file

@ -330,18 +330,10 @@ func (bt *BearerTokenBody) SetEACL(v *Table) {
}
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
}

21
ape/grpc/types.go Normal file
View file

@ -0,0 +1,21 @@
package ape
func (t *ChainTarget) SetType(typ TargetType) {
t.Type = typ
}
func (t *ChainTarget) SetName(name string) {
t.Name = name
}
func (c *Chain) SetKind(kind isChain_Kind) {
c.Kind = kind
}
func (cr *Chain_Raw) SetRaw(raw []byte) {
cr.Raw = raw
}
func (cr *Chain_Raw) GetRaw() []byte {
return cr.Raw
}

BIN
ape/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -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
}

View file

@ -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)
})
}

View file

@ -53,10 +53,6 @@ func (c *Chain) SetKind(kind chainKind) {
}
func (c *Chain) GetKind() chainKind {
if c == nil {
return nil
}
return c.kind
}
@ -71,9 +67,5 @@ func (c *ChainRaw) SetRaw(raw []byte) {
}
func (c *ChainRaw) GetRaw() []byte {
if c == nil {
return nil
}
return c.Raw
}

View file

@ -296,9 +296,9 @@ func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message {
if respBody != nil {
respBodygrpc = new(apemanager.ListChainsResponse_Body)
chainsgrpc := make([]apeGRPC.Chain, 0, len(respBody.GetChains()))
chainsgrpc := make([]*apeGRPC.Chain, 0, len(respBody.GetChains()))
for _, chain := range respBody.GetChains() {
chainsgrpc = append(chainsgrpc, *chain.ToGRPCMessage().(*apeGRPC.Chain))
chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apeGRPC.Chain))
}
respBodygrpc.SetChains(chainsgrpc)
@ -317,7 +317,7 @@ func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error {
for _, chaingrpc := range respBodygrpc.GetChains() {
chain := new(ape.Chain)
if err := chain.FromGRPCMessage(&chaingrpc); err != nil {
if err := chain.FromGRPCMessage(chaingrpc); err != nil {
return err
}
chains = append(chains, chain)

106
apemanager/grpc/service.go Normal file
View file

@ -0,0 +1,106 @@
package apemanager
import (
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
func (rb *AddChainRequest_Body) SetTarget(t *ape.ChainTarget) {
rb.Target = t
}
func (rb *AddChainRequest_Body) SetChain(chain *ape.Chain) {
rb.Chain = chain
}
func (r *AddChainRequest) SetBody(rb *AddChainRequest_Body) {
r.Body = rb
}
func (r *AddChainRequest) SetMetaHeader(mh *session.RequestMetaHeader) {
r.MetaHeader = mh
}
func (r *AddChainRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) {
r.VerifyHeader = vh
}
func (rb *AddChainResponse_Body) SetChainId(chainID []byte) {
rb.ChainId = chainID
}
func (r *AddChainResponse) SetBody(rb *AddChainResponse_Body) {
r.Body = rb
}
func (r *AddChainResponse) SetMetaHeader(mh *session.ResponseMetaHeader) {
r.MetaHeader = mh
}
func (r *AddChainResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) {
r.VerifyHeader = vh
}
func (rb *RemoveChainRequest_Body) SetTarget(t *ape.ChainTarget) {
rb.Target = t
}
func (rb *RemoveChainRequest_Body) SetChainId(chainID []byte) {
rb.ChainId = chainID
}
func (r *RemoveChainRequest) SetBody(rb *RemoveChainRequest_Body) {
r.Body = rb
}
func (r *RemoveChainRequest) SetMetaHeader(mh *session.RequestMetaHeader) {
r.MetaHeader = mh
}
func (r *RemoveChainRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) {
r.VerifyHeader = vh
}
func (r *RemoveChainResponse) SetBody(rb *RemoveChainResponse_Body) {
r.Body = rb
}
func (r *RemoveChainResponse) SetMetaHeader(mh *session.ResponseMetaHeader) {
r.MetaHeader = mh
}
func (r *RemoveChainResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) {
r.VerifyHeader = vh
}
func (r *ListChainsRequest_Body) SetTarget(t *ape.ChainTarget) {
r.Target = t
}
func (r *ListChainsRequest) SetBody(rb *ListChainsRequest_Body) {
r.Body = rb
}
func (r *ListChainsRequest) SetMetaHeader(mh *session.RequestMetaHeader) {
r.MetaHeader = mh
}
func (r *ListChainsRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) {
r.VerifyHeader = vh
}
func (rb *ListChainsResponse_Body) SetChains(chains []*ape.Chain) {
rb.Chains = chains
}
func (r *ListChainsResponse) SetBody(rb *ListChainsResponse_Body) {
r.Body = rb
}
func (r *ListChainsResponse) SetMetaHeader(mh *session.ResponseMetaHeader) {
r.MetaHeader = mh
}
func (r *ListChainsResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) {
r.VerifyHeader = vh
}

BIN
apemanager/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,121 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package apemanager
func DoFuzzProtoAddChainRequest(data []byte) int {
msg := new(AddChainRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONAddChainRequest(data []byte) int {
msg := new(AddChainRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoAddChainResponse(data []byte) int {
msg := new(AddChainResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONAddChainResponse(data []byte) int {
msg := new(AddChainResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRemoveChainRequest(data []byte) int {
msg := new(RemoveChainRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRemoveChainRequest(data []byte) int {
msg := new(RemoveChainRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRemoveChainResponse(data []byte) int {
msg := new(RemoveChainResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRemoveChainResponse(data []byte) int {
msg := new(RemoveChainResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListChainsRequest(data []byte) int {
msg := new(ListChainsRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListChainsRequest(data []byte) int {
msg := new(ListChainsRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListChainsResponse(data []byte) int {
msg := new(ListChainsResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListChainsResponse(data []byte) int {
msg := new(ListChainsResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,71 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package apemanager
import (
testing "testing"
)
func FuzzProtoAddChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoAddChainRequest(data)
})
}
func FuzzJSONAddChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONAddChainRequest(data)
})
}
func FuzzProtoAddChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoAddChainResponse(data)
})
}
func FuzzJSONAddChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONAddChainResponse(data)
})
}
func FuzzProtoRemoveChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRemoveChainRequest(data)
})
}
func FuzzJSONRemoveChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRemoveChainRequest(data)
})
}
func FuzzProtoRemoveChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRemoveChainResponse(data)
})
}
func FuzzJSONRemoveChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRemoveChainResponse(data)
})
}
func FuzzProtoListChainsRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListChainsRequest(data)
})
}
func FuzzJSONListChainsRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListChainsRequest(data)
})
}
func FuzzProtoListChainsResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListChainsResponse(data)
})
}
func FuzzJSONListChainsResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListChainsResponse(data)
})
}

View file

@ -16,10 +16,6 @@ func (r *AddChainRequest) SetBody(body *AddChainRequestBody) {
}
func (r *AddChainRequest) GetBody() *AddChainRequestBody {
if r == nil {
return nil
}
return r.body
}
@ -34,10 +30,6 @@ func (rb *AddChainRequestBody) SetTarget(target *ape.ChainTarget) {
}
func (rb *AddChainRequestBody) GetTarget() *ape.ChainTarget {
if rb == nil {
return nil
}
return rb.target
}
@ -46,10 +38,6 @@ func (rb *AddChainRequestBody) SetChain(chain *ape.Chain) {
}
func (rb *AddChainRequestBody) GetChain() *ape.Chain {
if rb == nil {
return nil
}
return rb.chain
}
@ -64,10 +52,6 @@ func (r *AddChainResponse) SetBody(body *AddChainResponseBody) {
}
func (r *AddChainResponse) GetBody() *AddChainResponseBody {
if r == nil {
return nil
}
return r.body
}
@ -80,10 +64,6 @@ func (rb *AddChainResponseBody) SetChainID(chainID []byte) {
}
func (rb *AddChainResponseBody) GetChainID() []byte {
if rb == nil {
return nil
}
return rb.chainID
}
@ -98,10 +78,6 @@ func (r *RemoveChainRequest) SetBody(body *RemoveChainRequestBody) {
}
func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody {
if r == nil {
return nil
}
return r.body
}
@ -116,10 +92,6 @@ func (rb *RemoveChainRequestBody) SetTarget(target *ape.ChainTarget) {
}
func (rb *RemoveChainRequestBody) GetTarget() *ape.ChainTarget {
if rb == nil {
return nil
}
return rb.target
}
@ -128,10 +100,6 @@ func (rb *RemoveChainRequestBody) SetChainID(chainID []byte) {
}
func (rb *RemoveChainRequestBody) GetChainID() []byte {
if rb == nil {
return nil
}
return rb.chainID
}
@ -148,10 +116,6 @@ func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) {
}
func (r *RemoveChainResponse) GetBody() *RemoveChainResponseBody {
if r == nil {
return nil
}
return r.body
}
@ -166,10 +130,6 @@ func (r *ListChainsRequest) SetBody(body *ListChainsRequestBody) {
}
func (r *ListChainsRequest) GetBody() *ListChainsRequestBody {
if r == nil {
return nil
}
return r.body
}
@ -182,10 +142,6 @@ func (rb *ListChainsRequestBody) SetTarget(target *ape.ChainTarget) {
}
func (rb *ListChainsRequestBody) GetTarget() *ape.ChainTarget {
if rb == nil {
return nil
}
return rb.target
}
@ -200,10 +156,6 @@ func (r *ListChainsResponse) SetBody(body *ListChainsResponseBody) {
}
func (r *ListChainsResponse) GetBody() *ListChainsResponseBody {
if r == nil {
return nil
}
return r.body
}
@ -218,9 +170,5 @@ func (r *ListChainsResponseBody) SetChains(chains []*ape.Chain) {
}
func (r *ListChainsResponseBody) GetChains() []*ape.Chain {
if r == nil {
return nil
}
return r.chains
}

View file

@ -1,6 +1,8 @@
package container
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
aclGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc"
container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
netmapGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
@ -37,29 +39,31 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(xs []Attribute) (res []container.Container_Attribute) {
func AttributesToGRPC(xs []Attribute) (res []*container.Container_Attribute) {
if xs != nil {
res = make([]container.Container_Attribute, 0, len(xs))
res = make([]*container.Container_Attribute, 0, len(xs))
for i := range xs {
res = append(res, *xs[i].ToGRPCMessage().(*container.Container_Attribute))
res = append(res, xs[i].ToGRPCMessage().(*container.Container_Attribute))
}
}
return
}
func AttributesFromGRPC(xs []container.Container_Attribute) (res []Attribute, err error) {
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 xs[i] != nil {
err = res[i].FromGRPCMessage(xs[i])
if err != nil {
return
}
}
}
}
return
}
@ -762,3 +766,175 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error {
return r.ResponseHeaders.FromMessage(v)
}
func (r *GetExtendedACLRequestBody) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLRequest_Body
if r != nil {
m = new(container.GetExtendedACLRequest_Body)
m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
}
return m
}
func (r *GetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLRequest_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 *GetExtendedACLRequest) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLRequest
if r != nil {
m = new(container.GetExtendedACLRequest)
m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLRequest_Body))
r.RequestHeaders.ToMessage(m)
}
return m
}
func (r *GetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLRequest)
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(GetExtendedACLRequestBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.RequestHeaders.FromMessage(v)
}
func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLResponse_Body
if r != nil {
m = new(container.GetExtendedACLResponse_Body)
m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable))
m.SetSignature(toSignatureRFC6979(r.sig))
m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken))
}
return m
}
func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
eacl := v.GetEacl()
if eacl == nil {
r.eacl = nil
} else {
if r.eacl == nil {
r.eacl = new(acl.Table)
}
err = r.eacl.FromGRPCMessage(eacl)
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())
}
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 *GetExtendedACLResponse) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLResponse
if r != nil {
m = new(container.GetExtendedACLResponse)
m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLResponse_Body))
r.ResponseHeaders.ToMessage(m)
}
return m
}
func (r *GetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLResponse)
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(GetExtendedACLResponseBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.ResponseHeaders.FromMessage(v)
}

234
container/grpc/service.go Normal file
View file

@ -0,0 +1,234 @@
package container
import (
acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc"
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetContainer sets container of the request.
func (m *PutRequest_Body) SetContainer(v *Container) {
m.Container = v
}
// SetSignature sets signature of the container structure.
func (m *PutRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetBody sets body of the request.
func (m *PutRequest) SetBody(v *PutRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerId sets identifier of the container.
func (m *PutResponse_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the response.
func (m *PutResponse) SetBody(v *PutResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerId sets identifier of the container.
func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetSignature sets signature of the container identifier.
func (m *DeleteRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetBody sets body of the request.
func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetBody sets body of the response.
func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerId sets identifier of the container.
func (m *GetRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the request.
func (m *GetRequest) SetBody(v *GetRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetContainer sets the container structure.
func (m *GetResponse_Body) SetContainer(v *Container) {
m.Container = v
}
// SetSessionToken sets token of the session within which requested
// container was created.
func (m *GetResponse_Body) SetSessionToken(v *session.SessionToken) {
m.SessionToken = v
}
// SetSignature sets signature of the container structure.
func (m *GetResponse_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetBody sets body of the response.
func (m *GetResponse) SetBody(v *GetResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetOwnerId sets identifier of the container owner.
func (m *ListRequest_Body) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetBody sets body of the request.
func (m *ListRequest) SetBody(v *ListRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *ListRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *ListRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerIds sets list of the container identifiers.
func (m *ListResponse_Body) SetContainerIds(v []*refs.ContainerID) {
m.ContainerIds = v
}
// SetBody sets body of the response.
func (m *ListResponse) SetBody(v *ListResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *ListResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *ListResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetContainerId sets identifier of the container.
func (m *GetExtendedACLRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the request.
func (m *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetEacl sets eACL table structure.
func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) {
m.Eacl = v
}
// SetSignature sets signature of the eACL table structure.
func (m *GetExtendedACLResponse_Body) SetSignature(v *refs.SignatureRFC6979) {
m.Signature = v
}
// SetSessionToken sets token of the session within which requested
// eACl table was set.
func (m *GetExtendedACLResponse_Body) SetSessionToken(v *session.SessionToken) {
m.SessionToken = v
}
// SetBody sets body of the response.
func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetExtendedACLResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}

BIN
container/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,159 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
func DoFuzzProtoPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListRequest(data []byte) int {
msg := new(ListRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListRequest(data []byte) int {
msg := new(ListRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListResponse(data []byte) int {
msg := new(ListResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListResponse(data []byte) int {
msg := new(ListResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,91 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
import (
testing "testing"
)
func FuzzProtoPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutRequest(data)
})
}
func FuzzJSONPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutRequest(data)
})
}
func FuzzProtoPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutResponse(data)
})
}
func FuzzJSONPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutResponse(data)
})
}
func FuzzProtoDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteRequest(data)
})
}
func FuzzJSONDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteRequest(data)
})
}
func FuzzProtoDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteResponse(data)
})
}
func FuzzJSONDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteResponse(data)
})
}
func FuzzProtoGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRequest(data)
})
}
func FuzzJSONGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRequest(data)
})
}
func FuzzProtoGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetResponse(data)
})
}
func FuzzJSONGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetResponse(data)
})
}
func FuzzProtoListRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListRequest(data)
})
}
func FuzzJSONListRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListRequest(data)
})
}
func FuzzProtoListResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListResponse(data)
})
}
func FuzzJSONListResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListResponse(data)
})
}

Binary file not shown.

46
container/grpc/types.go Normal file
View file

@ -0,0 +1,46 @@
package container
import (
netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
)
// SetKey sets key to the container attribute.
func (m *Container_Attribute) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the container attribute.
func (m *Container_Attribute) SetValue(v string) {
m.Value = v
}
// SetOwnerId sets identifier of the container owner,
func (m *Container) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetNonce sets nonce of the container structure.
func (m *Container) SetNonce(v []byte) {
m.Nonce = v
}
// SetBasicAcl sets basic ACL of the container.
func (m *Container) SetBasicAcl(v uint32) {
m.BasicAcl = v
}
// SetAttributes sets list of the container attributes.
func (m *Container) SetAttributes(v []*Container_Attribute) {
m.Attributes = v
}
// SetPlacementPolicy sets placement policy of the container.
func (m *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) {
m.PlacementPolicy = v
}
// SetVersion sets version of the container.
func (m *Container) SetVersion(v *refs.Version) {
m.Version = v
}

BIN
container/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,26 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
func DoFuzzProtoContainer(data []byte) int {
msg := new(Container)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONContainer(data []byte) int {
msg := new(Container)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,21 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
import (
testing "testing"
)
func FuzzProtoContainer(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoContainer(data)
})
}
func FuzzJSONContainer(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONContainer(data)
})
}

View file

@ -34,6 +34,12 @@ const (
listReqBodyOwnerField = 1
listRespBodyIDsField = 1
getEACLReqBodyIDField = 1
getEACLRespBodyTableField = 1
getEACLRespBodySignatureField = 2
getEACLRespBodyTokenField = 3
)
func (a *Attribute) StableMarshal(buf []byte) []byte {
@ -343,3 +349,65 @@ func (r *ListResponseBody) StableSize() (size int) {
func (r *ListResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListResponse_Body))
}
func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
protoutil.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid)
return buf
}
func (r *GetExtendedACLRequestBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(getEACLReqBodyIDField, r.cid)
return size
}
func (r *GetExtendedACLRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.GetExtendedACLRequest_Body))
}
func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
var offset int
offset += protoutil.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl)
offset += protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig)
protoutil.NestedStructureMarshal(getEACLRespBodyTokenField, buf[offset:], r.token)
return buf
}
func (r *GetExtendedACLResponseBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(getEACLRespBodyTableField, r.eacl)
size += protoutil.NestedStructureSize(getEACLRespBodySignatureField, r.sig)
size += protoutil.NestedStructureSize(getEACLRespBodyTokenField, r.token)
return size
}
func (r *GetExtendedACLResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.GetExtendedACLResponse_Body))
}

View file

@ -32,5 +32,9 @@ func TestMessageConvert(t *testing.T) {
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.GenerateGetExtendedACLRequestBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequest(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponseBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponse(empty) },
)
}

View file

@ -1,8 +1,7 @@
package containertest
import (
"crypto/rand"
acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test"
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
@ -37,11 +36,8 @@ 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.SetNonce([]byte{1, 2, 3})
m.SetOwnerID(refstest.GenerateOwnerID(false))
m.SetAttributes(GenerateAttributes(false))
m.SetPlacementPolicy(netmaptest.GeneratePlacementPolicy(false))
@ -238,3 +234,52 @@ func GenerateListResponse(empty bool) *container.ListResponse {
return m
}
func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequestBody {
m := new(container.GetExtendedACLRequestBody)
if !empty {
m.SetContainerID(refstest.GenerateContainerID(false))
}
return m
}
func GenerateGetExtendedACLRequest(empty bool) *container.GetExtendedACLRequest {
m := new(container.GetExtendedACLRequest)
if !empty {
m.SetBody(GenerateGetExtendedACLRequestBody(false))
}
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
return m
}
func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLResponseBody {
m := new(container.GetExtendedACLResponseBody)
if !empty {
m.SetEACL(acltest.GenerateTable(false))
}
m.SetSignature(refstest.GenerateSignature(empty))
m.SetSessionToken(sessiontest.GenerateSessionToken(empty))
return m
}
func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLResponse {
m := new(container.GetExtendedACLResponse)
if !empty {
m.SetBody(GenerateGetExtendedACLResponseBody(false))
}
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
return m
}

View file

@ -1,6 +1,7 @@
package container
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
@ -109,6 +110,30 @@ type ListResponse struct {
session.ResponseHeaders
}
type GetExtendedACLRequestBody struct {
cid *refs.ContainerID
}
type GetExtendedACLRequest struct {
body *GetExtendedACLRequestBody
session.RequestHeaders
}
type GetExtendedACLResponseBody struct {
eacl *acl.Table
sig *refs.Signature
token *session.Token
}
type GetExtendedACLResponse struct {
body *GetExtendedACLResponseBody
session.ResponseHeaders
}
func (a *Attribute) GetKey() string {
if a != nil {
return a.key
@ -444,3 +469,81 @@ func (r *ListResponse) GetBody() *ListResponseBody {
func (r *ListResponse) SetBody(v *ListResponseBody) {
r.body = v
}
func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID {
if r != nil {
return r.cid
}
return nil
}
func (r *GetExtendedACLRequestBody) SetContainerID(v *refs.ContainerID) {
r.cid = v
}
func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody {
if r != nil {
return r.body
}
return nil
}
func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) {
r.body = v
}
func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table {
if r != nil {
return r.eacl
}
return nil
}
func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) {
r.eacl = v
}
func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature {
if r != nil {
return r.sig
}
return nil
}
func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) {
// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
v.SetScheme(0)
r.sig = v
}
// GetSessionToken returns token of the session within which requested
// eACL table was set.
func (r *GetExtendedACLResponseBody) GetSessionToken() *session.Token {
if r != nil {
return r.token
}
return nil
}
// SetSessionToken sets token of the session within which requested
// eACL table was set.
func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.Token) {
r.token = v
}
func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody {
if r != nil {
return r.body
}
return nil
}
func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) {
r.body = v
}

20
go.mod
View file

@ -1,28 +1,26 @@
module git.frostfs.info/TrueCloudLab/frostfs-api-go/v2
go 1.22
go 1.20
require (
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0
github.com/VictoriaMetrics/easyproto v0.1.4
github.com/mailru/easyjson v0.7.7
github.com/stretchr/testify v1.8.3
golang.org/x/sync v0.7.0
google.golang.org/grpc v1.66.2
google.golang.org/protobuf v1.34.1
golang.org/x/sync v0.2.0
google.golang.org/grpc v1.55.0
google.golang.org/protobuf v1.33.0
)
require (
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

44
go.sum
View file

@ -2,22 +2,19 @@ git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSV
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA=
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc=
github.com/VictoriaMetrics/easyproto v0.1.4 h1:r8cNvo8o6sR4QShBXQd1bKw/VVLSQma/V2KhTBPf+Sc=
github.com/VictoriaMetrics/easyproto v0.1.4/go.mod h1:QlGlzaJnDfFd8Lk6Ci/fuLxfTo3/GThPs2KH23mv710=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@ -26,20 +23,23 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo=
google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

8
lock/grpc/types.go Normal file
View file

@ -0,0 +1,8 @@
package lock
import refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
// SetMembers sets `members` field.
func (x *Lock) SetMembers(ids []*refs.ObjectID) {
x.Members = ids
}

BIN
lock/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,26 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package lock
func DoFuzzProtoLock(data []byte) int {
msg := new(Lock)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLock(data []byte) int {
msg := new(Lock)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,21 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package lock
import (
testing "testing"
)
func FuzzProtoLock(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLock(data)
})
}
func FuzzJSONLock(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLock(data)
})
}

View file

@ -45,29 +45,31 @@ func (f *Filter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func FiltersToGRPC(fs []Filter) (res []netmap.Filter) {
func FiltersToGRPC(fs []Filter) (res []*netmap.Filter) {
if fs != nil {
res = make([]netmap.Filter, 0, len(fs))
res = make([]*netmap.Filter, 0, len(fs))
for i := range fs {
res = append(res, *fs[i].ToGRPCMessage().(*netmap.Filter))
res = append(res, fs[i].ToGRPCMessage().(*netmap.Filter))
}
}
return
}
func FiltersFromGRPC(fs []netmap.Filter) (res []Filter, err error) {
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 fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
}
}
}
return
}
@ -103,29 +105,31 @@ func (s *Selector) FromGRPCMessage(m grpc.Message) error {
return nil
}
func SelectorsToGRPC(ss []Selector) (res []netmap.Selector) {
func SelectorsToGRPC(ss []Selector) (res []*netmap.Selector) {
if ss != nil {
res = make([]netmap.Selector, 0, len(ss))
res = make([]*netmap.Selector, 0, len(ss))
for i := range ss {
res = append(res, *ss[i].ToGRPCMessage().(*netmap.Selector))
res = append(res, ss[i].ToGRPCMessage().(*netmap.Selector))
}
}
return
}
func SelectorsFromGRPC(ss []netmap.Selector) (res []Selector, err error) {
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 ss[i] != nil {
err = res[i].FromGRPCMessage(ss[i])
if err != nil {
return
}
}
}
}
return
}
@ -159,29 +163,31 @@ func (r *Replica) FromGRPCMessage(m grpc.Message) error {
return nil
}
func ReplicasToGRPC(rs []Replica) (res []netmap.Replica) {
func ReplicasToGRPC(rs []Replica) (res []*netmap.Replica) {
if rs != nil {
res = make([]netmap.Replica, 0, len(rs))
res = make([]*netmap.Replica, 0, len(rs))
for i := range rs {
res = append(res, *rs[i].ToGRPCMessage().(*netmap.Replica))
res = append(res, rs[i].ToGRPCMessage().(*netmap.Replica))
}
}
return
}
func ReplicasFromGRPC(rs []netmap.Replica) (res []Replica, err error) {
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 rs[i] != nil {
err = res[i].FromGRPCMessage(rs[i])
if err != nil {
return
}
}
}
}
return
}
@ -283,29 +289,31 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(as []Attribute) (res []netmap.NodeInfo_Attribute) {
func AttributesToGRPC(as []Attribute) (res []*netmap.NodeInfo_Attribute) {
if as != nil {
res = make([]netmap.NodeInfo_Attribute, 0, len(as))
res = make([]*netmap.NodeInfo_Attribute, 0, len(as))
for i := range as {
res = append(res, *as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute))
res = append(res, as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute))
}
}
return
}
func AttributesFromGRPC(as []netmap.NodeInfo_Attribute) (res []Attribute, err error) {
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 as[i] != nil {
err = res[i].FromGRPCMessage(as[i])
if err != nil {
return
}
}
}
}
return
}
@ -520,13 +528,13 @@ func (x *NetworkConfig) ToGRPCMessage() grpc.Message {
if x != nil {
m = new(netmap.NetworkConfig)
var ps []netmap.NetworkConfig_Parameter
var ps []*netmap.NetworkConfig_Parameter
if ln := len(x.ps); ln > 0 {
ps = make([]netmap.NetworkConfig_Parameter, 0, ln)
ps = make([]*netmap.NetworkConfig_Parameter, 0, ln)
for i := range ln {
ps = append(ps, *x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
for i := 0; i < ln; i++ {
ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
}
}
@ -552,12 +560,14 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error {
ps = make([]NetworkParameter, ln)
for i := range ln {
if err := ps[i].FromGRPCMessage(&psV2[i]); err != nil {
for i := 0; i < ln; i++ {
if psV2[i] != nil {
if err := ps[i].FromGRPCMessage(psV2[i]); err != nil {
return err
}
}
}
}
x.ps = ps
@ -746,10 +756,10 @@ func (x *NetMap) ToGRPCMessage() grpc.Message {
m.SetEpoch(x.epoch)
if x.nodes != nil {
nodes := make([]netmap.NodeInfo, len(x.nodes))
nodes := make([]*netmap.NodeInfo, len(x.nodes))
for i := range x.nodes {
nodes[i] = *x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo)
nodes[i] = x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo)
}
m.SetNodes(nodes)
@ -774,7 +784,7 @@ func (x *NetMap) FromGRPCMessage(m grpc.Message) error {
x.nodes = make([]NodeInfo, len(nodes))
for i := range nodes {
err = x.nodes[i].FromGRPCMessage(&nodes[i])
err = x.nodes[i].FromGRPCMessage(nodes[i])
if err != nil {
return err
}

116
netmap/grpc/service.go Normal file
View file

@ -0,0 +1,116 @@
package netmap
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetBody sets body of the request.
func (m *LocalNodeInfoRequest) SetBody(v *LocalNodeInfoRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *LocalNodeInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *LocalNodeInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetVersion sets version of response body.
func (m *LocalNodeInfoResponse_Body) SetVersion(v *refs.Version) {
m.Version = v
}
// SetNodeInfo sets node info of response body.
func (m *LocalNodeInfoResponse_Body) SetNodeInfo(v *NodeInfo) {
m.NodeInfo = v
}
// SetBody sets body of the response.
func (m *LocalNodeInfoResponse) SetBody(v *LocalNodeInfoResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *LocalNodeInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *LocalNodeInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetBody sets body of the request.
func (x *NetworkInfoRequest) SetBody(v *NetworkInfoRequest_Body) {
x.Body = v
}
// SetMetaHeader sets meta header of the request.
func (x *NetworkInfoRequest) SetMetaHeader(v *session.RequestMetaHeader) {
x.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (x *NetworkInfoRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
x.VerifyHeader = v
}
// SetNetworkInfo sets information about the network.
func (x *NetworkInfoResponse_Body) SetNetworkInfo(v *NetworkInfo) {
x.NetworkInfo = v
}
// SetBody sets body of the response.
func (x *NetworkInfoResponse) SetBody(v *NetworkInfoResponse_Body) {
x.Body = v
}
// SetMetaHeader sets meta header of the response.
func (x *NetworkInfoResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
x.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (x *NetworkInfoResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
x.VerifyHeader = v
}
// SetBody sets body of the request.
func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) {
x.Body = v
}
// SetMetaHeader sets meta header of the request.
func (x *NetmapSnapshotRequest) SetMetaHeader(v *session.RequestMetaHeader) {
x.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (x *NetmapSnapshotRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
x.VerifyHeader = v
}
// SetNetmap sets current Netmap.
func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) {
x.Netmap = v
}
// SetBody sets body of the response.
func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) {
x.Body = v
}
// SetMetaHeader sets meta header of the response.
func (x *NetmapSnapshotResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
x.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (x *NetmapSnapshotResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
x.VerifyHeader = v
}

BIN
netmap/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,121 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
func DoFuzzProtoLocalNodeInfoRequest(data []byte) int {
msg := new(LocalNodeInfoRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLocalNodeInfoRequest(data []byte) int {
msg := new(LocalNodeInfoRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoLocalNodeInfoResponse(data []byte) int {
msg := new(LocalNodeInfoResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLocalNodeInfoResponse(data []byte) int {
msg := new(LocalNodeInfoResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfoRequest(data []byte) int {
msg := new(NetworkInfoRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfoRequest(data []byte) int {
msg := new(NetworkInfoRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfoResponse(data []byte) int {
msg := new(NetworkInfoResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfoResponse(data []byte) int {
msg := new(NetworkInfoResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmapSnapshotRequest(data []byte) int {
msg := new(NetmapSnapshotRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmapSnapshotRequest(data []byte) int {
msg := new(NetmapSnapshotRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmapSnapshotResponse(data []byte) int {
msg := new(NetmapSnapshotResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmapSnapshotResponse(data []byte) int {
msg := new(NetmapSnapshotResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,71 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
import (
testing "testing"
)
func FuzzProtoLocalNodeInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLocalNodeInfoRequest(data)
})
}
func FuzzJSONLocalNodeInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLocalNodeInfoRequest(data)
})
}
func FuzzProtoLocalNodeInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLocalNodeInfoResponse(data)
})
}
func FuzzJSONLocalNodeInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLocalNodeInfoResponse(data)
})
}
func FuzzProtoNetworkInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfoRequest(data)
})
}
func FuzzJSONNetworkInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfoRequest(data)
})
}
func FuzzProtoNetworkInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfoResponse(data)
})
}
func FuzzJSONNetworkInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfoResponse(data)
})
}
func FuzzProtoNetmapSnapshotRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmapSnapshotRequest(data)
})
}
func FuzzJSONNetmapSnapshotRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmapSnapshotRequest(data)
})
}
func FuzzProtoNetmapSnapshotResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmapSnapshotResponse(data)
})
}
func FuzzJSONNetmapSnapshotResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmapSnapshotResponse(data)
})
}

Binary file not shown.

212
netmap/grpc/types.go Normal file
View file

@ -0,0 +1,212 @@
package netmap
// SetReplicas of placement policy.
func (m *PlacementPolicy) SetReplicas(v []*Replica) {
m.Replicas = v
}
// SetContainerBackupFactor of placement policy.
func (m *PlacementPolicy) SetContainerBackupFactor(v uint32) {
m.ContainerBackupFactor = v
}
// SetSelectors of placement policy.
func (m *PlacementPolicy) SetSelectors(v []*Selector) {
m.Selectors = v
}
// SetFilters of placement policy.
func (m *PlacementPolicy) SetFilters(v []*Filter) {
m.Filters = v
}
// SetUnique of placement policy.
func (m *PlacementPolicy) SetUnique(unique bool) {
m.Unique = unique
}
// SetName of placement filter.
func (m *Filter) SetName(v string) {
m.Name = v
}
// SetKey of placement filter.
func (m *Filter) SetKey(v string) {
m.Key = v
}
// SetOperation of placement filter.
func (m *Filter) SetOp(v Operation) {
m.Op = v
}
// SetValue of placement filter.
func (m *Filter) SetValue(v string) {
m.Value = v
}
// SetFilters sets sub-filters of placement filter.
func (m *Filter) SetFilters(v []*Filter) {
m.Filters = v
}
// SetName of placement selector.
func (m *Selector) SetName(v string) {
m.Name = v
}
// SetCount of nodes of placement selector.
func (m *Selector) SetCount(v uint32) {
m.Count = v
}
// SetAttribute of nodes of placement selector.
func (m *Selector) SetAttribute(v string) {
m.Attribute = v
}
// SetFilter of placement selector.
func (m *Selector) SetFilter(v string) {
m.Filter = v
}
// SetClause of placement selector.
func (m *Selector) SetClause(v Clause) {
m.Clause = v
}
// SetCount of object replica.
func (m *Replica) SetCount(v uint32) {
m.Count = v
}
// SetSelector of object replica.
func (m *Replica) SetSelector(v string) {
m.Selector = v
}
// SetKey sets key to the node attribute.
func (m *NodeInfo_Attribute) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the node attribute.
func (m *NodeInfo_Attribute) SetValue(v string) {
m.Value = v
}
// SetParent sets value of the node parents.
func (m *NodeInfo_Attribute) SetParents(v []string) {
m.Parents = v
}
// SetAddress sets node network address.
//
// Deprecated: use SetAddresses.
func (m *NodeInfo) SetAddress(v string) {
m.SetAddresses([]string{v})
}
// SetAddresses sets list of network addresses of the node.
func (m *NodeInfo) SetAddresses(v []string) {
m.Addresses = v
}
// SetPublicKey sets node public key in a binary format.
func (m *NodeInfo) SetPublicKey(v []byte) {
m.PublicKey = v
}
// SetAttributes sets list of the node attributes.
func (m *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) {
m.Attributes = v
}
// SetState sets node state.
func (m *NodeInfo) SetState(v NodeInfo_State) {
m.State = v
}
// SetCurrentEpoch sets number of the current epoch.
func (x *NetworkInfo) SetCurrentEpoch(v uint64) {
x.CurrentEpoch = v
}
// SetMagicNumber sets magic number of the sidechain.
func (x *NetworkInfo) SetMagicNumber(v uint64) {
x.MagicNumber = v
}
// SetMsPerBlock sets MillisecondsPerBlock network parameter.
func (x *NetworkInfo) SetMsPerBlock(v int64) {
x.MsPerBlock = v
}
// SetNetworkConfig sets NeoFS network configuration.
func (x *NetworkInfo) SetNetworkConfig(v *NetworkConfig) {
x.NetworkConfig = v
}
// 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 {
i, ok := Clause_value[s]
if ok {
*x = Clause(i)
}
return ok
}
// 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 {
i, ok := Operation_value[s]
if ok {
*x = Operation(i)
}
return ok
}
// FromString parses NodeInfo_State from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *NodeInfo_State) FromString(s string) bool {
i, ok := NodeInfo_State_value[s]
if ok {
*x = NodeInfo_State(i)
}
return ok
}
// SetKey sets parameter key.
func (x *NetworkConfig_Parameter) SetKey(v []byte) {
x.Key = v
}
// SetValue sets parameter value.
func (x *NetworkConfig_Parameter) SetValue(v []byte) {
x.Value = v
}
// SetParameters sets NeoFS network parameters.
func (x *NetworkConfig) SetParameters(v []*NetworkConfig_Parameter) {
x.Parameters = v
}
// SetEpoch sets revision number of the Netmap.
func (x *Netmap) SetEpoch(v uint64) {
x.Epoch = v
}
// SetNodes sets nodes presented in the Netmap.
func (x *Netmap) SetNodes(v []*NodeInfo) {
x.Nodes = v
}

BIN
netmap/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,159 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
func DoFuzzProtoFilter(data []byte) int {
msg := new(Filter)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONFilter(data []byte) int {
msg := new(Filter)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSelector(data []byte) int {
msg := new(Selector)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSelector(data []byte) int {
msg := new(Selector)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoReplica(data []byte) int {
msg := new(Replica)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONReplica(data []byte) int {
msg := new(Replica)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPlacementPolicy(data []byte) int {
msg := new(PlacementPolicy)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPlacementPolicy(data []byte) int {
msg := new(PlacementPolicy)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNodeInfo(data []byte) int {
msg := new(NodeInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNodeInfo(data []byte) int {
msg := new(NodeInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmap(data []byte) int {
msg := new(Netmap)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmap(data []byte) int {
msg := new(Netmap)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkConfig(data []byte) int {
msg := new(NetworkConfig)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkConfig(data []byte) int {
msg := new(NetworkConfig)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfo(data []byte) int {
msg := new(NetworkInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfo(data []byte) int {
msg := new(NetworkInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,91 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
import (
testing "testing"
)
func FuzzProtoFilter(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoFilter(data)
})
}
func FuzzJSONFilter(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONFilter(data)
})
}
func FuzzProtoSelector(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSelector(data)
})
}
func FuzzJSONSelector(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSelector(data)
})
}
func FuzzProtoReplica(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoReplica(data)
})
}
func FuzzJSONReplica(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONReplica(data)
})
}
func FuzzProtoPlacementPolicy(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPlacementPolicy(data)
})
}
func FuzzJSONPlacementPolicy(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPlacementPolicy(data)
})
}
func FuzzProtoNodeInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNodeInfo(data)
})
}
func FuzzJSONNodeInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNodeInfo(data)
})
}
func FuzzProtoNetmap(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmap(data)
})
}
func FuzzJSONNetmap(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmap(data)
})
}
func FuzzProtoNetworkConfig(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkConfig(data)
})
}
func FuzzJSONNetworkConfig(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkConfig(data)
})
}
func FuzzProtoNetworkInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfo(data)
})
}
func FuzzJSONNetworkInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfo(data)
})
}

View file

@ -111,7 +111,6 @@ const (
OR
AND
NOT
LIKE
)
const (
@ -335,10 +334,6 @@ func (p *PlacementPolicy) SetContainerBackupFactor(backupFactor uint32) {
}
func (p *PlacementPolicy) GetReplicas() []Replica {
if p == nil {
return nil
}
return p.replicas
}

View file

@ -26,7 +26,7 @@ func BenchmarkAttributesMarshal(b *testing.B) {
b.Run("marshal", func(b *testing.B) {
b.ReportAllocs()
for range b.N {
for i := 0; i < b.N; i++ {
res := AttributesToGRPC(attrs)
if len(res) != len(raw) {
b.FailNow()
@ -35,7 +35,7 @@ func BenchmarkAttributesMarshal(b *testing.B) {
})
b.Run("unmarshal", func(b *testing.B) {
b.ReportAllocs()
for range b.N {
for i := 0; i < b.N; i++ {
res, err := AttributesFromGRPC(raw)
if err != nil || len(res) != len(raw) {
b.FailNow()

View file

@ -142,29 +142,31 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(xs []Attribute) (res []object.Header_Attribute) {
func AttributesToGRPC(xs []Attribute) (res []*object.Header_Attribute) {
if xs != nil {
res = make([]object.Header_Attribute, 0, len(xs))
res = make([]*object.Header_Attribute, 0, len(xs))
for i := range xs {
res = append(res, *xs[i].ToGRPCMessage().(*object.Header_Attribute))
res = append(res, xs[i].ToGRPCMessage().(*object.Header_Attribute))
}
}
return
}
func AttributesFromGRPC(xs []object.Header_Attribute) (res []Attribute, err error) {
func AttributesFromGRPC(xs []*object.Header_Attribute) (res []Attribute, err error) {
if xs != nil {
res = make([]Attribute, len(xs))
for i := range xs {
err = res[i].FromGRPCMessage(&xs[i])
if xs[i] != nil {
err = res[i].FromGRPCMessage(xs[i])
if err != nil {
return
}
}
}
}
return
}
@ -681,9 +683,9 @@ func (s *ECInfo) ToGRPCMessage() grpc.Message {
m = new(object.ECInfo)
if s.Chunks != nil {
chunks := make([]object.ECInfo_Chunk, len(s.Chunks))
chunks := make([]*object.ECInfo_Chunk, len(s.Chunks))
for i := range chunks {
chunks[i] = *s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk)
chunks[i] = s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk)
}
m.Chunks = chunks
}
@ -704,7 +706,7 @@ func (s *ECInfo) FromGRPCMessage(m grpc.Message) error {
} else {
s.Chunks = make([]ECChunk, len(chunks))
for i := range chunks {
if err := s.Chunks[i].FromGRPCMessage(&chunks[i]); err != nil {
if err := s.Chunks[i].FromGRPCMessage(chunks[i]); err != nil {
return err
}
}
@ -1624,29 +1626,31 @@ func (f *SearchFilter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func SearchFiltersToGRPC(fs []SearchFilter) (res []object.SearchRequest_Body_Filter) {
func SearchFiltersToGRPC(fs []SearchFilter) (res []*object.SearchRequest_Body_Filter) {
if fs != nil {
res = make([]object.SearchRequest_Body_Filter, 0, len(fs))
res = make([]*object.SearchRequest_Body_Filter, 0, len(fs))
for i := range fs {
res = append(res, *fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter))
res = append(res, fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter))
}
}
return
}
func SearchFiltersFromGRPC(fs []object.SearchRequest_Body_Filter) (res []SearchFilter, err error) {
func SearchFiltersFromGRPC(fs []*object.SearchRequest_Body_Filter) (res []SearchFilter, err error) {
if fs != nil {
res = make([]SearchFilter, len(fs))
for i := range fs {
err = res[i].FromGRPCMessage(&fs[i])
if fs[i] != nil {
err = res[i].FromGRPCMessage(fs[i])
if err != nil {
return
}
}
}
}
return
}
@ -1823,29 +1827,31 @@ func (r *Range) FromGRPCMessage(m grpc.Message) error {
return nil
}
func RangesToGRPC(rs []Range) (res []object.Range) {
func RangesToGRPC(rs []Range) (res []*object.Range) {
if rs != nil {
res = make([]object.Range, 0, len(rs))
res = make([]*object.Range, 0, len(rs))
for i := range rs {
res = append(res, *rs[i].ToGRPCMessage().(*object.Range))
res = append(res, rs[i].ToGRPCMessage().(*object.Range))
}
}
return
}
func RangesFromGRPC(rs []object.Range) (res []Range, err error) {
func RangesFromGRPC(rs []*object.Range) (res []Range, err error) {
if rs != nil {
res = make([]Range, len(rs))
for i := range rs {
err = res[i].FromGRPCMessage(&rs[i])
if rs[i] != nil {
err = res[i].FromGRPCMessage(rs[i])
if err != nil {
return
}
}
}
}
return
}
@ -2346,8 +2352,8 @@ func (r *PatchRequestBodyPatch) ToGRPCMessage() grpc.Message {
if r != nil {
m = new(object.PatchRequest_Body_Patch)
m.SetSourceRange(r.GetRange().ToGRPCMessage().(*object.Range))
m.SetChunk(r.GetChunk())
m.SetSourceRange(r.Range.ToGRPCMessage().(*object.Range))
m.SetChunk(r.Chunk)
}
return m
@ -2485,7 +2491,7 @@ func (r *PatchResponseBody) ToGRPCMessage() grpc.Message {
if r != nil {
m = new(object.PatchResponse_Body)
m.SetObjectId(r.ObjectID.ToGRPCMessage().(*refsGRPC.ObjectID))
m.SetObjectID(r.ObjectID.ToGRPCMessage().(*refsGRPC.ObjectID))
}
return m

610
object/grpc/service.go Normal file
View file

@ -0,0 +1,610 @@
package object
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetAddress sets address of the requested object.
func (m *GetRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetRaw sets raw flag of the request.
func (m *GetRequest_Body) SetRaw(v bool) {
m.Raw = v
}
// SetBody sets body of the request.
func (m *GetRequest) SetBody(v *GetRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetObjectId sets identifier of the object.
func (m *GetResponse_Body_Init) SetObjectId(v *refs.ObjectID) {
m.ObjectId = v
}
// SetSignature sets signature of the object identifier.
func (m *GetResponse_Body_Init) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetHeader sets header of the object.
func (m *GetResponse_Body_Init) SetHeader(v *Header) {
m.Header = v
}
// GetChunk returns chunk of the object payload bytes.
func (m *GetResponse_Body_Chunk) GetChunk() []byte {
if m != nil {
return m.Chunk
}
return nil
}
// SetChunk sets chunk of the object payload bytes.
func (m *GetResponse_Body_Chunk) SetChunk(v []byte) {
m.Chunk = v
}
// SetInit sets initial part of the object.
func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) {
m.ObjectPart = &GetResponse_Body_Init_{
Init: v,
}
}
// SetChunk sets part of the object payload.
func (m *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) {
m.ObjectPart = v
}
// SetSplitInfo sets part of the object payload.
func (m *GetResponse_Body) SetSplitInfo(v *SplitInfo) {
m.ObjectPart = &GetResponse_Body_SplitInfo{
SplitInfo: v,
}
}
// SetEcInfo sets part of the object payload.
func (m *GetResponse_Body) SetEcInfo(v *ECInfo) {
m.ObjectPart = &GetResponse_Body_EcInfo{
EcInfo: v,
}
}
// SetBody sets body of the response.
func (m *GetResponse) SetBody(v *GetResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetObjectId sets identifier of the object.
func (m *PutRequest_Body_Init) SetObjectId(v *refs.ObjectID) {
m.ObjectId = v
}
// SetSignature sets signature of the object identifier.
func (m *PutRequest_Body_Init) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetHeader sets header of the object.
func (m *PutRequest_Body_Init) SetHeader(v *Header) {
m.Header = v
}
// SetCopiesNumber sets number of the copies to save.
func (m *PutRequest_Body_Init) SetCopiesNumber(v []uint32) {
m.CopiesNumber = v
}
// GetChunk returns chunk of the object payload bytes.
func (m *PutRequest_Body_Chunk) GetChunk() []byte {
if m != nil {
return m.Chunk
}
return nil
}
// SetChunk sets chunk of the object payload bytes.
func (m *PutRequest_Body_Chunk) SetChunk(v []byte) {
m.Chunk = v
}
// SetInit sets initial part of the object.
func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) {
m.ObjectPart = &PutRequest_Body_Init_{
Init: v,
}
}
// SetChunk sets part of the object payload.
func (m *PutRequest_Body) SetChunk(v *PutRequest_Body_Chunk) {
m.ObjectPart = v
}
// SetBody sets body of the request.
func (m *PutRequest) SetBody(v *PutRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *PutRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *PutRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetObjectId sets identifier of the saved object.
func (m *PutResponse_Body) SetObjectId(v *refs.ObjectID) {
m.ObjectId = v
}
// SetBody sets body of the response.
func (m *PutResponse) SetBody(v *PutResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *PutResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *PutResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetAddress sets address of the object to delete.
func (m *DeleteRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetBody sets body of the request.
func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *DeleteRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *DeleteRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetTombstone sets tombstone address.
func (x *DeleteResponse_Body) SetTombstone(v *refs.Address) {
x.Tombstone = v
}
// SetBody sets body of the response.
func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *DeleteResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *DeleteResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetAddress sets address of the object with the requested header.
func (m *HeadRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetMainOnly sets flag to return the minimal header subset.
func (m *HeadRequest_Body) SetMainOnly(v bool) {
m.MainOnly = v
}
// SetRaw sets raw flag of the request.
func (m *HeadRequest_Body) SetRaw(v bool) {
m.Raw = v
}
// SetBody sets body of the request.
func (m *HeadRequest) SetBody(v *HeadRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *HeadRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *HeadRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetHeader sets object header.
func (m *HeaderWithSignature) SetHeader(v *Header) {
m.Header = v
}
// SetSignature of the header.
func (m *HeaderWithSignature) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetHeader sets full header of the object.
func (m *HeadResponse_Body) SetHeader(v *HeaderWithSignature) {
m.Head = &HeadResponse_Body_Header{
Header: v,
}
}
// SetShortHeader sets short header of the object.
func (m *HeadResponse_Body) SetShortHeader(v *ShortHeader) {
m.Head = &HeadResponse_Body_ShortHeader{
ShortHeader: v,
}
}
// SetSplitInfo sets meta info about split hierarchy of the object.
func (m *HeadResponse_Body) SetSplitInfo(v *SplitInfo) {
m.Head = &HeadResponse_Body_SplitInfo{
SplitInfo: v,
}
}
// SetEcInfo sets meta info about the erasure coded object.
func (m *HeadResponse_Body) SetEcInfo(v *ECInfo) {
m.Head = &HeadResponse_Body_EcInfo{
EcInfo: v,
}
}
// SetBody sets body of the response.
func (m *HeadResponse) SetBody(v *HeadResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *HeadResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *HeadResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetMatchType sets match type of the filter.
func (m *SearchRequest_Body_Filter) SetMatchType(v MatchType) {
m.MatchType = v
}
// SetKey sets key to the filtering header.
func (m *SearchRequest_Body_Filter) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the filtering header.
func (m *SearchRequest_Body_Filter) SetValue(v string) {
m.Value = v
}
// SetVersion sets version of the search query.
func (m *SearchRequest_Body) SetVersion(v uint32) {
m.Version = v
}
// SetFilters sets list of the query filters.
func (m *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) {
m.Filters = v
}
// SetContainerId sets container ID of the search requets.
func (m *SearchRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the request.
func (m *SearchRequest) SetBody(v *SearchRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *SearchRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *SearchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetIdList sets list of the identifiers of the matched objects.
func (m *SearchResponse_Body) SetIdList(v []*refs.ObjectID) {
m.IdList = v
}
// SetBody sets body of the response.
func (m *SearchResponse) SetBody(v *SearchResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *SearchResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *SearchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetOffset sets offset of the payload range.
func (m *Range) SetOffset(v uint64) {
m.Offset = v
}
// SetLength sets length of the payload range.
func (m *Range) SetLength(v uint64) {
m.Length = v
}
// SetAddress sets address of the object with the request payload range.
func (m *GetRangeRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetRange sets range of the object payload.
func (m *GetRangeRequest_Body) SetRange(v *Range) {
m.Range = v
}
// SetRaw sets raw flag of the request.
func (m *GetRangeRequest_Body) SetRaw(v bool) {
m.Raw = v
}
// SetBody sets body of the request.
func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetRangeRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRangeRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// GetChunk returns chunk of the object payload range bytes.
func (m *GetRangeResponse_Body_Chunk) GetChunk() []byte {
if m != nil {
return m.Chunk
}
return nil
}
// SetChunk sets chunk of the object payload range bytes.
func (m *GetRangeResponse_Body_Chunk) SetChunk(v []byte) {
m.Chunk = v
}
// SetChunk sets chunk of the object payload.
func (m *GetRangeResponse_Body) SetChunk(v *GetRangeResponse_Body_Chunk) {
m.RangePart = v
}
// SetSplitInfo sets meta info about split hierarchy of the object.
func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) {
m.RangePart = &GetRangeResponse_Body_SplitInfo{
SplitInfo: v,
}
}
// SetEcInfo sets meta info about the erasure-coded object.
func (m *GetRangeResponse_Body) SetEcInfo(v *ECInfo) {
m.RangePart = &GetRangeResponse_Body_EcInfo{
EcInfo: v,
}
}
// SetBody sets body of the response.
func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetRangeResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetRangeResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetAddress sets address of the object with the request payload range.
func (m *GetRangeHashRequest_Body) SetAddress(v *refs.Address) {
m.Address = v
}
// SetRanges sets list of the ranges of the object payload.
func (m *GetRangeHashRequest_Body) SetRanges(v []*Range) {
m.Ranges = v
}
// SetSalt sets salt for the object payload ranges.
func (m *GetRangeHashRequest_Body) SetSalt(v []byte) {
m.Salt = v
}
// Set sets salt for the object payload ranges.
func (m *GetRangeHashRequest_Body) SetType(v refs.ChecksumType) {
m.Type = v
}
// SetBody sets body of the request.
func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the request.
func (m *GetRangeHashRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRangeHashRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetHashList returns list of the range hashes.
func (m *GetRangeHashResponse_Body) SetHashList(v [][]byte) {
m.HashList = v
}
// SetHashList returns list of the range hashes.
func (m *GetRangeHashResponse_Body) SetType(v refs.ChecksumType) {
m.Type = v
}
// SetBody sets body of the response.
func (m *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) {
m.Body = v
}
// SetMetaHeader sets meta header of the response.
func (m *GetRangeHashResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *GetRangeHashResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
// SetObject set object of the body.
func (m *PutSingleRequest_Body) SetObject(o *Object) {
m.Object = o
}
// SetCopiesNumber sets copies number of the body.
func (m *PutSingleRequest_Body) SetCopiesNumber(v []uint32) {
m.CopiesNumber = v
}
// SetBody sets body of the request.
func (m *PutSingleRequest) SetBody(b *PutSingleRequest_Body) {
m.Body = b
}
// SetMetaHeader sets meta header of the request.
func (m *PutSingleRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the request.
func (m *PutSingleRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
// SetBody sets body of the response.
func (m *PutSingleResponse) SetBody(b *PutSingleResponse_Body) {
m.Body = b
}
// SetMetaHeader sets meta header of the response.
func (m *PutSingleResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
// SetVerifyHeader sets verification header of the response.
func (m *PutSingleResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}
func (m *PatchRequest_Body) SetAddress(addr *refs.Address) {
m.Address = addr
}
func (m *PatchRequest_Body) SetNewAttributes(attrs []*Header_Attribute) {
m.NewAttributes = attrs
}
func (m *PatchRequest_Body) SetReplaceAttributes(replaceAttributes bool) {
m.ReplaceAttributes = replaceAttributes
}
func (m *PatchRequest_Body) SetPatch(patch *PatchRequest_Body_Patch) {
m.Patch = patch
}
func (m *PatchRequest_Body_Patch) SetSourceRange(r *Range) {
m.SourceRange = r
}
func (m *PatchRequest_Body_Patch) SetChunk(chunk []byte) {
m.Chunk = chunk
}
func (m *PatchRequest) SetBody(b *PatchRequest_Body) {
m.Body = b
}
func (m *PatchRequest) SetMetaHeader(v *session.RequestMetaHeader) {
m.MetaHeader = v
}
func (m *PatchRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
m.VerifyHeader = v
}
func (m *PatchResponse_Body) SetObjectID(objectID *refs.ObjectID) {
m.ObjectId = objectID
}
func (m *PatchResponse) SetBody(b *PatchResponse_Body) {
m.Body = b
}
func (m *PatchResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
m.MetaHeader = v
}
func (m *PatchResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
m.VerifyHeader = v
}

BIN
object/grpc/service.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,387 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
func DoFuzzProtoGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeadRequest(data []byte) int {
msg := new(HeadRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeadRequest(data []byte) int {
msg := new(HeadRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeaderWithSignature(data []byte) int {
msg := new(HeaderWithSignature)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeaderWithSignature(data []byte) int {
msg := new(HeaderWithSignature)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeadResponse(data []byte) int {
msg := new(HeadResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeadResponse(data []byte) int {
msg := new(HeadResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSearchRequest(data []byte) int {
msg := new(SearchRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSearchRequest(data []byte) int {
msg := new(SearchRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSearchResponse(data []byte) int {
msg := new(SearchResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSearchResponse(data []byte) int {
msg := new(SearchResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRange(data []byte) int {
msg := new(Range)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRange(data []byte) int {
msg := new(Range)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeRequest(data []byte) int {
msg := new(GetRangeRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeRequest(data []byte) int {
msg := new(GetRangeRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeResponse(data []byte) int {
msg := new(GetRangeResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeResponse(data []byte) int {
msg := new(GetRangeResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeHashRequest(data []byte) int {
msg := new(GetRangeHashRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeHashRequest(data []byte) int {
msg := new(GetRangeHashRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeHashResponse(data []byte) int {
msg := new(GetRangeHashResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeHashResponse(data []byte) int {
msg := new(GetRangeHashResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutSingleRequest(data []byte) int {
msg := new(PutSingleRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutSingleRequest(data []byte) int {
msg := new(PutSingleRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutSingleResponse(data []byte) int {
msg := new(PutSingleResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutSingleResponse(data []byte) int {
msg := new(PutSingleResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPatchRequest(data []byte) int {
msg := new(PatchRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPatchRequest(data []byte) int {
msg := new(PatchRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPatchResponse(data []byte) int {
msg := new(PatchResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPatchResponse(data []byte) int {
msg := new(PatchResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,211 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
import (
testing "testing"
)
func FuzzProtoGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRequest(data)
})
}
func FuzzJSONGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRequest(data)
})
}
func FuzzProtoGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetResponse(data)
})
}
func FuzzJSONGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetResponse(data)
})
}
func FuzzProtoPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutRequest(data)
})
}
func FuzzJSONPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutRequest(data)
})
}
func FuzzProtoPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutResponse(data)
})
}
func FuzzJSONPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutResponse(data)
})
}
func FuzzProtoDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteRequest(data)
})
}
func FuzzJSONDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteRequest(data)
})
}
func FuzzProtoDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteResponse(data)
})
}
func FuzzJSONDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteResponse(data)
})
}
func FuzzProtoHeadRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeadRequest(data)
})
}
func FuzzJSONHeadRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeadRequest(data)
})
}
func FuzzProtoHeaderWithSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeaderWithSignature(data)
})
}
func FuzzJSONHeaderWithSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeaderWithSignature(data)
})
}
func FuzzProtoHeadResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeadResponse(data)
})
}
func FuzzJSONHeadResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeadResponse(data)
})
}
func FuzzProtoSearchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSearchRequest(data)
})
}
func FuzzJSONSearchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSearchRequest(data)
})
}
func FuzzProtoSearchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSearchResponse(data)
})
}
func FuzzJSONSearchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSearchResponse(data)
})
}
func FuzzProtoRange(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRange(data)
})
}
func FuzzJSONRange(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRange(data)
})
}
func FuzzProtoGetRangeRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeRequest(data)
})
}
func FuzzJSONGetRangeRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeRequest(data)
})
}
func FuzzProtoGetRangeResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeResponse(data)
})
}
func FuzzJSONGetRangeResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeResponse(data)
})
}
func FuzzProtoGetRangeHashRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeHashRequest(data)
})
}
func FuzzJSONGetRangeHashRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeHashRequest(data)
})
}
func FuzzProtoGetRangeHashResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeHashResponse(data)
})
}
func FuzzJSONGetRangeHashResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeHashResponse(data)
})
}
func FuzzProtoPutSingleRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutSingleRequest(data)
})
}
func FuzzJSONPutSingleRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutSingleRequest(data)
})
}
func FuzzProtoPutSingleResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutSingleResponse(data)
})
}
func FuzzJSONPutSingleResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutSingleResponse(data)
})
}
func FuzzProtoPatchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPatchRequest(data)
})
}
func FuzzJSONPatchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPatchRequest(data)
})
}
func FuzzProtoPatchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPatchResponse(data)
})
}
func FuzzJSONPatchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPatchResponse(data)
})
}

Binary file not shown.

BIN
object/grpc/status.pb.go generated Normal file

Binary file not shown.

197
object/grpc/types.go Normal file
View file

@ -0,0 +1,197 @@
package object
import (
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
// SetKey sets key to the object attribute.
func (m *Header_Attribute) SetKey(v string) {
m.Key = v
}
// SetValue sets value of the object attribute.
func (m *Header_Attribute) SetValue(v string) {
m.Value = v
}
// SetParent sets identifier of the parent object.
func (m *Header_Split) SetParent(v *refs.ObjectID) {
m.Parent = v
}
// SetPrevious sets identifier of the previous object in split-chain.
func (m *Header_Split) SetPrevious(v *refs.ObjectID) {
m.Previous = v
}
// SetParentSignature sets signature of the parent object header.
func (m *Header_Split) SetParentSignature(v *refs.Signature) {
m.ParentSignature = v
}
// SetParentHeader sets parent header structure.
func (m *Header_Split) SetParentHeader(v *Header) {
m.ParentHeader = v
}
// SetChildren sets list of the identifiers of the child objects.
func (m *Header_Split) SetChildren(v []*refs.ObjectID) {
m.Children = v
}
// SetSplitId sets split ID of the object.
func (m *Header_Split) SetSplitId(v []byte) {
m.SplitId = v
}
// SetContainerId sets identifier of the container.
func (m *Header) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetOwnerId sets identifier of the object owner.
func (m *Header) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetCreationEpoch sets creation epoch number.
func (m *Header) SetCreationEpoch(v uint64) {
m.CreationEpoch = v
}
// SetVersion sets version of the object format.
func (m *Header) SetVersion(v *refs.Version) {
m.Version = v
}
// SetPayloadLength sets length of the object payload.
func (m *Header) SetPayloadLength(v uint64) {
m.PayloadLength = v
}
// SetPayloadHash sets hash of the object payload.
func (m *Header) SetPayloadHash(v *refs.Checksum) {
m.PayloadHash = v
}
// SetObjectType sets type of the object.
func (m *Header) SetObjectType(v ObjectType) {
m.ObjectType = v
}
// SetHomomorphicHash sets homomorphic hash of the object payload.
func (m *Header) SetHomomorphicHash(v *refs.Checksum) {
m.HomomorphicHash = v
}
// SetSessionToken sets session token.
func (m *Header) SetSessionToken(v *session.SessionToken) {
m.SessionToken = v
}
// SetAttributes sets list of the object attributes.
func (m *Header) SetAttributes(v []*Header_Attribute) {
m.Attributes = v
}
// SetSplit sets split header.
func (m *Header) SetSplit(v *Header_Split) {
m.Split = v
}
// SetObjectId sets identifier of the object.
func (m *Object) SetObjectId(v *refs.ObjectID) {
m.ObjectId = v
}
// SetSignature sets signature of the object identifier.
func (m *Object) SetSignature(v *refs.Signature) {
m.Signature = v
}
// SetHeader sets header of the object.
func (m *Object) SetHeader(v *Header) {
m.Header = v
}
// SetPayload sets payload bytes of the object.
func (m *Object) SetPayload(v []byte) {
m.Payload = v
}
// SetVersion sets version of the object.
func (m *ShortHeader) SetVersion(v *refs.Version) {
m.Version = v
}
// SetCreationEpoch sets creation epoch number.
func (m *ShortHeader) SetCreationEpoch(v uint64) {
m.CreationEpoch = v
}
// SetOwnerId sets identifier of the object owner.
func (m *ShortHeader) SetOwnerId(v *refs.OwnerID) {
m.OwnerId = v
}
// SetObjectType sets type of the object.
func (m *ShortHeader) SetObjectType(v ObjectType) {
m.ObjectType = v
}
// SetPayloadLength sets length of the object payload.
func (m *ShortHeader) SetPayloadLength(v uint64) {
m.PayloadLength = v
}
// SetPayloadHash sets hash of the object payload.
func (m *ShortHeader) SetPayloadHash(v *refs.Checksum) {
m.PayloadHash = v
}
// SetHomomorphicHash sets homomorphic hash of the object payload.
func (m *ShortHeader) SetHomomorphicHash(v *refs.Checksum) {
m.HomomorphicHash = v
}
// SetSplitId sets id of split hierarchy.
func (m *SplitInfo) SetSplitId(v []byte) {
m.SplitId = v
}
// SetLastPart sets id of most right child in split hierarchy.
func (m *SplitInfo) SetLastPart(v *refs.ObjectID) {
m.LastPart = v
}
// SetLink sets id of linking object in split hierarchy.
func (m *SplitInfo) SetLink(v *refs.ObjectID) {
m.Link = v
}
// FromString parses ObjectType from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *ObjectType) FromString(s string) bool {
i, ok := ObjectType_value[s]
if ok {
*x = ObjectType(i)
}
return ok
}
// 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 {
i, ok := MatchType_value[s]
if ok {
*x = MatchType(i)
}
return ok
}

BIN
object/grpc/types.pb.go generated Normal file

Binary file not shown.

Binary file not shown.

View file

@ -1,102 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
func DoFuzzProtoShortHeader(data []byte) int {
msg := new(ShortHeader)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONShortHeader(data []byte) int {
msg := new(ShortHeader)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeader(data []byte) int {
msg := new(Header)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeader(data []byte) int {
msg := new(Header)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoObject(data []byte) int {
msg := new(Object)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONObject(data []byte) int {
msg := new(Object)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSplitInfo(data []byte) int {
msg := new(SplitInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSplitInfo(data []byte) int {
msg := new(SplitInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoECInfo(data []byte) int {
msg := new(ECInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONECInfo(data []byte) int {
msg := new(ECInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -1,61 +0,0 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
import (
testing "testing"
)
func FuzzProtoShortHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoShortHeader(data)
})
}
func FuzzJSONShortHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONShortHeader(data)
})
}
func FuzzProtoHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeader(data)
})
}
func FuzzJSONHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeader(data)
})
}
func FuzzProtoObject(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoObject(data)
})
}
func FuzzJSONObject(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONObject(data)
})
}
func FuzzProtoSplitInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSplitInfo(data)
})
}
func FuzzJSONSplitInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSplitInfo(data)
})
}
func FuzzProtoECInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoECInfo(data)
})
}
func FuzzJSONECInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONECInfo(data)
})
}

View file

@ -89,13 +89,13 @@ func (x *Lock) ToGRPCMessage() grpc.Message {
if x != nil {
m = new(lock.Lock)
var members []refsGRPC.ObjectID
var members []*refsGRPC.ObjectID
if x.members != nil {
members = make([]refsGRPC.ObjectID, len(x.members))
members = make([]*refsGRPC.ObjectID, len(x.members))
for i := range x.members {
members[i] = *x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
members[i] = x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
}
}
@ -119,7 +119,7 @@ func (x *Lock) FromGRPCMessage(m grpc.Message) error {
var err error
for i := range x.members {
err = x.members[i].FromGRPCMessage(&members[i])
err = x.members[i].FromGRPCMessage(members[i])
if err != nil {
return err
}

View file

@ -1335,8 +1335,8 @@ func (r *PatchRequestBodyPatch) StableMarshal(buf []byte) []byte {
}
var offset int
offset += proto.NestedStructureMarshal(patchRequestBodyPatchRangeField, buf[offset:], r.GetRange())
proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.GetChunk())
offset += proto.NestedStructureMarshal(patchRequestBodyPatchRangeField, buf[offset:], r.Range)
proto.BytesMarshal(patchRequestBodyPatchChunkField, buf[offset:], r.Chunk)
return buf
}
@ -1347,8 +1347,8 @@ func (r *PatchRequestBodyPatch) StableSize() int {
}
var size int
size += proto.NestedStructureSize(patchRequestBodyPatchRangeField, r.GetRange())
size += proto.BytesSize(patchRequestBodyPatchChunkField, r.GetChunk())
size += proto.NestedStructureSize(patchRequestBodyPatchRangeField, r.Range)
size += proto.BytesSize(patchRequestBodyPatchChunkField, r.Chunk)
return size
}

View file

@ -1,7 +1,6 @@
package objecttest
import (
crand "crypto/rand"
"math/rand"
"time"
@ -60,10 +59,7 @@ func generateSplitHeader(empty, withPar bool) *object.SplitHeader {
m := new(object.SplitHeader)
if !empty {
id := make([]byte, 16)
_, _ = crand.Read(id)
m.SetSplitID(id)
m.SetSplitID([]byte{1, 3, 5})
m.SetParent(refstest.GenerateObjectID(false))
m.SetPrevious(refstest.GenerateObjectID(false))
m.SetChildren(refstest.GenerateObjectIDs(false))
@ -95,10 +91,7 @@ func GenerateECHeader(empty bool) *object.ECHeader {
if !empty {
ech.Parent = refstest.GenerateObjectID(empty)
ech.ParentSplitID = make([]byte, 16)
_, _ = crand.Read(ech.ParentSplitID)
ech.ParentSplitID = []byte{1, 2, 3}
ech.ParentSplitParentID = refstest.GenerateObjectID(empty)
ech.ParentAttributes = GenerateAttributes(empty)
ech.Index = 0
@ -157,10 +150,7 @@ func GenerateSplitInfo(empty bool) *object.SplitInfo {
m := new(object.SplitInfo)
if !empty {
id := make([]byte, 16)
_, _ = crand.Read(id)
m.SetSplitID(id)
m.SetSplitID([]byte("splitID"))
m.SetLastPart(refstest.GenerateObjectID(false))
m.SetLink(refstest.GenerateObjectID(false))
}
@ -637,10 +627,7 @@ func GenerateGetRangeHashResponseBody(empty bool) *object.GetRangeHashResponseBo
if !empty {
m.SetType(678)
m.SetHashList([][]byte{
refstest.GenerateChecksum(false).GetSum(),
refstest.GenerateChecksum(false).GetSum(),
})
m.SetHashList([][]byte{{1}, {2}})
}
return m

View file

@ -1615,34 +1615,6 @@ func (r *PatchResponse) SetBody(v *PatchResponseBody) {
r.Body = v
}
func (r *PatchResponseBody) GetObjectID() *refs.ObjectID {
if r != nil {
return r.ObjectID
}
return nil
}
func (r *PatchResponseBody) SetObjectID(objectID *refs.ObjectID) {
r.ObjectID = objectID
}
func (r *PatchRequestBodyPatch) GetChunk() []byte {
if r != nil {
return r.Chunk
}
return nil
}
func (r *PatchRequestBodyPatch) GetRange() *Range {
if r != nil {
return r.Range
}
return nil
}
func (s *ECInfo) getObjectPart() {}
func (s *ECInfo) getHeaderPart() {}

View file

@ -10,7 +10,7 @@ API_PATH=$1
# MOVE FILES FROM API REPO
cd "$API_PATH" || exit 1
ARGS=$(find ./ -name '*.proto' -not -path './bin/*')
ARGS=$(find ./ -name '*.proto' -not -path './vendor/*')
for file in $ARGS; do
dir=$(dirname "$file")
mkdir -p "$API_GO_PATH/$dir/grpc"
@ -19,7 +19,7 @@ done
# MODIFY FILES
cd "$API_GO_PATH" || exit 1
ARGS2=$(find ./ -name '*.proto' -not -path './bin/*')
ARGS2=$(find ./ -name '*.proto')
for file in $ARGS2; do
echo "$file"
sed -i "s/import\ \"\(.*\)\/\(.*\)\.proto\";/import\ \"\1\/grpc\/\2\.proto\";/" $file
@ -30,7 +30,7 @@ cd "$API_GO_PATH" || exit 1
make protoc
# REMOVE PROTO DEFINITIONS
ARGS=$(find ./$prefix -name '*.proto' -not -path './util/*' -not -path './bin/*')
ARGS=$(find ./$prefix -name '*.proto' -not -path './vendor/*' -not -path './util/*')
for file in $ARGS; do
rm "$file"
done

View file

@ -24,7 +24,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) {
b.Run("to grpc message", func(b *testing.B) {
b.ReportAllocs()
for range b.N {
for i := 0; i < b.N; i++ {
raw := ObjectIDListToGRPCMessage(ids)
if len(raw) != len(ids) {
b.FailNow()
@ -33,7 +33,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) {
})
b.Run("from grpc message", func(b *testing.B) {
b.ReportAllocs()
for range b.N {
for i := 0; i < b.N; i++ {
ids, err := ObjectIDListFromGRPCMessage(raw)
if err != nil || len(raw) != len(ids) {
b.FailNow()
@ -42,7 +42,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) {
})
b.Run("marshal", func(b *testing.B) {
b.ReportAllocs()
for range b.N {
for i := 0; i < b.N; i++ {
buf := make([]byte, ObjectIDNestedListSize(1, ids))
n := ObjectIDNestedListMarshal(1, buf, ids)
if n != len(buf) {

View file

@ -52,29 +52,31 @@ func (c *ContainerID) FromGRPCMessage(m grpc.Message) error {
return nil
}
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []refs.ContainerID) {
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []*refs.ContainerID) {
if ids != nil {
res = make([]refs.ContainerID, 0, len(ids))
res = make([]*refs.ContainerID, 0, len(ids))
for i := range ids {
res = append(res, *ids[i].ToGRPCMessage().(*refs.ContainerID))
res = append(res, ids[i].ToGRPCMessage().(*refs.ContainerID))
}
}
return
}
func ContainerIDsFromGRPCMessage(idsV2 []refs.ContainerID) (res []ContainerID, err error) {
func ContainerIDsFromGRPCMessage(idsV2 []*refs.ContainerID) (res []ContainerID, err error) {
if idsV2 != nil {
res = make([]ContainerID, len(idsV2))
for i := range idsV2 {
err = res[i].FromGRPCMessage(&idsV2[i])
if idsV2[i] != nil {
err = res[i].FromGRPCMessage(idsV2[i])
if err != nil {
return
}
}
}
}
return
}
@ -102,29 +104,31 @@ func (o *ObjectID) FromGRPCMessage(m grpc.Message) error {
return nil
}
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []refs.ObjectID) {
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []*refs.ObjectID) {
if ids != nil {
res = make([]refs.ObjectID, 0, len(ids))
res = make([]*refs.ObjectID, 0, len(ids))
for i := range ids {
res = append(res, *ids[i].ToGRPCMessage().(*refs.ObjectID))
res = append(res, ids[i].ToGRPCMessage().(*refs.ObjectID))
}
}
return
}
func ObjectIDListFromGRPCMessage(idsV2 []refs.ObjectID) (res []ObjectID, err error) {
func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) (res []ObjectID, err error) {
if idsV2 != nil {
res = make([]ObjectID, len(idsV2))
for i := range idsV2 {
err = res[i].FromGRPCMessage(&idsV2[i])
if idsV2[i] != nil {
err = res[i].FromGRPCMessage(idsV2[i])
if err != nil {
return
}
}
}
}
return
}

97
refs/grpc/types.go Normal file
View file

@ -0,0 +1,97 @@
package refs
// SetValue sets container identifier in a binary format.
func (x *ContainerID) SetValue(v []byte) {
x.Value = v
}
// SetValue sets object identifier in a binary format.
func (x *ObjectID) SetValue(v []byte) {
x.Value = v
}
// SetValue sets owner identifier in a binary format.
func (x *OwnerID) SetValue(v []byte) {
x.Value = v
}
// SetContainerId sets container identifier of the address.
func (x *Address) SetContainerId(v *ContainerID) {
x.ContainerId = v
}
// SetObjectId sets object identifier of the address.
func (x *Address) SetObjectId(v *ObjectID) {
x.ObjectId = v
}
// SetType in generic checksum structure.
func (x *Checksum) SetType(v ChecksumType) {
x.Type = v
}
// SetSum in generic checksum structure.
func (x *Checksum) SetSum(v []byte) {
x.Sum = v
}
// SetMajor sets major version number.
func (x *Version) SetMajor(v uint32) {
x.Major = v
}
// SetMinor sets minor version number.
func (x *Version) SetMinor(v uint32) {
x.Minor = v
}
// SetKey sets public key in a binary format.
func (x *Signature) SetKey(v []byte) {
x.Key = v
}
// SetSign sets signature.
func (x *Signature) SetSign(v []byte) {
x.Sign = v
}
// SetScheme sets signature scheme.
func (x *Signature) SetScheme(s SignatureScheme) {
x.Scheme = s
}
// SetKey sets public key in a binary format.
func (x *SignatureRFC6979) SetKey(v []byte) {
x.Key = v
}
// SetSign sets signature.
func (x *SignatureRFC6979) SetSign(v []byte) {
x.Sign = v
}
// FromString parses SignatureScheme from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *SignatureScheme) FromString(s string) bool {
i, ok := SignatureScheme_value[s]
if ok {
*x = SignatureScheme(i)
}
return ok
}
// FromString parses ChecksumType from a string representation,
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *ChecksumType) FromString(s string) bool {
i, ok := ChecksumType_value[s]
if ok {
*x = ChecksumType(i)
}
return ok
}

BIN
refs/grpc/types.pb.go generated Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more