Compare commits

...
Sign in to create a new pull request.

16 commits

Author SHA1 Message Date
557267a07b [#126] Refine CODEOWNERS settings
Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-12-10 12:37:53 +03:00
2bdee4c9e6 [#126] Stop using obsolete .github directory
This commit is a part of multi-repo cleanup effort:
TrueCloudLab/frostfs-infra#136

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
2024-11-06 15:14:57 +03:00
f0fc40e116
[#123] Resolve funlen linter issue
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-11 14:40:54 +03:00
29f2157563
[#123] protogen: Treat bytes field as non-nullable
In protobuf 3.12 they have added an support for `optional` keyword,
which has made it into the main branch in 3.15.
https://github.com/protocolbuffers/protobuf/blob/main/docs/implementing_proto3_presence.md
https://github.com/protocolbuffers/protobuf/blob/v3.12.0/docs/field_presence.md#presence-in-proto3-apis

This means that without an explicit `optional` keyword field presence
for scalars is not tracked, thus empty string in JSON should be
unmarshaled to a nil byte slice. Relevant decoding code and tests from
protojson:
fb995f184a/internal/impl/message_reflect_field.go (L327)
fb995f184a/encoding/protojson/decode_test.go (L134)
fb995f184a/encoding/protojson/decode_test.go (L156)

We do not support `optional` keyword and the generator will fail if it sees on.
So only implement the default behaviour.

Refs #122

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-11 14:40:54 +03:00
29c522d5d8 [#122] protogen: Always marshal empty fields
This is how it was done previously:
a0a9b765f3/rpc/message/encoding.go (L31)

The tricky part is `[]byte` which is marshaled as `null` by easyjson
helper, but as `""` by protojson.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-07 15:05:43 +03:00
3e705a3cbe [#121] .golangci.yml: Replace exportloopref with copyloopvar
Fix linter warning:
```
WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-02 09:48:11 +03:00
d9a604fbc1 [#120] proto/test: Unskip protojson compatibility test
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-01 14:18:52 +03:00
b06dad731c [#120] protogen: Marshal 64-bit integers as strings
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-01 14:18:46 +03:00
d94b9c6d0d [#120] protogen: Unmarshal stringified integers from JSON
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-01 14:18:45 +03:00
eeb754c327 [#120] protogen: Omit empty fields from JSON output
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-01 14:11:43 +03:00
805da79319 [#120] protogen: Marshal enum as string
Be compatible with protojson.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-01 14:11:43 +03:00
f812b1ae5b [#120] Regenerate proto files
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-01 14:11:43 +03:00
287e98ad67 [#120] proto/test: Add protojson compatibility test
It is failing, thus is skipped.
But implement it now to make it easier to see it failing.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-10-01 14:11:43 +03:00
c3dbbc5eab
[#118] status: Support INVALID_ARGUMENT status
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2024-09-24 14:38:14 +03:00
13fa0da374 [#117] rpc: Allow to specify custom gRPC dialer
After grpc upgrade there is no DialContext call.
So connection is not actually established after created.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-09-16 12:35:37 +03:00
c9782cf3ef [#117] go.mod: Upgrade grpc to v1.66.2
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-09-13 17:22:52 +03:00
40 changed files with 4251 additions and 858 deletions

70
.forgejo/logo.svg Normal file
View 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
View file

@ -1 +0,0 @@
* @TrueCloudLab/storage-core @TrueCloudLab/storage-services @TrueCloudLab/committers

View file

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

2
CODEOWNERS Normal file
View file

@ -0,0 +1,2 @@
.* @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-services-committers @TrueCloudLab/storage-services-developers
.forgejo/.* @potyarkin

View file

@ -25,7 +25,8 @@ 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
### 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).
@ -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.

View file

@ -1,5 +1,5 @@
<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>

View file

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

View file

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

View file

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

View file

@ -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()
}
@ -808,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 {
@ -832,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 {
@ -1084,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 {
@ -1292,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('}')
}
@ -1339,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
}
}
@ -1472,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 {
@ -1720,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)
}
@ -1923,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)
}

View file

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

View file

@ -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)
}
@ -1895,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 {
@ -2106,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)
}

View file

@ -121,14 +121,25 @@ func (x *PutRequest_Body) 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 = ",\"signature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix)
x.Signature.MarshalEasyJSON(out)
}
@ -330,19 +341,35 @@ func (x *PutRequest) 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)
}
@ -487,10 +514,16 @@ func (x *PutResponse_Body) 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)
}
out.RawByte('}')
@ -684,19 +717,35 @@ func (x *PutResponse) 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)
}
@ -864,14 +913,25 @@ func (x *DeleteRequest_Body) 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 = ",\"signature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix)
x.Signature.MarshalEasyJSON(out)
}
@ -1073,19 +1133,35 @@ func (x *DeleteRequest) 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)
}
@ -1389,19 +1465,35 @@ func (x *DeleteResponse) 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)
}
@ -1546,10 +1638,16 @@ func (x *GetRequest_Body) 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)
}
out.RawByte('}')
@ -1743,19 +1841,35 @@ func (x *GetRequest) 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)
}
@ -1946,19 +2060,35 @@ func (x *GetResponse_Body) 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 = ",\"signature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix)
x.Signature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"sessionToken\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sessionToken\":"
out.RawString(prefix)
x.SessionToken.MarshalEasyJSON(out)
}
@ -2167,19 +2297,35 @@ func (x *GetResponse) 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)
}
@ -2324,10 +2470,16 @@ func (x *ListRequest_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('}')
@ -2521,19 +2673,35 @@ func (x *ListRequest) 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)
}
@ -2681,10 +2849,16 @@ func (x *ListResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"containerIds\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"containerIds\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.ContainerIds {
if i != 0 {
@ -2892,19 +3066,35 @@ func (x *ListResponse) 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)
}

View file

@ -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)
}
@ -370,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 {
@ -404,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)
}
@ -453,13 +500,27 @@ 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":

View file

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

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

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

View file

@ -100,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 {

View file

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

View file

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

View file

@ -274,29 +274,60 @@ func (x *Filter) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"name\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"name\":"
out.RawString(prefix)
out.String(x.Name)
}
{
const prefix string = ",\"key\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
out.String(x.Key)
}
{
const prefix string = ",\"op\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"op\":"
out.RawString(prefix)
out.Int32(int32(x.Op))
v := int32(x.Op)
if vv, ok := Operation_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"value\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
out.String(x.Value)
}
{
const prefix string = ",\"filters\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"filters\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Filters {
@ -558,29 +589,60 @@ func (x *Selector) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"name\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"name\":"
out.RawString(prefix)
out.String(x.Name)
}
{
const prefix string = ",\"count\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"count\":"
out.RawString(prefix)
out.Uint32(x.Count)
}
{
const prefix string = ",\"clause\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"clause\":"
out.RawString(prefix)
out.Int32(int32(x.Clause))
v := int32(x.Clause)
if vv, ok := Clause_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"attribute\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"attribute\":"
out.RawString(prefix)
out.String(x.Attribute)
}
{
const prefix string = ",\"filter\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"filter\":"
out.RawString(prefix)
out.String(x.Filter)
}
@ -621,7 +683,15 @@ func (x *Selector) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "count":
{
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.Count = f
}
case "clause":
@ -807,24 +877,45 @@ func (x *Replica) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"count\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"count\":"
out.RawString(prefix)
out.Uint32(x.Count)
}
{
const prefix string = ",\"selector\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"selector\":"
out.RawString(prefix)
out.String(x.Selector)
}
{
const prefix string = ",\"ecDataCount\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ecDataCount\":"
out.RawString(prefix)
out.Uint32(x.EcDataCount)
}
{
const prefix string = ",\"ecParityCount\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ecParityCount\":"
out.RawString(prefix)
out.Uint32(x.EcParityCount)
}
@ -859,7 +950,15 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "count":
{
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.Count = f
}
case "selector":
@ -871,13 +970,29 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "ecDataCount":
{
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.EcDataCount = f
}
case "ecParityCount":
{
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.EcParityCount = f
}
}
@ -1067,10 +1182,16 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"replicas\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"replicas\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Replicas {
if i != 0 {
@ -1081,12 +1202,22 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"containerBackupFactor\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"containerBackupFactor\":"
out.RawString(prefix)
out.Uint32(x.ContainerBackupFactor)
}
{
const prefix string = ",\"selectors\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"selectors\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Selectors {
@ -1098,7 +1229,12 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"filters\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"filters\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Filters {
@ -1110,7 +1246,12 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"unique\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"unique\":"
out.RawString(prefix)
out.Bool(x.Unique)
}
@ -1159,7 +1300,15 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "containerBackupFactor":
{
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.ContainerBackupFactor = f
}
case "selectors":
@ -1363,19 +1512,35 @@ func (x *NodeInfo_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)
}
{
const prefix string = ",\"parents\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parents\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Parents {
@ -1594,14 +1759,29 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"publicKey\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.PublicKey)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"publicKey\":"
out.RawString(prefix)
if x.PublicKey != nil {
out.Base64Bytes(x.PublicKey)
} else {
out.String("")
}
}
{
const prefix string = ",\"addresses\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"addresses\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Addresses {
@ -1613,7 +1793,12 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
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 {
@ -1625,9 +1810,19 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"state\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"state\":"
out.RawString(prefix)
out.Int32(int32(x.State))
v := int32(x.State)
if vv, ok := NodeInfo_State_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
out.RawByte('}')
}
@ -1660,7 +1855,13 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "publicKey":
{
var f []byte
f = in.Bytes()
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.PublicKey = f
}
case "addresses":
@ -1827,14 +2028,27 @@ func (x *Netmap) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"epoch\":"
out.RawString(prefix[1:])
out.Uint64(x.Epoch)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"epoch\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10)
out.RawByte('"')
}
{
const prefix string = ",\"nodes\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nodes\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Nodes {
@ -1876,7 +2090,15 @@ func (x *Netmap) 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 "nodes":
@ -2002,16 +2224,35 @@ func (x *NetworkConfig_Parameter) 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 = ",\"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('}')
}
@ -2044,13 +2285,25 @@ func (x *NetworkConfig_Parameter) 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 "value":
{
var f []byte
f = in.Bytes()
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Value = f
}
}
@ -2148,10 +2401,16 @@ func (x *NetworkConfig) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"parameters\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parameters\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Parameters {
if i != 0 {
@ -2355,24 +2614,51 @@ func (x *NetworkInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"currentEpoch\":"
out.RawString(prefix[1:])
out.Uint64(x.CurrentEpoch)
}
{
const prefix string = ",\"magicNumber\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"currentEpoch\":"
out.RawString(prefix)
out.Uint64(x.MagicNumber)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CurrentEpoch, 10)
out.RawByte('"')
}
{
const prefix string = ",\"msPerBlock\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"magicNumber\":"
out.RawString(prefix)
out.Int64(x.MsPerBlock)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10)
out.RawByte('"')
}
{
const prefix string = ",\"networkConfig\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"msPerBlock\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.MsPerBlock, 10)
out.RawByte('"')
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"networkConfig\":"
out.RawString(prefix)
x.NetworkConfig.MarshalEasyJSON(out)
}
@ -2407,19 +2693,43 @@ func (x *NetworkInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "currentEpoch":
{
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.CurrentEpoch = f
}
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
}
case "msPerBlock":
{
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.MsPerBlock = f
}
case "networkConfig":

File diff suppressed because it is too large Load diff

View file

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

View file

@ -304,39 +304,84 @@ func (x *ShortHeader) 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 = ",\"creationEpoch\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"creationEpoch\":"
out.RawString(prefix)
out.Uint64(x.CreationEpoch)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CreationEpoch, 10)
out.RawByte('"')
}
{
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 = ",\"objectType\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"objectType\":"
out.RawString(prefix)
out.Int32(int32(x.ObjectType))
v := int32(x.ObjectType)
if vv, ok := ObjectType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"payloadLength\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"payloadLength\":"
out.RawString(prefix)
out.Uint64(x.PayloadLength)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.PayloadLength, 10)
out.RawByte('"')
}
{
const prefix string = ",\"payloadHash\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"payloadHash\":"
out.RawString(prefix)
x.PayloadHash.MarshalEasyJSON(out)
}
{
const prefix string = ",\"homomorphicHash\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"homomorphicHash\":"
out.RawString(prefix)
x.HomomorphicHash.MarshalEasyJSON(out)
}
@ -378,7 +423,15 @@ func (x *ShortHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "creationEpoch":
{
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.CreationEpoch = f
}
case "ownerID":
@ -413,7 +466,15 @@ func (x *ShortHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "payloadLength":
{
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.PayloadLength = f
}
case "payloadHash":
@ -539,14 +600,25 @@ func (x *Header_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)
}
@ -797,29 +869,55 @@ func (x *Header_Split) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"parent\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parent\":"
out.RawString(prefix)
x.Parent.MarshalEasyJSON(out)
}
{
const prefix string = ",\"previous\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"previous\":"
out.RawString(prefix)
x.Previous.MarshalEasyJSON(out)
}
{
const prefix string = ",\"parentSignature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parentSignature\":"
out.RawString(prefix)
x.ParentSignature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"parentHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parentHeader\":"
out.RawString(prefix)
x.ParentHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"children\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"children\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Children {
@ -831,9 +929,18 @@ func (x *Header_Split) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"splitID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"splitID\":"
out.RawString(prefix)
out.Base64Bytes(x.SplitId)
if x.SplitId != nil {
out.Base64Bytes(x.SplitId)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -908,7 +1015,13 @@ func (x *Header_Split) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "splitID":
{
var f []byte
f = in.Bytes()
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.SplitId = f
}
}
@ -1152,44 +1265,93 @@ func (x *Header_EC) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"parent\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parent\":"
out.RawString(prefix)
x.Parent.MarshalEasyJSON(out)
}
{
const prefix string = ",\"index\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"index\":"
out.RawString(prefix)
out.Uint32(x.Index)
}
{
const prefix string = ",\"total\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"total\":"
out.RawString(prefix)
out.Uint32(x.Total)
}
{
const prefix string = ",\"headerLength\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"headerLength\":"
out.RawString(prefix)
out.Uint32(x.HeaderLength)
}
{
const prefix string = ",\"header\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"header\":"
out.RawString(prefix)
out.Base64Bytes(x.Header)
if x.Header != nil {
out.Base64Bytes(x.Header)
} else {
out.String("")
}
}
{
const prefix string = ",\"parentSplitID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parentSplitID\":"
out.RawString(prefix)
out.Base64Bytes(x.ParentSplitId)
if x.ParentSplitId != nil {
out.Base64Bytes(x.ParentSplitId)
} else {
out.String("")
}
}
{
const prefix string = ",\"parentSplitParentID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parentSplitParentID\":"
out.RawString(prefix)
x.ParentSplitParentId.MarshalEasyJSON(out)
}
{
const prefix string = ",\"parentAttributes\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parentAttributes\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.ParentAttributes {
@ -1238,31 +1400,67 @@ func (x *Header_EC) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "index":
{
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.Index = f
}
case "total":
{
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.Total = f
}
case "headerLength":
{
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.HeaderLength = f
}
case "header":
{
var f []byte
f = in.Bytes()
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Header = f
}
case "parentSplitID":
{
var f []byte
f = in.Bytes()
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.ParentSplitId = f
}
case "parentSplitParentID":
@ -1625,54 +1823,114 @@ func (x *Header) 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 = ",\"ownerID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerID\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out)
}
{
const prefix string = ",\"creationEpoch\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"creationEpoch\":"
out.RawString(prefix)
out.Uint64(x.CreationEpoch)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CreationEpoch, 10)
out.RawByte('"')
}
{
const prefix string = ",\"payloadLength\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"payloadLength\":"
out.RawString(prefix)
out.Uint64(x.PayloadLength)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.PayloadLength, 10)
out.RawByte('"')
}
{
const prefix string = ",\"payloadHash\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"payloadHash\":"
out.RawString(prefix)
x.PayloadHash.MarshalEasyJSON(out)
}
{
const prefix string = ",\"objectType\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"objectType\":"
out.RawString(prefix)
out.Int32(int32(x.ObjectType))
v := int32(x.ObjectType)
if vv, ok := ObjectType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"homomorphicHash\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"homomorphicHash\":"
out.RawString(prefix)
x.HomomorphicHash.MarshalEasyJSON(out)
}
{
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 = ",\"attributes\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"attributes\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Attributes {
@ -1684,12 +1942,22 @@ func (x *Header) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"split\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"split\":"
out.RawString(prefix)
x.Split.MarshalEasyJSON(out)
}
{
const prefix string = ",\"ec\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ec\":"
out.RawString(prefix)
x.Ec.MarshalEasyJSON(out)
}
@ -1745,13 +2013,29 @@ func (x *Header) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "creationEpoch":
{
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.CreationEpoch = f
}
case "payloadLength":
{
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.PayloadLength = f
}
case "payloadHash":
@ -1983,26 +2267,51 @@ func (x *Object) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"objectID\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"objectID\":"
out.RawString(prefix)
x.ObjectId.MarshalEasyJSON(out)
}
{
const prefix string = ",\"signature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix)
x.Signature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"header\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"header\":"
out.RawString(prefix)
x.Header.MarshalEasyJSON(out)
}
{
const prefix string = ",\"payload\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"payload\":"
out.RawString(prefix)
out.Base64Bytes(x.Payload)
if x.Payload != nil {
out.Base64Bytes(x.Payload)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -2056,7 +2365,13 @@ func (x *Object) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "payload":
{
var f []byte
f = in.Bytes()
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Payload = f
}
}
@ -2194,19 +2509,39 @@ func (x *SplitInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"splitId\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.SplitId)
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("")
}
}
{
const prefix string = ",\"lastPart\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"lastPart\":"
out.RawString(prefix)
x.LastPart.MarshalEasyJSON(out)
}
{
const prefix string = ",\"link\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"link\":"
out.RawString(prefix)
x.Link.MarshalEasyJSON(out)
}
@ -2241,7 +2576,13 @@ func (x *SplitInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "splitId":
{
var f []byte
f = in.Bytes()
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.SplitId = f
}
case "lastPart":
@ -2390,19 +2731,35 @@ func (x *ECInfo_Chunk) 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)
x.Id.MarshalEasyJSON(out)
}
{
const prefix string = ",\"index\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"index\":"
out.RawString(prefix)
out.Uint32(x.Index)
}
{
const prefix string = ",\"total\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"total\":"
out.RawString(prefix)
out.Uint32(x.Total)
}
@ -2444,13 +2801,29 @@ func (x *ECInfo_Chunk) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "index":
{
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.Index = f
}
case "total":
{
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.Total = f
}
}
@ -2548,10 +2921,16 @@ func (x *ECInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"chunks\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chunks\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Chunks {
if i != 0 {

View file

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

View file

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

View file

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

View file

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

View file

@ -37,7 +37,6 @@ func (c *cfg) initDefault() {
c.dialTimeout = defaultDialTimeout
c.rwTimeout = defaultRWTimeout
c.grpcDialOpts = []grpc.DialOption{
grpc.WithBlock(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
}
}

View file

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

View file

@ -179,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 {
@ -358,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)
}
@ -596,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)
}
@ -804,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('}')
}
@ -851,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
}
}
@ -1085,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)
}
@ -1151,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":
@ -1171,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":
@ -1323,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)
}
@ -1485,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)
}
@ -1783,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 {
@ -1812,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('}')
}
@ -1869,13 +2081,29 @@ 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":
@ -1916,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
}
}
@ -2123,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 {
@ -2152,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)
}
@ -2199,13 +2468,29 @@ 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":
@ -2397,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)
}
@ -2635,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)
}

View file

@ -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
}
}
@ -554,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 {
@ -608,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":

View file

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

View file

@ -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 Tombstone struct {
@ -140,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 {
@ -194,13 +217,27 @@ 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":

View file

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

View file

@ -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":
@ -882,10 +1054,16 @@ func (x *RepPrimitives_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('}')
@ -919,7 +1097,15 @@ func (x *RepPrimitives_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
}
}
@ -1164,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 {
@ -1190,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 {
@ -1202,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 {
@ -1214,43 +1425,69 @@ 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(']')
}
{
const prefix string = ",\"fieldAux\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldAux\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldAux {
@ -1295,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()
}
@ -1321,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()
}
@ -1334,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()
}
@ -1347,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()
}
@ -1360,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()
}
@ -1373,7 +1648,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()
}

View file

@ -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,7 +133,17 @@ 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 = ", fieldType(g, f)[2:], "{}")
@ -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: