Compare commits
No commits in common. "master" and "fix/rpc_apemanager" have entirely different histories.
master
...
fix/rpc_ap
186 changed files with 5186 additions and 5999 deletions
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 184.2 51.8" style="enable-background:new 0 0 184.2 51.8;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{display:none;}
|
||||
.st1{display:inline;}
|
||||
.st2{fill:#01E397;}
|
||||
.st3{display:inline;fill:#010032;}
|
||||
.st4{display:inline;fill:#00E599;}
|
||||
.st5{display:inline;fill:#00AF92;}
|
||||
.st6{fill:#00C3E5;}
|
||||
</style>
|
||||
<g id="Layer_2">
|
||||
<g id="Layer_1-2" class="st0">
|
||||
<g class="st1">
|
||||
<path class="st2" d="M146.6,18.3v7.2h10.9V29h-10.9v10.7h-4V14.8h18v3.5H146.6z"/>
|
||||
<path class="st2" d="M180,15.7c1.7,0.9,3,2.2,4,3.8l-3,2.7c-0.6-1.3-1.5-2.4-2.6-3.3c-1.3-0.7-2.8-1-4.3-1
|
||||
c-1.4-0.1-2.8,0.3-4,1.1c-0.9,0.5-1.5,1.5-1.4,2.6c0,1,0.5,1.9,1.4,2.4c1.5,0.8,3.2,1.3,4.9,1.5c1.9,0.3,3.7,0.8,5.4,1.6
|
||||
c1.2,0.5,2.2,1.3,2.9,2.3c0.6,1,1,2.2,0.9,3.4c0,1.4-0.5,2.7-1.3,3.8c-0.9,1.2-2.1,2.1-3.5,2.6c-1.7,0.6-3.4,0.9-5.2,0.8
|
||||
c-5,0-8.6-1.6-10.7-5l2.9-2.8c0.7,1.4,1.8,2.5,3.1,3.3c1.5,0.7,3.1,1.1,4.7,1c1.5,0.1,2.9-0.2,4.2-0.9c0.9-0.5,1.5-1.5,1.5-2.6
|
||||
c0-0.9-0.5-1.8-1.3-2.2c-1.5-0.7-3.1-1.2-4.8-1.5c-1.9-0.3-3.7-0.8-5.5-1.5c-1.2-0.5-2.2-1.4-3-2.4c-0.6-1-1-2.2-0.9-3.4
|
||||
c0-1.4,0.4-2.7,1.2-3.8c0.8-1.2,2-2.2,3.3-2.8c1.6-0.7,3.4-1.1,5.2-1C176.1,14.3,178.2,14.8,180,15.7z"/>
|
||||
</g>
|
||||
<path class="st3" d="M73.3,16.3c1.9,1.9,2.9,4.5,2.7,7.1v15.9h-4V24.8c0-2.6-0.5-4.5-1.6-5.7c-1.2-1.2-2.8-1.8-4.5-1.7
|
||||
c-1.3,0-2.5,0.3-3.7,0.8c-1.2,0.7-2.2,1.7-2.9,2.9c-0.8,1.5-1.1,3.2-1.1,4.9v13.3h-4V15.1l3.6,1.5v1.7c0.8-1.5,2.1-2.6,3.6-3.3
|
||||
c1.5-0.8,3.2-1.2,4.9-1.1C68.9,13.8,71.3,14.7,73.3,16.3z"/>
|
||||
<path class="st3" d="M104.4,28.3H85.6c0.1,2.2,1,4.3,2.5,5.9c1.5,1.4,3.5,2.2,5.6,2.1c1.6,0.1,3.2-0.2,4.6-0.9
|
||||
c1.1-0.6,2-1.6,2.5-2.8l3.3,1.8c-0.9,1.7-2.3,3.1-4,4c-2,1-4.2,1.5-6.4,1.4c-3.7,0-6.7-1.1-8.8-3.4s-3.2-5.5-3.2-9.6s1-7.2,3-9.5
|
||||
s5-3.4,8.7-3.4c2.1-0.1,4.2,0.5,6.1,1.5c1.6,1,3,2.5,3.8,4.2c0.9,1.8,1.3,3.9,1.3,5.9C104.6,26.4,104.6,27.4,104.4,28.3z
|
||||
M88.1,19.3c-1.4,1.5-2.2,3.4-2.4,5.5h15.1c-0.2-2-1-3.9-2.3-5.5c-1.4-1.3-3.2-2-5.1-1.9C91.5,17.3,89.6,18,88.1,19.3z"/>
|
||||
<path class="st3" d="M131,17.3c2.2,2.3,3.2,5.5,3.2,9.5s-1,7.3-3.2,9.6s-5.1,3.4-8.8,3.4s-6.7-1.1-8.9-3.4s-3.2-5.5-3.2-9.6
|
||||
s1.1-7.2,3.2-9.5s5.1-3.4,8.9-3.4S128.9,15,131,17.3z M116.2,19.9c-1.5,2-2.2,4.4-2.1,6.9c-0.2,2.5,0.6,5,2.1,7
|
||||
c1.5,1.7,3.7,2.7,6,2.6c2.3,0.1,4.4-0.9,5.9-2.6c1.5-2,2.3-4.5,2.1-7c0.1-2.5-0.6-4.9-2.1-6.9c-1.5-1.7-3.6-2.7-5.9-2.6
|
||||
C119.9,17.2,117.7,18.2,116.2,19.9z"/>
|
||||
<polygon class="st4" points="0,9.1 0,43.7 22.5,51.8 22.5,16.9 46.8,7.9 24.8,0 "/>
|
||||
<polygon class="st5" points="24.3,17.9 24.3,36.8 46.8,44.9 46.8,9.6 "/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path class="st6" d="M41.6,17.5H28.2v6.9h10.4v3.3H28.2v10.2h-3.9V14.2h17.2V17.5z"/>
|
||||
<path class="st6" d="M45.8,37.9v-18h3.3l0.4,3.2c0.5-1.2,1.2-2.1,2.1-2.7c0.9-0.6,2.1-0.9,3.5-0.9c0.4,0,0.7,0,1.1,0.1
|
||||
c0.4,0.1,0.7,0.2,0.9,0.3l-0.5,3.4c-0.3-0.1-0.6-0.2-0.9-0.2C55.4,23,54.9,23,54.4,23c-0.7,0-1.5,0.2-2.2,0.6
|
||||
c-0.7,0.4-1.3,1-1.8,1.8s-0.7,1.8-0.7,3v9.5H45.8z"/>
|
||||
<path class="st6" d="M68.6,19.6c1.8,0,3.3,0.4,4.6,1.1c1.3,0.7,2.4,1.8,3.1,3.2s1.1,3.1,1.1,5c0,1.9-0.4,3.6-1.1,5
|
||||
c-0.8,1.4-1.8,2.5-3.1,3.2c-1.3,0.7-2.9,1.1-4.6,1.1s-3.3-0.4-4.6-1.1c-1.3-0.7-2.4-1.8-3.2-3.2c-0.8-1.4-1.2-3.1-1.2-5
|
||||
c0-1.9,0.4-3.6,1.2-5s1.8-2.5,3.2-3.2C65.3,19.9,66.8,19.6,68.6,19.6z M68.6,22.6c-1.1,0-2,0.2-2.8,0.7c-0.8,0.5-1.3,1.2-1.7,2.1
|
||||
s-0.6,2.1-0.6,3.5c0,1.3,0.2,2.5,0.6,3.4s1,1.7,1.7,2.2s1.7,0.7,2.8,0.7c1.1,0,2-0.2,2.7-0.7c0.7-0.5,1.3-1.2,1.7-2.2
|
||||
s0.6-2.1,0.6-3.4c0-1.4-0.2-2.5-0.6-3.5s-1-1.6-1.7-2.1C70.6,22.8,69.6,22.6,68.6,22.6z"/>
|
||||
<path class="st6" d="M89.2,38.3c-1.8,0-3.4-0.3-4.9-1c-1.5-0.7-2.7-1.7-3.5-3l2.7-2.3c0.5,1,1.3,1.8,2.3,2.4
|
||||
c1,0.6,2.2,0.9,3.6,0.9c1.1,0,2-0.2,2.6-0.6c0.6-0.4,1-0.9,1-1.6c0-0.5-0.2-0.9-0.5-1.2s-0.9-0.6-1.7-0.8l-3.8-0.8
|
||||
c-1.9-0.4-3.3-1-4.1-1.9c-0.8-0.9-1.2-1.9-1.2-3.3c0-1,0.3-1.9,0.9-2.7c0.6-0.8,1.4-1.5,2.5-2s2.5-0.8,4-0.8c1.8,0,3.3,0.3,4.6,1
|
||||
c1.3,0.6,2.2,1.5,2.9,2.7l-2.7,2.2c-0.5-1-1.1-1.7-2-2.1c-0.9-0.5-1.8-0.7-2.8-0.7c-0.8,0-1.4,0.1-2,0.3c-0.6,0.2-1,0.5-1.3,0.8
|
||||
c-0.3,0.3-0.4,0.7-0.4,1.2c0,0.5,0.2,0.9,0.5,1.3s1,0.6,1.9,0.8l4.1,0.9c1.7,0.3,2.9,0.9,3.7,1.7c0.7,0.8,1.1,1.8,1.1,2.9
|
||||
c0,1.2-0.3,2.2-0.9,3c-0.6,0.9-1.5,1.6-2.6,2C92.1,38.1,90.7,38.3,89.2,38.3z"/>
|
||||
<path class="st6" d="M112.8,19.9v3H99.3v-3H112.8z M106.6,14.6v17.9c0,0.9,0.2,1.5,0.7,1.9c0.5,0.4,1.1,0.6,1.9,0.6
|
||||
c0.6,0,1.2-0.1,1.7-0.3c0.5-0.2,0.9-0.5,1.3-0.8l0.9,2.8c-0.6,0.5-1.2,0.9-2,1.1c-0.8,0.3-1.7,0.4-2.7,0.4c-1,0-2-0.2-2.8-0.5
|
||||
s-1.5-0.9-2-1.6c-0.5-0.8-0.7-1.7-0.8-3V15.7L106.6,14.6z"/>
|
||||
<path d="M137.9,17.5h-13.3v6.9h10.4v3.3h-10.4v10.2h-3.9V14.2h17.2V17.5z"/>
|
||||
<path d="M150.9,13.8c2.1,0,4,0.4,5.5,1.2c1.6,0.8,2.9,2,4,3.5l-2.6,2.5c-0.9-1.4-1.9-2.4-3.1-3c-1.1-0.6-2.5-0.9-4-0.9
|
||||
c-1.2,0-2.1,0.2-2.8,0.5c-0.7,0.3-1.3,0.7-1.6,1.2c-0.3,0.5-0.5,1.1-0.5,1.7c0,0.7,0.3,1.4,0.8,1.9c0.5,0.6,1.5,1,2.9,1.3
|
||||
l4.8,1.1c2.3,0.5,3.9,1.3,4.9,2.3c1,1,1.4,2.3,1.4,3.9c0,1.5-0.4,2.7-1.2,3.8c-0.8,1.1-1.9,1.9-3.3,2.5s-3.1,0.9-5,0.9
|
||||
c-1.7,0-3.2-0.2-4.5-0.6c-1.3-0.4-2.5-1-3.5-1.8c-1-0.7-1.8-1.6-2.5-2.6l2.7-2.7c0.5,0.8,1.1,1.6,1.9,2.2
|
||||
c0.8,0.7,1.7,1.2,2.7,1.5c1,0.4,2.2,0.5,3.4,0.5c1.1,0,2.1-0.1,2.9-0.4c0.8-0.3,1.4-0.7,1.8-1.2c0.4-0.5,0.6-1.1,0.6-1.9
|
||||
c0-0.7-0.2-1.3-0.7-1.8c-0.5-0.5-1.3-0.9-2.6-1.2l-5.2-1.2c-1.4-0.3-2.6-0.8-3.6-1.3c-0.9-0.6-1.6-1.3-2.1-2.1s-0.7-1.8-0.7-2.8
|
||||
c0-1.3,0.4-2.6,1.1-3.7c0.7-1.1,1.8-2,3.2-2.6C147.3,14.1,148.9,13.8,150.9,13.8z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 5.5 KiB |
|
@ -13,7 +13,7 @@ jobs:
|
|||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.23'
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Run commit format checker
|
||||
uses: https://git.frostfs.info/TrueCloudLab/dco-go@v3
|
||||
|
|
|
@ -11,7 +11,7 @@ jobs:
|
|||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.23'
|
||||
go-version: '1.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
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
* @TrueCloudLab/storage-core @TrueCloudLab/storage-services @TrueCloudLab/committers
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
.idea
|
||||
bin
|
||||
temp
|
||||
/vendor/
|
||||
|
|
|
@ -9,11 +9,13 @@ run:
|
|||
# include test files or not, default is true
|
||||
tests: false
|
||||
|
||||
skip-files:
|
||||
- (^|.*/)grpc/(.*)
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||
formats:
|
||||
- format: tab
|
||||
format: tab
|
||||
|
||||
# all available settings of specific linters
|
||||
linters-settings:
|
||||
|
@ -50,7 +52,7 @@ linters:
|
|||
- bidichk
|
||||
- durationcheck
|
||||
- exhaustive
|
||||
- copyloopvar
|
||||
- exportloopref
|
||||
- gofmt
|
||||
- goimports
|
||||
- misspell
|
||||
|
@ -65,9 +67,6 @@ linters:
|
|||
fast: false
|
||||
|
||||
issues:
|
||||
exclude-files:
|
||||
- (^|.*/)grpc/(.*)
|
||||
|
||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
||||
exclude-rules:
|
||||
- path: v2 # ignore stutters in universal structures due to protobuf compatibility
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
.* @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-services-committers @TrueCloudLab/storage-services-developers
|
||||
.forgejo/.* @potyarkin
|
|
@ -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.
|
||||
|
@ -25,20 +25,19 @@ Start by forking the `frostfs-api-go` repository, make changes in a branch and t
|
|||
send a pull request. We encourage pull requests to discuss code changes. Here
|
||||
are the steps in details:
|
||||
|
||||
### Set up your repository
|
||||
|
||||
Fork [FrostFS node upstream](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/fork) source
|
||||
### Set up your GitHub Repository
|
||||
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
|
||||
...
|
||||
|
@ -87,7 +86,7 @@ $ git push origin feature/123-something_awesome
|
|||
```
|
||||
|
||||
### Create a Pull Request
|
||||
Pull requests can be created via git.frostfs.info. Refer to [this
|
||||
Pull requests can be created via GitHub. Refer to [this
|
||||
document](https://help.github.com/articles/creating-a-pull-request/) for
|
||||
detailed steps on how to create a pull request. After a Pull Request gets peer
|
||||
reviewed and approved, it will be merged.
|
||||
|
|
58
Makefile
58
Makefile
|
@ -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"
|
||||
|
|
16
README.md
16
README.md
|
@ -1,25 +1,27 @@
|
|||
<p align="center">
|
||||
<img src="./.forgejo/logo.svg" width="500px" alt="FrostFS">
|
||||
<img src="./.github/logo.svg" width="500px" alt="FrostFS">
|
||||
</p>
|
||||
<p align="center">
|
||||
Low-level Golang API for <a href="https://frostfs.info">FrostFS</a>
|
||||
</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
|
||||
|
||||
|
|
46
accounting/grpc/service.go
Normal file
46
accounting/grpc/service.go
Normal 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
BIN
accounting/grpc/service.pb.go
generated
Normal file
Binary file not shown.
BIN
accounting/grpc/service_frostfs.pb.go
generated
BIN
accounting/grpc/service_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
BIN
accounting/grpc/service_grpc.pb.go
generated
BIN
accounting/grpc/service_grpc.pb.go
generated
Binary file not shown.
11
accounting/grpc/types.go
Normal file
11
accounting/grpc/types.go
Normal 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
BIN
accounting/grpc/types.pb.go
generated
Normal file
Binary file not shown.
BIN
accounting/grpc/types_frostfs.pb.go
generated
BIN
accounting/grpc/types_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
|
@ -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()
|
||||
|
|
113
acl/convert.go
113
acl/convert.go
|
@ -2,8 +2,6 @@ package acl
|
|||
|
||||
import (
|
||||
acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
|
||||
apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
||||
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
|
||||
|
@ -187,26 +185,28 @@ 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 err != nil {
|
||||
return
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,26 +239,28 @@ 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 err != nil {
|
||||
return
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -305,26 +307,28 @@ 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 err != nil {
|
||||
return
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -414,54 +418,6 @@ func (l *TokenLifetime) FromGRPCMessage(m grpc.Message) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *APEOverride) ToGRPCMessage() grpc.Message {
|
||||
var m *acl.BearerToken_Body_APEOverride
|
||||
|
||||
if c != nil {
|
||||
m = new(acl.BearerToken_Body_APEOverride)
|
||||
|
||||
m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
|
||||
|
||||
if len(c.chains) > 0 {
|
||||
apeChains := make([]apeGRPC.Chain, len(c.chains))
|
||||
for i := range c.chains {
|
||||
apeChains[i] = *c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
|
||||
}
|
||||
m.SetChains(apeChains)
|
||||
}
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (c *APEOverride) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*acl.BearerToken_Body_APEOverride)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
if targetGRPC := v.GetTarget(); targetGRPC != nil {
|
||||
if c.target == nil {
|
||||
c.target = new(ape.ChainTarget)
|
||||
}
|
||||
if err := c.target.FromGRPCMessage(v.GetTarget()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if apeChains := v.GetChains(); len(apeChains) > 0 {
|
||||
c.chains = make([]*ape.Chain, len(apeChains))
|
||||
for i := range apeChains {
|
||||
c.chains[i] = new(ape.Chain)
|
||||
if err := c.chains[i].FromGRPCMessage(&apeChains[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message {
|
||||
var m *acl.BearerToken_Body
|
||||
|
||||
|
@ -472,7 +428,6 @@ 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))
|
||||
}
|
||||
|
||||
return m
|
||||
|
@ -522,19 +477,7 @@ func (bt *BearerTokenBody) FromGRPCMessage(m grpc.Message) error {
|
|||
bt.eacl = new(Table)
|
||||
}
|
||||
|
||||
if err = bt.eacl.FromGRPCMessage(eacl); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if apeOverrideGRPC := v.GetApeOverride(); apeOverrideGRPC != nil {
|
||||
if bt.apeOverride == nil {
|
||||
bt.apeOverride = new(APEOverride)
|
||||
}
|
||||
err = bt.apeOverride.FromGRPCMessage(apeOverrideGRPC)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = bt.eacl.FromGRPCMessage(eacl)
|
||||
}
|
||||
|
||||
bt.impersonate = v.GetAllowImpersonate()
|
||||
|
|
180
acl/grpc/types.go
Normal file
180
acl/grpc/types.go
Normal file
|
@ -0,0 +1,180 @@
|
|||
package acl
|
||||
|
||||
import (
|
||||
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
|
||||
}
|
||||
|
||||
// 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
BIN
acl/grpc/types.pb.go
generated
Normal file
Binary file not shown.
BIN
acl/grpc/types_frostfs.pb.go
generated
BIN
acl/grpc/types_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
|
@ -21,14 +21,6 @@ func (t *Target) UnmarshalJSON(data []byte) error {
|
|||
return message.UnmarshalJSON(t, data, new(acl.EACLRecord_Target))
|
||||
}
|
||||
|
||||
func (a *APEOverride) MarshalJSON() ([]byte, error) {
|
||||
return message.MarshalJSON(a)
|
||||
}
|
||||
|
||||
func (a *APEOverride) UnmarshalJSON(data []byte) error {
|
||||
return message.UnmarshalJSON(a, data, new(acl.BearerToken_Body_APEOverride))
|
||||
}
|
||||
|
||||
func (r *Record) MarshalJSON() ([]byte, error) {
|
||||
return message.MarshalJSON(r)
|
||||
}
|
||||
|
|
|
@ -28,14 +28,10 @@ const (
|
|||
lifetimeNotValidBeforeField = 2
|
||||
lifetimeIssuedAtField = 3
|
||||
|
||||
tokenAPEChainsTargetField = 1
|
||||
tokenAPEChainsChainsField = 2
|
||||
|
||||
bearerTokenBodyACLField = 1
|
||||
bearerTokenBodyOwnerField = 2
|
||||
bearerTokenBodyLifetimeField = 3
|
||||
bearerTokenBodyImpersonate = 4
|
||||
bearerTokenTokenAPEChainsField = 5
|
||||
bearerTokenBodyACLField = 1
|
||||
bearerTokenBodyOwnerField = 2
|
||||
bearerTokenBodyLifetimeField = 3
|
||||
bearerTokenBodyImpersonate = 4
|
||||
|
||||
bearerTokenBodyField = 1
|
||||
bearerTokenSignatureField = 2
|
||||
|
@ -243,42 +239,6 @@ func (l *TokenLifetime) Unmarshal(data []byte) error {
|
|||
return message.Unmarshal(l, data, new(acl.BearerToken_Body_TokenLifetime))
|
||||
}
|
||||
|
||||
func (c *APEOverride) StableMarshal(buf []byte) []byte {
|
||||
if c == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, c.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
offset += protoutil.NestedStructureMarshal(tokenAPEChainsTargetField, buf[offset:], c.target)
|
||||
for i := range c.chains {
|
||||
offset += protoutil.NestedStructureMarshal(tokenAPEChainsChainsField, buf[offset:], c.chains[i])
|
||||
}
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (c *APEOverride) StableSize() (size int) {
|
||||
if c == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
size += protoutil.NestedStructureSize(tokenAPEChainsTargetField, c.target)
|
||||
for i := range c.chains {
|
||||
size += protoutil.NestedStructureSize(tokenAPEChainsChainsField, c.chains[i])
|
||||
}
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (c *APEOverride) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(c, data, new(acl.BearerToken_Body_APEOverride))
|
||||
}
|
||||
|
||||
func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte {
|
||||
if bt == nil {
|
||||
return []byte{}
|
||||
|
@ -293,8 +253,7 @@ func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte {
|
|||
offset += protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl)
|
||||
offset += protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID)
|
||||
offset += protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime)
|
||||
offset += protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate)
|
||||
protoutil.NestedStructureMarshal(bearerTokenTokenAPEChainsField, buf[offset:], bt.apeOverride)
|
||||
protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
@ -308,7 +267,6 @@ func (bt *BearerTokenBody) StableSize() (size int) {
|
|||
size += protoutil.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID)
|
||||
size += protoutil.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime)
|
||||
size += protoutil.BoolSize(bearerTokenBodyImpersonate, bt.impersonate)
|
||||
size += protoutil.NestedStructureSize(bearerTokenTokenAPEChainsField, bt.apeOverride)
|
||||
|
||||
return size
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package acltest
|
|||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
|
||||
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
|
||||
accountingtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
||||
)
|
||||
|
||||
|
@ -23,20 +22,8 @@ func GenerateBearerTokenBody(empty bool) *acl.BearerTokenBody {
|
|||
|
||||
if !empty {
|
||||
m.SetOwnerID(accountingtest.GenerateOwnerID(false))
|
||||
m.SetEACL(GenerateTable(false))
|
||||
m.SetLifetime(GenerateTokenLifetime(false))
|
||||
m.SetAPEOverride(GenerateAPEOverride(empty))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateAPEOverride(empty bool) *acl.APEOverride {
|
||||
var m *acl.APEOverride
|
||||
|
||||
if !empty {
|
||||
m = new(acl.APEOverride)
|
||||
m.SetTarget(apetest.GenerateChainTarget(empty))
|
||||
m.SetChains(apetest.GenerateRawChains(false, 3))
|
||||
}
|
||||
|
||||
return m
|
||||
|
|
49
acl/types.go
49
acl/types.go
|
@ -1,9 +1,6 @@
|
|||
package acl
|
||||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
||||
)
|
||||
import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
||||
|
||||
// HeaderFilter is a unified structure of FilterInfo
|
||||
// message from proto definition.
|
||||
|
@ -49,12 +46,6 @@ type TokenLifetime struct {
|
|||
exp, nbf, iat uint64
|
||||
}
|
||||
|
||||
type APEOverride struct {
|
||||
target *ape.ChainTarget
|
||||
|
||||
chains []*ape.Chain
|
||||
}
|
||||
|
||||
type BearerTokenBody struct {
|
||||
eacl *Table
|
||||
|
||||
|
@ -62,8 +53,6 @@ type BearerTokenBody struct {
|
|||
|
||||
lifetime *TokenLifetime
|
||||
|
||||
apeOverride *APEOverride
|
||||
|
||||
impersonate bool
|
||||
}
|
||||
|
||||
|
@ -329,42 +318,6 @@ func (bt *BearerTokenBody) SetEACL(v *Table) {
|
|||
bt.eacl = v
|
||||
}
|
||||
|
||||
func (t *APEOverride) GetTarget() *ape.ChainTarget {
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.target
|
||||
}
|
||||
|
||||
func (t *APEOverride) GetChains() []*ape.Chain {
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.chains
|
||||
}
|
||||
|
||||
func (t *APEOverride) SetTarget(v *ape.ChainTarget) {
|
||||
t.target = v
|
||||
}
|
||||
|
||||
func (t *APEOverride) SetChains(v []*ape.Chain) {
|
||||
t.chains = v
|
||||
}
|
||||
|
||||
func (bt *BearerTokenBody) GetAPEOverride() *APEOverride {
|
||||
if bt != nil {
|
||||
return bt.apeOverride
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bt *BearerTokenBody) SetAPEOverride(v *APEOverride) {
|
||||
bt.apeOverride = v
|
||||
}
|
||||
|
||||
func (bt *BearerTokenBody) GetOwnerID() *refs.OwnerID {
|
||||
if bt != nil {
|
||||
return bt.ownerID
|
||||
|
|
132
ape/convert.go
132
ape/convert.go
|
@ -1,132 +0,0 @@
|
|||
package ape
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
||||
)
|
||||
|
||||
func TargetTypeToGRPCField(typ TargetType) ape.TargetType {
|
||||
switch typ {
|
||||
case TargetTypeNamespace:
|
||||
return ape.TargetType_NAMESPACE
|
||||
case TargetTypeContainer:
|
||||
return ape.TargetType_CONTAINER
|
||||
case TargetTypeUser:
|
||||
return ape.TargetType_USER
|
||||
case TargetTypeGroup:
|
||||
return ape.TargetType_GROUP
|
||||
default:
|
||||
return ape.TargetType_UNDEFINED
|
||||
}
|
||||
}
|
||||
|
||||
func TargetTypeFromGRPCField(typ ape.TargetType) TargetType {
|
||||
switch typ {
|
||||
case ape.TargetType_NAMESPACE:
|
||||
return TargetTypeNamespace
|
||||
case ape.TargetType_CONTAINER:
|
||||
return TargetTypeContainer
|
||||
case ape.TargetType_USER:
|
||||
return TargetTypeUser
|
||||
case ape.TargetType_GROUP:
|
||||
return TargetTypeGroup
|
||||
default:
|
||||
return TargetTypeUndefined
|
||||
}
|
||||
}
|
||||
|
||||
func TargetTypeToGRPC(typ TargetType) ape.TargetType {
|
||||
return ape.TargetType(typ)
|
||||
}
|
||||
|
||||
func TargetTypeFromGRPC(typ ape.TargetType) TargetType {
|
||||
return TargetType(typ)
|
||||
}
|
||||
|
||||
func (v2 *ChainTarget) ToGRPCMessage() grpc.Message {
|
||||
var mgrpc *ape.ChainTarget
|
||||
|
||||
if v2 != nil {
|
||||
mgrpc = new(ape.ChainTarget)
|
||||
|
||||
mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType()))
|
||||
mgrpc.SetName(v2.GetName())
|
||||
}
|
||||
|
||||
return mgrpc
|
||||
}
|
||||
|
||||
func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error {
|
||||
mgrpc, ok := m.(*ape.ChainTarget)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, mgrpc)
|
||||
}
|
||||
|
||||
v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType()))
|
||||
v2.SetName(mgrpc.GetName())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v2 *ChainRaw) ToGRPCMessage() grpc.Message {
|
||||
var mgrpc *ape.Chain_Raw
|
||||
|
||||
if v2 != nil {
|
||||
mgrpc = new(ape.Chain_Raw)
|
||||
|
||||
mgrpc.SetRaw(v2.GetRaw())
|
||||
}
|
||||
|
||||
return mgrpc
|
||||
}
|
||||
|
||||
func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error {
|
||||
mgrpc, ok := m.(*ape.Chain_Raw)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, mgrpc)
|
||||
}
|
||||
|
||||
v2.SetRaw(mgrpc.GetRaw())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v2 *Chain) ToGRPCMessage() grpc.Message {
|
||||
var mgrpc *ape.Chain
|
||||
|
||||
if v2 != nil {
|
||||
mgrpc = new(ape.Chain)
|
||||
|
||||
switch chainKind := v2.GetKind().(type) {
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported chain kind: %T", chainKind))
|
||||
case *ChainRaw:
|
||||
mgrpc.SetKind(chainKind.ToGRPCMessage().(*ape.Chain_Raw))
|
||||
}
|
||||
}
|
||||
|
||||
return mgrpc
|
||||
}
|
||||
|
||||
func (v2 *Chain) FromGRPCMessage(m grpc.Message) error {
|
||||
mgrpc, ok := m.(*ape.Chain)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, mgrpc)
|
||||
}
|
||||
|
||||
switch chainKind := mgrpc.GetKind().(type) {
|
||||
default:
|
||||
return fmt.Errorf("unsupported chain kind: %T", chainKind)
|
||||
case *ape.Chain_Raw:
|
||||
chainRaw := new(ChainRaw)
|
||||
if err := chainRaw.FromGRPCMessage(chainKind); err != nil {
|
||||
return err
|
||||
}
|
||||
v2.SetKind(chainRaw)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
BIN
ape/grpc/types_frostfs.pb.go
generated
BIN
ape/grpc/types_frostfs.pb.go
generated
Binary file not shown.
|
@ -1,45 +0,0 @@
|
|||
//go:build gofuzz
|
||||
// +build gofuzz
|
||||
|
||||
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
|
||||
|
||||
package ape
|
||||
|
||||
func DoFuzzProtoChainTarget(data []byte) int {
|
||||
msg := new(ChainTarget)
|
||||
if err := msg.UnmarshalProtobuf(data); err != nil {
|
||||
return 0
|
||||
}
|
||||
_ = msg.MarshalProtobuf(nil)
|
||||
return 1
|
||||
}
|
||||
func DoFuzzJSONChainTarget(data []byte) int {
|
||||
msg := new(ChainTarget)
|
||||
if err := msg.UnmarshalJSON(data); err != nil {
|
||||
return 0
|
||||
}
|
||||
_, err := msg.MarshalJSON()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
func DoFuzzProtoChain(data []byte) int {
|
||||
msg := new(Chain)
|
||||
if err := msg.UnmarshalProtobuf(data); err != nil {
|
||||
return 0
|
||||
}
|
||||
_ = msg.MarshalProtobuf(nil)
|
||||
return 1
|
||||
}
|
||||
func DoFuzzJSONChain(data []byte) int {
|
||||
msg := new(Chain)
|
||||
if err := msg.UnmarshalJSON(data); err != nil {
|
||||
return 0
|
||||
}
|
||||
_, err := msg.MarshalJSON()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return 1
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
//go:build gofuzz
|
||||
// +build gofuzz
|
||||
|
||||
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
|
||||
|
||||
package ape
|
||||
|
||||
import (
|
||||
testing "testing"
|
||||
)
|
||||
|
||||
func FuzzProtoChainTarget(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
DoFuzzProtoChainTarget(data)
|
||||
})
|
||||
}
|
||||
func FuzzJSONChainTarget(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
DoFuzzJSONChainTarget(data)
|
||||
})
|
||||
}
|
||||
func FuzzProtoChain(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
DoFuzzProtoChain(data)
|
||||
})
|
||||
}
|
||||
func FuzzJSONChain(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
DoFuzzJSONChain(data)
|
||||
})
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
package ape
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
chainTargetTargetTypeField = 1
|
||||
chainTargetNameField = 2
|
||||
|
||||
chainRawField = 1
|
||||
)
|
||||
|
||||
func (t *ChainTarget) StableSize() (size int) {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType))
|
||||
size += proto.StringSize(chainTargetNameField, t.name)
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (t *ChainTarget) StableMarshal(buf []byte) []byte {
|
||||
if t == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, t.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType))
|
||||
proto.StringMarshal(chainTargetNameField, buf[offset:], t.name)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (t *ChainTarget) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(t, data, new(ape.ChainTarget))
|
||||
}
|
||||
|
||||
func (c *Chain) StableSize() (size int) {
|
||||
if c == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
switch v := c.GetKind().(type) {
|
||||
case *ChainRaw:
|
||||
if v != nil {
|
||||
size += proto.BytesSize(chainRawField, v.GetRaw())
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported chain kind: %T", v))
|
||||
}
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (c *Chain) StableMarshal(buf []byte) []byte {
|
||||
if c == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, c.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
switch v := c.GetKind().(type) {
|
||||
case *ChainRaw:
|
||||
if v != nil {
|
||||
proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw())
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported chain kind: %T", v))
|
||||
}
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (c *Chain) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(c, data, new(ape.Chain))
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package ape_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
||||
messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test"
|
||||
)
|
||||
|
||||
func TestMessageConvert(t *testing.T) {
|
||||
messagetest.TestRPCMessage(t,
|
||||
func(empty bool) message.Message { return apetest.GenerateChainTarget(empty) },
|
||||
)
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
package test
|
||||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
|
||||
)
|
||||
|
||||
func GenerateRawChains(empty bool, n int) []*ape.Chain {
|
||||
if empty {
|
||||
return []*ape.Chain{}
|
||||
}
|
||||
|
||||
res := make([]*ape.Chain, n)
|
||||
for i := range res {
|
||||
res[i] = GenerateRawChain(empty)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func GenerateRawChain(empty bool) *ape.Chain {
|
||||
chRaw := new(ape.ChainRaw)
|
||||
|
||||
if empty {
|
||||
chRaw.SetRaw([]byte("{}"))
|
||||
} else {
|
||||
chRaw.SetRaw([]byte(`{
|
||||
"ID": "",
|
||||
"Rules": [
|
||||
{
|
||||
"Status": "Allow",
|
||||
"Actions": {
|
||||
"Inverted": false,
|
||||
"Names": [
|
||||
"GetObject"
|
||||
]
|
||||
},
|
||||
"Resources": {
|
||||
"Inverted": false,
|
||||
"Names": [
|
||||
"native:object/*"
|
||||
]
|
||||
},
|
||||
"Any": false,
|
||||
"Condition": [
|
||||
{
|
||||
"Op": "StringEquals",
|
||||
"Object": "Resource",
|
||||
"Key": "Department",
|
||||
"Value": "HR"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"MatchType": "DenyPriority"
|
||||
}`))
|
||||
}
|
||||
|
||||
ch := new(ape.Chain)
|
||||
ch.SetKind(chRaw)
|
||||
return ch
|
||||
}
|
||||
|
||||
func GenerateChainTarget(empty bool) *ape.ChainTarget {
|
||||
m := new(ape.ChainTarget)
|
||||
|
||||
if !empty {
|
||||
m.SetTargetType(ape.TargetTypeContainer)
|
||||
m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R")
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
79
ape/types.go
79
ape/types.go
|
@ -1,79 +0,0 @@
|
|||
package ape
|
||||
|
||||
type TargetType uint32
|
||||
|
||||
const (
|
||||
TargetTypeUndefined TargetType = iota
|
||||
TargetTypeNamespace
|
||||
TargetTypeContainer
|
||||
TargetTypeUser
|
||||
TargetTypeGroup
|
||||
)
|
||||
|
||||
type ChainTarget struct {
|
||||
targeType TargetType
|
||||
|
||||
name string
|
||||
}
|
||||
|
||||
func (ct *ChainTarget) SetTargetType(targeType TargetType) {
|
||||
ct.targeType = targeType
|
||||
}
|
||||
|
||||
func (ct *ChainTarget) SetName(name string) {
|
||||
ct.name = name
|
||||
}
|
||||
|
||||
func (ct *ChainTarget) GetTargetType() TargetType {
|
||||
if ct != nil {
|
||||
return ct.targeType
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func (ct *ChainTarget) GetName() string {
|
||||
if ct != nil {
|
||||
return ct.name
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
type chainKind interface {
|
||||
isChainKind()
|
||||
}
|
||||
|
||||
type Chain struct {
|
||||
kind chainKind
|
||||
}
|
||||
|
||||
func (c *Chain) SetKind(kind chainKind) {
|
||||
c.kind = kind
|
||||
}
|
||||
|
||||
func (c *Chain) GetKind() chainKind {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.kind
|
||||
}
|
||||
|
||||
type ChainRaw struct {
|
||||
Raw []byte
|
||||
}
|
||||
|
||||
func (*ChainRaw) isChainKind() {}
|
||||
|
||||
func (c *ChainRaw) SetRaw(raw []byte) {
|
||||
c.Raw = raw
|
||||
}
|
||||
|
||||
func (c *ChainRaw) GetRaw() []byte {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.Raw
|
||||
}
|
|
@ -1,21 +1,144 @@
|
|||
package apemanager
|
||||
|
||||
import (
|
||||
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
|
||||
apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
|
||||
"fmt"
|
||||
|
||||
apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
||||
)
|
||||
|
||||
func TargetTypeToGRPCField(typ TargetType) apemanager.TargetType {
|
||||
switch typ {
|
||||
case TargetTypeNamespace:
|
||||
return apemanager.TargetType_NAMESPACE
|
||||
case TargetTypeContainer:
|
||||
return apemanager.TargetType_CONTAINER
|
||||
case TargetTypeUser:
|
||||
return apemanager.TargetType_USER
|
||||
case TargetTypeGroup:
|
||||
return apemanager.TargetType_GROUP
|
||||
default:
|
||||
return apemanager.TargetType_UNDEFINED
|
||||
}
|
||||
}
|
||||
|
||||
func TargetTypeFromGRPCField(typ apemanager.TargetType) TargetType {
|
||||
switch typ {
|
||||
case apemanager.TargetType_NAMESPACE:
|
||||
return TargetTypeNamespace
|
||||
case apemanager.TargetType_CONTAINER:
|
||||
return TargetTypeContainer
|
||||
case apemanager.TargetType_USER:
|
||||
return TargetTypeUser
|
||||
case apemanager.TargetType_GROUP:
|
||||
return TargetTypeGroup
|
||||
default:
|
||||
return TargetTypeUndefined
|
||||
}
|
||||
}
|
||||
|
||||
func TargetTypeToGRPC(typ TargetType) apemanager.TargetType {
|
||||
return apemanager.TargetType(typ)
|
||||
}
|
||||
|
||||
func TargetTypeFromGRPC(typ apemanager.TargetType) TargetType {
|
||||
return TargetType(typ)
|
||||
}
|
||||
|
||||
func (v2 *ChainTarget) ToGRPCMessage() grpc.Message {
|
||||
var mgrpc *apemanager.ChainTarget
|
||||
|
||||
if v2 != nil {
|
||||
mgrpc = new(apemanager.ChainTarget)
|
||||
|
||||
mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType()))
|
||||
mgrpc.SetName(v2.GetName())
|
||||
}
|
||||
|
||||
return mgrpc
|
||||
}
|
||||
|
||||
func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error {
|
||||
mgrpc, ok := m.(*apemanager.ChainTarget)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, mgrpc)
|
||||
}
|
||||
|
||||
v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType()))
|
||||
v2.SetName(mgrpc.GetName())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v2 *ChainRaw) ToGRPCMessage() grpc.Message {
|
||||
var mgrpc *apemanager.Chain_Raw
|
||||
|
||||
if v2 != nil {
|
||||
mgrpc = new(apemanager.Chain_Raw)
|
||||
|
||||
mgrpc.SetRaw(v2.GetRaw())
|
||||
}
|
||||
|
||||
return mgrpc
|
||||
}
|
||||
|
||||
func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error {
|
||||
mgrpc, ok := m.(*apemanager.Chain_Raw)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, mgrpc)
|
||||
}
|
||||
|
||||
v2.SetRaw(mgrpc.GetRaw())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v2 *Chain) ToGRPCMessage() grpc.Message {
|
||||
var mgrpc *apemanager.Chain
|
||||
|
||||
if v2 != nil {
|
||||
mgrpc = new(apemanager.Chain)
|
||||
|
||||
switch chainKind := v2.GetKind().(type) {
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported chain kind: %T", chainKind))
|
||||
case *ChainRaw:
|
||||
mgrpc.SetKind(chainKind.ToGRPCMessage().(*apemanager.Chain_Raw))
|
||||
}
|
||||
}
|
||||
|
||||
return mgrpc
|
||||
}
|
||||
|
||||
func (v2 *Chain) FromGRPCMessage(m grpc.Message) error {
|
||||
mgrpc, ok := m.(*apemanager.Chain)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, mgrpc)
|
||||
}
|
||||
|
||||
switch chainKind := mgrpc.GetKind().(type) {
|
||||
default:
|
||||
return fmt.Errorf("unsupported chain kind: %T", chainKind)
|
||||
case *apemanager.Chain_Raw:
|
||||
chainRaw := new(ChainRaw)
|
||||
if err := chainRaw.FromGRPCMessage(chainKind); err != nil {
|
||||
return err
|
||||
}
|
||||
v2.SetKind(chainRaw)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (reqBody *AddChainRequestBody) ToGRPCMessage() grpc.Message {
|
||||
var reqBodygrpc *apemanager.AddChainRequest_Body
|
||||
|
||||
if reqBody != nil {
|
||||
reqBodygrpc = new(apemanager.AddChainRequest_Body)
|
||||
|
||||
reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apeGRPC.ChainTarget))
|
||||
reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apeGRPC.Chain))
|
||||
reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apemanager.ChainTarget))
|
||||
reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apemanager.Chain))
|
||||
}
|
||||
|
||||
return reqBodygrpc
|
||||
|
@ -28,14 +151,14 @@ func (reqBody *AddChainRequestBody) FromGRPCMessage(m grpc.Message) error {
|
|||
}
|
||||
|
||||
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
|
||||
reqBody.target = new(ape.ChainTarget)
|
||||
reqBody.target = new(ChainTarget)
|
||||
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if chaingrpc := reqBodygrpc.GetChain(); chaingrpc != nil {
|
||||
reqBody.chain = new(ape.Chain)
|
||||
reqBody.chain = new(Chain)
|
||||
if err := reqBody.GetChain().FromGRPCMessage(chaingrpc); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -131,7 +254,7 @@ func (reqBody *RemoveChainRequestBody) ToGRPCMessage() grpc.Message {
|
|||
if reqBody != nil {
|
||||
reqBodygrpc = new(apemanager.RemoveChainRequest_Body)
|
||||
|
||||
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
|
||||
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget))
|
||||
reqBodygrpc.SetChainId(reqBody.GetChainID())
|
||||
}
|
||||
|
||||
|
@ -145,7 +268,7 @@ func (reqBody *RemoveChainRequestBody) FromGRPCMessage(m grpc.Message) error {
|
|||
}
|
||||
|
||||
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
|
||||
reqBody.target = new(ape.ChainTarget)
|
||||
reqBody.target = new(ChainTarget)
|
||||
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -239,7 +362,7 @@ func (reqBody *ListChainsRequestBody) ToGRPCMessage() grpc.Message {
|
|||
if reqBody != nil {
|
||||
reqBodygrpc = new(apemanager.ListChainsRequest_Body)
|
||||
|
||||
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
|
||||
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget))
|
||||
}
|
||||
|
||||
return reqBodygrpc
|
||||
|
@ -252,7 +375,7 @@ func (reqBody *ListChainsRequestBody) FromGRPCMessage(m grpc.Message) error {
|
|||
}
|
||||
|
||||
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
|
||||
reqBody.target = new(ape.ChainTarget)
|
||||
reqBody.target = new(ChainTarget)
|
||||
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -296,9 +419,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([]*apemanager.Chain, 0, len(respBody.GetChains()))
|
||||
for _, chain := range respBody.GetChains() {
|
||||
chainsgrpc = append(chainsgrpc, *chain.ToGRPCMessage().(*apeGRPC.Chain))
|
||||
chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apemanager.Chain))
|
||||
}
|
||||
|
||||
respBodygrpc.SetChains(chainsgrpc)
|
||||
|
@ -313,11 +436,11 @@ func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error {
|
|||
return message.NewUnexpectedMessageType(m, respBodygrpc)
|
||||
}
|
||||
|
||||
chains := make([]*ape.Chain, 0, len(respBodygrpc.GetChains()))
|
||||
chains := make([]*Chain, 0, len(respBodygrpc.GetChains()))
|
||||
|
||||
for _, chaingrpc := range respBodygrpc.GetChains() {
|
||||
chain := new(ape.Chain)
|
||||
if err := chain.FromGRPCMessage(&chaingrpc); err != nil {
|
||||
chain := new(Chain)
|
||||
if err := chain.FromGRPCMessage(chaingrpc); err != nil {
|
||||
return err
|
||||
}
|
||||
chains = append(chains, chain)
|
||||
|
|
105
apemanager/grpc/service.go
Normal file
105
apemanager/grpc/service.go
Normal file
|
@ -0,0 +1,105 @@
|
|||
package apemanager
|
||||
|
||||
import (
|
||||
session_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
|
||||
)
|
||||
|
||||
func (rb *AddChainRequest_Body) SetTarget(t *ChainTarget) {
|
||||
rb.Target = t
|
||||
}
|
||||
|
||||
func (rb *AddChainRequest_Body) SetChain(chain *Chain) {
|
||||
rb.Chain = chain
|
||||
}
|
||||
|
||||
func (r *AddChainRequest) SetBody(rb *AddChainRequest_Body) {
|
||||
r.Body = rb
|
||||
}
|
||||
|
||||
func (r *AddChainRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) {
|
||||
r.MetaHeader = mh
|
||||
}
|
||||
|
||||
func (r *AddChainRequest) SetVerifyHeader(vh *session_grpc.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_grpc.ResponseMetaHeader) {
|
||||
r.MetaHeader = mh
|
||||
}
|
||||
|
||||
func (r *AddChainResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) {
|
||||
r.VerifyHeader = vh
|
||||
}
|
||||
|
||||
func (rb *RemoveChainRequest_Body) SetTarget(t *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_grpc.RequestMetaHeader) {
|
||||
r.MetaHeader = mh
|
||||
}
|
||||
|
||||
func (r *RemoveChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) {
|
||||
r.VerifyHeader = vh
|
||||
}
|
||||
|
||||
func (r *RemoveChainResponse) SetBody(rb *RemoveChainResponse_Body) {
|
||||
r.Body = rb
|
||||
}
|
||||
|
||||
func (r *RemoveChainResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) {
|
||||
r.MetaHeader = mh
|
||||
}
|
||||
|
||||
func (r *RemoveChainResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) {
|
||||
r.VerifyHeader = vh
|
||||
}
|
||||
|
||||
func (r *ListChainsRequest_Body) SetTarget(t *ChainTarget) {
|
||||
r.Target = t
|
||||
}
|
||||
|
||||
func (r *ListChainsRequest) SetBody(rb *ListChainsRequest_Body) {
|
||||
r.Body = rb
|
||||
}
|
||||
|
||||
func (r *ListChainsRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) {
|
||||
r.MetaHeader = mh
|
||||
}
|
||||
|
||||
func (r *ListChainsRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) {
|
||||
r.VerifyHeader = vh
|
||||
}
|
||||
|
||||
func (rb *ListChainsResponse_Body) SetChains(chains []*Chain) {
|
||||
rb.Chains = chains
|
||||
}
|
||||
|
||||
func (r *ListChainsResponse) SetBody(rb *ListChainsResponse_Body) {
|
||||
r.Body = rb
|
||||
}
|
||||
|
||||
func (r *ListChainsResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) {
|
||||
r.MetaHeader = mh
|
||||
}
|
||||
|
||||
func (r *ListChainsResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) {
|
||||
r.VerifyHeader = vh
|
||||
}
|
BIN
apemanager/grpc/service.pb.go
generated
Normal file
BIN
apemanager/grpc/service.pb.go
generated
Normal file
Binary file not shown.
BIN
apemanager/grpc/service_frostfs.pb.go
generated
BIN
apemanager/grpc/service_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
BIN
apemanager/grpc/service_grpc.pb.go
generated
BIN
apemanager/grpc/service_grpc.pb.go
generated
Binary file not shown.
21
apemanager/grpc/types.go
Normal file
21
apemanager/grpc/types.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package apemanager
|
||||
|
||||
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
apemanager/grpc/types.pb.go
generated
Normal file
BIN
apemanager/grpc/types.pb.go
generated
Normal file
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
package ape
|
||||
package apemanager
|
||||
|
||||
import (
|
||||
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
|
||||
apemanager_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
||||
)
|
||||
|
||||
|
@ -10,5 +10,5 @@ func (t *ChainTarget) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (t *ChainTarget) UnmarshalJSON(data []byte) error {
|
||||
return message.UnmarshalJSON(t, data, new(ape.ChainTarget))
|
||||
return message.UnmarshalJSON(t, data, new(apemanager_grpc.ChainTarget))
|
||||
}
|
|
@ -1,12 +1,19 @@
|
|||
package apemanager
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
chainTargetTargetTypeField = 1
|
||||
chainTargetNameField = 2
|
||||
|
||||
chainRawField = 1
|
||||
|
||||
addChainReqBodyTargetField = 1
|
||||
addChainReqBodyChainField = 2
|
||||
|
||||
|
@ -24,6 +31,82 @@ const (
|
|||
listChainsRespBodyChainsField = 1
|
||||
)
|
||||
|
||||
func (t *ChainTarget) StableSize() (size int) {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType))
|
||||
size += proto.StringSize(chainTargetNameField, t.name)
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (t *ChainTarget) StableMarshal(buf []byte) []byte {
|
||||
if t == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, t.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType))
|
||||
proto.StringMarshal(chainTargetNameField, buf[offset:], t.name)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (t *ChainTarget) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(t, data, new(apemanager.ChainTarget))
|
||||
}
|
||||
|
||||
func (c *Chain) StableSize() (size int) {
|
||||
if c == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
switch v := c.GetKind().(type) {
|
||||
case *ChainRaw:
|
||||
if v != nil {
|
||||
size += proto.BytesSize(chainRawField, v.GetRaw())
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported chain kind: %T", v))
|
||||
}
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (c *Chain) StableMarshal(buf []byte) []byte {
|
||||
if c == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, c.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
switch v := c.GetKind().(type) {
|
||||
case *ChainRaw:
|
||||
if v != nil {
|
||||
proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw())
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported chain kind: %T", v))
|
||||
}
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (c *Chain) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(c, data, new(apemanager.Chain))
|
||||
}
|
||||
|
||||
func (rb *AddChainRequestBody) StableSize() (size int) {
|
||||
if rb == nil {
|
||||
return 0
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
func TestMessageConvert(t *testing.T) {
|
||||
messagetest.TestRPCMessage(t,
|
||||
func(empty bool) message.Message { return apemanagertest.GenerateChainTarget(empty) },
|
||||
func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequestBody(empty) },
|
||||
func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequest(empty) },
|
||||
func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponseBody(empty) },
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ape
|
||||
package apemanager
|
||||
|
||||
import (
|
||||
apegrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
|
||||
apemanager_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
|
||||
)
|
||||
|
||||
func (tt TargetType) String() string {
|
||||
|
@ -9,7 +9,7 @@ func (tt TargetType) String() string {
|
|||
}
|
||||
|
||||
func (tt *TargetType) FromString(s string) bool {
|
||||
i, ok := apegrpc.TargetType_value[s]
|
||||
i, ok := apemanager_grpc.TargetType_value[s]
|
||||
if ok {
|
||||
*tt = TargetType(i)
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package apemanagertest
|
||||
|
||||
import (
|
||||
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager"
|
||||
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test"
|
||||
)
|
||||
|
@ -14,12 +13,78 @@ func generateChainID(empty bool) []byte {
|
|||
return []byte("616c6c6f774f626a476574436e72")
|
||||
}
|
||||
|
||||
func generateRawChains(empty bool, n int) []*apemanager.Chain {
|
||||
if empty {
|
||||
return []*apemanager.Chain{}
|
||||
}
|
||||
|
||||
res := make([]*apemanager.Chain, n)
|
||||
for i := range res {
|
||||
res[i] = generateRawChain(empty)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func generateRawChain(empty bool) *apemanager.Chain {
|
||||
chRaw := new(apemanager.ChainRaw)
|
||||
|
||||
if empty {
|
||||
chRaw.SetRaw([]byte("{}"))
|
||||
} else {
|
||||
chRaw.SetRaw([]byte(`{
|
||||
"ID": "",
|
||||
"Rules": [
|
||||
{
|
||||
"Status": "Allow",
|
||||
"Actions": {
|
||||
"Inverted": false,
|
||||
"Names": [
|
||||
"GetObject"
|
||||
]
|
||||
},
|
||||
"Resources": {
|
||||
"Inverted": false,
|
||||
"Names": [
|
||||
"native:object/*"
|
||||
]
|
||||
},
|
||||
"Any": false,
|
||||
"Condition": [
|
||||
{
|
||||
"Op": "StringEquals",
|
||||
"Object": "Resource",
|
||||
"Key": "Department",
|
||||
"Value": "HR"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"MatchType": "DenyPriority"
|
||||
}`))
|
||||
}
|
||||
|
||||
ch := new(apemanager.Chain)
|
||||
ch.SetKind(chRaw)
|
||||
return ch
|
||||
}
|
||||
|
||||
func GenerateChainTarget(empty bool) *apemanager.ChainTarget {
|
||||
m := new(apemanager.ChainTarget)
|
||||
|
||||
if !empty {
|
||||
m.SetTargetType(apemanager.TargetTypeContainer)
|
||||
m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R")
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateAddChainRequestBody(empty bool) *apemanager.AddChainRequestBody {
|
||||
m := new(apemanager.AddChainRequestBody)
|
||||
|
||||
if !empty {
|
||||
m.SetTarget(apetest.GenerateChainTarget(empty))
|
||||
m.SetChain(apetest.GenerateRawChain(empty))
|
||||
m.SetTarget(GenerateChainTarget(empty))
|
||||
m.SetChain(generateRawChain(empty))
|
||||
}
|
||||
|
||||
return m
|
||||
|
@ -64,7 +129,7 @@ func GenerateRemoveChainRequestBody(empty bool) *apemanager.RemoveChainRequestBo
|
|||
|
||||
if !empty {
|
||||
m.SetChainID(generateChainID(empty))
|
||||
m.SetTarget(apetest.GenerateChainTarget(empty))
|
||||
m.SetTarget(GenerateChainTarget(empty))
|
||||
}
|
||||
|
||||
return m
|
||||
|
@ -102,7 +167,7 @@ func GenerateListChainsRequestBody(empty bool) *apemanager.ListChainsRequestBody
|
|||
m := new(apemanager.ListChainsRequestBody)
|
||||
|
||||
if !empty {
|
||||
m.SetTarget(apetest.GenerateChainTarget(empty))
|
||||
m.SetTarget(GenerateChainTarget(empty))
|
||||
}
|
||||
|
||||
return m
|
||||
|
@ -124,7 +189,7 @@ func GenerateListChainsResponseBody(empty bool) *apemanager.ListChainsResponseBo
|
|||
m := new(apemanager.ListChainsResponseBody)
|
||||
|
||||
if !empty {
|
||||
m.SetChains(apetest.GenerateRawChains(empty, 10))
|
||||
m.SetChains(generateRawChains(empty, 10))
|
||||
}
|
||||
|
||||
return m
|
||||
|
|
|
@ -1,10 +1,49 @@
|
|||
package apemanager
|
||||
|
||||
import (
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
||||
)
|
||||
|
||||
type TargetType uint32
|
||||
|
||||
const (
|
||||
TargetTypeUndefined TargetType = iota
|
||||
TargetTypeNamespace
|
||||
TargetTypeContainer
|
||||
TargetTypeUser
|
||||
TargetTypeGroup
|
||||
)
|
||||
|
||||
type ChainTarget struct {
|
||||
targeType TargetType
|
||||
|
||||
name string
|
||||
}
|
||||
|
||||
func (ct *ChainTarget) SetTargetType(targeType TargetType) {
|
||||
ct.targeType = targeType
|
||||
}
|
||||
|
||||
func (ct *ChainTarget) SetName(name string) {
|
||||
ct.name = name
|
||||
}
|
||||
|
||||
func (ct *ChainTarget) GetTargetType() TargetType {
|
||||
if ct != nil {
|
||||
return ct.targeType
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func (ct *ChainTarget) GetName() string {
|
||||
if ct != nil {
|
||||
return ct.name
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
type AddChainRequest struct {
|
||||
body *AddChainRequestBody
|
||||
|
||||
|
@ -16,40 +55,58 @@ func (r *AddChainRequest) SetBody(body *AddChainRequestBody) {
|
|||
}
|
||||
|
||||
func (r *AddChainRequest) GetBody() *AddChainRequestBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
type AddChainRequestBody struct {
|
||||
target *ape.ChainTarget
|
||||
|
||||
chain *ape.Chain
|
||||
type chainKind interface {
|
||||
isChainKind()
|
||||
}
|
||||
|
||||
func (rb *AddChainRequestBody) SetTarget(target *ape.ChainTarget) {
|
||||
type Chain struct {
|
||||
kind chainKind
|
||||
}
|
||||
|
||||
func (c *Chain) SetKind(kind chainKind) {
|
||||
c.kind = kind
|
||||
}
|
||||
|
||||
func (c *Chain) GetKind() chainKind {
|
||||
return c.kind
|
||||
}
|
||||
|
||||
type ChainRaw struct {
|
||||
Raw []byte
|
||||
}
|
||||
|
||||
func (*ChainRaw) isChainKind() {}
|
||||
|
||||
func (c *ChainRaw) SetRaw(raw []byte) {
|
||||
c.Raw = raw
|
||||
}
|
||||
|
||||
func (c *ChainRaw) GetRaw() []byte {
|
||||
return c.Raw
|
||||
}
|
||||
|
||||
type AddChainRequestBody struct {
|
||||
target *ChainTarget
|
||||
|
||||
chain *Chain
|
||||
}
|
||||
|
||||
func (rb *AddChainRequestBody) SetTarget(target *ChainTarget) {
|
||||
rb.target = target
|
||||
}
|
||||
|
||||
func (rb *AddChainRequestBody) GetTarget() *ape.ChainTarget {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rb *AddChainRequestBody) GetTarget() *ChainTarget {
|
||||
return rb.target
|
||||
}
|
||||
|
||||
func (rb *AddChainRequestBody) SetChain(chain *ape.Chain) {
|
||||
func (rb *AddChainRequestBody) SetChain(chain *Chain) {
|
||||
rb.chain = chain
|
||||
}
|
||||
|
||||
func (rb *AddChainRequestBody) GetChain() *ape.Chain {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rb *AddChainRequestBody) GetChain() *Chain {
|
||||
return rb.chain
|
||||
}
|
||||
|
||||
|
@ -64,10 +121,6 @@ func (r *AddChainResponse) SetBody(body *AddChainResponseBody) {
|
|||
}
|
||||
|
||||
func (r *AddChainResponse) GetBody() *AddChainResponseBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
|
@ -80,10 +133,6 @@ func (rb *AddChainResponseBody) SetChainID(chainID []byte) {
|
|||
}
|
||||
|
||||
func (rb *AddChainResponseBody) GetChainID() []byte {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return rb.chainID
|
||||
}
|
||||
|
||||
|
@ -98,28 +147,20 @@ func (r *RemoveChainRequest) SetBody(body *RemoveChainRequestBody) {
|
|||
}
|
||||
|
||||
func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
type RemoveChainRequestBody struct {
|
||||
target *ape.ChainTarget
|
||||
target *ChainTarget
|
||||
|
||||
chainID []byte
|
||||
}
|
||||
|
||||
func (rb *RemoveChainRequestBody) SetTarget(target *ape.ChainTarget) {
|
||||
func (rb *RemoveChainRequestBody) SetTarget(target *ChainTarget) {
|
||||
rb.target = target
|
||||
}
|
||||
|
||||
func (rb *RemoveChainRequestBody) GetTarget() *ape.ChainTarget {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rb *RemoveChainRequestBody) GetTarget() *ChainTarget {
|
||||
return rb.target
|
||||
}
|
||||
|
||||
|
@ -128,10 +169,6 @@ func (rb *RemoveChainRequestBody) SetChainID(chainID []byte) {
|
|||
}
|
||||
|
||||
func (rb *RemoveChainRequestBody) GetChainID() []byte {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return rb.chainID
|
||||
}
|
||||
|
||||
|
@ -141,17 +178,14 @@ type RemoveChainResponse struct {
|
|||
session.ResponseHeaders
|
||||
}
|
||||
|
||||
type RemoveChainResponseBody struct{}
|
||||
type RemoveChainResponseBody struct {
|
||||
}
|
||||
|
||||
func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) {
|
||||
r.body = body
|
||||
}
|
||||
|
||||
func (r *RemoveChainResponse) GetBody() *RemoveChainResponseBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
|
@ -166,26 +200,18 @@ func (r *ListChainsRequest) SetBody(body *ListChainsRequestBody) {
|
|||
}
|
||||
|
||||
func (r *ListChainsRequest) GetBody() *ListChainsRequestBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
type ListChainsRequestBody struct {
|
||||
target *ape.ChainTarget
|
||||
target *ChainTarget
|
||||
}
|
||||
|
||||
func (rb *ListChainsRequestBody) SetTarget(target *ape.ChainTarget) {
|
||||
func (rb *ListChainsRequestBody) SetTarget(target *ChainTarget) {
|
||||
rb.target = target
|
||||
}
|
||||
|
||||
func (rb *ListChainsRequestBody) GetTarget() *ape.ChainTarget {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rb *ListChainsRequestBody) GetTarget() *ChainTarget {
|
||||
return rb.target
|
||||
}
|
||||
|
||||
|
@ -200,27 +226,19 @@ func (r *ListChainsResponse) SetBody(body *ListChainsResponseBody) {
|
|||
}
|
||||
|
||||
func (r *ListChainsResponse) GetBody() *ListChainsResponseBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
type ListChainsResponseBody struct {
|
||||
chains []*ape.Chain
|
||||
chains []*Chain
|
||||
|
||||
session.RequestHeaders
|
||||
}
|
||||
|
||||
func (r *ListChainsResponseBody) SetChains(chains []*ape.Chain) {
|
||||
func (r *ListChainsResponseBody) SetChains(chains []*Chain) {
|
||||
r.chains = chains
|
||||
}
|
||||
|
||||
func (r *ListChainsResponseBody) GetChains() []*ape.Chain {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *ListChainsResponseBody) GetChains() []*Chain {
|
||||
return r.chains
|
||||
}
|
||||
|
|
|
@ -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,26 +39,28 @@ 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 err != nil {
|
||||
return
|
||||
if xs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(xs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -762,3 +766,515 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error {
|
|||
|
||||
return r.ResponseHeaders.FromMessage(v)
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) ToGRPCMessage() grpc.Message {
|
||||
var m *container.SetExtendedACLRequest_Body
|
||||
|
||||
if r != nil {
|
||||
m = new(container.SetExtendedACLRequest_Body)
|
||||
|
||||
m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable))
|
||||
m.SetSignature(toSignatureRFC6979(r.sig))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.SetExtendedACLRequest_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())
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequest) ToGRPCMessage() grpc.Message {
|
||||
var m *container.SetExtendedACLRequest
|
||||
|
||||
if r != nil {
|
||||
m = new(container.SetExtendedACLRequest)
|
||||
|
||||
m.SetBody(r.body.ToGRPCMessage().(*container.SetExtendedACLRequest_Body))
|
||||
r.RequestHeaders.ToMessage(m)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.SetExtendedACLRequest)
|
||||
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(SetExtendedACLRequestBody)
|
||||
}
|
||||
|
||||
err = r.body.FromGRPCMessage(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return r.RequestHeaders.FromMessage(v)
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponseBody) ToGRPCMessage() grpc.Message {
|
||||
var m *container.SetExtendedACLResponse_Body
|
||||
|
||||
if r != nil {
|
||||
m = new(container.SetExtendedACLResponse_Body)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.SetExtendedACLResponse_Body)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponse) ToGRPCMessage() grpc.Message {
|
||||
var m *container.SetExtendedACLResponse
|
||||
|
||||
if r != nil {
|
||||
m = new(container.SetExtendedACLResponse)
|
||||
|
||||
m.SetBody(r.body.ToGRPCMessage().(*container.SetExtendedACLResponse_Body))
|
||||
r.ResponseHeaders.ToMessage(m)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.SetExtendedACLResponse)
|
||||
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(SetExtendedACLResponseBody)
|
||||
}
|
||||
|
||||
err = r.body.FromGRPCMessage(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) ToGRPCMessage() grpc.Message {
|
||||
var m *container.AnnounceUsedSpaceRequest_Body_Announcement
|
||||
|
||||
if a != nil {
|
||||
m = new(container.AnnounceUsedSpaceRequest_Body_Announcement)
|
||||
|
||||
m.SetContainerId(a.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
|
||||
m.SetEpoch(a.epoch)
|
||||
m.SetUsedSpace(a.usedSpace)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.AnnounceUsedSpaceRequest_Body_Announcement)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
cid := v.GetContainerId()
|
||||
if cid == nil {
|
||||
a.cid = nil
|
||||
} else {
|
||||
if a.cid == nil {
|
||||
a.cid = new(refs.ContainerID)
|
||||
}
|
||||
|
||||
err = a.cid.FromGRPCMessage(cid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
a.epoch = v.GetEpoch()
|
||||
a.usedSpace = v.GetUsedSpace()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func UsedSpaceAnnouncementsToGRPCMessage(
|
||||
ids []UsedSpaceAnnouncement,
|
||||
) (res []*container.AnnounceUsedSpaceRequest_Body_Announcement) {
|
||||
if ids != nil {
|
||||
res = make([]*container.AnnounceUsedSpaceRequest_Body_Announcement, 0, len(ids))
|
||||
|
||||
for i := range ids {
|
||||
res = append(res, ids[i].ToGRPCMessage().(*container.AnnounceUsedSpaceRequest_Body_Announcement))
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func UsedSpaceAnnouncementssFromGRPCMessage(
|
||||
asV2 []*container.AnnounceUsedSpaceRequest_Body_Announcement,
|
||||
) (res []UsedSpaceAnnouncement, err error) {
|
||||
if asV2 != nil {
|
||||
res = make([]UsedSpaceAnnouncement, len(asV2))
|
||||
|
||||
for i := range asV2 {
|
||||
if asV2[i] != nil {
|
||||
err = res[i].FromGRPCMessage(asV2[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequestBody) ToGRPCMessage() grpc.Message {
|
||||
var m *container.AnnounceUsedSpaceRequest_Body
|
||||
|
||||
if r != nil {
|
||||
m = new(container.AnnounceUsedSpaceRequest_Body)
|
||||
|
||||
m.SetAnnouncements(UsedSpaceAnnouncementsToGRPCMessage(r.announcements))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequestBody) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.AnnounceUsedSpaceRequest_Body)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
r.announcements, err = UsedSpaceAnnouncementssFromGRPCMessage(v.GetAnnouncements())
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequest) ToGRPCMessage() grpc.Message {
|
||||
var m *container.AnnounceUsedSpaceRequest
|
||||
|
||||
if r != nil {
|
||||
m = new(container.AnnounceUsedSpaceRequest)
|
||||
|
||||
m.SetBody(r.body.ToGRPCMessage().(*container.AnnounceUsedSpaceRequest_Body))
|
||||
r.RequestHeaders.ToMessage(m)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequest) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.AnnounceUsedSpaceRequest)
|
||||
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(AnnounceUsedSpaceRequestBody)
|
||||
}
|
||||
|
||||
err = r.body.FromGRPCMessage(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return r.RequestHeaders.FromMessage(v)
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponseBody) ToGRPCMessage() grpc.Message {
|
||||
var m *container.AnnounceUsedSpaceResponse_Body
|
||||
|
||||
if r != nil {
|
||||
m = new(container.AnnounceUsedSpaceResponse_Body)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponseBody) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.AnnounceUsedSpaceResponse_Body)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponse) ToGRPCMessage() grpc.Message {
|
||||
var m *container.AnnounceUsedSpaceResponse
|
||||
|
||||
if r != nil {
|
||||
m = new(container.AnnounceUsedSpaceResponse)
|
||||
|
||||
m.SetBody(r.body.ToGRPCMessage().(*container.AnnounceUsedSpaceResponse_Body))
|
||||
r.ResponseHeaders.ToMessage(m)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponse) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.AnnounceUsedSpaceResponse)
|
||||
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(AnnounceUsedSpaceResponseBody)
|
||||
}
|
||||
|
||||
err = r.body.FromGRPCMessage(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return r.ResponseHeaders.FromMessage(v)
|
||||
}
|
||||
|
|
324
container/grpc/service.go
Normal file
324
container/grpc/service.go
Normal file
|
@ -0,0 +1,324 @@
|
|||
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
|
||||
}
|
||||
|
||||
// SetEacl sets eACL table structure.
|
||||
func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) {
|
||||
m.Eacl = v
|
||||
}
|
||||
|
||||
// SetSignature sets signature of the eACL table structure.
|
||||
func (m *SetExtendedACLRequest_Body) SetSignature(v *refs.SignatureRFC6979) {
|
||||
m.Signature = v
|
||||
}
|
||||
|
||||
// SetBody sets body of the request.
|
||||
func (m *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequest_Body) {
|
||||
m.Body = v
|
||||
}
|
||||
|
||||
// SetMetaHeader sets meta header of the request.
|
||||
func (m *SetExtendedACLRequest) SetMetaHeader(v *session.RequestMetaHeader) {
|
||||
m.MetaHeader = v
|
||||
}
|
||||
|
||||
// SetVerifyHeader sets verification header of the request.
|
||||
func (m *SetExtendedACLRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
|
||||
m.VerifyHeader = v
|
||||
}
|
||||
|
||||
// SetBody sets body of the response.
|
||||
func (m *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponse_Body) {
|
||||
m.Body = v
|
||||
}
|
||||
|
||||
// SetMetaHeader sets meta header of the response.
|
||||
func (m *SetExtendedACLResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
|
||||
m.MetaHeader = v
|
||||
}
|
||||
|
||||
// SetVerifyHeader sets verification header of the response.
|
||||
func (m *SetExtendedACLResponse) 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
|
||||
}
|
||||
|
||||
// SetEpoch sets epoch of the size estimation.
|
||||
func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetEpoch(v uint64) {
|
||||
m.Epoch = v
|
||||
}
|
||||
|
||||
// SetContainerId sets identifier of the container.
|
||||
func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetContainerId(v *refs.ContainerID) {
|
||||
m.ContainerId = v
|
||||
}
|
||||
|
||||
// SetUsedSpace sets used space value of the container.
|
||||
func (m *AnnounceUsedSpaceRequest_Body_Announcement) SetUsedSpace(v uint64) {
|
||||
m.UsedSpace = v
|
||||
}
|
||||
|
||||
// SetAnnouncements sets list of announcement for shared containers between nodes.
|
||||
func (m *AnnounceUsedSpaceRequest_Body) SetAnnouncements(v []*AnnounceUsedSpaceRequest_Body_Announcement) {
|
||||
m.Announcements = v
|
||||
}
|
||||
|
||||
// SetBody sets body of the request.
|
||||
func (m *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequest_Body) {
|
||||
m.Body = v
|
||||
}
|
||||
|
||||
// SetMetaHeader sets meta header of the request.
|
||||
func (m *AnnounceUsedSpaceRequest) SetMetaHeader(v *session.RequestMetaHeader) {
|
||||
m.MetaHeader = v
|
||||
}
|
||||
|
||||
// SetVerifyHeader sets verification header of the request.
|
||||
func (m *AnnounceUsedSpaceRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
|
||||
m.VerifyHeader = v
|
||||
}
|
||||
|
||||
// SetBody sets body of the response.
|
||||
func (m *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponse_Body) {
|
||||
m.Body = v
|
||||
}
|
||||
|
||||
// SetMetaHeader sets meta header of the response.
|
||||
func (m *AnnounceUsedSpaceResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
|
||||
m.MetaHeader = v
|
||||
}
|
||||
|
||||
// SetVerifyHeader sets verification header of the response.
|
||||
func (m *AnnounceUsedSpaceResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
|
||||
m.VerifyHeader = v
|
||||
}
|
BIN
container/grpc/service.pb.go
generated
Normal file
BIN
container/grpc/service.pb.go
generated
Normal file
Binary file not shown.
BIN
container/grpc/service_frostfs.pb.go
generated
BIN
container/grpc/service_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
BIN
container/grpc/service_grpc.pb.go
generated
BIN
container/grpc/service_grpc.pb.go
generated
Binary file not shown.
46
container/grpc/types.go
Normal file
46
container/grpc/types.go
Normal 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
BIN
container/grpc/types.pb.go
generated
Normal file
Binary file not shown.
BIN
container/grpc/types_frostfs.pb.go
generated
BIN
container/grpc/types_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
|
@ -34,6 +34,21 @@ const (
|
|||
listReqBodyOwnerField = 1
|
||||
|
||||
listRespBodyIDsField = 1
|
||||
|
||||
setEACLReqBodyTableField = 1
|
||||
setEACLReqBodySignatureField = 2
|
||||
|
||||
getEACLReqBodyIDField = 1
|
||||
|
||||
getEACLRespBodyTableField = 1
|
||||
getEACLRespBodySignatureField = 2
|
||||
getEACLRespBodyTokenField = 3
|
||||
|
||||
usedSpaceAnnounceEpochField = 1
|
||||
usedSpaceAnnounceCIDField = 2
|
||||
usedSpaceAnnounceUsedSpaceField = 3
|
||||
|
||||
usedSpaceReqBodyAnnouncementsField = 1
|
||||
)
|
||||
|
||||
func (a *Attribute) StableMarshal(buf []byte) []byte {
|
||||
|
@ -343,3 +358,189 @@ func (r *ListResponseBody) StableSize() (size int) {
|
|||
func (r *ListResponseBody) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(r, data, new(container.ListResponse_Body))
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) StableMarshal(buf []byte) []byte {
|
||||
if r == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, r.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
offset += protoutil.NestedStructureMarshal(setEACLReqBodyTableField, buf[offset:], r.eacl)
|
||||
protoutil.NestedStructureMarshal(setEACLReqBodySignatureField, buf[offset:], r.sig)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) StableSize() (size int) {
|
||||
if r == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
size += protoutil.NestedStructureSize(setEACLReqBodyTableField, r.eacl)
|
||||
size += protoutil.NestedStructureSize(setEACLReqBodySignatureField, r.sig)
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(r, data, new(container.SetExtendedACLRequest_Body))
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponseBody) StableMarshal(_ []byte) []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponseBody) StableSize() (size int) {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponseBody) Unmarshal([]byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) StableMarshal(buf []byte) []byte {
|
||||
if a == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, a.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
offset += protoutil.UInt64Marshal(usedSpaceAnnounceEpochField, buf[offset:], a.epoch)
|
||||
offset += protoutil.NestedStructureMarshal(usedSpaceAnnounceCIDField, buf[offset:], a.cid)
|
||||
protoutil.UInt64Marshal(usedSpaceAnnounceUsedSpaceField, buf[offset:], a.usedSpace)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) StableSize() (size int) {
|
||||
if a == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
size += protoutil.UInt64Size(usedSpaceAnnounceEpochField, a.epoch)
|
||||
size += protoutil.NestedStructureSize(usedSpaceAnnounceCIDField, a.cid)
|
||||
size += protoutil.UInt64Size(usedSpaceAnnounceUsedSpaceField, a.usedSpace)
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(a, data, new(container.AnnounceUsedSpaceRequest_Body_Announcement))
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequestBody) StableMarshal(buf []byte) []byte {
|
||||
if r == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, r.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
for i := range r.announcements {
|
||||
offset += protoutil.NestedStructureMarshal(usedSpaceReqBodyAnnouncementsField, buf[offset:], &r.announcements[i])
|
||||
}
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequestBody) StableSize() (size int) {
|
||||
if r == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
for i := range r.announcements {
|
||||
size += protoutil.NestedStructureSize(usedSpaceReqBodyAnnouncementsField, &r.announcements[i])
|
||||
}
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequestBody) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(r, data, new(container.AnnounceUsedSpaceRequest_Body))
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponseBody) StableMarshal(_ []byte) []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponseBody) StableSize() (size int) {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponseBody) Unmarshal([]byte) error {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -28,9 +28,20 @@ func TestMessageConvert(t *testing.T) {
|
|||
func(empty bool) message.Message { return containertest.GenerateListRequest(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateListResponseBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateListResponse(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateSetExtendedACLRequestBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateSetExtendedACLRequest(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetRequestBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) },
|
||||
func(empty bool) message.Message { return containertest.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) },
|
||||
func(empty bool) message.Message { return containertest.GenerateUsedSpaceAnnouncement(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequestBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceRequest(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceResponseBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateAnnounceUsedSpaceResponse(empty) },
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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,163 @@ func GenerateListResponse(empty bool) *container.ListResponse {
|
|||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateSetExtendedACLRequestBody(empty bool) *container.SetExtendedACLRequestBody {
|
||||
m := new(container.SetExtendedACLRequestBody)
|
||||
|
||||
if !empty {
|
||||
m.SetEACL(acltest.GenerateTable(false))
|
||||
}
|
||||
|
||||
m.SetSignature(refstest.GenerateSignature(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateSetExtendedACLRequest(empty bool) *container.SetExtendedACLRequest {
|
||||
m := new(container.SetExtendedACLRequest)
|
||||
|
||||
if !empty {
|
||||
m.SetBody(GenerateSetExtendedACLRequestBody(false))
|
||||
}
|
||||
|
||||
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
||||
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateSetExtendedACLResponseBody(_ bool) *container.SetExtendedACLResponseBody {
|
||||
m := new(container.SetExtendedACLResponseBody)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateSetExtendedACLResponse(empty bool) *container.SetExtendedACLResponse {
|
||||
m := new(container.SetExtendedACLResponse)
|
||||
|
||||
if !empty {
|
||||
m.SetBody(GenerateSetExtendedACLResponseBody(false))
|
||||
}
|
||||
|
||||
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
||||
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
func GenerateUsedSpaceAnnouncement(empty bool) *container.UsedSpaceAnnouncement {
|
||||
m := new(container.UsedSpaceAnnouncement)
|
||||
|
||||
if !empty {
|
||||
m.SetContainerID(refstest.GenerateContainerID(false))
|
||||
m.SetEpoch(1)
|
||||
m.SetUsedSpace(2)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateUsedSpaceAnnouncements(empty bool) []container.UsedSpaceAnnouncement {
|
||||
var res []container.UsedSpaceAnnouncement
|
||||
|
||||
if !empty {
|
||||
res = append(res,
|
||||
*GenerateUsedSpaceAnnouncement(false),
|
||||
*GenerateUsedSpaceAnnouncement(false),
|
||||
)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func GenerateAnnounceUsedSpaceRequestBody(empty bool) *container.AnnounceUsedSpaceRequestBody {
|
||||
m := new(container.AnnounceUsedSpaceRequestBody)
|
||||
|
||||
if !empty {
|
||||
m.SetAnnouncements(GenerateUsedSpaceAnnouncements(false))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateAnnounceUsedSpaceRequest(empty bool) *container.AnnounceUsedSpaceRequest {
|
||||
m := new(container.AnnounceUsedSpaceRequest)
|
||||
|
||||
if !empty {
|
||||
m.SetBody(GenerateAnnounceUsedSpaceRequestBody(false))
|
||||
}
|
||||
|
||||
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
||||
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateAnnounceUsedSpaceResponseBody(_ bool) *container.AnnounceUsedSpaceResponseBody {
|
||||
m := new(container.AnnounceUsedSpaceResponseBody)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateAnnounceUsedSpaceResponse(empty bool) *container.AnnounceUsedSpaceResponse {
|
||||
m := new(container.AnnounceUsedSpaceResponse)
|
||||
|
||||
if !empty {
|
||||
m.SetBody(GenerateAnnounceUsedSpaceResponseBody(false))
|
||||
}
|
||||
|
||||
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
||||
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
|
|
@ -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,76 @@ type ListResponse struct {
|
|||
session.ResponseHeaders
|
||||
}
|
||||
|
||||
type SetExtendedACLRequestBody struct {
|
||||
eacl *acl.Table
|
||||
|
||||
sig *refs.Signature
|
||||
}
|
||||
|
||||
type SetExtendedACLRequest struct {
|
||||
body *SetExtendedACLRequestBody
|
||||
|
||||
session.RequestHeaders
|
||||
}
|
||||
|
||||
type SetExtendedACLResponseBody struct{}
|
||||
|
||||
type SetExtendedACLResponse struct {
|
||||
body *SetExtendedACLResponseBody
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
type UsedSpaceAnnouncement struct {
|
||||
epoch uint64
|
||||
|
||||
cid *refs.ContainerID
|
||||
|
||||
usedSpace uint64
|
||||
}
|
||||
|
||||
type AnnounceUsedSpaceRequestBody struct {
|
||||
announcements []UsedSpaceAnnouncement
|
||||
}
|
||||
|
||||
type AnnounceUsedSpaceRequest struct {
|
||||
body *AnnounceUsedSpaceRequestBody
|
||||
|
||||
session.RequestHeaders
|
||||
}
|
||||
|
||||
type AnnounceUsedSpaceResponseBody struct{}
|
||||
|
||||
type AnnounceUsedSpaceResponse struct {
|
||||
body *AnnounceUsedSpaceResponseBody
|
||||
|
||||
session.ResponseHeaders
|
||||
}
|
||||
|
||||
func (a *Attribute) GetKey() string {
|
||||
if a != nil {
|
||||
return a.key
|
||||
|
@ -444,3 +515,203 @@ func (r *ListResponse) GetBody() *ListResponseBody {
|
|||
func (r *ListResponse) SetBody(v *ListResponseBody) {
|
||||
r.body = v
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) GetEACL() *acl.Table {
|
||||
if r != nil {
|
||||
return r.eacl
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) SetEACL(v *acl.Table) {
|
||||
r.eacl = v
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) GetSignature() *refs.Signature {
|
||||
if r != nil {
|
||||
return r.sig
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequestBody) SetSignature(v *refs.Signature) {
|
||||
// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
|
||||
v.SetScheme(0)
|
||||
r.sig = v
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequest) GetBody() *SetExtendedACLRequestBody {
|
||||
if r != nil {
|
||||
return r.body
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) {
|
||||
r.body = v
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponse) GetBody() *SetExtendedACLResponseBody {
|
||||
if r != nil {
|
||||
return r.body
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) {
|
||||
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
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) GetEpoch() uint64 {
|
||||
if a != nil {
|
||||
return a.epoch
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) SetEpoch(v uint64) {
|
||||
a.epoch = v
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) GetUsedSpace() uint64 {
|
||||
if a != nil {
|
||||
return a.usedSpace
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) SetUsedSpace(v uint64) {
|
||||
a.usedSpace = v
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) GetContainerID() *refs.ContainerID {
|
||||
if a != nil {
|
||||
return a.cid
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *UsedSpaceAnnouncement) SetContainerID(v *refs.ContainerID) {
|
||||
a.cid = v
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []UsedSpaceAnnouncement {
|
||||
if r != nil {
|
||||
return r.announcements
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequestBody) SetAnnouncements(v []UsedSpaceAnnouncement) {
|
||||
r.announcements = v
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequestBody {
|
||||
if r != nil {
|
||||
return r.body
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequestBody) {
|
||||
r.body = v
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponseBody {
|
||||
if r != nil {
|
||||
return r.body
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponseBody) {
|
||||
r.body = v
|
||||
}
|
||||
|
|
|
@ -35,11 +35,11 @@ Tag a release (must be signed) and push it:
|
|||
$ git tag -s vX.Y.Z[-rc.N] && git push origin vX.Y.Z[-rc.N]
|
||||
```
|
||||
|
||||
## Make a proper release
|
||||
## Make a Github release
|
||||
|
||||
Using git.frostfs.info web interface create a new release based on just created tag
|
||||
Using Github's web interface create a new release based on just created tag
|
||||
with the same changes from changelog and publish it.
|
||||
|
||||
## Close milestone
|
||||
## Close github milestone
|
||||
|
||||
Close corresponding vX.Y.Z milestone.
|
||||
Close corresponding vX.Y.Z github milestone.
|
||||
|
|
20
go.mod
20
go.mod
|
@ -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
44
go.sum
|
@ -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
8
lock/grpc/types.go
Normal 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
BIN
lock/grpc/types.pb.go
generated
Normal file
Binary file not shown.
BIN
lock/grpc/types_frostfs.pb.go
generated
BIN
lock/grpc/types_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
|
@ -45,26 +45,28 @@ 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 err != nil {
|
||||
return
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,26 +105,28 @@ 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 err != nil {
|
||||
return
|
||||
if ss[i] != nil {
|
||||
err = res[i].FromGRPCMessage(ss[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -159,26 +163,28 @@ 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 err != nil {
|
||||
return
|
||||
if rs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(rs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,26 +289,28 @@ 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 err != nil {
|
||||
return
|
||||
if as[i] != nil {
|
||||
err = res[i].FromGRPCMessage(as[i])
|
||||
if err != nil {
|
||||
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,9 +560,11 @@ 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 {
|
||||
return err
|
||||
for i := 0; i < ln; i++ {
|
||||
if psV2[i] != nil {
|
||||
if err := ps[i].FromGRPCMessage(psV2[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
116
netmap/grpc/service.go
Normal 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
BIN
netmap/grpc/service.pb.go
generated
Normal file
Binary file not shown.
BIN
netmap/grpc/service_frostfs.pb.go
generated
BIN
netmap/grpc/service_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
BIN
netmap/grpc/service_grpc.pb.go
generated
BIN
netmap/grpc/service_grpc.pb.go
generated
Binary file not shown.
212
netmap/grpc/types.go
Normal file
212
netmap/grpc/types.go
Normal 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
BIN
netmap/grpc/types.pb.go
generated
Normal file
Binary file not shown.
BIN
netmap/grpc/types_frostfs.pb.go
generated
BIN
netmap/grpc/types_frostfs.pb.go
generated
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -142,26 +142,28 @@ 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 err != nil {
|
||||
return
|
||||
if xs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(xs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,9 +269,6 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message {
|
|||
m = new(object.Header_EC)
|
||||
|
||||
m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID)
|
||||
m.ParentSplitId = h.ParentSplitID
|
||||
m.ParentSplitParentId = h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID)
|
||||
m.ParentAttributes = AttributesToGRPC(h.ParentAttributes)
|
||||
m.Index = h.Index
|
||||
m.Total = h.Total
|
||||
m.Header = h.Header
|
||||
|
@ -301,26 +300,6 @@ func (h *ECHeader) FromGRPCMessage(m grpc.Message) error {
|
|||
}
|
||||
}
|
||||
|
||||
h.ParentSplitID = v.GetParentSplitId()
|
||||
|
||||
parSplitParentID := v.GetParentSplitParentId()
|
||||
if parSplitParentID == nil {
|
||||
h.ParentSplitParentID = nil
|
||||
} else {
|
||||
if h.ParentSplitParentID == nil {
|
||||
h.ParentSplitParentID = new(refs.ObjectID)
|
||||
}
|
||||
|
||||
err = h.ParentSplitParentID.FromGRPCMessage(parSplitParentID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if h.ParentAttributes, err = AttributesFromGRPC(v.GetParentAttributes()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
h.Index = v.GetIndex()
|
||||
h.Total = v.GetTotal()
|
||||
h.Header = v.GetHeader()
|
||||
|
@ -681,9 +660,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 +683,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,26 +1603,28 @@ 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 err != nil {
|
||||
return
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1823,26 +1804,28 @@ 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 err != nil {
|
||||
return
|
||||
if rs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(rs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2339,217 +2322,3 @@ func (r *PutSingleResponse) FromGRPCMessage(m grpc.Message) error {
|
|||
|
||||
return r.ResponseHeaders.FromMessage(v)
|
||||
}
|
||||
|
||||
func (r *PatchRequestBodyPatch) ToGRPCMessage() grpc.Message {
|
||||
var m *object.PatchRequest_Body_Patch
|
||||
|
||||
if r != nil {
|
||||
m = new(object.PatchRequest_Body_Patch)
|
||||
|
||||
m.SetSourceRange(r.GetRange().ToGRPCMessage().(*object.Range))
|
||||
m.SetChunk(r.GetChunk())
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *PatchRequestBodyPatch) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*object.PatchRequest_Body_Patch)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
srcRange := v.GetSourceRange()
|
||||
if srcRange == nil {
|
||||
r.Range = nil
|
||||
} else {
|
||||
if r.Range == nil {
|
||||
r.Range = new(Range)
|
||||
}
|
||||
|
||||
err = r.Range.FromGRPCMessage(srcRange)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
r.Chunk = v.GetChunk()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *PatchRequestBody) ToGRPCMessage() grpc.Message {
|
||||
var m *object.PatchRequest_Body
|
||||
|
||||
if r != nil {
|
||||
m = new(object.PatchRequest_Body)
|
||||
|
||||
m.SetAddress(r.address.ToGRPCMessage().(*refsGRPC.Address))
|
||||
m.SetNewAttributes(AttributesToGRPC(r.newAttributes))
|
||||
m.SetReplaceAttributes(r.replaceAttributes)
|
||||
m.SetPatch(r.patch.ToGRPCMessage().(*object.PatchRequest_Body_Patch))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *PatchRequestBody) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*object.PatchRequest_Body)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
addr := v.GetAddress()
|
||||
if addr == nil {
|
||||
r.address = nil
|
||||
} else {
|
||||
if r.address == nil {
|
||||
r.address = new(refs.Address)
|
||||
}
|
||||
|
||||
err = r.address.FromGRPCMessage(addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
r.newAttributes, err = AttributesFromGRPC(v.GetNewAttributes())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
r.replaceAttributes = v.GetReplaceAttributes()
|
||||
|
||||
patch := v.GetPatch()
|
||||
if patch == nil {
|
||||
r.patch = nil
|
||||
} else {
|
||||
if r.patch == nil {
|
||||
r.patch = new(PatchRequestBodyPatch)
|
||||
}
|
||||
|
||||
err = r.patch.FromGRPCMessage(patch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *PatchRequest) ToGRPCMessage() grpc.Message {
|
||||
var m *object.PatchRequest
|
||||
|
||||
if r != nil {
|
||||
m = new(object.PatchRequest)
|
||||
|
||||
m.SetBody(r.body.ToGRPCMessage().(*object.PatchRequest_Body))
|
||||
r.RequestHeaders.ToMessage(m)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *PatchRequest) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*object.PatchRequest)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
body := v.GetBody()
|
||||
if body == nil {
|
||||
r.body = nil
|
||||
} else {
|
||||
if r.body == nil {
|
||||
r.body = new(PatchRequestBody)
|
||||
}
|
||||
|
||||
err = r.body.FromGRPCMessage(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return r.RequestHeaders.FromMessage(v)
|
||||
}
|
||||
|
||||
func (r *PatchResponseBody) ToGRPCMessage() grpc.Message {
|
||||
var m *object.PatchResponse_Body
|
||||
|
||||
if r != nil {
|
||||
m = new(object.PatchResponse_Body)
|
||||
|
||||
m.SetObjectId(r.ObjectID.ToGRPCMessage().(*refsGRPC.ObjectID))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *PatchResponseBody) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*object.PatchResponse_Body)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
objID := v.GetObjectId()
|
||||
if objID == nil {
|
||||
r.ObjectID = nil
|
||||
} else {
|
||||
if r.ObjectID == nil {
|
||||
r.ObjectID = new(refs.ObjectID)
|
||||
}
|
||||
|
||||
err = r.ObjectID.FromGRPCMessage(objID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *PatchResponse) ToGRPCMessage() grpc.Message {
|
||||
var m *object.PatchResponse
|
||||
|
||||
if r != nil {
|
||||
m = new(object.PatchResponse)
|
||||
|
||||
m.SetBody(r.Body.ToGRPCMessage().(*object.PatchResponse_Body))
|
||||
r.ResponseHeaders.ToMessage(m)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *PatchResponse) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*object.PatchResponse)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
body := v.GetBody()
|
||||
if body == nil {
|
||||
r.Body = nil
|
||||
} else {
|
||||
if r.Body == nil {
|
||||
r.Body = new(PatchResponseBody)
|
||||
}
|
||||
|
||||
err = r.Body.FromGRPCMessage(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return r.ResponseHeaders.FromMessage(v)
|
||||
}
|
||||
|
|
|
@ -36,9 +36,6 @@ const (
|
|||
|
||||
// FilterHeaderSplitID is a filter key to "split.splitID" field of the object header.
|
||||
FilterHeaderSplitID = ReservedFilterPrefix + "split.splitID"
|
||||
|
||||
// FilterHeaderECParent is a filter key to "ec.parent" field of the object header.
|
||||
FilterHeaderECParent = ReservedFilterPrefix + "ec.parent"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue