forked from TrueCloudLab/frostfs-api-go
Compare commits
25 commits
fix/patch/
...
master
Author | SHA1 | Date | |
---|---|---|---|
557267a07b | |||
2bdee4c9e6 | |||
f0fc40e116 | |||
29f2157563 | |||
29c522d5d8 | |||
3e705a3cbe | |||
d9a604fbc1 | |||
b06dad731c | |||
d94b9c6d0d | |||
eeb754c327 | |||
805da79319 | |||
f812b1ae5b | |||
287e98ad67 | |||
c3dbbc5eab | |||
13fa0da374 | |||
c9782cf3ef | |||
c49c482ba6 | |||
0484647aae | |||
9c0007fb1d | |||
bd588fa2e5 | |||
7d71556eee | |||
c11f50efec | |||
9c5e32a183 | |||
5e1c6a908f | |||
a2025376fc |
77 changed files with 5158 additions and 2775 deletions
70
.forgejo/logo.svg
Normal file
70
.forgejo/logo.svg
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?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>
|
After Width: | Height: | Size: 5.5 KiB |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -1 +0,0 @@
|
|||
* @TrueCloudLab/storage-core @TrueCloudLab/storage-services @TrueCloudLab/committers
|
|
@ -50,7 +50,7 @@ linters:
|
|||
- bidichk
|
||||
- durationcheck
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- copyloopvar
|
||||
- gofmt
|
||||
- goimports
|
||||
- misspell
|
||||
|
|
|
@ -37,6 +37,6 @@ repos:
|
|||
language: system
|
||||
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v1.56.2
|
||||
rev: v1.60.3
|
||||
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://github.com/TrueCloudLab/compare/v2.15.0...master
|
||||
[Unreleased]: https://git.frostfs.info/TrueCloudLab/frostfs-api-go/compare/v2.16.0...master
|
||||
|
|
2
CODEOWNERS
Normal file
2
CODEOWNERS
Normal file
|
@ -0,0 +1,2 @@
|
|||
.* @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://github.com/TrueCloudLab/frostfs-api-go/issues) and
|
||||
[pull requests](https://github.com/TrueCloudLab/frostfs-api-go/pulls) for existing
|
||||
- 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
|
||||
discussions.
|
||||
|
||||
- Open an issue first, to discuss a new feature or enhancement.
|
||||
|
@ -25,19 +25,20 @@ 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 GitHub Repository
|
||||
Fork [FrostFS node upstream](https://github.com/TrueCloudLab/frostfs-api-go/fork) source
|
||||
### Set up your repository
|
||||
|
||||
Fork [FrostFS node upstream](https://git.frostfs.info/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://github.com/TrueCloudLab/frostfs-api-go
|
||||
$ git clone https://git.frostfs.info/TrueCloudLab/frostfs-api-go
|
||||
```
|
||||
|
||||
### Set up git remote as ``upstream``
|
||||
```sh
|
||||
$ cd frostfs-api-go
|
||||
$ git remote add upstream https://github.com/TrueCloudLab/frostfs-api-go
|
||||
$ git remote add upstream https://git.frostfs.info/TrueCloudLab/frostfs-api-go
|
||||
$ git fetch upstream
|
||||
$ git merge upstream/master
|
||||
...
|
||||
|
@ -86,7 +87,7 @@ $ git push origin feature/123-something_awesome
|
|||
```
|
||||
|
||||
### Create a Pull Request
|
||||
Pull requests can be created via GitHub. Refer to [this
|
||||
Pull requests can be created via git.frostfs.info. 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.
|
||||
|
|
16
README.md
16
README.md
|
@ -1,27 +1,25 @@
|
|||
<p align="center">
|
||||
<img src="./.github/logo.svg" width="500px" alt="FrostFS">
|
||||
<img src="./.forgejo/logo.svg" width="500px" alt="FrostFS">
|
||||
</p>
|
||||
<p align="center">
|
||||
Low-level Golang API for <a href="https://frostfs.info">FrostFS</a>
|
||||
</p>
|
||||
|
||||
---
|
||||

|
||||
[](https://codecov.io/gh/TrueCloudLab/frostfs-api-go)
|
||||
[](https://goreportcard.com/report/github.com/TrueCloudLab/frostfs-api-go)
|
||||
[](https://github.com/TrueCloudLab/frostfs-api-go)
|
||||

|
||||

|
||||
[](https://goreportcard.com/report/git.frostfs.info/TrueCloudLab/frostfs-api-go)
|
||||
[](https://git.frostfs.info/TrueCloudLab/frostfs-api-go)
|
||||
|
||||
# Overview
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
## Frostfs-Api compatibility
|
||||
|
||||
|frostfs-api-go version|supported frostfs-api versions|
|
||||
|:------------------:|:--------------------------:|
|
||||
|v2.14.x|[v2.14.0](https://github.com/TrueCloudLab/frostfs-api/releases/tag/v2.14.0)|
|
||||
|v2.14.x|[v2.14.0](https://git.frostfs.info/TrueCloudLab/frostfs-api/releases/tag/v2.14.0)|
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
68
accounting/grpc/service_frostfs.pb.go
generated
68
accounting/grpc/service_frostfs.pb.go
generated
|
@ -98,10 +98,16 @@ func (x *BalanceRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"ownerId\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"ownerId\":"
|
||||
out.RawString(prefix)
|
||||
x.OwnerId.MarshalEasyJSON(out)
|
||||
}
|
||||
out.RawByte('}')
|
||||
|
@ -295,19 +301,35 @@ func (x *BalanceRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -452,10 +474,16 @@ func (x *BalanceResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"balance\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"balance\":"
|
||||
out.RawString(prefix)
|
||||
x.Balance.MarshalEasyJSON(out)
|
||||
}
|
||||
out.RawByte('}')
|
||||
|
@ -649,19 +677,35 @@ func (x *BalanceResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
|
4
accounting/grpc/service_grpc.pb.go
generated
4
accounting/grpc/service_grpc.pb.go
generated
|
@ -26,7 +26,7 @@ const (
|
|||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type AccountingServiceClient interface {
|
||||
// Returns the amount of funds in GAS token for the requested NeoFS account.
|
||||
// Returns the amount of funds in GAS token for the requested FrostFS account.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS):
|
||||
|
@ -56,7 +56,7 @@ func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceReques
|
|||
// All implementations should embed UnimplementedAccountingServiceServer
|
||||
// for forward compatibility
|
||||
type AccountingServiceServer interface {
|
||||
// Returns the amount of funds in GAS token for the requested NeoFS account.
|
||||
// Returns the amount of funds in GAS token for the requested FrostFS account.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS):
|
||||
|
|
42
accounting/grpc/types_frostfs.pb.go
generated
42
accounting/grpc/types_frostfs.pb.go
generated
|
@ -11,6 +11,7 @@ import (
|
|||
easyproto "github.com/VictoriaMetrics/easyproto"
|
||||
jlexer "github.com/mailru/easyjson/jlexer"
|
||||
jwriter "github.com/mailru/easyjson/jwriter"
|
||||
strconv "strconv"
|
||||
)
|
||||
|
||||
type Decimal struct {
|
||||
|
@ -113,14 +114,27 @@ func (x *Decimal) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"value\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Int64(x.Value)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"value\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.Value, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"precision\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"precision\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.Precision)
|
||||
}
|
||||
|
@ -155,13 +169,29 @@ func (x *Decimal) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "value":
|
||||
{
|
||||
var f int64
|
||||
f = in.Int64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseInt(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := int64(v)
|
||||
f = pv
|
||||
x.Value = f
|
||||
}
|
||||
case "precision":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Precision = f
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ func BenchmarkTable_ToGRPCMessage(b *testing.B) {
|
|||
|
||||
b.Run("to grpc message", func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
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 i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
tb := new(acl.Table)
|
||||
if tb.FromGRPCMessage(raw) != nil {
|
||||
b.FailNow()
|
||||
|
|
|
@ -187,28 +187,26 @@ 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 {
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,28 +239,26 @@ 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 {
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,28 +305,26 @@ 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 {
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -429,9 +423,9 @@ func (c *APEOverride) ToGRPCMessage() grpc.Message {
|
|||
m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
|
||||
|
||||
if len(c.chains) > 0 {
|
||||
apeChains := make([]*apeGRPC.Chain, len(c.chains))
|
||||
apeChains := make([]apeGRPC.Chain, len(c.chains))
|
||||
for i := range c.chains {
|
||||
apeChains[i] = c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
|
||||
apeChains[i] = *c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
|
||||
}
|
||||
m.SetChains(apeChains)
|
||||
}
|
||||
|
@ -459,7 +453,7 @@ func (c *APEOverride) FromGRPCMessage(m grpc.Message) error {
|
|||
c.chains = make([]*ape.Chain, len(apeChains))
|
||||
for i := range apeChains {
|
||||
c.chains[i] = new(ape.Chain)
|
||||
if err := c.chains[i].FromGRPCMessage(apeChains[i]); err != nil {
|
||||
if err := c.chains[i].FromGRPCMessage(&apeChains[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
390
acl/grpc/types_frostfs.pb.go
generated
390
acl/grpc/types_frostfs.pb.go
generated
|
@ -352,24 +352,55 @@ func (x *EACLRecord_Filter) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"headerType\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Int32(int32(x.HeaderType))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"matchType\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"headerType\":"
|
||||
out.RawString(prefix)
|
||||
out.Int32(int32(x.MatchType))
|
||||
v := int32(x.HeaderType)
|
||||
if vv, ok := HeaderType_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"key\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"matchType\":"
|
||||
out.RawString(prefix)
|
||||
v := int32(x.MatchType)
|
||||
if vv, ok := MatchType_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"key\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.Key)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"value\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"value\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.Value)
|
||||
}
|
||||
|
@ -566,21 +597,41 @@ func (x *EACLRecord_Target) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"role\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Int32(int32(x.Role))
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"role\":"
|
||||
out.RawString(prefix)
|
||||
v := int32(x.Role)
|
||||
if vv, ok := Role_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"keys\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"keys\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Keys {
|
||||
if i != 0 {
|
||||
out.RawByte(',')
|
||||
}
|
||||
out.Base64Bytes(x.Keys[i])
|
||||
if x.Keys[i] != nil {
|
||||
out.Base64Bytes(x.Keys[i])
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte(']')
|
||||
}
|
||||
|
@ -640,7 +691,13 @@ func (x *EACLRecord_Target) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
var list [][]byte
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
}
|
||||
|
@ -657,10 +714,10 @@ func (x *EACLRecord_Target) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
|
||||
type EACLRecord struct {
|
||||
Operation Operation `json:"operation"`
|
||||
Action Action `json:"action"`
|
||||
Filters []*EACLRecord_Filter `json:"filters"`
|
||||
Targets []*EACLRecord_Target `json:"targets"`
|
||||
Operation Operation `json:"operation"`
|
||||
Action Action `json:"action"`
|
||||
Filters []EACLRecord_Filter `json:"filters"`
|
||||
Targets []EACLRecord_Target `json:"targets"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -680,10 +737,10 @@ func (x *EACLRecord) StableSize() (size int) {
|
|||
size += proto.EnumSize(1, int32(x.Operation))
|
||||
size += proto.EnumSize(2, int32(x.Action))
|
||||
for i := range x.Filters {
|
||||
size += proto.NestedStructureSize(3, x.Filters[i])
|
||||
size += proto.NestedStructureSizeUnchecked(3, &x.Filters[i])
|
||||
}
|
||||
for i := range x.Targets {
|
||||
size += proto.NestedStructureSize(4, x.Targets[i])
|
||||
size += proto.NestedStructureSizeUnchecked(4, &x.Targets[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
@ -708,14 +765,10 @@ func (x *EACLRecord) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
mm.AppendInt32(2, int32(x.Action))
|
||||
}
|
||||
for i := range x.Filters {
|
||||
if x.Filters[i] != nil {
|
||||
x.Filters[i].EmitProtobuf(mm.AppendMessage(3))
|
||||
}
|
||||
x.Filters[i].EmitProtobuf(mm.AppendMessage(3))
|
||||
}
|
||||
for i := range x.Targets {
|
||||
if x.Targets[i] != nil {
|
||||
x.Targets[i].EmitProtobuf(mm.AppendMessage(4))
|
||||
}
|
||||
x.Targets[i].EmitProtobuf(mm.AppendMessage(4))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -745,8 +798,8 @@ func (x *EACLRecord) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Filters")
|
||||
}
|
||||
x.Filters = append(x.Filters, new(EACLRecord_Filter))
|
||||
ff := x.Filters[len(x.Filters)-1]
|
||||
x.Filters = append(x.Filters, EACLRecord_Filter{})
|
||||
ff := &x.Filters[len(x.Filters)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -755,8 +808,8 @@ func (x *EACLRecord) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Targets")
|
||||
}
|
||||
x.Targets = append(x.Targets, new(EACLRecord_Target))
|
||||
ff := x.Targets[len(x.Targets)-1]
|
||||
x.Targets = append(x.Targets, EACLRecord_Target{})
|
||||
ff := &x.Targets[len(x.Targets)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -782,22 +835,22 @@ func (x *EACLRecord) GetAction() Action {
|
|||
func (x *EACLRecord) SetAction(v Action) {
|
||||
x.Action = v
|
||||
}
|
||||
func (x *EACLRecord) GetFilters() []*EACLRecord_Filter {
|
||||
func (x *EACLRecord) GetFilters() []EACLRecord_Filter {
|
||||
if x != nil {
|
||||
return x.Filters
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *EACLRecord) SetFilters(v []*EACLRecord_Filter) {
|
||||
func (x *EACLRecord) SetFilters(v []EACLRecord_Filter) {
|
||||
x.Filters = v
|
||||
}
|
||||
func (x *EACLRecord) GetTargets() []*EACLRecord_Target {
|
||||
func (x *EACLRecord) GetTargets() []EACLRecord_Target {
|
||||
if x != nil {
|
||||
return x.Targets
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *EACLRecord) SetTargets(v []*EACLRecord_Target) {
|
||||
func (x *EACLRecord) SetTargets(v []EACLRecord_Target) {
|
||||
x.Targets = v
|
||||
}
|
||||
|
||||
|
@ -812,19 +865,45 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"operation\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Int32(int32(x.Operation))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"action\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"operation\":"
|
||||
out.RawString(prefix)
|
||||
out.Int32(int32(x.Action))
|
||||
v := int32(x.Operation)
|
||||
if vv, ok := Operation_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"filters\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"action\":"
|
||||
out.RawString(prefix)
|
||||
v := int32(x.Action)
|
||||
if vv, ok := Action_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"filters\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Filters {
|
||||
|
@ -836,7 +915,12 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"targets\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"targets\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Targets {
|
||||
|
@ -921,11 +1005,11 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
case "filters":
|
||||
{
|
||||
var f *EACLRecord_Filter
|
||||
var list []*EACLRecord_Filter
|
||||
var f EACLRecord_Filter
|
||||
var list []EACLRecord_Filter
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(EACLRecord_Filter)
|
||||
f = EACLRecord_Filter{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
@ -935,11 +1019,11 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
case "targets":
|
||||
{
|
||||
var f *EACLRecord_Target
|
||||
var list []*EACLRecord_Target
|
||||
var f EACLRecord_Target
|
||||
var list []EACLRecord_Target
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(EACLRecord_Target)
|
||||
f = EACLRecord_Target{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
@ -959,7 +1043,7 @@ func (x *EACLRecord) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
type EACLTable struct {
|
||||
Version *grpc.Version `json:"version"`
|
||||
ContainerId *grpc.ContainerID `json:"containerID"`
|
||||
Records []*EACLRecord `json:"records"`
|
||||
Records []EACLRecord `json:"records"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -979,7 +1063,7 @@ func (x *EACLTable) StableSize() (size int) {
|
|||
size += proto.NestedStructureSize(1, x.Version)
|
||||
size += proto.NestedStructureSize(2, x.ContainerId)
|
||||
for i := range x.Records {
|
||||
size += proto.NestedStructureSize(3, x.Records[i])
|
||||
size += proto.NestedStructureSizeUnchecked(3, &x.Records[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
@ -1004,9 +1088,7 @@ func (x *EACLTable) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
x.ContainerId.EmitProtobuf(mm.AppendMessage(2))
|
||||
}
|
||||
for i := range x.Records {
|
||||
if x.Records[i] != nil {
|
||||
x.Records[i].EmitProtobuf(mm.AppendMessage(3))
|
||||
}
|
||||
x.Records[i].EmitProtobuf(mm.AppendMessage(3))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1042,8 +1124,8 @@ func (x *EACLTable) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Records")
|
||||
}
|
||||
x.Records = append(x.Records, new(EACLRecord))
|
||||
ff := x.Records[len(x.Records)-1]
|
||||
x.Records = append(x.Records, EACLRecord{})
|
||||
ff := &x.Records[len(x.Records)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -1069,13 +1151,13 @@ func (x *EACLTable) GetContainerId() *grpc.ContainerID {
|
|||
func (x *EACLTable) SetContainerId(v *grpc.ContainerID) {
|
||||
x.ContainerId = v
|
||||
}
|
||||
func (x *EACLTable) GetRecords() []*EACLRecord {
|
||||
func (x *EACLTable) GetRecords() []EACLRecord {
|
||||
if x != nil {
|
||||
return x.Records
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *EACLTable) SetRecords(v []*EACLRecord) {
|
||||
func (x *EACLTable) SetRecords(v []EACLRecord) {
|
||||
x.Records = v
|
||||
}
|
||||
|
||||
|
@ -1090,19 +1172,35 @@ func (x *EACLTable) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"version\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"version\":"
|
||||
out.RawString(prefix)
|
||||
x.Version.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"containerID\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"containerID\":"
|
||||
out.RawString(prefix)
|
||||
x.ContainerId.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"records\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"records\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Records {
|
||||
|
@ -1157,11 +1255,11 @@ func (x *EACLTable) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
case "records":
|
||||
{
|
||||
var f *EACLRecord
|
||||
var list []*EACLRecord
|
||||
var f EACLRecord
|
||||
var list []EACLRecord
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(EACLRecord)
|
||||
f = EACLRecord{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
@ -1298,21 +1396,43 @@ func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"exp\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Uint64(x.Exp)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"exp\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"nbf\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"nbf\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.Nbf)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"iat\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"iat\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.Iat)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -1345,19 +1465,43 @@ func (x *BearerToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "exp":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Exp = f
|
||||
}
|
||||
case "nbf":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Nbf = f
|
||||
}
|
||||
case "iat":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Iat = f
|
||||
}
|
||||
}
|
||||
|
@ -1371,7 +1515,7 @@ func (x *BearerToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
|
||||
type BearerToken_Body_APEOverride struct {
|
||||
Target *grpc1.ChainTarget `json:"target"`
|
||||
Chains []*grpc1.Chain `json:"chains"`
|
||||
Chains []grpc1.Chain `json:"chains"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -1390,7 +1534,7 @@ func (x *BearerToken_Body_APEOverride) StableSize() (size int) {
|
|||
}
|
||||
size += proto.NestedStructureSize(1, x.Target)
|
||||
for i := range x.Chains {
|
||||
size += proto.NestedStructureSize(2, x.Chains[i])
|
||||
size += proto.NestedStructureSizeUnchecked(2, &x.Chains[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
@ -1412,9 +1556,7 @@ func (x *BearerToken_Body_APEOverride) EmitProtobuf(mm *easyproto.MessageMarshal
|
|||
x.Target.EmitProtobuf(mm.AppendMessage(1))
|
||||
}
|
||||
for i := range x.Chains {
|
||||
if x.Chains[i] != nil {
|
||||
x.Chains[i].EmitProtobuf(mm.AppendMessage(2))
|
||||
}
|
||||
x.Chains[i].EmitProtobuf(mm.AppendMessage(2))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1441,8 +1583,8 @@ func (x *BearerToken_Body_APEOverride) UnmarshalProtobuf(src []byte) (err error)
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Chains")
|
||||
}
|
||||
x.Chains = append(x.Chains, new(grpc1.Chain))
|
||||
ff := x.Chains[len(x.Chains)-1]
|
||||
x.Chains = append(x.Chains, grpc1.Chain{})
|
||||
ff := &x.Chains[len(x.Chains)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -1459,13 +1601,13 @@ func (x *BearerToken_Body_APEOverride) GetTarget() *grpc1.ChainTarget {
|
|||
func (x *BearerToken_Body_APEOverride) SetTarget(v *grpc1.ChainTarget) {
|
||||
x.Target = v
|
||||
}
|
||||
func (x *BearerToken_Body_APEOverride) GetChains() []*grpc1.Chain {
|
||||
func (x *BearerToken_Body_APEOverride) GetChains() []grpc1.Chain {
|
||||
if x != nil {
|
||||
return x.Chains
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *BearerToken_Body_APEOverride) SetChains(v []*grpc1.Chain) {
|
||||
func (x *BearerToken_Body_APEOverride) SetChains(v []grpc1.Chain) {
|
||||
x.Chains = v
|
||||
}
|
||||
|
||||
|
@ -1480,14 +1622,25 @@ func (x *BearerToken_Body_APEOverride) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"target\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"target\":"
|
||||
out.RawString(prefix)
|
||||
x.Target.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"chains\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"chains\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Chains {
|
||||
|
@ -1535,11 +1688,11 @@ func (x *BearerToken_Body_APEOverride) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
case "chains":
|
||||
{
|
||||
var f *grpc1.Chain
|
||||
var list []*grpc1.Chain
|
||||
var f grpc1.Chain
|
||||
var list []grpc1.Chain
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(grpc1.Chain)
|
||||
f = grpc1.Chain{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
@ -1728,29 +1881,55 @@ func (x *BearerToken_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"eaclTable\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"eaclTable\":"
|
||||
out.RawString(prefix)
|
||||
x.EaclTable.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"ownerID\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"ownerID\":"
|
||||
out.RawString(prefix)
|
||||
x.OwnerId.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"lifetime\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"lifetime\":"
|
||||
out.RawString(prefix)
|
||||
x.Lifetime.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"allowImpersonate\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"allowImpersonate\":"
|
||||
out.RawString(prefix)
|
||||
out.Bool(x.AllowImpersonate)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"apeOverride\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"apeOverride\":"
|
||||
out.RawString(prefix)
|
||||
x.ApeOverride.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1931,14 +2110,25 @@ func (x *BearerToken) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"signature\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"signature\":"
|
||||
out.RawString(prefix)
|
||||
x.Signature.MarshalEasyJSON(out)
|
||||
}
|
||||
|
|
|
@ -330,10 +330,18 @@ func (bt *BearerTokenBody) SetEACL(v *Table) {
|
|||
}
|
||||
|
||||
func (t *APEOverride) GetTarget() *ape.ChainTarget {
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.target
|
||||
}
|
||||
|
||||
func (t *APEOverride) GetChains() []*ape.Chain {
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.chains
|
||||
}
|
||||
|
||||
|
|
48
ape/grpc/types_frostfs.pb.go
generated
48
ape/grpc/types_frostfs.pb.go
generated
|
@ -155,14 +155,30 @@ func (x *ChainTarget) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"type\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Int32(int32(x.Type))
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"type\":"
|
||||
out.RawString(prefix)
|
||||
v := int32(x.Type)
|
||||
if vv, ok := TargetType_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"name\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"name\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.Name)
|
||||
}
|
||||
|
@ -333,13 +349,23 @@ func (x *Chain) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
switch xx := x.Kind.(type) {
|
||||
case *Chain_Raw:
|
||||
{
|
||||
const prefix string = ",\"raw\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(xx.Raw)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"raw\":"
|
||||
out.RawString(prefix)
|
||||
if xx.Raw != nil {
|
||||
out.Base64Bytes(xx.Raw)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
|
@ -375,7 +401,13 @@ func (x *Chain) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
x.Kind = xx
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
xx.Raw = f
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,10 @@ func (c *Chain) SetKind(kind chainKind) {
|
|||
}
|
||||
|
||||
func (c *Chain) GetKind() chainKind {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.kind
|
||||
}
|
||||
|
||||
|
@ -67,5 +71,9 @@ func (c *ChainRaw) SetRaw(raw []byte) {
|
|||
}
|
||||
|
||||
func (c *ChainRaw) GetRaw() []byte {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.Raw
|
||||
}
|
||||
|
|
|
@ -296,9 +296,9 @@ func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message {
|
|||
if respBody != nil {
|
||||
respBodygrpc = new(apemanager.ListChainsResponse_Body)
|
||||
|
||||
chainsgrpc := make([]*apeGRPC.Chain, 0, len(respBody.GetChains()))
|
||||
chainsgrpc := make([]apeGRPC.Chain, 0, len(respBody.GetChains()))
|
||||
for _, chain := range respBody.GetChains() {
|
||||
chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apeGRPC.Chain))
|
||||
chainsgrpc = append(chainsgrpc, *chain.ToGRPCMessage().(*apeGRPC.Chain))
|
||||
}
|
||||
|
||||
respBodygrpc.SetChains(chainsgrpc)
|
||||
|
@ -317,7 +317,7 @@ func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error {
|
|||
|
||||
for _, chaingrpc := range respBodygrpc.GetChains() {
|
||||
chain := new(ape.Chain)
|
||||
if err := chain.FromGRPCMessage(chaingrpc); err != nil {
|
||||
if err := chain.FromGRPCMessage(&chaingrpc); err != nil {
|
||||
return err
|
||||
}
|
||||
chains = append(chains, chain)
|
||||
|
|
258
apemanager/grpc/service_frostfs.pb.go
generated
258
apemanager/grpc/service_frostfs.pb.go
generated
|
@ -121,14 +121,25 @@ func (x *AddChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"target\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"target\":"
|
||||
out.RawString(prefix)
|
||||
x.Target.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"chain\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"chain\":"
|
||||
out.RawString(prefix)
|
||||
x.Chain.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -330,19 +341,35 @@ func (x *AddChainRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -484,11 +511,21 @@ func (x *AddChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"chainId\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.ChainId)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"chainId\":"
|
||||
out.RawString(prefix)
|
||||
if x.ChainId != nil {
|
||||
out.Base64Bytes(x.ChainId)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -521,7 +558,13 @@ func (x *AddChainResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "chainId":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.ChainId = f
|
||||
}
|
||||
}
|
||||
|
@ -680,19 +723,35 @@ func (x *AddChainResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -857,16 +916,31 @@ func (x *RemoveChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"target\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"target\":"
|
||||
out.RawString(prefix)
|
||||
x.Target.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"chainId\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"chainId\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.ChainId)
|
||||
if x.ChainId != nil {
|
||||
out.Base64Bytes(x.ChainId)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -906,7 +980,13 @@ func (x *RemoveChainRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "chainId":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.ChainId = f
|
||||
}
|
||||
}
|
||||
|
@ -1065,19 +1145,35 @@ func (x *RemoveChainRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1381,19 +1477,35 @@ func (x *RemoveChainResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1538,10 +1650,16 @@ func (x *ListChainsRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"target\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"target\":"
|
||||
out.RawString(prefix)
|
||||
x.Target.MarshalEasyJSON(out)
|
||||
}
|
||||
out.RawByte('}')
|
||||
|
@ -1735,19 +1853,35 @@ func (x *ListChainsRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1810,7 +1944,7 @@ func (x *ListChainsRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
|
||||
type ListChainsResponse_Body struct {
|
||||
Chains []*grpc.Chain `json:"chains"`
|
||||
Chains []grpc.Chain `json:"chains"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -1828,7 +1962,7 @@ func (x *ListChainsResponse_Body) StableSize() (size int) {
|
|||
return 0
|
||||
}
|
||||
for i := range x.Chains {
|
||||
size += proto.NestedStructureSize(1, x.Chains[i])
|
||||
size += proto.NestedStructureSizeUnchecked(1, &x.Chains[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
@ -1847,9 +1981,7 @@ func (x *ListChainsResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
return
|
||||
}
|
||||
for i := range x.Chains {
|
||||
if x.Chains[i] != nil {
|
||||
x.Chains[i].EmitProtobuf(mm.AppendMessage(1))
|
||||
}
|
||||
x.Chains[i].EmitProtobuf(mm.AppendMessage(1))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1867,8 +1999,8 @@ func (x *ListChainsResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Chains")
|
||||
}
|
||||
x.Chains = append(x.Chains, new(grpc.Chain))
|
||||
ff := x.Chains[len(x.Chains)-1]
|
||||
x.Chains = append(x.Chains, grpc.Chain{})
|
||||
ff := &x.Chains[len(x.Chains)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -1876,13 +2008,13 @@ func (x *ListChainsResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (x *ListChainsResponse_Body) GetChains() []*grpc.Chain {
|
||||
func (x *ListChainsResponse_Body) GetChains() []grpc.Chain {
|
||||
if x != nil {
|
||||
return x.Chains
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *ListChainsResponse_Body) SetChains(v []*grpc.Chain) {
|
||||
func (x *ListChainsResponse_Body) SetChains(v []grpc.Chain) {
|
||||
x.Chains = v
|
||||
}
|
||||
|
||||
|
@ -1897,10 +2029,16 @@ func (x *ListChainsResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"chains\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"chains\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Chains {
|
||||
if i != 0 {
|
||||
|
@ -1940,11 +2078,11 @@ func (x *ListChainsResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
switch key {
|
||||
case "chains":
|
||||
{
|
||||
var f *grpc.Chain
|
||||
var list []*grpc.Chain
|
||||
var f grpc.Chain
|
||||
var list []grpc.Chain
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(grpc.Chain)
|
||||
f = grpc.Chain{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
@ -2108,19 +2246,35 @@ func (x *ListChainsResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@ func (r *AddChainRequest) SetBody(body *AddChainRequestBody) {
|
|||
}
|
||||
|
||||
func (r *AddChainRequest) GetBody() *AddChainRequestBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
|
@ -30,6 +34,10 @@ func (rb *AddChainRequestBody) SetTarget(target *ape.ChainTarget) {
|
|||
}
|
||||
|
||||
func (rb *AddChainRequestBody) GetTarget() *ape.ChainTarget {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return rb.target
|
||||
}
|
||||
|
||||
|
@ -38,6 +46,10 @@ func (rb *AddChainRequestBody) SetChain(chain *ape.Chain) {
|
|||
}
|
||||
|
||||
func (rb *AddChainRequestBody) GetChain() *ape.Chain {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return rb.chain
|
||||
}
|
||||
|
||||
|
@ -52,6 +64,10 @@ func (r *AddChainResponse) SetBody(body *AddChainResponseBody) {
|
|||
}
|
||||
|
||||
func (r *AddChainResponse) GetBody() *AddChainResponseBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
|
@ -64,6 +80,10 @@ func (rb *AddChainResponseBody) SetChainID(chainID []byte) {
|
|||
}
|
||||
|
||||
func (rb *AddChainResponseBody) GetChainID() []byte {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return rb.chainID
|
||||
}
|
||||
|
||||
|
@ -78,6 +98,10 @@ func (r *RemoveChainRequest) SetBody(body *RemoveChainRequestBody) {
|
|||
}
|
||||
|
||||
func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
|
@ -92,6 +116,10 @@ func (rb *RemoveChainRequestBody) SetTarget(target *ape.ChainTarget) {
|
|||
}
|
||||
|
||||
func (rb *RemoveChainRequestBody) GetTarget() *ape.ChainTarget {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return rb.target
|
||||
}
|
||||
|
||||
|
@ -100,6 +128,10 @@ func (rb *RemoveChainRequestBody) SetChainID(chainID []byte) {
|
|||
}
|
||||
|
||||
func (rb *RemoveChainRequestBody) GetChainID() []byte {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return rb.chainID
|
||||
}
|
||||
|
||||
|
@ -116,6 +148,10 @@ func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) {
|
|||
}
|
||||
|
||||
func (r *RemoveChainResponse) GetBody() *RemoveChainResponseBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
|
@ -130,6 +166,10 @@ func (r *ListChainsRequest) SetBody(body *ListChainsRequestBody) {
|
|||
}
|
||||
|
||||
func (r *ListChainsRequest) GetBody() *ListChainsRequestBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
|
@ -142,6 +182,10 @@ func (rb *ListChainsRequestBody) SetTarget(target *ape.ChainTarget) {
|
|||
}
|
||||
|
||||
func (rb *ListChainsRequestBody) GetTarget() *ape.ChainTarget {
|
||||
if rb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return rb.target
|
||||
}
|
||||
|
||||
|
@ -156,6 +200,10 @@ func (r *ListChainsResponse) SetBody(body *ListChainsResponseBody) {
|
|||
}
|
||||
|
||||
func (r *ListChainsResponse) GetBody() *ListChainsResponseBody {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.body
|
||||
}
|
||||
|
||||
|
@ -170,5 +218,9 @@ func (r *ListChainsResponseBody) SetChains(chains []*ape.Chain) {
|
|||
}
|
||||
|
||||
func (r *ListChainsResponseBody) GetChains() []*ape.Chain {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return r.chains
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
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"
|
||||
|
@ -39,28 +37,26 @@ 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 {
|
||||
if xs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(xs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&xs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -766,175 +762,3 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error {
|
|||
|
||||
return r.ResponseHeaders.FromMessage(v)
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequestBody) ToGRPCMessage() grpc.Message {
|
||||
var m *container.GetExtendedACLRequest_Body
|
||||
|
||||
if r != nil {
|
||||
m = new(container.GetExtendedACLRequest_Body)
|
||||
|
||||
m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.GetExtendedACLRequest_Body)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
cid := v.GetContainerId()
|
||||
if cid == nil {
|
||||
r.cid = nil
|
||||
} else {
|
||||
if r.cid == nil {
|
||||
r.cid = new(refs.ContainerID)
|
||||
}
|
||||
|
||||
err = r.cid.FromGRPCMessage(cid)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequest) ToGRPCMessage() grpc.Message {
|
||||
var m *container.GetExtendedACLRequest
|
||||
|
||||
if r != nil {
|
||||
m = new(container.GetExtendedACLRequest)
|
||||
|
||||
m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLRequest_Body))
|
||||
r.RequestHeaders.ToMessage(m)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.GetExtendedACLRequest)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
body := v.GetBody()
|
||||
if body == nil {
|
||||
r.body = nil
|
||||
} else {
|
||||
if r.body == nil {
|
||||
r.body = new(GetExtendedACLRequestBody)
|
||||
}
|
||||
|
||||
err = r.body.FromGRPCMessage(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return r.RequestHeaders.FromMessage(v)
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message {
|
||||
var m *container.GetExtendedACLResponse_Body
|
||||
|
||||
if r != nil {
|
||||
m = new(container.GetExtendedACLResponse_Body)
|
||||
|
||||
m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable))
|
||||
m.SetSignature(toSignatureRFC6979(r.sig))
|
||||
m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.GetExtendedACLResponse_Body)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
eacl := v.GetEacl()
|
||||
if eacl == nil {
|
||||
r.eacl = nil
|
||||
} else {
|
||||
if r.eacl == nil {
|
||||
r.eacl = new(acl.Table)
|
||||
}
|
||||
|
||||
err = r.eacl.FromGRPCMessage(eacl)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
sig := v.GetSignature()
|
||||
if sig == nil {
|
||||
r.sig = nil
|
||||
} else {
|
||||
if r.sig == nil {
|
||||
r.sig = new(refs.Signature)
|
||||
}
|
||||
|
||||
r.sig.SetKey(sig.GetKey())
|
||||
r.sig.SetSign(sig.GetSign())
|
||||
}
|
||||
|
||||
token := v.GetSessionToken()
|
||||
if token == nil {
|
||||
r.token = nil
|
||||
} else {
|
||||
if r.token == nil {
|
||||
r.token = new(session.Token)
|
||||
}
|
||||
|
||||
err = r.token.FromGRPCMessage(token)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponse) ToGRPCMessage() grpc.Message {
|
||||
var m *container.GetExtendedACLResponse
|
||||
|
||||
if r != nil {
|
||||
m = new(container.GetExtendedACLResponse)
|
||||
|
||||
m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLResponse_Body))
|
||||
r.ResponseHeaders.ToMessage(m)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*container.GetExtendedACLResponse)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
body := v.GetBody()
|
||||
if body == nil {
|
||||
r.body = nil
|
||||
} else {
|
||||
if r.body == nil {
|
||||
r.body = new(GetExtendedACLResponseBody)
|
||||
}
|
||||
|
||||
err = r.body.FromGRPCMessage(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return r.ResponseHeaders.FromMessage(v)
|
||||
}
|
||||
|
|
1091
container/grpc/service_frostfs.pb.go
generated
1091
container/grpc/service_frostfs.pb.go
generated
File diff suppressed because it is too large
Load diff
|
@ -157,41 +157,3 @@ func DoFuzzJSONListResponse(data []byte) int {
|
|||
}
|
||||
return 1
|
||||
}
|
||||
func DoFuzzProtoGetExtendedACLRequest(data []byte) int {
|
||||
msg := new(GetExtendedACLRequest)
|
||||
if err := msg.UnmarshalProtobuf(data); err != nil {
|
||||
return 0
|
||||
}
|
||||
_ = msg.MarshalProtobuf(nil)
|
||||
return 1
|
||||
}
|
||||
func DoFuzzJSONGetExtendedACLRequest(data []byte) int {
|
||||
msg := new(GetExtendedACLRequest)
|
||||
if err := msg.UnmarshalJSON(data); err != nil {
|
||||
return 0
|
||||
}
|
||||
_, err := msg.MarshalJSON()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
func DoFuzzProtoGetExtendedACLResponse(data []byte) int {
|
||||
msg := new(GetExtendedACLResponse)
|
||||
if err := msg.UnmarshalProtobuf(data); err != nil {
|
||||
return 0
|
||||
}
|
||||
_ = msg.MarshalProtobuf(nil)
|
||||
return 1
|
||||
}
|
||||
func DoFuzzJSONGetExtendedACLResponse(data []byte) int {
|
||||
msg := new(GetExtendedACLResponse)
|
||||
if err := msg.UnmarshalJSON(data); err != nil {
|
||||
return 0
|
||||
}
|
||||
_, err := msg.MarshalJSON()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
|
|
@ -89,23 +89,3 @@ func FuzzJSONListResponse(f *testing.F) {
|
|||
DoFuzzJSONListResponse(data)
|
||||
})
|
||||
}
|
||||
func FuzzProtoGetExtendedACLRequest(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
DoFuzzProtoGetExtendedACLRequest(data)
|
||||
})
|
||||
}
|
||||
func FuzzJSONGetExtendedACLRequest(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
DoFuzzJSONGetExtendedACLRequest(data)
|
||||
})
|
||||
}
|
||||
func FuzzProtoGetExtendedACLResponse(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
DoFuzzProtoGetExtendedACLResponse(data)
|
||||
})
|
||||
}
|
||||
func FuzzJSONGetExtendedACLResponse(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
DoFuzzJSONGetExtendedACLResponse(data)
|
||||
})
|
||||
}
|
||||
|
|
71
container/grpc/service_grpc.pb.go
generated
71
container/grpc/service_grpc.pb.go
generated
|
@ -19,11 +19,10 @@ import (
|
|||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
ContainerService_Put_FullMethodName = "/neo.fs.v2.container.ContainerService/Put"
|
||||
ContainerService_Delete_FullMethodName = "/neo.fs.v2.container.ContainerService/Delete"
|
||||
ContainerService_Get_FullMethodName = "/neo.fs.v2.container.ContainerService/Get"
|
||||
ContainerService_List_FullMethodName = "/neo.fs.v2.container.ContainerService/List"
|
||||
ContainerService_GetExtendedACL_FullMethodName = "/neo.fs.v2.container.ContainerService/GetExtendedACL"
|
||||
ContainerService_Put_FullMethodName = "/neo.fs.v2.container.ContainerService/Put"
|
||||
ContainerService_Delete_FullMethodName = "/neo.fs.v2.container.ContainerService/Delete"
|
||||
ContainerService_Get_FullMethodName = "/neo.fs.v2.container.ContainerService/Get"
|
||||
ContainerService_List_FullMethodName = "/neo.fs.v2.container.ContainerService/List"
|
||||
)
|
||||
|
||||
// ContainerServiceClient is the client API for ContainerService service.
|
||||
|
@ -74,20 +73,6 @@ type ContainerServiceClient interface {
|
|||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// container list access denied.
|
||||
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
|
||||
// Returns Extended ACL table and signature from `Container` smart contract
|
||||
// storage.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS): \
|
||||
// container eACL has been successfully read;
|
||||
// - Common failures (SECTION_FAILURE_COMMON);
|
||||
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
|
||||
// container not found;
|
||||
// - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \
|
||||
// eACL table not found;
|
||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// access to container eACL is denied.
|
||||
GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error)
|
||||
}
|
||||
|
||||
type containerServiceClient struct {
|
||||
|
@ -134,15 +119,6 @@ func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *containerServiceClient) GetExtendedACL(ctx context.Context, in *GetExtendedACLRequest, opts ...grpc.CallOption) (*GetExtendedACLResponse, error) {
|
||||
out := new(GetExtendedACLResponse)
|
||||
err := c.cc.Invoke(ctx, ContainerService_GetExtendedACL_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ContainerServiceServer is the server API for ContainerService service.
|
||||
// All implementations should embed UnimplementedContainerServiceServer
|
||||
// for forward compatibility
|
||||
|
@ -191,20 +167,6 @@ type ContainerServiceServer interface {
|
|||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// container list access denied.
|
||||
List(context.Context, *ListRequest) (*ListResponse, error)
|
||||
// Returns Extended ACL table and signature from `Container` smart contract
|
||||
// storage.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS): \
|
||||
// container eACL has been successfully read;
|
||||
// - Common failures (SECTION_FAILURE_COMMON);
|
||||
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
|
||||
// container not found;
|
||||
// - **EACL_NOT_FOUND** (3073, SECTION_CONTAINER): \
|
||||
// eACL table not found;
|
||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||
// access to container eACL is denied.
|
||||
GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedContainerServiceServer should be embedded to have forward compatible implementations.
|
||||
|
@ -223,9 +185,6 @@ func (UnimplementedContainerServiceServer) Get(context.Context, *GetRequest) (*G
|
|||
func (UnimplementedContainerServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
|
||||
}
|
||||
func (UnimplementedContainerServiceServer) GetExtendedACL(context.Context, *GetExtendedACLRequest) (*GetExtendedACLResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetExtendedACL not implemented")
|
||||
}
|
||||
|
||||
// UnsafeContainerServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ContainerServiceServer will
|
||||
|
@ -310,24 +269,6 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ContainerService_GetExtendedACL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetExtendedACLRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ContainerServiceServer).GetExtendedACL(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ContainerService_GetExtendedACL_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ContainerServiceServer).GetExtendedACL(ctx, req.(*GetExtendedACLRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ContainerService_ServiceDesc is the grpc.ServiceDesc for ContainerService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -351,10 +292,6 @@ var ContainerService_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "List",
|
||||
Handler: _ContainerService_List_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetExtendedACL",
|
||||
Handler: _ContainerService_GetExtendedACL_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "container/grpc/service.proto",
|
||||
|
|
109
container/grpc/types_frostfs.pb.go
generated
109
container/grpc/types_frostfs.pb.go
generated
|
@ -13,6 +13,7 @@ import (
|
|||
easyproto "github.com/VictoriaMetrics/easyproto"
|
||||
jlexer "github.com/mailru/easyjson/jlexer"
|
||||
jwriter "github.com/mailru/easyjson/jwriter"
|
||||
strconv "strconv"
|
||||
)
|
||||
|
||||
type Container_Attribute struct {
|
||||
|
@ -115,14 +116,25 @@ func (x *Container_Attribute) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"key\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"key\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.Key)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"value\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"value\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.Value)
|
||||
}
|
||||
|
@ -180,7 +192,7 @@ type Container struct {
|
|||
OwnerId *grpc.OwnerID `json:"ownerID"`
|
||||
Nonce []byte `json:"nonce"`
|
||||
BasicAcl uint32 `json:"basicACL"`
|
||||
Attributes []*Container_Attribute `json:"attributes"`
|
||||
Attributes []Container_Attribute `json:"attributes"`
|
||||
PlacementPolicy *grpc1.PlacementPolicy `json:"placementPolicy"`
|
||||
}
|
||||
|
||||
|
@ -203,7 +215,7 @@ func (x *Container) StableSize() (size int) {
|
|||
size += proto.BytesSize(3, x.Nonce)
|
||||
size += proto.UInt32Size(4, x.BasicAcl)
|
||||
for i := range x.Attributes {
|
||||
size += proto.NestedStructureSize(5, x.Attributes[i])
|
||||
size += proto.NestedStructureSizeUnchecked(5, &x.Attributes[i])
|
||||
}
|
||||
size += proto.NestedStructureSize(6, x.PlacementPolicy)
|
||||
return size
|
||||
|
@ -235,9 +247,7 @@ func (x *Container) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
mm.AppendUint32(4, x.BasicAcl)
|
||||
}
|
||||
for i := range x.Attributes {
|
||||
if x.Attributes[i] != nil {
|
||||
x.Attributes[i].EmitProtobuf(mm.AppendMessage(5))
|
||||
}
|
||||
x.Attributes[i].EmitProtobuf(mm.AppendMessage(5))
|
||||
}
|
||||
if x.PlacementPolicy != nil {
|
||||
x.PlacementPolicy.EmitProtobuf(mm.AppendMessage(6))
|
||||
|
@ -288,8 +298,8 @@ func (x *Container) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Attributes")
|
||||
}
|
||||
x.Attributes = append(x.Attributes, new(Container_Attribute))
|
||||
ff := x.Attributes[len(x.Attributes)-1]
|
||||
x.Attributes = append(x.Attributes, Container_Attribute{})
|
||||
ff := &x.Attributes[len(x.Attributes)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -342,13 +352,13 @@ func (x *Container) GetBasicAcl() uint32 {
|
|||
func (x *Container) SetBasicAcl(v uint32) {
|
||||
x.BasicAcl = v
|
||||
}
|
||||
func (x *Container) GetAttributes() []*Container_Attribute {
|
||||
func (x *Container) GetAttributes() []Container_Attribute {
|
||||
if x != nil {
|
||||
return x.Attributes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *Container) SetAttributes(v []*Container_Attribute) {
|
||||
func (x *Container) SetAttributes(v []Container_Attribute) {
|
||||
x.Attributes = v
|
||||
}
|
||||
func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy {
|
||||
|
@ -372,29 +382,59 @@ func (x *Container) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"version\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"version\":"
|
||||
out.RawString(prefix)
|
||||
x.Version.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"ownerID\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"ownerID\":"
|
||||
out.RawString(prefix)
|
||||
x.OwnerId.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"nonce\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"nonce\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.Nonce)
|
||||
if x.Nonce != nil {
|
||||
out.Base64Bytes(x.Nonce)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"basicACL\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"basicACL\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.BasicAcl)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"attributes\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"attributes\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Attributes {
|
||||
|
@ -406,7 +446,12 @@ func (x *Container) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"placementPolicy\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"placementPolicy\":"
|
||||
out.RawString(prefix)
|
||||
x.PlacementPolicy.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -455,22 +500,36 @@ func (x *Container) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "nonce":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Nonce = f
|
||||
}
|
||||
case "basicACL":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.BasicAcl = f
|
||||
}
|
||||
case "attributes":
|
||||
{
|
||||
var f *Container_Attribute
|
||||
var list []*Container_Attribute
|
||||
var f Container_Attribute
|
||||
var list []Container_Attribute
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(Container_Attribute)
|
||||
f = Container_Attribute{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
|
|
@ -34,12 +34,6 @@ const (
|
|||
listReqBodyOwnerField = 1
|
||||
|
||||
listRespBodyIDsField = 1
|
||||
|
||||
getEACLReqBodyIDField = 1
|
||||
|
||||
getEACLRespBodyTableField = 1
|
||||
getEACLRespBodySignatureField = 2
|
||||
getEACLRespBodyTokenField = 3
|
||||
)
|
||||
|
||||
func (a *Attribute) StableMarshal(buf []byte) []byte {
|
||||
|
@ -349,65 +343,3 @@ func (r *ListResponseBody) StableSize() (size int) {
|
|||
func (r *ListResponseBody) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(r, data, new(container.ListResponse_Body))
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) []byte {
|
||||
if r == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, r.StableSize())
|
||||
}
|
||||
|
||||
protoutil.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequestBody) StableSize() (size int) {
|
||||
if r == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
size += protoutil.NestedStructureSize(getEACLReqBodyIDField, r.cid)
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequestBody) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(r, data, new(container.GetExtendedACLRequest_Body))
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) []byte {
|
||||
if r == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, r.StableSize())
|
||||
}
|
||||
|
||||
var offset int
|
||||
|
||||
offset += protoutil.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl)
|
||||
offset += protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig)
|
||||
protoutil.NestedStructureMarshal(getEACLRespBodyTokenField, buf[offset:], r.token)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) StableSize() (size int) {
|
||||
if r == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
size += protoutil.NestedStructureSize(getEACLRespBodyTableField, r.eacl)
|
||||
size += protoutil.NestedStructureSize(getEACLRespBodySignatureField, r.sig)
|
||||
size += protoutil.NestedStructureSize(getEACLRespBodyTokenField, r.token)
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(r, data, new(container.GetExtendedACLResponse_Body))
|
||||
}
|
||||
|
|
|
@ -32,9 +32,5 @@ func TestMessageConvert(t *testing.T) {
|
|||
func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequestBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequest(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponseBody(empty) },
|
||||
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponse(empty) },
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package containertest
|
||||
|
||||
import (
|
||||
acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test"
|
||||
"crypto/rand"
|
||||
|
||||
"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"
|
||||
|
@ -36,8 +37,11 @@ func GenerateContainer(empty bool) *container.Container {
|
|||
m := new(container.Container)
|
||||
|
||||
if !empty {
|
||||
nonce := make([]byte, 16)
|
||||
_, _ = rand.Read(nonce)
|
||||
|
||||
m.SetBasicACL(12)
|
||||
m.SetNonce([]byte{1, 2, 3})
|
||||
m.SetNonce(nonce)
|
||||
m.SetOwnerID(refstest.GenerateOwnerID(false))
|
||||
m.SetAttributes(GenerateAttributes(false))
|
||||
m.SetPlacementPolicy(netmaptest.GeneratePlacementPolicy(false))
|
||||
|
@ -234,52 +238,3 @@ func GenerateListResponse(empty bool) *container.ListResponse {
|
|||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequestBody {
|
||||
m := new(container.GetExtendedACLRequestBody)
|
||||
|
||||
if !empty {
|
||||
m.SetContainerID(refstest.GenerateContainerID(false))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateGetExtendedACLRequest(empty bool) *container.GetExtendedACLRequest {
|
||||
m := new(container.GetExtendedACLRequest)
|
||||
|
||||
if !empty {
|
||||
m.SetBody(GenerateGetExtendedACLRequestBody(false))
|
||||
}
|
||||
|
||||
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
||||
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLResponseBody {
|
||||
m := new(container.GetExtendedACLResponseBody)
|
||||
|
||||
if !empty {
|
||||
m.SetEACL(acltest.GenerateTable(false))
|
||||
}
|
||||
|
||||
m.SetSignature(refstest.GenerateSignature(empty))
|
||||
m.SetSessionToken(sessiontest.GenerateSessionToken(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLResponse {
|
||||
m := new(container.GetExtendedACLResponse)
|
||||
|
||||
if !empty {
|
||||
m.SetBody(GenerateGetExtendedACLResponseBody(false))
|
||||
}
|
||||
|
||||
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
||||
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
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"
|
||||
|
@ -110,30 +109,6 @@ type ListResponse struct {
|
|||
session.ResponseHeaders
|
||||
}
|
||||
|
||||
type GetExtendedACLRequestBody struct {
|
||||
cid *refs.ContainerID
|
||||
}
|
||||
|
||||
type GetExtendedACLRequest struct {
|
||||
body *GetExtendedACLRequestBody
|
||||
|
||||
session.RequestHeaders
|
||||
}
|
||||
|
||||
type GetExtendedACLResponseBody struct {
|
||||
eacl *acl.Table
|
||||
|
||||
sig *refs.Signature
|
||||
|
||||
token *session.Token
|
||||
}
|
||||
|
||||
type GetExtendedACLResponse struct {
|
||||
body *GetExtendedACLResponseBody
|
||||
|
||||
session.ResponseHeaders
|
||||
}
|
||||
|
||||
func (a *Attribute) GetKey() string {
|
||||
if a != nil {
|
||||
return a.key
|
||||
|
@ -469,81 +444,3 @@ func (r *ListResponse) GetBody() *ListResponseBody {
|
|||
func (r *ListResponse) SetBody(v *ListResponseBody) {
|
||||
r.body = v
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID {
|
||||
if r != nil {
|
||||
return r.cid
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequestBody) SetContainerID(v *refs.ContainerID) {
|
||||
r.cid = v
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody {
|
||||
if r != nil {
|
||||
return r.body
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) {
|
||||
r.body = v
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table {
|
||||
if r != nil {
|
||||
return r.eacl
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) {
|
||||
r.eacl = v
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature {
|
||||
if r != nil {
|
||||
return r.sig
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) {
|
||||
// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
|
||||
v.SetScheme(0)
|
||||
r.sig = v
|
||||
}
|
||||
|
||||
// GetSessionToken returns token of the session within which requested
|
||||
// eACL table was set.
|
||||
func (r *GetExtendedACLResponseBody) GetSessionToken() *session.Token {
|
||||
if r != nil {
|
||||
return r.token
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSessionToken sets token of the session within which requested
|
||||
// eACL table was set.
|
||||
func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.Token) {
|
||||
r.token = v
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody {
|
||||
if r != nil {
|
||||
return r.body
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) {
|
||||
r.body = v
|
||||
}
|
||||
|
|
|
@ -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 Github release
|
||||
## Make a proper release
|
||||
|
||||
Using Github's web interface create a new release based on just created tag
|
||||
Using git.frostfs.info web interface create a new release based on just created tag
|
||||
with the same changes from changelog and publish it.
|
||||
|
||||
## Close github milestone
|
||||
## Close milestone
|
||||
|
||||
Close corresponding vX.Y.Z github milestone.
|
||||
Close corresponding vX.Y.Z milestone.
|
||||
|
|
14
go.mod
14
go.mod
|
@ -7,9 +7,9 @@ require (
|
|||
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.6.0
|
||||
google.golang.org/grpc v1.63.2
|
||||
google.golang.org/protobuf v1.33.0
|
||||
golang.org/x/sync v0.7.0
|
||||
google.golang.org/grpc v1.66.2
|
||||
google.golang.org/protobuf v1.34.1
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -19,10 +19,10 @@ require (
|
|||
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.21.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // 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
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
28
go.sum
28
go.sum
|
@ -26,20 +26,20 @@ 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
|
||||
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
|
||||
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
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=
|
||||
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=
|
||||
|
|
32
lock/grpc/types_frostfs.pb.go
generated
32
lock/grpc/types_frostfs.pb.go
generated
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
type Lock struct {
|
||||
Members []*grpc.ObjectID `json:"members"`
|
||||
Members []grpc.ObjectID `json:"members"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -33,7 +33,7 @@ func (x *Lock) StableSize() (size int) {
|
|||
return 0
|
||||
}
|
||||
for i := range x.Members {
|
||||
size += proto.NestedStructureSize(1, x.Members[i])
|
||||
size += proto.NestedStructureSizeUnchecked(1, &x.Members[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
@ -52,9 +52,7 @@ func (x *Lock) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
return
|
||||
}
|
||||
for i := range x.Members {
|
||||
if x.Members[i] != nil {
|
||||
x.Members[i].EmitProtobuf(mm.AppendMessage(1))
|
||||
}
|
||||
x.Members[i].EmitProtobuf(mm.AppendMessage(1))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,8 +70,8 @@ func (x *Lock) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Members")
|
||||
}
|
||||
x.Members = append(x.Members, new(grpc.ObjectID))
|
||||
ff := x.Members[len(x.Members)-1]
|
||||
x.Members = append(x.Members, grpc.ObjectID{})
|
||||
ff := &x.Members[len(x.Members)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -81,13 +79,13 @@ func (x *Lock) UnmarshalProtobuf(src []byte) (err error) {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (x *Lock) GetMembers() []*grpc.ObjectID {
|
||||
func (x *Lock) GetMembers() []grpc.ObjectID {
|
||||
if x != nil {
|
||||
return x.Members
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *Lock) SetMembers(v []*grpc.ObjectID) {
|
||||
func (x *Lock) SetMembers(v []grpc.ObjectID) {
|
||||
x.Members = v
|
||||
}
|
||||
|
||||
|
@ -102,10 +100,16 @@ func (x *Lock) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"members\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"members\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Members {
|
||||
if i != 0 {
|
||||
|
@ -145,11 +149,11 @@ func (x *Lock) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
switch key {
|
||||
case "members":
|
||||
{
|
||||
var f *grpc.ObjectID
|
||||
var list []*grpc.ObjectID
|
||||
var f grpc.ObjectID
|
||||
var list []grpc.ObjectID
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(grpc.ObjectID)
|
||||
f = grpc.ObjectID{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
|
|
@ -45,28 +45,26 @@ 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 {
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,28 +103,26 @@ 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 {
|
||||
if ss[i] != nil {
|
||||
err = res[i].FromGRPCMessage(ss[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&ss[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,28 +159,26 @@ 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 {
|
||||
if rs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(rs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&rs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,28 +283,26 @@ 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 {
|
||||
if as[i] != nil {
|
||||
err = res[i].FromGRPCMessage(as[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&as[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -528,13 +520,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 := 0; i < ln; i++ {
|
||||
ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
|
||||
for i := range ln {
|
||||
ps = append(ps, *x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -560,11 +552,9 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error {
|
|||
|
||||
ps = make([]NetworkParameter, ln)
|
||||
|
||||
for i := 0; i < ln; i++ {
|
||||
if psV2[i] != nil {
|
||||
if err := ps[i].FromGRPCMessage(psV2[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
for i := range ln {
|
||||
if err := ps[i].FromGRPCMessage(&psV2[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -756,10 +746,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)
|
||||
|
@ -784,7 +774,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
|
||||
}
|
||||
|
|
181
netmap/grpc/service_frostfs.pb.go
generated
181
netmap/grpc/service_frostfs.pb.go
generated
|
@ -257,19 +257,35 @@ func (x *LocalNodeInfoRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -437,14 +453,25 @@ func (x *LocalNodeInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"version\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"version\":"
|
||||
out.RawString(prefix)
|
||||
x.Version.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"nodeInfo\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"nodeInfo\":"
|
||||
out.RawString(prefix)
|
||||
x.NodeInfo.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -646,19 +673,35 @@ func (x *LocalNodeInfoResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -962,19 +1005,35 @@ func (x *NetworkInfoRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1119,10 +1178,16 @@ func (x *NetworkInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"networkInfo\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"networkInfo\":"
|
||||
out.RawString(prefix)
|
||||
x.NetworkInfo.MarshalEasyJSON(out)
|
||||
}
|
||||
out.RawByte('}')
|
||||
|
@ -1316,19 +1381,35 @@ func (x *NetworkInfoResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1632,19 +1713,35 @@ func (x *NetmapSnapshotRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1789,10 +1886,16 @@ func (x *NetmapSnapshotResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"netmap\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"netmap\":"
|
||||
out.RawString(prefix)
|
||||
x.Netmap.MarshalEasyJSON(out)
|
||||
}
|
||||
out.RawByte('}')
|
||||
|
@ -1986,19 +2089,35 @@ func (x *NetmapSnapshotResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
|
8
netmap/grpc/service_grpc.pb.go
generated
8
netmap/grpc/service_grpc.pb.go
generated
|
@ -40,14 +40,14 @@ type NetmapServiceClient interface {
|
|||
// information about the server has been successfully read;
|
||||
// - Common failures (SECTION_FAILURE_COMMON).
|
||||
LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error)
|
||||
// Read recent information about the NeoFS network.
|
||||
// Read recent information about the FrostFS network.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS):
|
||||
// information about the current network state has been successfully read;
|
||||
// - Common failures (SECTION_FAILURE_COMMON).
|
||||
NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error)
|
||||
// Returns network map snapshot of the current NeoFS epoch.
|
||||
// Returns network map snapshot of the current FrostFS epoch.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS):
|
||||
|
@ -107,14 +107,14 @@ type NetmapServiceServer interface {
|
|||
// information about the server has been successfully read;
|
||||
// - Common failures (SECTION_FAILURE_COMMON).
|
||||
LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error)
|
||||
// Read recent information about the NeoFS network.
|
||||
// Read recent information about the FrostFS network.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS):
|
||||
// information about the current network state has been successfully read;
|
||||
// - Common failures (SECTION_FAILURE_COMMON).
|
||||
NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error)
|
||||
// Returns network map snapshot of the current NeoFS epoch.
|
||||
// Returns network map snapshot of the current FrostFS epoch.
|
||||
//
|
||||
// Statuses:
|
||||
// - **OK** (0, SECTION_SUCCESS):
|
||||
|
|
614
netmap/grpc/types_frostfs.pb.go
generated
614
netmap/grpc/types_frostfs.pb.go
generated
File diff suppressed because it is too large
Load diff
|
@ -335,6 +335,10 @@ 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 i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
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 i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
res, err := AttributesFromGRPC(raw)
|
||||
if err != nil || len(res) != len(raw) {
|
||||
b.FailNow()
|
||||
|
|
|
@ -142,28 +142,26 @@ 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 {
|
||||
if xs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(xs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&xs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -683,9 +681,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
|
||||
}
|
||||
|
@ -706,7 +704,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
|
||||
}
|
||||
}
|
||||
|
@ -1626,28 +1624,26 @@ 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 {
|
||||
if fs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&fs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1827,28 +1823,26 @@ 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 {
|
||||
if rs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(rs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&rs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1173
object/grpc/service_frostfs.pb.go
generated
1173
object/grpc/service_frostfs.pb.go
generated
File diff suppressed because it is too large
Load diff
44
object/grpc/service_grpc.pb.go
generated
44
object/grpc/service_grpc.pb.go
generated
|
@ -170,7 +170,7 @@ type ObjectServiceClient interface {
|
|||
// provided session token has expired.
|
||||
Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error)
|
||||
// Search objects in container. Search query allows to match by Object
|
||||
// Header's filed values. Please see the corresponding NeoFS Technical
|
||||
// Header's filed values. Please see the corresponding FrostFS Technical
|
||||
// Specification section for more details.
|
||||
//
|
||||
// Extended headers can change `Search` behaviour:
|
||||
|
@ -301,16 +301,20 @@ type ObjectServiceClient interface {
|
|||
// provided session token has expired.
|
||||
PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error)
|
||||
// Patch the object. Request uses gRPC stream. First message must set
|
||||
// the address of the object that is going to get patched. If the object's attributes
|
||||
// are patched, then these attrubutes must be set only within the first stream message.
|
||||
// the address of the object that is going to get patched. If the object's
|
||||
// attributes are patched, then these attrubutes must be set only within the
|
||||
// first stream message.
|
||||
//
|
||||
// If the patch request is performed by NOT the object's owner but if the actor has the permission
|
||||
// to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner
|
||||
// loses the object's ownership after the patch request is successfully done.
|
||||
// If the patch request is performed by NOT the object's owner but if the
|
||||
// actor has the permission to perform the patch, then `OwnerID` of the object
|
||||
// is changed. In this case the object's owner loses the object's ownership
|
||||
// after the patch request is successfully done.
|
||||
//
|
||||
// As objects are content-addressable the patching causes new object ID generation for the patched object.
|
||||
// This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases:
|
||||
// 1. The chunk of the applying patch contains the same value as the object's payload within the same range;
|
||||
// As objects are content-addressable the patching causes new object ID
|
||||
// generation for the patched object. This object id is set witihn
|
||||
// `PatchResponse`. But the object id may remain unchanged in such cases:
|
||||
// 1. The chunk of the applying patch contains the same value as the object's
|
||||
// payload within the same range;
|
||||
// 2. The patch that reverts the changes applied by preceding patch;
|
||||
// 3. The application of the same patches for the object a few times.
|
||||
//
|
||||
|
@ -694,7 +698,7 @@ type ObjectServiceServer interface {
|
|||
// provided session token has expired.
|
||||
Head(context.Context, *HeadRequest) (*HeadResponse, error)
|
||||
// Search objects in container. Search query allows to match by Object
|
||||
// Header's filed values. Please see the corresponding NeoFS Technical
|
||||
// Header's filed values. Please see the corresponding FrostFS Technical
|
||||
// Specification section for more details.
|
||||
//
|
||||
// Extended headers can change `Search` behaviour:
|
||||
|
@ -825,16 +829,20 @@ type ObjectServiceServer interface {
|
|||
// provided session token has expired.
|
||||
PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error)
|
||||
// Patch the object. Request uses gRPC stream. First message must set
|
||||
// the address of the object that is going to get patched. If the object's attributes
|
||||
// are patched, then these attrubutes must be set only within the first stream message.
|
||||
// the address of the object that is going to get patched. If the object's
|
||||
// attributes are patched, then these attrubutes must be set only within the
|
||||
// first stream message.
|
||||
//
|
||||
// If the patch request is performed by NOT the object's owner but if the actor has the permission
|
||||
// to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner
|
||||
// loses the object's ownership after the patch request is successfully done.
|
||||
// If the patch request is performed by NOT the object's owner but if the
|
||||
// actor has the permission to perform the patch, then `OwnerID` of the object
|
||||
// is changed. In this case the object's owner loses the object's ownership
|
||||
// after the patch request is successfully done.
|
||||
//
|
||||
// As objects are content-addressable the patching causes new object ID generation for the patched object.
|
||||
// This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases:
|
||||
// 1. The chunk of the applying patch contains the same value as the object's payload within the same range;
|
||||
// As objects are content-addressable the patching causes new object ID
|
||||
// generation for the patched object. This object id is set witihn
|
||||
// `PatchResponse`. But the object id may remain unchanged in such cases:
|
||||
// 1. The chunk of the applying patch contains the same value as the object's
|
||||
// payload within the same range;
|
||||
// 2. The patch that reverts the changes applied by preceding patch;
|
||||
// 3. The application of the same patches for the object a few times.
|
||||
//
|
||||
|
|
651
object/grpc/types_frostfs.pb.go
generated
651
object/grpc/types_frostfs.pb.go
generated
File diff suppressed because it is too large
Load diff
|
@ -89,13 +89,13 @@ func (x *Lock) ToGRPCMessage() grpc.Message {
|
|||
if x != nil {
|
||||
m = new(lock.Lock)
|
||||
|
||||
var members []*refsGRPC.ObjectID
|
||||
var members []refsGRPC.ObjectID
|
||||
|
||||
if x.members != nil {
|
||||
members = make([]*refsGRPC.ObjectID, len(x.members))
|
||||
members = make([]refsGRPC.ObjectID, len(x.members))
|
||||
|
||||
for i := range x.members {
|
||||
members[i] = x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
|
||||
members[i] = *x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ func (x *Lock) FromGRPCMessage(m grpc.Message) error {
|
|||
var err error
|
||||
|
||||
for i := range x.members {
|
||||
err = x.members[i].FromGRPCMessage(members[i])
|
||||
err = x.members[i].FromGRPCMessage(&members[i])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package objecttest
|
||||
|
||||
import (
|
||||
crand "crypto/rand"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
|
@ -59,7 +60,10 @@ func generateSplitHeader(empty, withPar bool) *object.SplitHeader {
|
|||
m := new(object.SplitHeader)
|
||||
|
||||
if !empty {
|
||||
m.SetSplitID([]byte{1, 3, 5})
|
||||
id := make([]byte, 16)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetSplitID(id)
|
||||
m.SetParent(refstest.GenerateObjectID(false))
|
||||
m.SetPrevious(refstest.GenerateObjectID(false))
|
||||
m.SetChildren(refstest.GenerateObjectIDs(false))
|
||||
|
@ -91,7 +95,10 @@ func GenerateECHeader(empty bool) *object.ECHeader {
|
|||
|
||||
if !empty {
|
||||
ech.Parent = refstest.GenerateObjectID(empty)
|
||||
ech.ParentSplitID = []byte{1, 2, 3}
|
||||
|
||||
ech.ParentSplitID = make([]byte, 16)
|
||||
_, _ = crand.Read(ech.ParentSplitID)
|
||||
|
||||
ech.ParentSplitParentID = refstest.GenerateObjectID(empty)
|
||||
ech.ParentAttributes = GenerateAttributes(empty)
|
||||
ech.Index = 0
|
||||
|
@ -150,7 +157,10 @@ func GenerateSplitInfo(empty bool) *object.SplitInfo {
|
|||
m := new(object.SplitInfo)
|
||||
|
||||
if !empty {
|
||||
m.SetSplitID([]byte("splitID"))
|
||||
id := make([]byte, 16)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetSplitID(id)
|
||||
m.SetLastPart(refstest.GenerateObjectID(false))
|
||||
m.SetLink(refstest.GenerateObjectID(false))
|
||||
}
|
||||
|
@ -627,7 +637,10 @@ func GenerateGetRangeHashResponseBody(empty bool) *object.GetRangeHashResponseBo
|
|||
|
||||
if !empty {
|
||||
m.SetType(678)
|
||||
m.SetHashList([][]byte{{1}, {2}})
|
||||
m.SetHashList([][]byte{
|
||||
refstest.GenerateChecksum(false).GetSum(),
|
||||
refstest.GenerateChecksum(false).GetSum(),
|
||||
})
|
||||
}
|
||||
|
||||
return m
|
||||
|
|
|
@ -24,7 +24,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) {
|
|||
|
||||
b.Run("to grpc message", func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
raw := ObjectIDListToGRPCMessage(ids)
|
||||
if len(raw) != len(ids) {
|
||||
b.FailNow()
|
||||
|
@ -33,7 +33,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) {
|
|||
})
|
||||
b.Run("from grpc message", func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
ids, err := ObjectIDListFromGRPCMessage(raw)
|
||||
if err != nil || len(raw) != len(ids) {
|
||||
b.FailNow()
|
||||
|
@ -42,7 +42,7 @@ func benchmarkObjectIDSlice(b *testing.B, size int) {
|
|||
})
|
||||
b.Run("marshal", func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
buf := make([]byte, ObjectIDNestedListSize(1, ids))
|
||||
n := ObjectIDNestedListMarshal(1, buf, ids)
|
||||
if n != len(buf) {
|
||||
|
|
|
@ -52,28 +52,26 @@ func (c *ContainerID) FromGRPCMessage(m grpc.Message) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []*refs.ContainerID) {
|
||||
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []refs.ContainerID) {
|
||||
if ids != nil {
|
||||
res = make([]*refs.ContainerID, 0, len(ids))
|
||||
res = make([]refs.ContainerID, 0, len(ids))
|
||||
|
||||
for i := range ids {
|
||||
res = append(res, ids[i].ToGRPCMessage().(*refs.ContainerID))
|
||||
res = append(res, *ids[i].ToGRPCMessage().(*refs.ContainerID))
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ContainerIDsFromGRPCMessage(idsV2 []*refs.ContainerID) (res []ContainerID, err error) {
|
||||
func ContainerIDsFromGRPCMessage(idsV2 []refs.ContainerID) (res []ContainerID, err error) {
|
||||
if idsV2 != nil {
|
||||
res = make([]ContainerID, len(idsV2))
|
||||
|
||||
for i := range idsV2 {
|
||||
if idsV2[i] != nil {
|
||||
err = res[i].FromGRPCMessage(idsV2[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&idsV2[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,28 +102,26 @@ func (o *ObjectID) FromGRPCMessage(m grpc.Message) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []*refs.ObjectID) {
|
||||
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []refs.ObjectID) {
|
||||
if ids != nil {
|
||||
res = make([]*refs.ObjectID, 0, len(ids))
|
||||
res = make([]refs.ObjectID, 0, len(ids))
|
||||
|
||||
for i := range ids {
|
||||
res = append(res, ids[i].ToGRPCMessage().(*refs.ObjectID))
|
||||
res = append(res, *ids[i].ToGRPCMessage().(*refs.ObjectID))
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) (res []ObjectID, err error) {
|
||||
func ObjectIDListFromGRPCMessage(idsV2 []refs.ObjectID) (res []ObjectID, err error) {
|
||||
if idsV2 != nil {
|
||||
res = make([]ObjectID, len(idsV2))
|
||||
|
||||
for i := range idsV2 {
|
||||
if idsV2[i] != nil {
|
||||
err = res[i].FromGRPCMessage(idsV2[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&idsV2[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
268
refs/grpc/types_frostfs.pb.go
generated
268
refs/grpc/types_frostfs.pb.go
generated
|
@ -190,14 +190,25 @@ func (x *Address) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"containerID\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"containerID\":"
|
||||
out.RawString(prefix)
|
||||
x.ContainerId.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"objectID\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"objectID\":"
|
||||
out.RawString(prefix)
|
||||
x.ObjectId.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -332,11 +343,21 @@ func (x *ObjectID) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"value\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.Value)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"value\":"
|
||||
out.RawString(prefix)
|
||||
if x.Value != nil {
|
||||
out.Base64Bytes(x.Value)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -369,7 +390,13 @@ func (x *ObjectID) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "value":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Value = f
|
||||
}
|
||||
}
|
||||
|
@ -461,11 +488,21 @@ func (x *ContainerID) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"value\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.Value)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"value\":"
|
||||
out.RawString(prefix)
|
||||
if x.Value != nil {
|
||||
out.Base64Bytes(x.Value)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -498,7 +535,13 @@ func (x *ContainerID) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "value":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Value = f
|
||||
}
|
||||
}
|
||||
|
@ -590,11 +633,21 @@ func (x *OwnerID) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"value\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.Value)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"value\":"
|
||||
out.RawString(prefix)
|
||||
if x.Value != nil {
|
||||
out.Base64Bytes(x.Value)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -627,7 +680,13 @@ func (x *OwnerID) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "value":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Value = f
|
||||
}
|
||||
}
|
||||
|
@ -739,14 +798,25 @@ func (x *Version) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"major\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"major\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.Major)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"minor\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"minor\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.Minor)
|
||||
}
|
||||
|
@ -781,13 +851,29 @@ func (x *Version) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "major":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Major = f
|
||||
}
|
||||
case "minor":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Minor = f
|
||||
}
|
||||
}
|
||||
|
@ -919,21 +1005,50 @@ func (x *Signature) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"key\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.Key)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"key\":"
|
||||
out.RawString(prefix)
|
||||
if x.Key != nil {
|
||||
out.Base64Bytes(x.Key)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"signature\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"signature\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.Sign)
|
||||
if x.Sign != nil {
|
||||
out.Base64Bytes(x.Sign)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"scheme\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"scheme\":"
|
||||
out.RawString(prefix)
|
||||
out.Int32(int32(x.Scheme))
|
||||
v := int32(x.Scheme)
|
||||
if vv, ok := SignatureScheme_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -966,13 +1081,25 @@ func (x *Signature) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "key":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Key = f
|
||||
}
|
||||
case "signature":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Sign = f
|
||||
}
|
||||
case "scheme":
|
||||
|
@ -1106,16 +1233,35 @@ func (x *SignatureRFC6979) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"key\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.Key)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"key\":"
|
||||
out.RawString(prefix)
|
||||
if x.Key != nil {
|
||||
out.Base64Bytes(x.Key)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"signature\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"signature\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.Sign)
|
||||
if x.Sign != nil {
|
||||
out.Base64Bytes(x.Sign)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -1148,13 +1294,25 @@ func (x *SignatureRFC6979) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "key":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Key = f
|
||||
}
|
||||
case "signature":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Sign = f
|
||||
}
|
||||
}
|
||||
|
@ -1266,16 +1424,36 @@ func (x *Checksum) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"type\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Int32(int32(x.Type))
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"type\":"
|
||||
out.RawString(prefix)
|
||||
v := int32(x.Type)
|
||||
if vv, ok := ChecksumType_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"sum\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"sum\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.Sum)
|
||||
if x.Sum != nil {
|
||||
out.Base64Bytes(x.Sum)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -1330,7 +1508,13 @@ func (x *Checksum) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "sum":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Sum = f
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package refstest
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
crand "crypto/rand"
|
||||
"crypto/sha256"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
||||
)
|
||||
|
@ -21,7 +22,10 @@ func GenerateOwnerID(empty bool) *refs.OwnerID {
|
|||
m := new(refs.OwnerID)
|
||||
|
||||
if !empty {
|
||||
m.SetValue([]byte{1, 2, 3})
|
||||
id := make([]byte, 25)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetValue(id)
|
||||
}
|
||||
|
||||
return m
|
||||
|
@ -42,7 +46,10 @@ func GenerateObjectID(empty bool) *refs.ObjectID {
|
|||
m := new(refs.ObjectID)
|
||||
|
||||
if !empty {
|
||||
m.SetValue([]byte{1, 2, 3})
|
||||
id := make([]byte, sha256.Size)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetValue(id)
|
||||
}
|
||||
|
||||
return m
|
||||
|
@ -65,7 +72,10 @@ func GenerateContainerID(empty bool) *refs.ContainerID {
|
|||
m := new(refs.ContainerID)
|
||||
|
||||
if !empty {
|
||||
m.SetValue([]byte{1, 2, 3})
|
||||
id := make([]byte, sha256.Size)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetValue(id)
|
||||
}
|
||||
|
||||
return m
|
||||
|
@ -88,9 +98,15 @@ func GenerateSignature(empty bool) *refs.Signature {
|
|||
m := new(refs.Signature)
|
||||
|
||||
if !empty {
|
||||
m.SetKey([]byte{1})
|
||||
m.SetSign([]byte{2})
|
||||
m.SetScheme(refs.SignatureScheme(rand.Int31() % 3))
|
||||
key := make([]byte, 33)
|
||||
_, _ = crand.Read(key)
|
||||
|
||||
sign := make([]byte, 65)
|
||||
_, _ = crand.Read(sign)
|
||||
|
||||
m.SetScheme(refs.ECDSA_SHA512)
|
||||
m.SetKey(key)
|
||||
m.SetSign(sign)
|
||||
}
|
||||
|
||||
return m
|
||||
|
@ -100,8 +116,11 @@ func GenerateChecksum(empty bool) *refs.Checksum {
|
|||
m := new(refs.Checksum)
|
||||
|
||||
if !empty {
|
||||
m.SetType(1)
|
||||
m.SetSum([]byte{1, 2, 3})
|
||||
cs := make([]byte, sha256.Size)
|
||||
_, _ = crand.Read(cs)
|
||||
|
||||
m.SetType(refs.SHA256)
|
||||
m.SetSum(cs)
|
||||
}
|
||||
|
||||
return m
|
||||
|
|
|
@ -2,13 +2,16 @@ package client
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// CallOption is a messaging session option within Protobuf RPC.
|
||||
type CallOption func(*callParameters)
|
||||
|
||||
type callParameters struct {
|
||||
ctx context.Context // nolint:containedctx
|
||||
ctx context.Context // nolint:containedctx
|
||||
dialer func(context.Context, grpc.ClientConnInterface) error
|
||||
}
|
||||
|
||||
func defaultCallParameters() *callParameters {
|
||||
|
@ -27,3 +30,11 @@ func WithContext(ctx context.Context) CallOption {
|
|||
prm.ctx = ctx
|
||||
}
|
||||
}
|
||||
|
||||
// WithDialer returns option to specify grpc dialer. If passed, it will be
|
||||
// called after the connection is successfully created.
|
||||
func WithDialer(dialer func(context.Context, grpc.ClientConnInterface) error) CallOption {
|
||||
return func(prm *callParameters) {
|
||||
prm.dialer = dialer
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
var errInvalidEndpoint = errors.New("invalid endpoint options")
|
||||
|
||||
func (c *Client) openGRPCConn(ctx context.Context) error {
|
||||
func (c *Client) openGRPCConn(ctx context.Context, dialer func(ctx context.Context, cc grpcstd.ClientConnInterface) error) error {
|
||||
if c.conn != nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -21,15 +21,21 @@ func (c *Client) openGRPCConn(ctx context.Context) error {
|
|||
return errInvalidEndpoint
|
||||
}
|
||||
|
||||
dialCtx, cancel := context.WithTimeout(ctx, c.dialTimeout)
|
||||
var err error
|
||||
|
||||
c.conn, err = grpcstd.DialContext(dialCtx, c.addr, c.grpcDialOpts...)
|
||||
|
||||
cancel()
|
||||
|
||||
c.conn, err = grpcstd.NewClient(c.addr, c.grpcDialOpts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("gRPC dial: %w", err)
|
||||
return fmt.Errorf("gRPC new client: %w", err)
|
||||
}
|
||||
|
||||
if dialer != nil {
|
||||
ctx, cancel := context.WithTimeout(ctx, c.dialTimeout)
|
||||
defer cancel()
|
||||
|
||||
if err := dialer(ctx, c.conn); err != nil {
|
||||
_ = c.conn.Close()
|
||||
return fmt.Errorf("gRPC dial: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -46,7 +46,7 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe
|
|||
opt(prm)
|
||||
}
|
||||
|
||||
if err := c.openGRPCConn(prm.ctx); err != nil {
|
||||
if err := c.openGRPCConn(prm.ctx, prm.dialer); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ func (c *cfg) initDefault() {
|
|||
c.dialTimeout = defaultDialTimeout
|
||||
c.rwTimeout = defaultRWTimeout
|
||||
c.grpcDialOpts = []grpc.DialOption{
|
||||
grpc.WithBlock(),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,19 +80,3 @@ func ListContainers(
|
|||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetEACL executes ContainerService.GetExtendedACL RPC.
|
||||
func GetEACL(
|
||||
cli *client.Client,
|
||||
req *container.GetExtendedACLRequest,
|
||||
opts ...client.CallOption,
|
||||
) (*container.GetExtendedACLResponse, error) {
|
||||
resp := new(container.GetExtendedACLResponse)
|
||||
|
||||
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerGetEACL), req, resp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -207,28 +207,26 @@ func (x *XHeader) FromGRPCMessage(m grpc.Message) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func XHeadersToGRPC(xs []XHeader) (res []*session.XHeader) {
|
||||
func XHeadersToGRPC(xs []XHeader) (res []session.XHeader) {
|
||||
if xs != nil {
|
||||
res = make([]*session.XHeader, 0, len(xs))
|
||||
res = make([]session.XHeader, 0, len(xs))
|
||||
|
||||
for i := range xs {
|
||||
res = append(res, xs[i].ToGRPCMessage().(*session.XHeader))
|
||||
res = append(res, *xs[i].ToGRPCMessage().(*session.XHeader))
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func XHeadersFromGRPC(xs []*session.XHeader) (res []XHeader, err error) {
|
||||
func XHeadersFromGRPC(xs []session.XHeader) (res []XHeader, err error) {
|
||||
if xs != nil {
|
||||
res = make([]XHeader, len(xs))
|
||||
|
||||
for i := range xs {
|
||||
if xs[i] != nil {
|
||||
err = res[i].FromGRPCMessage(xs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = res[i].FromGRPCMessage(&xs[i])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
125
session/grpc/service_frostfs.pb.go
generated
125
session/grpc/service_frostfs.pb.go
generated
|
@ -12,6 +12,7 @@ import (
|
|||
easyproto "github.com/VictoriaMetrics/easyproto"
|
||||
jlexer "github.com/mailru/easyjson/jlexer"
|
||||
jwriter "github.com/mailru/easyjson/jwriter"
|
||||
strconv "strconv"
|
||||
)
|
||||
|
||||
type CreateRequest_Body struct {
|
||||
|
@ -117,16 +118,29 @@ func (x *CreateRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"ownerId\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"ownerId\":"
|
||||
out.RawString(prefix)
|
||||
x.OwnerId.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"expiration\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"expiration\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.Expiration)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Expiration, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -166,7 +180,15 @@ func (x *CreateRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "expiration":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Expiration = f
|
||||
}
|
||||
}
|
||||
|
@ -325,19 +347,35 @@ func (x *CreateRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -499,16 +537,35 @@ func (x *CreateResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"id\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.Id)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"id\":"
|
||||
out.RawString(prefix)
|
||||
if x.Id != nil {
|
||||
out.Base64Bytes(x.Id)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"sessionKey\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"sessionKey\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.SessionKey)
|
||||
if x.SessionKey != nil {
|
||||
out.Base64Bytes(x.SessionKey)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -541,13 +598,25 @@ func (x *CreateResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "id":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Id = f
|
||||
}
|
||||
case "sessionKey":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.SessionKey = f
|
||||
}
|
||||
}
|
||||
|
@ -706,19 +775,35 @@ func (x *CreateResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"verifyHeader\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verifyHeader\":"
|
||||
out.RawString(prefix)
|
||||
x.VerifyHeader.MarshalEasyJSON(out)
|
||||
}
|
||||
|
|
539
session/grpc/types_frostfs.pb.go
generated
539
session/grpc/types_frostfs.pb.go
generated
|
@ -72,7 +72,7 @@ func (x *ObjectSessionContext_Verb) FromString(s string) bool {
|
|||
|
||||
type ObjectSessionContext_Target struct {
|
||||
Container *grpc.ContainerID `json:"container"`
|
||||
Objects []*grpc.ObjectID `json:"objects"`
|
||||
Objects []grpc.ObjectID `json:"objects"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -91,7 +91,7 @@ func (x *ObjectSessionContext_Target) StableSize() (size int) {
|
|||
}
|
||||
size += proto.NestedStructureSize(1, x.Container)
|
||||
for i := range x.Objects {
|
||||
size += proto.NestedStructureSize(2, x.Objects[i])
|
||||
size += proto.NestedStructureSizeUnchecked(2, &x.Objects[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
@ -113,9 +113,7 @@ func (x *ObjectSessionContext_Target) EmitProtobuf(mm *easyproto.MessageMarshale
|
|||
x.Container.EmitProtobuf(mm.AppendMessage(1))
|
||||
}
|
||||
for i := range x.Objects {
|
||||
if x.Objects[i] != nil {
|
||||
x.Objects[i].EmitProtobuf(mm.AppendMessage(2))
|
||||
}
|
||||
x.Objects[i].EmitProtobuf(mm.AppendMessage(2))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,8 +140,8 @@ func (x *ObjectSessionContext_Target) UnmarshalProtobuf(src []byte) (err error)
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Objects")
|
||||
}
|
||||
x.Objects = append(x.Objects, new(grpc.ObjectID))
|
||||
ff := x.Objects[len(x.Objects)-1]
|
||||
x.Objects = append(x.Objects, grpc.ObjectID{})
|
||||
ff := &x.Objects[len(x.Objects)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -160,13 +158,13 @@ func (x *ObjectSessionContext_Target) GetContainer() *grpc.ContainerID {
|
|||
func (x *ObjectSessionContext_Target) SetContainer(v *grpc.ContainerID) {
|
||||
x.Container = v
|
||||
}
|
||||
func (x *ObjectSessionContext_Target) GetObjects() []*grpc.ObjectID {
|
||||
func (x *ObjectSessionContext_Target) GetObjects() []grpc.ObjectID {
|
||||
if x != nil {
|
||||
return x.Objects
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *ObjectSessionContext_Target) SetObjects(v []*grpc.ObjectID) {
|
||||
func (x *ObjectSessionContext_Target) SetObjects(v []grpc.ObjectID) {
|
||||
x.Objects = v
|
||||
}
|
||||
|
||||
|
@ -181,14 +179,25 @@ func (x *ObjectSessionContext_Target) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"container\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"container\":"
|
||||
out.RawString(prefix)
|
||||
x.Container.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"objects\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"objects\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Objects {
|
||||
|
@ -236,11 +245,11 @@ func (x *ObjectSessionContext_Target) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
case "objects":
|
||||
{
|
||||
var f *grpc.ObjectID
|
||||
var list []*grpc.ObjectID
|
||||
var f grpc.ObjectID
|
||||
var list []grpc.ObjectID
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(grpc.ObjectID)
|
||||
f = grpc.ObjectID{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
@ -360,14 +369,30 @@ func (x *ObjectSessionContext) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"verb\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Int32(int32(x.Verb))
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verb\":"
|
||||
out.RawString(prefix)
|
||||
v := int32(x.Verb)
|
||||
if vv, ok := ObjectSessionContext_Verb_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"target\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"target\":"
|
||||
out.RawString(prefix)
|
||||
x.Target.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -598,19 +623,40 @@ func (x *ContainerSessionContext) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"verb\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Int32(int32(x.Verb))
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"verb\":"
|
||||
out.RawString(prefix)
|
||||
v := int32(x.Verb)
|
||||
if vv, ok := ContainerSessionContext_Verb_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"wildcard\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"wildcard\":"
|
||||
out.RawString(prefix)
|
||||
out.Bool(x.Wildcard)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"containerID\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"containerID\":"
|
||||
out.RawString(prefix)
|
||||
x.ContainerId.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -806,21 +852,43 @@ func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"exp\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Uint64(x.Exp)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"exp\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"nbf\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"nbf\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.Nbf)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"iat\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"iat\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.Iat)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -853,19 +921,43 @@ func (x *SessionToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "exp":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Exp = f
|
||||
}
|
||||
case "nbf":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Nbf = f
|
||||
}
|
||||
case "iat":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Iat = f
|
||||
}
|
||||
}
|
||||
|
@ -1087,37 +1179,76 @@ func (x *SessionToken_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"id\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.Id)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"id\":"
|
||||
out.RawString(prefix)
|
||||
if x.Id != nil {
|
||||
out.Base64Bytes(x.Id)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"ownerID\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"ownerID\":"
|
||||
out.RawString(prefix)
|
||||
x.OwnerId.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"lifetime\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"lifetime\":"
|
||||
out.RawString(prefix)
|
||||
x.Lifetime.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"sessionKey\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"sessionKey\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.SessionKey)
|
||||
if x.SessionKey != nil {
|
||||
out.Base64Bytes(x.SessionKey)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
switch xx := x.Context.(type) {
|
||||
case *SessionToken_Body_Object:
|
||||
{
|
||||
const prefix string = ",\"object\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"object\":"
|
||||
out.RawString(prefix)
|
||||
xx.Object.MarshalEasyJSON(out)
|
||||
}
|
||||
case *SessionToken_Body_Container:
|
||||
{
|
||||
const prefix string = ",\"container\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"container\":"
|
||||
out.RawString(prefix)
|
||||
xx.Container.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1153,7 +1284,13 @@ func (x *SessionToken_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "id":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Id = f
|
||||
}
|
||||
case "ownerID":
|
||||
|
@ -1173,7 +1310,13 @@ func (x *SessionToken_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "sessionKey":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.SessionKey = f
|
||||
}
|
||||
case "object":
|
||||
|
@ -1325,14 +1468,25 @@ func (x *SessionToken) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"body\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"body\":"
|
||||
out.RawString(prefix)
|
||||
x.Body.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"signature\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"signature\":"
|
||||
out.RawString(prefix)
|
||||
x.Signature.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -1487,14 +1641,25 @@ func (x *XHeader) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"key\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"key\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.Key)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"value\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"value\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.Value)
|
||||
}
|
||||
|
@ -1551,7 +1716,7 @@ type RequestMetaHeader struct {
|
|||
Version *grpc.Version `json:"version"`
|
||||
Epoch uint64 `json:"epoch"`
|
||||
Ttl uint32 `json:"ttl"`
|
||||
XHeaders []*XHeader `json:"xHeaders"`
|
||||
XHeaders []XHeader `json:"xHeaders"`
|
||||
SessionToken *SessionToken `json:"sessionToken"`
|
||||
BearerToken *grpc1.BearerToken `json:"bearerToken"`
|
||||
Origin *RequestMetaHeader `json:"origin"`
|
||||
|
@ -1576,7 +1741,7 @@ func (x *RequestMetaHeader) StableSize() (size int) {
|
|||
size += proto.UInt64Size(2, x.Epoch)
|
||||
size += proto.UInt32Size(3, x.Ttl)
|
||||
for i := range x.XHeaders {
|
||||
size += proto.NestedStructureSize(4, x.XHeaders[i])
|
||||
size += proto.NestedStructureSizeUnchecked(4, &x.XHeaders[i])
|
||||
}
|
||||
size += proto.NestedStructureSize(5, x.SessionToken)
|
||||
size += proto.NestedStructureSize(6, x.BearerToken)
|
||||
|
@ -1608,9 +1773,7 @@ func (x *RequestMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
mm.AppendUint32(3, x.Ttl)
|
||||
}
|
||||
for i := range x.XHeaders {
|
||||
if x.XHeaders[i] != nil {
|
||||
x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4))
|
||||
}
|
||||
x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4))
|
||||
}
|
||||
if x.SessionToken != nil {
|
||||
x.SessionToken.EmitProtobuf(mm.AppendMessage(5))
|
||||
|
@ -1661,8 +1824,8 @@ func (x *RequestMetaHeader) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "XHeaders")
|
||||
}
|
||||
x.XHeaders = append(x.XHeaders, new(XHeader))
|
||||
ff := x.XHeaders[len(x.XHeaders)-1]
|
||||
x.XHeaders = append(x.XHeaders, XHeader{})
|
||||
ff := &x.XHeaders[len(x.XHeaders)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -1730,13 +1893,13 @@ func (x *RequestMetaHeader) GetTtl() uint32 {
|
|||
func (x *RequestMetaHeader) SetTtl(v uint32) {
|
||||
x.Ttl = v
|
||||
}
|
||||
func (x *RequestMetaHeader) GetXHeaders() []*XHeader {
|
||||
func (x *RequestMetaHeader) GetXHeaders() []XHeader {
|
||||
if x != nil {
|
||||
return x.XHeaders
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *RequestMetaHeader) SetXHeaders(v []*XHeader) {
|
||||
func (x *RequestMetaHeader) SetXHeaders(v []XHeader) {
|
||||
x.XHeaders = v
|
||||
}
|
||||
func (x *RequestMetaHeader) GetSessionToken() *SessionToken {
|
||||
|
@ -1787,24 +1950,47 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"version\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"version\":"
|
||||
out.RawString(prefix)
|
||||
x.Version.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"epoch\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"epoch\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.Epoch)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"ttl\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"ttl\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.Ttl)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"xHeaders\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"xHeaders\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.XHeaders {
|
||||
|
@ -1816,24 +2002,46 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"sessionToken\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"sessionToken\":"
|
||||
out.RawString(prefix)
|
||||
x.SessionToken.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"bearerToken\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"bearerToken\":"
|
||||
out.RawString(prefix)
|
||||
x.BearerToken.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"origin\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"origin\":"
|
||||
out.RawString(prefix)
|
||||
x.Origin.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"magicNumber\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"magicNumber\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.MagicNumber)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -1873,22 +2081,38 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "epoch":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Epoch = f
|
||||
}
|
||||
case "ttl":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Ttl = f
|
||||
}
|
||||
case "xHeaders":
|
||||
{
|
||||
var f *XHeader
|
||||
var list []*XHeader
|
||||
var f XHeader
|
||||
var list []XHeader
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(XHeader)
|
||||
f = XHeader{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
@ -1920,7 +2144,15 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "magicNumber":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.MagicNumber = f
|
||||
}
|
||||
}
|
||||
|
@ -1936,7 +2168,7 @@ type ResponseMetaHeader struct {
|
|||
Version *grpc.Version `json:"version"`
|
||||
Epoch uint64 `json:"epoch"`
|
||||
Ttl uint32 `json:"ttl"`
|
||||
XHeaders []*XHeader `json:"xHeaders"`
|
||||
XHeaders []XHeader `json:"xHeaders"`
|
||||
Origin *ResponseMetaHeader `json:"origin"`
|
||||
Status *grpc2.Status `json:"status"`
|
||||
}
|
||||
|
@ -1959,7 +2191,7 @@ func (x *ResponseMetaHeader) StableSize() (size int) {
|
|||
size += proto.UInt64Size(2, x.Epoch)
|
||||
size += proto.UInt32Size(3, x.Ttl)
|
||||
for i := range x.XHeaders {
|
||||
size += proto.NestedStructureSize(4, x.XHeaders[i])
|
||||
size += proto.NestedStructureSizeUnchecked(4, &x.XHeaders[i])
|
||||
}
|
||||
size += proto.NestedStructureSize(5, x.Origin)
|
||||
size += proto.NestedStructureSize(6, x.Status)
|
||||
|
@ -1989,9 +2221,7 @@ func (x *ResponseMetaHeader) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
mm.AppendUint32(3, x.Ttl)
|
||||
}
|
||||
for i := range x.XHeaders {
|
||||
if x.XHeaders[i] != nil {
|
||||
x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4))
|
||||
}
|
||||
x.XHeaders[i].EmitProtobuf(mm.AppendMessage(4))
|
||||
}
|
||||
if x.Origin != nil {
|
||||
x.Origin.EmitProtobuf(mm.AppendMessage(5))
|
||||
|
@ -2036,8 +2266,8 @@ func (x *ResponseMetaHeader) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "XHeaders")
|
||||
}
|
||||
x.XHeaders = append(x.XHeaders, new(XHeader))
|
||||
ff := x.XHeaders[len(x.XHeaders)-1]
|
||||
x.XHeaders = append(x.XHeaders, XHeader{})
|
||||
ff := &x.XHeaders[len(x.XHeaders)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -2090,13 +2320,13 @@ func (x *ResponseMetaHeader) GetTtl() uint32 {
|
|||
func (x *ResponseMetaHeader) SetTtl(v uint32) {
|
||||
x.Ttl = v
|
||||
}
|
||||
func (x *ResponseMetaHeader) GetXHeaders() []*XHeader {
|
||||
func (x *ResponseMetaHeader) GetXHeaders() []XHeader {
|
||||
if x != nil {
|
||||
return x.XHeaders
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *ResponseMetaHeader) SetXHeaders(v []*XHeader) {
|
||||
func (x *ResponseMetaHeader) SetXHeaders(v []XHeader) {
|
||||
x.XHeaders = v
|
||||
}
|
||||
func (x *ResponseMetaHeader) GetOrigin() *ResponseMetaHeader {
|
||||
|
@ -2129,24 +2359,47 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"version\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"version\":"
|
||||
out.RawString(prefix)
|
||||
x.Version.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"epoch\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"epoch\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.Epoch)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"ttl\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"ttl\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.Ttl)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"xHeaders\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"xHeaders\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.XHeaders {
|
||||
|
@ -2158,12 +2411,22 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"origin\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"origin\":"
|
||||
out.RawString(prefix)
|
||||
x.Origin.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"status\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"status\":"
|
||||
out.RawString(prefix)
|
||||
x.Status.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -2205,22 +2468,38 @@ func (x *ResponseMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "epoch":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.Epoch = f
|
||||
}
|
||||
case "ttl":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Ttl = f
|
||||
}
|
||||
case "xHeaders":
|
||||
{
|
||||
var f *XHeader
|
||||
var list []*XHeader
|
||||
var f XHeader
|
||||
var list []XHeader
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(XHeader)
|
||||
f = XHeader{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
@ -2403,24 +2682,45 @@ func (x *RequestVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"bodySignature\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"bodySignature\":"
|
||||
out.RawString(prefix)
|
||||
x.BodySignature.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaSignature\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaSignature\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaSignature.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"originSignature\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"originSignature\":"
|
||||
out.RawString(prefix)
|
||||
x.OriginSignature.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"origin\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"origin\":"
|
||||
out.RawString(prefix)
|
||||
x.Origin.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -2641,24 +2941,45 @@ func (x *ResponseVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"bodySignature\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"bodySignature\":"
|
||||
out.RawString(prefix)
|
||||
x.BodySignature.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"metaSignature\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"metaSignature\":"
|
||||
out.RawString(prefix)
|
||||
x.MetaSignature.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"originSignature\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"originSignature\":"
|
||||
out.RawString(prefix)
|
||||
x.OriginSignature.MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"origin\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"origin\":"
|
||||
out.RawString(prefix)
|
||||
x.Origin.MarshalEasyJSON(out)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package sessiontest
|
||||
|
||||
import (
|
||||
crand "crypto/rand"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
|
@ -38,7 +39,10 @@ func GenerateCreateResponseBody(empty bool) *session.CreateResponseBody {
|
|||
m := new(session.CreateResponseBody)
|
||||
|
||||
if !empty {
|
||||
m.SetID([]byte{1, 2, 3})
|
||||
id := make([]byte, 16)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetID(id)
|
||||
m.SetSessionKey([]byte{4, 5, 6})
|
||||
}
|
||||
|
||||
|
@ -164,7 +168,10 @@ func GenerateSessionTokenBody(empty bool) *session.TokenBody {
|
|||
m := new(session.TokenBody)
|
||||
|
||||
if !empty {
|
||||
m.SetID([]byte{1})
|
||||
id := make([]byte, 16)
|
||||
_, _ = crand.Read(id)
|
||||
|
||||
m.SetID(id)
|
||||
m.SetSessionKey([]byte{2})
|
||||
m.SetOwnerID(refstest.GenerateOwnerID(false))
|
||||
m.SetLifetime(GenerateTokenLifetime(false))
|
||||
|
|
|
@ -46,10 +46,6 @@ func serviceMessageBody(req any) stableMarshaler {
|
|||
return v.GetBody()
|
||||
case *container.ListResponse:
|
||||
return v.GetBody()
|
||||
case *container.GetExtendedACLRequest:
|
||||
return v.GetBody()
|
||||
case *container.GetExtendedACLResponse:
|
||||
return v.GetBody()
|
||||
|
||||
/* Object */
|
||||
case *object.PutRequest:
|
||||
|
|
|
@ -77,7 +77,7 @@ func BenchmarkSignRequest(b *testing.B) {
|
|||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
b.StopTimer()
|
||||
dec := new(accounting.Decimal)
|
||||
dec.SetValue(100)
|
||||
|
@ -103,7 +103,7 @@ func BenchmarkVerifyRequest(b *testing.B) {
|
|||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
for range b.N {
|
||||
b.StopTimer()
|
||||
dec := new(accounting.Decimal)
|
||||
dec.SetValue(100)
|
||||
|
|
|
@ -48,13 +48,13 @@ func (x *Status) ToGRPCMessage() grpc.Message {
|
|||
m.SetCode(CodeToGRPC(x.code))
|
||||
m.SetMessage(x.msg)
|
||||
|
||||
var ds []*status.Status_Detail
|
||||
var ds []status.Status_Detail
|
||||
|
||||
if ln := len(x.details); ln > 0 {
|
||||
ds = make([]*status.Status_Detail, 0, ln)
|
||||
ds = make([]status.Status_Detail, 0, ln)
|
||||
|
||||
for i := 0; i < ln; i++ {
|
||||
ds = append(ds, x.details[i].ToGRPCMessage().(*status.Status_Detail))
|
||||
for i := range ln {
|
||||
ds = append(ds, *x.details[i].ToGRPCMessage().(*status.Status_Detail))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,11 +80,9 @@ func (x *Status) FromGRPCMessage(m grpc.Message) error {
|
|||
|
||||
ds = make([]Detail, ln)
|
||||
|
||||
for i := 0; i < ln; i++ {
|
||||
if dsV2[i] != nil {
|
||||
if err := ds[i].FromGRPCMessage(dsV2[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
for i := range ln {
|
||||
if err := ds[i].FromGRPCMessage(&dsV2[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
101
status/grpc/types_frostfs.pb.go
generated
101
status/grpc/types_frostfs.pb.go
generated
|
@ -368,16 +368,31 @@ func (x *Status_Detail) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"id\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"id\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.Id)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"value\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"value\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.Value)
|
||||
if x.Value != nil {
|
||||
out.Base64Bytes(x.Value)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
@ -410,13 +425,27 @@ func (x *Status_Detail) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "id":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Id = f
|
||||
}
|
||||
case "value":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.Value = f
|
||||
}
|
||||
}
|
||||
|
@ -429,9 +458,9 @@ func (x *Status_Detail) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
|
||||
type Status struct {
|
||||
Code uint32 `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Details []*Status_Detail `json:"details"`
|
||||
Code uint32 `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Details []Status_Detail `json:"details"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -451,7 +480,7 @@ func (x *Status) StableSize() (size int) {
|
|||
size += proto.UInt32Size(1, x.Code)
|
||||
size += proto.StringSize(2, x.Message)
|
||||
for i := range x.Details {
|
||||
size += proto.NestedStructureSize(3, x.Details[i])
|
||||
size += proto.NestedStructureSizeUnchecked(3, &x.Details[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
@ -476,9 +505,7 @@ func (x *Status) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
mm.AppendString(2, x.Message)
|
||||
}
|
||||
for i := range x.Details {
|
||||
if x.Details[i] != nil {
|
||||
x.Details[i].EmitProtobuf(mm.AppendMessage(3))
|
||||
}
|
||||
x.Details[i].EmitProtobuf(mm.AppendMessage(3))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,8 +535,8 @@ func (x *Status) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Details")
|
||||
}
|
||||
x.Details = append(x.Details, new(Status_Detail))
|
||||
ff := x.Details[len(x.Details)-1]
|
||||
x.Details = append(x.Details, Status_Detail{})
|
||||
ff := &x.Details[len(x.Details)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -535,13 +562,13 @@ func (x *Status) GetMessage() string {
|
|||
func (x *Status) SetMessage(v string) {
|
||||
x.Message = v
|
||||
}
|
||||
func (x *Status) GetDetails() []*Status_Detail {
|
||||
func (x *Status) GetDetails() []Status_Detail {
|
||||
if x != nil {
|
||||
return x.Details
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *Status) SetDetails(v []*Status_Detail) {
|
||||
func (x *Status) SetDetails(v []Status_Detail) {
|
||||
x.Details = v
|
||||
}
|
||||
|
||||
|
@ -556,19 +583,35 @@ func (x *Status) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"code\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"code\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.Code)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"message\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"message\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.Message)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"details\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"details\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Details {
|
||||
|
@ -610,7 +653,15 @@ func (x *Status) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "code":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.Code = f
|
||||
}
|
||||
case "message":
|
||||
|
@ -621,11 +672,11 @@ func (x *Status) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
}
|
||||
case "details":
|
||||
{
|
||||
var f *Status_Detail
|
||||
var list []*Status_Detail
|
||||
var f Status_Detail
|
||||
var list []Status_Detail
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(Status_Detail)
|
||||
f = Status_Detail{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
|
|
@ -63,6 +63,8 @@ const (
|
|||
SignatureVerificationFail
|
||||
// NodeUnderMaintenance is a local Code value for NODE_UNDER_MAINTENANCE status.
|
||||
NodeUnderMaintenance
|
||||
// InvalidArgument is a local Code value for INVALID_ARGUMENT status.
|
||||
InvalidArgument
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
83
tombstone/grpc/types_frostfs.pb.go
generated
83
tombstone/grpc/types_frostfs.pb.go
generated
|
@ -12,12 +12,13 @@ import (
|
|||
easyproto "github.com/VictoriaMetrics/easyproto"
|
||||
jlexer "github.com/mailru/easyjson/jlexer"
|
||||
jwriter "github.com/mailru/easyjson/jwriter"
|
||||
strconv "strconv"
|
||||
)
|
||||
|
||||
type Tombstone struct {
|
||||
ExpirationEpoch uint64 `json:"expirationEpoch"`
|
||||
SplitId []byte `json:"splitID"`
|
||||
Members []*grpc.ObjectID `json:"members"`
|
||||
ExpirationEpoch uint64 `json:"expirationEpoch"`
|
||||
SplitId []byte `json:"splitID"`
|
||||
Members []grpc.ObjectID `json:"members"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -37,7 +38,7 @@ func (x *Tombstone) StableSize() (size int) {
|
|||
size += proto.UInt64Size(1, x.ExpirationEpoch)
|
||||
size += proto.BytesSize(2, x.SplitId)
|
||||
for i := range x.Members {
|
||||
size += proto.NestedStructureSize(3, x.Members[i])
|
||||
size += proto.NestedStructureSizeUnchecked(3, &x.Members[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
@ -62,9 +63,7 @@ func (x *Tombstone) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
mm.AppendBytes(2, x.SplitId)
|
||||
}
|
||||
for i := range x.Members {
|
||||
if x.Members[i] != nil {
|
||||
x.Members[i].EmitProtobuf(mm.AppendMessage(3))
|
||||
}
|
||||
x.Members[i].EmitProtobuf(mm.AppendMessage(3))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,8 +93,8 @@ func (x *Tombstone) UnmarshalProtobuf(src []byte) (err error) {
|
|||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "Members")
|
||||
}
|
||||
x.Members = append(x.Members, new(grpc.ObjectID))
|
||||
ff := x.Members[len(x.Members)-1]
|
||||
x.Members = append(x.Members, grpc.ObjectID{})
|
||||
ff := &x.Members[len(x.Members)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
|
@ -121,13 +120,13 @@ func (x *Tombstone) GetSplitId() []byte {
|
|||
func (x *Tombstone) SetSplitId(v []byte) {
|
||||
x.SplitId = v
|
||||
}
|
||||
func (x *Tombstone) GetMembers() []*grpc.ObjectID {
|
||||
func (x *Tombstone) GetMembers() []grpc.ObjectID {
|
||||
if x != nil {
|
||||
return x.Members
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *Tombstone) SetMembers(v []*grpc.ObjectID) {
|
||||
func (x *Tombstone) SetMembers(v []grpc.ObjectID) {
|
||||
x.Members = v
|
||||
}
|
||||
|
||||
|
@ -142,19 +141,41 @@ func (x *Tombstone) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"expirationEpoch\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Uint64(x.ExpirationEpoch)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"splitID\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"expirationEpoch\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(x.SplitId)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.ExpirationEpoch, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"members\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"splitID\":"
|
||||
out.RawString(prefix)
|
||||
if x.SplitId != nil {
|
||||
out.Base64Bytes(x.SplitId)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
{
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"members\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.Members {
|
||||
|
@ -196,22 +217,36 @@ func (x *Tombstone) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "expirationEpoch":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.ExpirationEpoch = f
|
||||
}
|
||||
case "splitID":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.SplitId = f
|
||||
}
|
||||
case "members":
|
||||
{
|
||||
var f *grpc.ObjectID
|
||||
var list []*grpc.ObjectID
|
||||
var f grpc.ObjectID
|
||||
var list []grpc.ObjectID
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = new(grpc.ObjectID)
|
||||
f = grpc.ObjectID{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package tombstonetest
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
|
||||
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone"
|
||||
)
|
||||
|
@ -9,8 +11,11 @@ func GenerateTombstone(empty bool) *tombstone.Tombstone {
|
|||
m := new(tombstone.Tombstone)
|
||||
|
||||
if !empty {
|
||||
id := make([]byte, 16)
|
||||
_, _ = rand.Read(id)
|
||||
|
||||
m.SetExpirationEpoch(89)
|
||||
m.SetSplitID([]byte{3, 2, 1})
|
||||
m.SetSplitID(id)
|
||||
m.SetMembers(refstest.GenerateObjectIDs(false))
|
||||
}
|
||||
|
||||
|
|
|
@ -26,11 +26,34 @@ func nonZero[T protoInt]() T {
|
|||
|
||||
func TestStableMarshalSingle(t *testing.T) {
|
||||
t.Run("empty", func(t *testing.T) {
|
||||
input := &generated.Primitives{}
|
||||
require.Zero(t, input.StableSize())
|
||||
t.Run("proto", func(t *testing.T) {
|
||||
input := &generated.Primitives{}
|
||||
require.Zero(t, input.StableSize())
|
||||
|
||||
r := input.MarshalProtobuf(nil)
|
||||
require.Empty(t, r)
|
||||
r := input.MarshalProtobuf(nil)
|
||||
require.Empty(t, r)
|
||||
})
|
||||
t.Run("json", func(t *testing.T) {
|
||||
input := &generated.Primitives{}
|
||||
r, err := input.MarshalJSON()
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, r)
|
||||
|
||||
var actual test.Primitives
|
||||
require.NoError(t, protojson.Unmarshal(r, &actual))
|
||||
|
||||
t.Run("protojson compatibility", func(t *testing.T) {
|
||||
data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(&actual)
|
||||
require.NoError(t, err)
|
||||
require.JSONEq(t, string(data), string(r))
|
||||
})
|
||||
|
||||
var actualFrostfs generated.Primitives
|
||||
require.NoError(t, actualFrostfs.UnmarshalJSON(r))
|
||||
require.Equal(t, input, &actualFrostfs)
|
||||
|
||||
primitivesEqual(t, input, &actual)
|
||||
})
|
||||
})
|
||||
|
||||
marshalCases := []struct {
|
||||
|
@ -76,6 +99,12 @@ func TestStableMarshalSingle(t *testing.T) {
|
|||
var actual test.Primitives
|
||||
require.NoError(t, protojson.Unmarshal(r, &actual))
|
||||
|
||||
t.Run("protojson compatibility", func(t *testing.T) {
|
||||
data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(&actual)
|
||||
require.NoError(t, err)
|
||||
require.JSONEq(t, string(data), string(r))
|
||||
})
|
||||
|
||||
var actualFrostfs generated.Primitives
|
||||
require.NoError(t, actualFrostfs.UnmarshalJSON(r))
|
||||
require.Equal(t, tc.input, &actualFrostfs)
|
||||
|
@ -88,6 +117,7 @@ func TestStableMarshalSingle(t *testing.T) {
|
|||
|
||||
func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) {
|
||||
// Compare each field directly, because proto-generated code has private fields.
|
||||
require.Equal(t, len(a.FieldA), len(b.FieldA))
|
||||
require.Equal(t, a.FieldA, b.FieldA)
|
||||
require.Equal(t, a.FieldB, b.FieldB)
|
||||
require.Equal(t, a.FieldC, b.FieldC)
|
||||
|
@ -113,6 +143,10 @@ func repPrimitivesEqual(t *testing.T, a *generated.RepPrimitives, b *test.RepPri
|
|||
require.Equal(t, a.FieldE, b.FieldE)
|
||||
require.Equal(t, a.FieldF, b.FieldF)
|
||||
require.Equal(t, a.FieldFu, b.FieldFu)
|
||||
require.Equal(t, len(a.GetFieldAux()), len(b.GetFieldAux()))
|
||||
for i := range a.FieldAux {
|
||||
require.Equal(t, a.GetFieldAux()[i].GetInnerField(), b.GetFieldAux()[i].GetInnerField())
|
||||
}
|
||||
}
|
||||
|
||||
func randIntSlice[T protoInt](n int, includeZero bool) []T {
|
||||
|
@ -129,6 +163,14 @@ func randIntSlice[T protoInt](n int, includeZero bool) []T {
|
|||
return r
|
||||
}
|
||||
|
||||
func uint32SliceToAux(s []uint32) []generated.RepPrimitives_Aux {
|
||||
r := make([]generated.RepPrimitives_Aux, len(s))
|
||||
for i := range s {
|
||||
r[i] = generated.RepPrimitives_Aux{InnerField: s[i]}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func TestStableMarshalRep(t *testing.T) {
|
||||
t.Run("empty", func(t *testing.T) {
|
||||
marshalCases := []struct {
|
||||
|
@ -176,6 +218,9 @@ func TestStableMarshalRep(t *testing.T) {
|
|||
{name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](1, true)}},
|
||||
{name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, true)}},
|
||||
{name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, false)}},
|
||||
{name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](1, true))}},
|
||||
{name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](2, true))}},
|
||||
{name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](2, false))}},
|
||||
}
|
||||
for _, tc := range marshalCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
|
580
util/proto/test/custom/test_frostfs.pb.go
generated
580
util/proto/test/custom/test_frostfs.pb.go
generated
|
@ -130,10 +130,16 @@ func (x *Primitives_Aux) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"innerField\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"innerField\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.InnerField)
|
||||
}
|
||||
out.RawByte('}')
|
||||
|
@ -167,7 +173,15 @@ func (x *Primitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "innerField":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.InnerField = f
|
||||
}
|
||||
}
|
||||
|
@ -560,78 +574,168 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"fieldA\":"
|
||||
out.RawString(prefix[1:])
|
||||
out.Base64Bytes(x.FieldA)
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldA\":"
|
||||
out.RawString(prefix)
|
||||
if x.FieldA != nil {
|
||||
out.Base64Bytes(x.FieldA)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldB\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldB\":"
|
||||
out.RawString(prefix)
|
||||
out.String(x.FieldB)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldC\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldC\":"
|
||||
out.RawString(prefix)
|
||||
out.Bool(x.FieldC)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldD\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldD\":"
|
||||
out.RawString(prefix)
|
||||
out.Int32(x.FieldD)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldE\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldE\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.FieldE)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldF\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldF\":"
|
||||
out.RawString(prefix)
|
||||
out.Int64(x.FieldF)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldF, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldG\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldG\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.FieldG)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldG, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldI\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldI\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint64(x.FieldI)
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldI, 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldJ\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldJ\":"
|
||||
out.RawString(prefix)
|
||||
out.Float64(x.FieldJ)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldK\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldK\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.FieldK)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldH\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldH\":"
|
||||
out.RawString(prefix)
|
||||
out.Int32(int32(x.FieldH))
|
||||
v := int32(x.FieldH)
|
||||
if vv, ok := Primitives_SomeEnum_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}
|
||||
}
|
||||
switch xx := x.FieldM.(type) {
|
||||
case *Primitives_FieldMa:
|
||||
{
|
||||
const prefix string = ",\"fieldMa\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldMa\":"
|
||||
out.RawString(prefix)
|
||||
out.Base64Bytes(xx.FieldMa)
|
||||
if xx.FieldMa != nil {
|
||||
out.Base64Bytes(xx.FieldMa)
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
case *Primitives_FieldMe:
|
||||
{
|
||||
const prefix string = ",\"fieldMe\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldMe\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(xx.FieldMe)
|
||||
}
|
||||
case *Primitives_FieldAux:
|
||||
{
|
||||
const prefix string = ",\"fieldAux\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldAux\":"
|
||||
out.RawString(prefix)
|
||||
xx.FieldAux.MarshalEasyJSON(out)
|
||||
}
|
||||
|
@ -667,7 +771,13 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "fieldA":
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
x.FieldA = f
|
||||
}
|
||||
case "fieldB":
|
||||
|
@ -685,31 +795,71 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "fieldD":
|
||||
{
|
||||
var f int32
|
||||
f = in.Int32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseInt(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := int32(v)
|
||||
f = pv
|
||||
x.FieldD = f
|
||||
}
|
||||
case "fieldE":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.FieldE = f
|
||||
}
|
||||
case "fieldF":
|
||||
{
|
||||
var f int64
|
||||
f = in.Int64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseInt(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := int64(v)
|
||||
f = pv
|
||||
x.FieldF = f
|
||||
}
|
||||
case "fieldG":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.FieldG = f
|
||||
}
|
||||
case "fieldI":
|
||||
{
|
||||
var f uint64
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
x.FieldI = f
|
||||
}
|
||||
case "fieldJ":
|
||||
|
@ -721,7 +871,15 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
case "fieldK":
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.FieldK = f
|
||||
}
|
||||
case "fieldH":
|
||||
|
@ -751,7 +909,13 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
x.FieldM = xx
|
||||
{
|
||||
var f []byte
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
xx.FieldMa = f
|
||||
}
|
||||
case "fieldMe":
|
||||
|
@ -759,7 +923,15 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
x.FieldM = xx
|
||||
{
|
||||
var f uint32
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
xx.FieldMe = f
|
||||
}
|
||||
case "fieldAux":
|
||||
|
@ -802,14 +974,158 @@ func (*Primitives_FieldMe) isPrimitives_FieldM() {}
|
|||
|
||||
func (*Primitives_FieldAux) isPrimitives_FieldM() {}
|
||||
|
||||
type RepPrimitives_Aux struct {
|
||||
InnerField uint32 `json:"innerField"`
|
||||
}
|
||||
|
||||
var (
|
||||
_ encoding.ProtoMarshaler = (*RepPrimitives_Aux)(nil)
|
||||
_ encoding.ProtoUnmarshaler = (*RepPrimitives_Aux)(nil)
|
||||
_ json.Marshaler = (*RepPrimitives_Aux)(nil)
|
||||
_ json.Unmarshaler = (*RepPrimitives_Aux)(nil)
|
||||
)
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *RepPrimitives_Aux) StableSize() (size int) {
|
||||
if x == nil {
|
||||
return 0
|
||||
}
|
||||
size += proto.UInt32Size(1, x.InnerField)
|
||||
return size
|
||||
}
|
||||
|
||||
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
||||
func (x *RepPrimitives_Aux) MarshalProtobuf(dst []byte) []byte {
|
||||
m := pool.MarshalerPool.Get()
|
||||
defer pool.MarshalerPool.Put(m)
|
||||
x.EmitProtobuf(m.MessageMarshaler())
|
||||
dst = m.Marshal(dst)
|
||||
return dst
|
||||
}
|
||||
|
||||
func (x *RepPrimitives_Aux) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
||||
if x == nil {
|
||||
return
|
||||
}
|
||||
if x.InnerField != 0 {
|
||||
mm.AppendUint32(1, x.InnerField)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
||||
func (x *RepPrimitives_Aux) UnmarshalProtobuf(src []byte) (err error) {
|
||||
var fc easyproto.FieldContext
|
||||
for len(src) > 0 {
|
||||
src, err = fc.NextField(src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot read next field in %s", "RepPrimitives_Aux")
|
||||
}
|
||||
switch fc.FieldNum {
|
||||
case 1: // InnerField
|
||||
data, ok := fc.Uint32()
|
||||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "InnerField")
|
||||
}
|
||||
x.InnerField = data
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *RepPrimitives_Aux) GetInnerField() uint32 {
|
||||
if x != nil {
|
||||
return x.InnerField
|
||||
}
|
||||
return 0
|
||||
}
|
||||
func (x *RepPrimitives_Aux) SetInnerField(v uint32) {
|
||||
x.InnerField = v
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (x *RepPrimitives_Aux) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
x.MarshalEasyJSON(&w)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
func (x *RepPrimitives_Aux) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
if x == nil {
|
||||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"innerField\":"
|
||||
out.RawString(prefix)
|
||||
out.Uint32(x.InnerField)
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||
func (x *RepPrimitives_Aux) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
x.UnmarshalEasyJSON(&r)
|
||||
return r.Error()
|
||||
}
|
||||
func (x *RepPrimitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeFieldName(false)
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "innerField":
|
||||
{
|
||||
var f uint32
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
x.InnerField = f
|
||||
}
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
|
||||
type RepPrimitives struct {
|
||||
FieldA [][]byte `json:"fieldA"`
|
||||
FieldB []string `json:"fieldB"`
|
||||
FieldC []int32 `json:"fieldC"`
|
||||
FieldD []uint32 `json:"fieldD"`
|
||||
FieldE []int64 `json:"fieldE"`
|
||||
FieldF []uint64 `json:"fieldF"`
|
||||
FieldFu []uint64 `json:"fieldFu"`
|
||||
FieldA [][]byte `json:"fieldA"`
|
||||
FieldB []string `json:"fieldB"`
|
||||
FieldC []int32 `json:"fieldC"`
|
||||
FieldD []uint32 `json:"fieldD"`
|
||||
FieldE []int64 `json:"fieldE"`
|
||||
FieldF []uint64 `json:"fieldF"`
|
||||
FieldFu []uint64 `json:"fieldFu"`
|
||||
FieldAux []RepPrimitives_Aux `json:"fieldAux"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -840,6 +1156,9 @@ func (x *RepPrimitives) StableSize() (size int) {
|
|||
for i := range x.FieldFu {
|
||||
size += protowire.SizeGroup(protowire.Number(7), protowire.SizeVarint(x.FieldFu[i]))
|
||||
}
|
||||
for i := range x.FieldAux {
|
||||
size += proto.NestedStructureSizeUnchecked(8, &x.FieldAux[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
||||
|
@ -877,6 +1196,9 @@ func (x *RepPrimitives) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|||
for j := range x.FieldFu {
|
||||
mm.AppendUint64(7, x.FieldFu[j])
|
||||
}
|
||||
for i := range x.FieldAux {
|
||||
x.FieldAux[i].EmitProtobuf(mm.AppendMessage(8))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
||||
|
@ -930,6 +1252,16 @@ func (x *RepPrimitives) UnmarshalProtobuf(src []byte) (err error) {
|
|||
return fmt.Errorf("cannot unmarshal field %s", "FieldFu")
|
||||
}
|
||||
x.FieldFu = append(x.FieldFu, data)
|
||||
case 8: // FieldAux
|
||||
data, ok := fc.MessageData()
|
||||
if !ok {
|
||||
return fmt.Errorf("cannot unmarshal field %s", "FieldAux")
|
||||
}
|
||||
x.FieldAux = append(x.FieldAux, RepPrimitives_Aux{})
|
||||
ff := &x.FieldAux[len(x.FieldAux)-1]
|
||||
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||
return fmt.Errorf("unmarshal: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -997,6 +1329,15 @@ func (x *RepPrimitives) GetFieldFu() []uint64 {
|
|||
func (x *RepPrimitives) SetFieldFu(v []uint64) {
|
||||
x.FieldFu = v
|
||||
}
|
||||
func (x *RepPrimitives) GetFieldAux() []RepPrimitives_Aux {
|
||||
if x != nil {
|
||||
return x.FieldAux
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (x *RepPrimitives) SetFieldAux(v []RepPrimitives_Aux) {
|
||||
x.FieldAux = v
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (x *RepPrimitives) MarshalJSON() ([]byte, error) {
|
||||
|
@ -1009,21 +1350,36 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawString("null")
|
||||
return
|
||||
}
|
||||
first := true
|
||||
out.RawByte('{')
|
||||
{
|
||||
const prefix string = ",\"fieldA\":"
|
||||
out.RawString(prefix[1:])
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldA\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.FieldA {
|
||||
if i != 0 {
|
||||
out.RawByte(',')
|
||||
}
|
||||
out.Base64Bytes(x.FieldA[i])
|
||||
if x.FieldA[i] != nil {
|
||||
out.Base64Bytes(x.FieldA[i])
|
||||
} else {
|
||||
out.String("")
|
||||
}
|
||||
}
|
||||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldB\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldB\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.FieldB {
|
||||
|
@ -1035,7 +1391,12 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldC\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldC\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.FieldC {
|
||||
|
@ -1047,7 +1408,12 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldD\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldD\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.FieldD {
|
||||
|
@ -1059,38 +1425,76 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
|
|||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldE\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldE\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.FieldE {
|
||||
if i != 0 {
|
||||
out.RawByte(',')
|
||||
}
|
||||
out.Int64(x.FieldE[i])
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldE[i], 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldF\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldF\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.FieldF {
|
||||
if i != 0 {
|
||||
out.RawByte(',')
|
||||
}
|
||||
out.Uint64(x.FieldF[i])
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldF[i], 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"fieldFu\":"
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldFu\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.FieldFu {
|
||||
if i != 0 {
|
||||
out.RawByte(',')
|
||||
}
|
||||
out.Uint64(x.FieldFu[i])
|
||||
out.RawByte('"')
|
||||
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldFu[i], 10)
|
||||
out.RawByte('"')
|
||||
}
|
||||
out.RawByte(']')
|
||||
}
|
||||
{
|
||||
if !first {
|
||||
out.RawByte(',')
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
const prefix string = "\"fieldAux\":"
|
||||
out.RawString(prefix)
|
||||
out.RawByte('[')
|
||||
for i := range x.FieldAux {
|
||||
if i != 0 {
|
||||
out.RawByte(',')
|
||||
}
|
||||
x.FieldAux[i].MarshalEasyJSON(out)
|
||||
}
|
||||
out.RawByte(']')
|
||||
}
|
||||
|
@ -1128,7 +1532,13 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
var list [][]byte
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = in.Bytes()
|
||||
{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
f = tmp
|
||||
}
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
}
|
||||
|
@ -1154,7 +1564,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
var list []int32
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = in.Int32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseInt(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := int32(v)
|
||||
f = pv
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
}
|
||||
|
@ -1167,7 +1585,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
var list []uint32
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = in.Uint32()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint32(v)
|
||||
f = pv
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
}
|
||||
|
@ -1180,7 +1606,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
var list []int64
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = in.Int64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseInt(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := int64(v)
|
||||
f = pv
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
}
|
||||
|
@ -1193,7 +1627,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
var list []uint64
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
}
|
||||
|
@ -1206,13 +1648,35 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
var list []uint64
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = in.Uint64()
|
||||
r := in.JsonNumber()
|
||||
n := r.String()
|
||||
v, err := strconv.ParseUint(n, 10, 64)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
pv := uint64(v)
|
||||
f = pv
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
}
|
||||
x.FieldFu = list
|
||||
in.Delim(']')
|
||||
}
|
||||
case "fieldAux":
|
||||
{
|
||||
var f RepPrimitives_Aux
|
||||
var list []RepPrimitives_Aux
|
||||
in.Delim('[')
|
||||
for !in.IsDelim(']') {
|
||||
f = RepPrimitives_Aux{}
|
||||
f.UnmarshalEasyJSON(in)
|
||||
list = append(list, f)
|
||||
in.WantComma()
|
||||
}
|
||||
x.FieldAux = list
|
||||
in.Delim(']')
|
||||
}
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
|
|
117
util/proto/test/test.pb.go
generated
117
util/proto/test/test.pb.go
generated
|
@ -257,13 +257,14 @@ type RepPrimitives struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"`
|
||||
FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"`
|
||||
FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"`
|
||||
FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"`
|
||||
FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"`
|
||||
FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"`
|
||||
FieldFu []uint64 `protobuf:"varint,7,rep,name=field_fu,json=fieldFu,proto3" json:"field_fu,omitempty"`
|
||||
FieldA [][]byte `protobuf:"bytes,1,rep,name=field_a,json=fieldA,proto3" json:"field_a,omitempty"`
|
||||
FieldB []string `protobuf:"bytes,2,rep,name=field_b,json=fieldB,proto3" json:"field_b,omitempty"`
|
||||
FieldC []int32 `protobuf:"varint,3,rep,packed,name=field_c,json=fieldC,proto3" json:"field_c,omitempty"`
|
||||
FieldD []uint32 `protobuf:"varint,4,rep,packed,name=field_d,json=fieldD,proto3" json:"field_d,omitempty"`
|
||||
FieldE []int64 `protobuf:"varint,5,rep,packed,name=field_e,json=fieldE,proto3" json:"field_e,omitempty"`
|
||||
FieldF []uint64 `protobuf:"varint,6,rep,packed,name=field_f,json=fieldF,proto3" json:"field_f,omitempty"`
|
||||
FieldFu []uint64 `protobuf:"varint,7,rep,name=field_fu,json=fieldFu,proto3" json:"field_fu,omitempty"`
|
||||
FieldAux []*RepPrimitives_Aux `protobuf:"bytes,8,rep,name=field_aux,json=fieldAux,proto3" json:"field_aux,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RepPrimitives) Reset() {
|
||||
|
@ -347,6 +348,13 @@ func (x *RepPrimitives) GetFieldFu() []uint64 {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *RepPrimitives) GetFieldAux() []*RepPrimitives_Aux {
|
||||
if x != nil {
|
||||
return x.FieldAux
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Primitives_Aux struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -394,6 +402,53 @@ func (x *Primitives_Aux) GetInnerField() uint32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
type RepPrimitives_Aux struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
InnerField uint32 `protobuf:"varint,1,opt,name=inner_field,json=innerField,proto3" json:"inner_field,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RepPrimitives_Aux) Reset() {
|
||||
*x = RepPrimitives_Aux{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RepPrimitives_Aux) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RepPrimitives_Aux) ProtoMessage() {}
|
||||
|
||||
func (x *RepPrimitives_Aux) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_util_proto_test_test_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RepPrimitives_Aux.ProtoReflect.Descriptor instead.
|
||||
func (*RepPrimitives_Aux) Descriptor() ([]byte, []int) {
|
||||
return file_util_proto_test_test_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
func (x *RepPrimitives_Aux) GetInnerField() uint32 {
|
||||
if x != nil {
|
||||
return x.InnerField
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_util_proto_test_test_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_util_proto_test_test_proto_rawDesc = []byte{
|
||||
|
@ -433,7 +488,7 @@ var file_util_proto_test_test_proto_rawDesc = []byte{
|
|||
0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50,
|
||||
0x4f, 0x53, 0x49, 0x54, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x08, 0x4e, 0x45, 0x47,
|
||||
0x41, 0x54, 0x49, 0x56, 0x45, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01,
|
||||
0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22, 0xc4, 0x01, 0x0a, 0x0d,
|
||||
0x42, 0x09, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x22, 0xa2, 0x02, 0x0a, 0x0d,
|
||||
0x52, 0x65, 0x70, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x12, 0x17, 0x0a,
|
||||
0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06,
|
||||
0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
|
||||
|
@ -446,8 +501,14 @@ var file_util_proto_test_test_proto_rawDesc = []byte{
|
|||
0x65, 0x6c, 0x64, 0x5f, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x46, 0x12, 0x1d, 0x0a, 0x08, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x66, 0x75, 0x18,
|
||||
0x07, 0x20, 0x03, 0x28, 0x04, 0x42, 0x02, 0x10, 0x00, 0x52, 0x07, 0x66, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x46, 0x75, 0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x46, 0x75, 0x12, 0x34, 0x0a, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x61, 0x75, 0x78, 0x18,
|
||||
0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70,
|
||||
0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x78, 0x52, 0x08,
|
||||
0x66, 0x69, 0x65, 0x6c, 0x64, 0x41, 0x75, 0x78, 0x1a, 0x26, 0x0a, 0x03, 0x41, 0x75, 0x78, 0x12,
|
||||
0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x42, 0x11, 0x5a, 0x0f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74,
|
||||
0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -463,21 +524,23 @@ func file_util_proto_test_test_proto_rawDescGZIP() []byte {
|
|||
}
|
||||
|
||||
var file_util_proto_test_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_util_proto_test_test_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_util_proto_test_test_proto_goTypes = []interface{}{
|
||||
(Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum
|
||||
(*Primitives)(nil), // 1: test.Primitives
|
||||
(*RepPrimitives)(nil), // 2: test.RepPrimitives
|
||||
(*Primitives_Aux)(nil), // 3: test.Primitives.Aux
|
||||
(Primitives_SomeEnum)(0), // 0: test.Primitives.SomeEnum
|
||||
(*Primitives)(nil), // 1: test.Primitives
|
||||
(*RepPrimitives)(nil), // 2: test.RepPrimitives
|
||||
(*Primitives_Aux)(nil), // 3: test.Primitives.Aux
|
||||
(*RepPrimitives_Aux)(nil), // 4: test.RepPrimitives.Aux
|
||||
}
|
||||
var file_util_proto_test_test_proto_depIdxs = []int32{
|
||||
0, // 0: test.Primitives.field_h:type_name -> test.Primitives.SomeEnum
|
||||
3, // 1: test.Primitives.field_aux:type_name -> test.Primitives.Aux
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
4, // 2: test.RepPrimitives.field_aux:type_name -> test.RepPrimitives.Aux
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_util_proto_test_test_proto_init() }
|
||||
|
@ -522,6 +585,18 @@ func file_util_proto_test_test_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_util_proto_test_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RepPrimitives_Aux); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
file_util_proto_test_test_proto_msgTypes[0].OneofWrappers = []interface{}{
|
||||
(*Primitives_FieldMa)(nil),
|
||||
|
@ -534,7 +609,7 @@ func file_util_proto_test_test_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_util_proto_test_test_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 3,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
@ -40,4 +40,7 @@ message RepPrimitives {
|
|||
repeated int64 field_e = 5;
|
||||
repeated uint64 field_f = 6;
|
||||
repeated uint64 field_fu = 7 [ packed = false ];
|
||||
|
||||
message Aux { uint32 inner_field = 1; }
|
||||
repeated Aux field_aux = 8;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,35 @@ func emitJSONUnmarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
|
|||
g.P("}")
|
||||
}
|
||||
|
||||
func emitJSONParseInteger(g *protogen.GeneratedFile, ident string, method string, bitSize int, typ string) {
|
||||
g.P("r := in.JsonNumber()")
|
||||
g.P("n := r.String()")
|
||||
g.P("v, err := ", strconvPackage.Ident(method), "(n, 10, ", bitSize, ")")
|
||||
g.P("if err != nil {")
|
||||
g.P(" in.AddError(err)")
|
||||
g.P(" return")
|
||||
g.P("}")
|
||||
g.P(ident, " := ", typ, "(v)")
|
||||
}
|
||||
|
||||
func emitJSONReadEnum(g *protogen.GeneratedFile, name string, enumType string) {
|
||||
g.P(`switch v := in.Interface().(type) {
|
||||
case string:
|
||||
if vv, ok := `+enumType+`_value[v]; ok {
|
||||
`+name+` = `+enumType+`(vv)
|
||||
break
|
||||
}
|
||||
vv, err := `, strconvPackage.Ident("ParseInt"), `(v, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
`+name+` = `+enumType+`(vv)
|
||||
case float64:
|
||||
`+name+` = `+enumType+`(v)
|
||||
}`)
|
||||
}
|
||||
|
||||
func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string) {
|
||||
g.P("{")
|
||||
defer g.P("}")
|
||||
|
@ -83,30 +112,20 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string
|
|||
|
||||
enumType := fieldType(g, f).String()
|
||||
g.P("var parsedValue " + enumType)
|
||||
g.P(`switch v := in.Interface().(type) {
|
||||
case string:
|
||||
if vv, ok := `+enumType+`_value[v]; ok {
|
||||
parsedValue = `+enumType+`(vv)
|
||||
break
|
||||
}
|
||||
vv, err := `, strconvPackage.Ident("ParseInt"), `(v, 10, 32)
|
||||
if err != nil {
|
||||
in.AddError(err)
|
||||
return
|
||||
}
|
||||
parsedValue = `+enumType+`(vv)
|
||||
case float64:
|
||||
parsedValue = `+enumType+`(v)
|
||||
}`)
|
||||
emitJSONReadEnum(g, "parsedValue", enumType)
|
||||
template = "%s = parsedValue"
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||
template = "%s = in.Int32()"
|
||||
emitJSONParseInteger(g, "pv", "ParseInt", 32, "int32")
|
||||
template = "%s = pv"
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||
template = "%s = in.Uint32()"
|
||||
emitJSONParseInteger(g, "pv", "ParseUint", 32, "uint32")
|
||||
template = "%s = pv"
|
||||
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
template = "%s = in.Int64()"
|
||||
emitJSONParseInteger(g, "pv", "ParseInt", 64, "int64")
|
||||
template = "%s = pv"
|
||||
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
template = "%s = in.Uint64()"
|
||||
emitJSONParseInteger(g, "pv", "ParseUint", 64, "uint64")
|
||||
template = "%s = pv"
|
||||
case protoreflect.FloatKind:
|
||||
template = "%s = in.Float32()"
|
||||
case protoreflect.DoubleKind:
|
||||
|
@ -114,10 +133,20 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string
|
|||
case protoreflect.StringKind:
|
||||
template = "%s = in.String()"
|
||||
case protoreflect.BytesKind:
|
||||
template = "%s = in.Bytes()"
|
||||
// Since some time ago proto3 support optional keyword, thus the presence is not tracked by default:
|
||||
// https://github.com/protocolbuffers/protobuf-go/blob/fb995f184a1719ec42b247a3771d1036d92adf67/internal/impl/message_reflect_field.go#L327
|
||||
// We do not explicitly support `optional` keyword, protoc will fail on such fileds.
|
||||
// Thus, treat empty string as `[]byte(nil)`.
|
||||
template = `{
|
||||
tmp := in.Bytes()
|
||||
if len(tmp) == 0 {
|
||||
tmp = nil
|
||||
}
|
||||
%s = tmp
|
||||
}`
|
||||
case protoreflect.MessageKind:
|
||||
if f.Desc.IsList() {
|
||||
g.P("f = new(", fieldType(g, f)[3:], ")")
|
||||
g.P("f = ", fieldType(g, f)[2:], "{}")
|
||||
} else {
|
||||
g.P("f = new(", fieldType(g, f)[1:], ")")
|
||||
}
|
||||
|
@ -147,8 +176,11 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
|
|||
g.P("func (x *", msg.GoIdent.GoName, ") MarshalEasyJSON(out *", jwriterPackage.Ident("Writer"), ") {")
|
||||
g.P(`if x == nil { out.RawString("null"); return }`)
|
||||
|
||||
if len(msg.Fields) != 0 {
|
||||
g.P("first := true")
|
||||
}
|
||||
g.P("out.RawByte('{')")
|
||||
for i, f := range msg.Fields {
|
||||
for _, f := range msg.Fields {
|
||||
if f.Oneof != nil {
|
||||
if f.Oneof.Fields[0] != f {
|
||||
continue
|
||||
|
@ -157,29 +189,38 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
|
|||
g.P("switch xx := x.", f.Oneof.GoName, ".(type) {")
|
||||
for _, ff := range f.Oneof.Fields {
|
||||
g.P("case *", ff.GoIdent, ":")
|
||||
emitJSONFieldWrite(g, ff, "xx", i == 0)
|
||||
emitJSONFieldWrite(g, ff, "xx")
|
||||
}
|
||||
g.P("}")
|
||||
continue
|
||||
}
|
||||
emitJSONFieldWrite(g, f, "x", i == 0)
|
||||
emitJSONFieldWrite(g, f, "x")
|
||||
}
|
||||
g.P("out.RawByte('}')")
|
||||
g.P("}")
|
||||
}
|
||||
|
||||
func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string, first bool) {
|
||||
func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string) {
|
||||
g.P("{")
|
||||
defer g.P("}")
|
||||
|
||||
g.P("const prefix string = ", `",\"`, fieldJSONName(f), `\":"`)
|
||||
if first {
|
||||
g.P("out.RawString(prefix[1:])")
|
||||
} else {
|
||||
g.P("out.RawString(prefix)")
|
||||
}
|
||||
|
||||
selector := name + "." + f.GoName
|
||||
|
||||
// This code is responsible for ignoring default values.
|
||||
// We will restore it after having parametrized JSON marshaling.
|
||||
//
|
||||
// isNotDefault := notNil
|
||||
// if f.Desc.IsList() {
|
||||
// isNotDefault = notEmpty
|
||||
// } else if f.Desc.Kind() != protoreflect.MessageKind {
|
||||
// _, isNotDefault = easyprotoKindInfo(f.Desc.Kind())
|
||||
// }
|
||||
// g.P("if ", isNotDefault(selector), "{")
|
||||
// defer g.P("}")
|
||||
|
||||
g.P("if !first { out.RawByte(','); } else { first = false; }")
|
||||
g.P("const prefix string = ", `"\"`, fieldJSONName(f), `\":"`)
|
||||
g.P("out.RawString(prefix)")
|
||||
if f.Desc.IsList() {
|
||||
selector += "[i]"
|
||||
g.P("out.RawByte('[')")
|
||||
|
@ -195,15 +236,27 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin
|
|||
case protoreflect.BoolKind:
|
||||
template = "out.Bool(%s)"
|
||||
case protoreflect.EnumKind:
|
||||
template = "out.Int32(int32(%s))"
|
||||
enumType := fieldType(g, f).String()
|
||||
template = `v := int32(%s)
|
||||
if vv, ok := ` + enumType + `_name[v]; ok {
|
||||
out.String(vv)
|
||||
} else {
|
||||
out.Int32(v)
|
||||
}`
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||
template = "out.Int32(%s)"
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||
template = "out.Uint32(%s)"
|
||||
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
template = "out.Int64(%s)"
|
||||
g.P("out.RawByte('\"')")
|
||||
g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendInt"), "(out.Buffer.Buf, ", selector, ", 10)")
|
||||
g.P("out.RawByte('\"')")
|
||||
return
|
||||
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
template = "out.Uint64(%s)"
|
||||
g.P("out.RawByte('\"')")
|
||||
g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendUint"), "(out.Buffer.Buf, ", selector, ", 10)")
|
||||
g.P("out.RawByte('\"')")
|
||||
return
|
||||
case protoreflect.FloatKind:
|
||||
template = "out.Float32(%s)"
|
||||
case protoreflect.DoubleKind:
|
||||
|
@ -211,7 +264,10 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin
|
|||
case protoreflect.StringKind:
|
||||
template = "out.String(%s)"
|
||||
case protoreflect.BytesKind:
|
||||
template = "out.Base64Bytes(%s)"
|
||||
g.P("if ", selector, "!= nil {")
|
||||
g.P("out.Base64Bytes(", selector, ")")
|
||||
g.P("} else { out.String(\"\") }")
|
||||
return
|
||||
case protoreflect.MessageKind:
|
||||
template = "%s.MarshalEasyJSON(out)"
|
||||
case protoreflect.GroupKind:
|
||||
|
|
|
@ -39,8 +39,8 @@ func emitFieldUnmarshal(g *protogen.GeneratedFile, f *protogen.Field) {
|
|||
g.P("data, ok := fc.MessageData()")
|
||||
g.P(`if !ok { return fmt.Errorf("cannot unmarshal field %s", "`, f.GoName, `") }`)
|
||||
if f.Desc.IsList() {
|
||||
g.P(name, " = append(", name, ", new(", fieldType(g, f)[3:], "))")
|
||||
g.P("ff := ", name, "[len(", name, ")-1]")
|
||||
g.P(name, " = append(", name, ", ", fieldType(g, f)[2:], "{})")
|
||||
g.P("ff := &", name, "[len(", name, ")-1]")
|
||||
name = "ff"
|
||||
} else if f.Oneof != nil {
|
||||
const tmp = "oneofField"
|
||||
|
@ -172,11 +172,12 @@ func emitMarshalRaw(g *protogen.GeneratedFile, f *protogen.Field, name string) {
|
|||
defer g.P("}")
|
||||
|
||||
name += "[i]"
|
||||
} else {
|
||||
g.P("if ", notNil(name), " {")
|
||||
defer g.P("}")
|
||||
}
|
||||
|
||||
g.P("if ", notNil(name), " {")
|
||||
g.P(name, ".EmitProtobuf(mm.AppendMessage(", f.Desc.Number(), "))")
|
||||
g.P("}")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,10 @@ func fieldType(g *protogen.GeneratedFile, field *protogen.Field) structField {
|
|||
case protoreflect.BytesKind:
|
||||
typ = "[]byte"
|
||||
case protoreflect.MessageKind:
|
||||
typ = structField(g.QualifiedGoIdent(field.Message.GoIdent)).PointerTo()
|
||||
typ = structField(g.QualifiedGoIdent(field.Message.GoIdent))
|
||||
if !field.Desc.IsList() {
|
||||
typ = typ.PointerTo()
|
||||
}
|
||||
case protoreflect.GroupKind:
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ func emitFieldSize(g *protogen.GeneratedFile, f *protogen.Field) {
|
|||
case f.Desc.IsList() && (f.Desc.Kind() == protoreflect.MessageKind || f.Desc.Kind() == protoreflect.Uint64Kind && !f.Desc.IsPacked()):
|
||||
g.P("for i := range ", name, "{")
|
||||
if f.Desc.Kind() == protoreflect.MessageKind {
|
||||
g.P("size += ", protoPackage.Ident("NestedStructureSize"), "(", f.Desc.Number(), ", ", name, "[i])")
|
||||
g.P("size += ", protoPackage.Ident("NestedStructureSizeUnchecked"), "(", f.Desc.Number(), ", &", name, "[i])")
|
||||
} else {
|
||||
if f.Desc.Kind() != protoreflect.Uint64Kind {
|
||||
panic("only uint64 unpacked primitive is supported")
|
||||
|
|
Loading…
Add table
Reference in a new issue