Compare commits

..

No commits in common. "master" and "fix/obsolete-urls" have entirely different histories.

40 changed files with 850 additions and 4243 deletions

View file

@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 184.2 51.8" style="enable-background:new 0 0 184.2 51.8;" xml:space="preserve">
<style type="text/css">
.st0{display:none;}
.st1{display:inline;}
.st2{fill:#01E397;}
.st3{display:inline;fill:#010032;}
.st4{display:inline;fill:#00E599;}
.st5{display:inline;fill:#00AF92;}
.st6{fill:#00C3E5;}
</style>
<g id="Layer_2">
<g id="Layer_1-2" class="st0">
<g class="st1">
<path class="st2" d="M146.6,18.3v7.2h10.9V29h-10.9v10.7h-4V14.8h18v3.5H146.6z"/>
<path class="st2" d="M180,15.7c1.7,0.9,3,2.2,4,3.8l-3,2.7c-0.6-1.3-1.5-2.4-2.6-3.3c-1.3-0.7-2.8-1-4.3-1
c-1.4-0.1-2.8,0.3-4,1.1c-0.9,0.5-1.5,1.5-1.4,2.6c0,1,0.5,1.9,1.4,2.4c1.5,0.8,3.2,1.3,4.9,1.5c1.9,0.3,3.7,0.8,5.4,1.6
c1.2,0.5,2.2,1.3,2.9,2.3c0.6,1,1,2.2,0.9,3.4c0,1.4-0.5,2.7-1.3,3.8c-0.9,1.2-2.1,2.1-3.5,2.6c-1.7,0.6-3.4,0.9-5.2,0.8
c-5,0-8.6-1.6-10.7-5l2.9-2.8c0.7,1.4,1.8,2.5,3.1,3.3c1.5,0.7,3.1,1.1,4.7,1c1.5,0.1,2.9-0.2,4.2-0.9c0.9-0.5,1.5-1.5,1.5-2.6
c0-0.9-0.5-1.8-1.3-2.2c-1.5-0.7-3.1-1.2-4.8-1.5c-1.9-0.3-3.7-0.8-5.5-1.5c-1.2-0.5-2.2-1.4-3-2.4c-0.6-1-1-2.2-0.9-3.4
c0-1.4,0.4-2.7,1.2-3.8c0.8-1.2,2-2.2,3.3-2.8c1.6-0.7,3.4-1.1,5.2-1C176.1,14.3,178.2,14.8,180,15.7z"/>
</g>
<path class="st3" d="M73.3,16.3c1.9,1.9,2.9,4.5,2.7,7.1v15.9h-4V24.8c0-2.6-0.5-4.5-1.6-5.7c-1.2-1.2-2.8-1.8-4.5-1.7
c-1.3,0-2.5,0.3-3.7,0.8c-1.2,0.7-2.2,1.7-2.9,2.9c-0.8,1.5-1.1,3.2-1.1,4.9v13.3h-4V15.1l3.6,1.5v1.7c0.8-1.5,2.1-2.6,3.6-3.3
c1.5-0.8,3.2-1.2,4.9-1.1C68.9,13.8,71.3,14.7,73.3,16.3z"/>
<path class="st3" d="M104.4,28.3H85.6c0.1,2.2,1,4.3,2.5,5.9c1.5,1.4,3.5,2.2,5.6,2.1c1.6,0.1,3.2-0.2,4.6-0.9
c1.1-0.6,2-1.6,2.5-2.8l3.3,1.8c-0.9,1.7-2.3,3.1-4,4c-2,1-4.2,1.5-6.4,1.4c-3.7,0-6.7-1.1-8.8-3.4s-3.2-5.5-3.2-9.6s1-7.2,3-9.5
s5-3.4,8.7-3.4c2.1-0.1,4.2,0.5,6.1,1.5c1.6,1,3,2.5,3.8,4.2c0.9,1.8,1.3,3.9,1.3,5.9C104.6,26.4,104.6,27.4,104.4,28.3z
M88.1,19.3c-1.4,1.5-2.2,3.4-2.4,5.5h15.1c-0.2-2-1-3.9-2.3-5.5c-1.4-1.3-3.2-2-5.1-1.9C91.5,17.3,89.6,18,88.1,19.3z"/>
<path class="st3" d="M131,17.3c2.2,2.3,3.2,5.5,3.2,9.5s-1,7.3-3.2,9.6s-5.1,3.4-8.8,3.4s-6.7-1.1-8.9-3.4s-3.2-5.5-3.2-9.6
s1.1-7.2,3.2-9.5s5.1-3.4,8.9-3.4S128.9,15,131,17.3z M116.2,19.9c-1.5,2-2.2,4.4-2.1,6.9c-0.2,2.5,0.6,5,2.1,7
c1.5,1.7,3.7,2.7,6,2.6c2.3,0.1,4.4-0.9,5.9-2.6c1.5-2,2.3-4.5,2.1-7c0.1-2.5-0.6-4.9-2.1-6.9c-1.5-1.7-3.6-2.7-5.9-2.6
C119.9,17.2,117.7,18.2,116.2,19.9z"/>
<polygon class="st4" points="0,9.1 0,43.7 22.5,51.8 22.5,16.9 46.8,7.9 24.8,0 "/>
<polygon class="st5" points="24.3,17.9 24.3,36.8 46.8,44.9 46.8,9.6 "/>
</g>
<g>
<g>
<path class="st6" d="M41.6,17.5H28.2v6.9h10.4v3.3H28.2v10.2h-3.9V14.2h17.2V17.5z"/>
<path class="st6" d="M45.8,37.9v-18h3.3l0.4,3.2c0.5-1.2,1.2-2.1,2.1-2.7c0.9-0.6,2.1-0.9,3.5-0.9c0.4,0,0.7,0,1.1,0.1
c0.4,0.1,0.7,0.2,0.9,0.3l-0.5,3.4c-0.3-0.1-0.6-0.2-0.9-0.2C55.4,23,54.9,23,54.4,23c-0.7,0-1.5,0.2-2.2,0.6
c-0.7,0.4-1.3,1-1.8,1.8s-0.7,1.8-0.7,3v9.5H45.8z"/>
<path class="st6" d="M68.6,19.6c1.8,0,3.3,0.4,4.6,1.1c1.3,0.7,2.4,1.8,3.1,3.2s1.1,3.1,1.1,5c0,1.9-0.4,3.6-1.1,5
c-0.8,1.4-1.8,2.5-3.1,3.2c-1.3,0.7-2.9,1.1-4.6,1.1s-3.3-0.4-4.6-1.1c-1.3-0.7-2.4-1.8-3.2-3.2c-0.8-1.4-1.2-3.1-1.2-5
c0-1.9,0.4-3.6,1.2-5s1.8-2.5,3.2-3.2C65.3,19.9,66.8,19.6,68.6,19.6z M68.6,22.6c-1.1,0-2,0.2-2.8,0.7c-0.8,0.5-1.3,1.2-1.7,2.1
s-0.6,2.1-0.6,3.5c0,1.3,0.2,2.5,0.6,3.4s1,1.7,1.7,2.2s1.7,0.7,2.8,0.7c1.1,0,2-0.2,2.7-0.7c0.7-0.5,1.3-1.2,1.7-2.2
s0.6-2.1,0.6-3.4c0-1.4-0.2-2.5-0.6-3.5s-1-1.6-1.7-2.1C70.6,22.8,69.6,22.6,68.6,22.6z"/>
<path class="st6" d="M89.2,38.3c-1.8,0-3.4-0.3-4.9-1c-1.5-0.7-2.7-1.7-3.5-3l2.7-2.3c0.5,1,1.3,1.8,2.3,2.4
c1,0.6,2.2,0.9,3.6,0.9c1.1,0,2-0.2,2.6-0.6c0.6-0.4,1-0.9,1-1.6c0-0.5-0.2-0.9-0.5-1.2s-0.9-0.6-1.7-0.8l-3.8-0.8
c-1.9-0.4-3.3-1-4.1-1.9c-0.8-0.9-1.2-1.9-1.2-3.3c0-1,0.3-1.9,0.9-2.7c0.6-0.8,1.4-1.5,2.5-2s2.5-0.8,4-0.8c1.8,0,3.3,0.3,4.6,1
c1.3,0.6,2.2,1.5,2.9,2.7l-2.7,2.2c-0.5-1-1.1-1.7-2-2.1c-0.9-0.5-1.8-0.7-2.8-0.7c-0.8,0-1.4,0.1-2,0.3c-0.6,0.2-1,0.5-1.3,0.8
c-0.3,0.3-0.4,0.7-0.4,1.2c0,0.5,0.2,0.9,0.5,1.3s1,0.6,1.9,0.8l4.1,0.9c1.7,0.3,2.9,0.9,3.7,1.7c0.7,0.8,1.1,1.8,1.1,2.9
c0,1.2-0.3,2.2-0.9,3c-0.6,0.9-1.5,1.6-2.6,2C92.1,38.1,90.7,38.3,89.2,38.3z"/>
<path class="st6" d="M112.8,19.9v3H99.3v-3H112.8z M106.6,14.6v17.9c0,0.9,0.2,1.5,0.7,1.9c0.5,0.4,1.1,0.6,1.9,0.6
c0.6,0,1.2-0.1,1.7-0.3c0.5-0.2,0.9-0.5,1.3-0.8l0.9,2.8c-0.6,0.5-1.2,0.9-2,1.1c-0.8,0.3-1.7,0.4-2.7,0.4c-1,0-2-0.2-2.8-0.5
s-1.5-0.9-2-1.6c-0.5-0.8-0.7-1.7-0.8-3V15.7L106.6,14.6z"/>
<path d="M137.9,17.5h-13.3v6.9h10.4v3.3h-10.4v10.2h-3.9V14.2h17.2V17.5z"/>
<path d="M150.9,13.8c2.1,0,4,0.4,5.5,1.2c1.6,0.8,2.9,2,4,3.5l-2.6,2.5c-0.9-1.4-1.9-2.4-3.1-3c-1.1-0.6-2.5-0.9-4-0.9
c-1.2,0-2.1,0.2-2.8,0.5c-0.7,0.3-1.3,0.7-1.6,1.2c-0.3,0.5-0.5,1.1-0.5,1.7c0,0.7,0.3,1.4,0.8,1.9c0.5,0.6,1.5,1,2.9,1.3
l4.8,1.1c2.3,0.5,3.9,1.3,4.9,2.3c1,1,1.4,2.3,1.4,3.9c0,1.5-0.4,2.7-1.2,3.8c-0.8,1.1-1.9,1.9-3.3,2.5s-3.1,0.9-5,0.9
c-1.7,0-3.2-0.2-4.5-0.6c-1.3-0.4-2.5-1-3.5-1.8c-1-0.7-1.8-1.6-2.5-2.6l2.7-2.7c0.5,0.8,1.1,1.6,1.9,2.2
c0.8,0.7,1.7,1.2,2.7,1.5c1,0.4,2.2,0.5,3.4,0.5c1.1,0,2.1-0.1,2.9-0.4c0.8-0.3,1.4-0.7,1.8-1.2c0.4-0.5,0.6-1.1,0.6-1.9
c0-0.7-0.2-1.3-0.7-1.8c-0.5-0.5-1.3-0.9-2.6-1.2l-5.2-1.2c-1.4-0.3-2.6-0.8-3.6-1.3c-0.9-0.6-1.6-1.3-2.1-2.1s-0.7-1.8-0.7-2.8
c0-1.3,0.4-2.6,1.1-3.7c0.7-1.1,1.8-2,3.2-2.6C147.3,14.1,148.9,13.8,150.9,13.8z"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.5 KiB

1
.github/CODEOWNERS vendored Normal file
View file

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

View file

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

View file

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

View file

@ -25,8 +25,7 @@ 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 send a pull request. We encourage pull requests to discuss code changes. Here
are the steps in details: are the steps in details:
### Set up your repository ### Set up your GitHub Repository
Fork [FrostFS node upstream](https://git.frostfs.info/TrueCloudLab/frostfs-api-go/fork) source 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 repository to your own personal repository. Copy the URL of your fork (you will
need it for the `git clone` command below). need it for the `git clone` command below).
@ -87,7 +86,7 @@ $ git push origin feature/123-something_awesome
``` ```
### Create a Pull Request ### Create a Pull Request
Pull requests can be created via git.frostfs.info. Refer to [this Pull requests can be created via GitHub. Refer to [this
document](https://help.github.com/articles/creating-a-pull-request/) for 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 detailed steps on how to create a pull request. After a Pull Request gets peer
reviewed and approved, it will be merged. reviewed and approved, it will be merged.

View file

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="./.forgejo/logo.svg" width="500px" alt="FrostFS"> <img src="./.github/logo.svg" width="500px" alt="FrostFS">
</p> </p>
<p align="center"> <p align="center">
Low-level Golang API for <a href="https://frostfs.info">FrostFS</a> Low-level Golang API for <a href="https://frostfs.info">FrostFS</a>

View file

@ -98,16 +98,10 @@ func (x *BalanceRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"ownerId\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"ownerId\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out) x.OwnerId.MarshalEasyJSON(out)
} }
out.RawByte('}') out.RawByte('}')
@ -301,35 +295,19 @@ func (x *BalanceRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -474,16 +452,10 @@ func (x *BalanceResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"balance\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"balance\":"
out.RawString(prefix)
x.Balance.MarshalEasyJSON(out) x.Balance.MarshalEasyJSON(out)
} }
out.RawByte('}') out.RawByte('}')
@ -677,35 +649,19 @@ func (x *BalanceResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) 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. // 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 { type AccountingServiceClient interface {
// Returns the amount of funds in GAS token for the requested FrostFS account. // Returns the amount of funds in GAS token for the requested NeoFS account.
// //
// Statuses: // Statuses:
// - **OK** (0, SECTION_SUCCESS): // - **OK** (0, SECTION_SUCCESS):
@ -56,7 +56,7 @@ func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceReques
// All implementations should embed UnimplementedAccountingServiceServer // All implementations should embed UnimplementedAccountingServiceServer
// for forward compatibility // for forward compatibility
type AccountingServiceServer interface { type AccountingServiceServer interface {
// Returns the amount of funds in GAS token for the requested FrostFS account. // Returns the amount of funds in GAS token for the requested NeoFS account.
// //
// Statuses: // Statuses:
// - **OK** (0, SECTION_SUCCESS): // - **OK** (0, SECTION_SUCCESS):

View file

@ -11,7 +11,6 @@ import (
easyproto "github.com/VictoriaMetrics/easyproto" easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer" jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter" jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
) )
type Decimal struct { type Decimal struct {
@ -114,27 +113,14 @@ func (x *Decimal) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Int64(x.Value)
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.Value, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"precision\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"precision\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.Precision) out.Uint32(x.Precision)
} }
@ -169,29 +155,13 @@ func (x *Decimal) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "value": case "value":
{ {
var f int64 var f int64
r := in.JsonNumber() f = in.Int64()
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 x.Value = f
} }
case "precision": case "precision":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Precision = f
} }
} }

View file

@ -352,55 +352,24 @@ func (x *EACLRecord_Filter) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"headerType\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Int32(int32(x.HeaderType))
first = false
}
const prefix string = "\"headerType\":"
out.RawString(prefix)
v := int32(x.HeaderType)
if vv, ok := HeaderType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
{ {
if !first { const prefix string = ",\"matchType\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"matchType\":"
out.RawString(prefix) out.RawString(prefix)
v := int32(x.MatchType) out.Int32(int32(x.MatchType))
if vv, ok := MatchType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
{ {
if !first { const prefix string = ",\"key\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Key) out.String(x.Key)
} }
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Value) out.String(x.Value)
} }
@ -597,41 +566,21 @@ func (x *EACLRecord_Target) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"role\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Int32(int32(x.Role))
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)
}
} }
{ {
if !first { const prefix string = ",\"keys\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"keys\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Keys { for i := range x.Keys {
if i != 0 { if i != 0 {
out.RawByte(',') out.RawByte(',')
} }
if x.Keys[i] != nil {
out.Base64Bytes(x.Keys[i]) out.Base64Bytes(x.Keys[i])
} else {
out.String("")
}
} }
out.RawByte(']') out.RawByte(']')
} }
@ -691,13 +640,7 @@ func (x *EACLRecord_Target) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list [][]byte var list [][]byte
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
} }
@ -865,45 +808,19 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"operation\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Int32(int32(x.Operation))
first = false
}
const prefix string = "\"operation\":"
out.RawString(prefix)
v := int32(x.Operation)
if vv, ok := Operation_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
{ {
if !first { const prefix string = ",\"action\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"action\":"
out.RawString(prefix) out.RawString(prefix)
v := int32(x.Action) out.Int32(int32(x.Action))
if vv, ok := Action_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
{ {
if !first { const prefix string = ",\"filters\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"filters\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Filters { for i := range x.Filters {
@ -915,12 +832,7 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"targets\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"targets\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Targets { for i := range x.Targets {
@ -1172,35 +1084,19 @@ func (x *EACLTable) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"version\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out) x.Version.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"containerID\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"containerID\":"
out.RawString(prefix) out.RawString(prefix)
x.ContainerId.MarshalEasyJSON(out) x.ContainerId.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"records\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"records\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Records { for i := range x.Records {
@ -1396,43 +1292,21 @@ func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"exp\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Uint64(x.Exp)
first = false
}
const prefix string = "\"exp\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"nbf\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nbf\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.Nbf)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"iat\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"iat\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.Iat)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10)
out.RawByte('"')
} }
out.RawByte('}') out.RawByte('}')
} }
@ -1465,43 +1339,19 @@ func (x *BearerToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "exp": case "exp":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Exp = f
} }
case "nbf": case "nbf":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Nbf = f
} }
case "iat": case "iat":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Iat = f
} }
} }
@ -1622,25 +1472,14 @@ func (x *BearerToken_Body_APEOverride) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"target\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out) x.Target.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"chains\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chains\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Chains { for i := range x.Chains {
@ -1881,55 +1720,29 @@ func (x *BearerToken_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"eaclTable\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"eaclTable\":"
out.RawString(prefix)
x.EaclTable.MarshalEasyJSON(out) x.EaclTable.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"ownerID\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerID\":"
out.RawString(prefix) out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out) x.OwnerId.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"lifetime\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"lifetime\":"
out.RawString(prefix) out.RawString(prefix)
x.Lifetime.MarshalEasyJSON(out) x.Lifetime.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"allowImpersonate\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"allowImpersonate\":"
out.RawString(prefix) out.RawString(prefix)
out.Bool(x.AllowImpersonate) out.Bool(x.AllowImpersonate)
} }
{ {
if !first { const prefix string = ",\"apeOverride\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"apeOverride\":"
out.RawString(prefix) out.RawString(prefix)
x.ApeOverride.MarshalEasyJSON(out) x.ApeOverride.MarshalEasyJSON(out)
} }
@ -2110,25 +1923,14 @@ func (x *BearerToken) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"signature\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix) out.RawString(prefix)
x.Signature.MarshalEasyJSON(out) x.Signature.MarshalEasyJSON(out)
} }

View file

@ -155,30 +155,14 @@ func (x *ChainTarget) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"type\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Int32(int32(x.Type))
first = false
}
const prefix string = "\"type\":"
out.RawString(prefix)
v := int32(x.Type)
if vv, ok := TargetType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
{ {
if !first { const prefix string = ",\"name\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"name\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Name) out.String(x.Name)
} }
@ -349,23 +333,13 @@ func (x *Chain) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
switch xx := x.Kind.(type) { switch xx := x.Kind.(type) {
case *Chain_Raw: case *Chain_Raw:
{ {
if !first { const prefix string = ",\"raw\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"raw\":"
out.RawString(prefix)
if xx.Raw != nil {
out.Base64Bytes(xx.Raw) out.Base64Bytes(xx.Raw)
} else {
out.String("")
}
} }
} }
out.RawByte('}') out.RawByte('}')
@ -401,13 +375,7 @@ func (x *Chain) UnmarshalEasyJSON(in *jlexer.Lexer) {
x.Kind = xx x.Kind = xx
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
xx.Raw = f xx.Raw = f
} }
} }

View file

@ -121,25 +121,14 @@ func (x *AddChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"target\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out) x.Target.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"chain\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chain\":"
out.RawString(prefix) out.RawString(prefix)
x.Chain.MarshalEasyJSON(out) x.Chain.MarshalEasyJSON(out)
} }
@ -341,35 +330,19 @@ func (x *AddChainRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -511,21 +484,11 @@ func (x *AddChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"chainId\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"chainId\":"
out.RawString(prefix)
if x.ChainId != nil {
out.Base64Bytes(x.ChainId) out.Base64Bytes(x.ChainId)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -558,13 +521,7 @@ func (x *AddChainResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "chainId": case "chainId":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.ChainId = f x.ChainId = f
} }
} }
@ -723,35 +680,19 @@ func (x *AddChainResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -916,31 +857,16 @@ func (x *RemoveChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"target\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out) x.Target.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"chainId\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chainId\":"
out.RawString(prefix) out.RawString(prefix)
if x.ChainId != nil {
out.Base64Bytes(x.ChainId) out.Base64Bytes(x.ChainId)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -980,13 +906,7 @@ func (x *RemoveChainRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "chainId": case "chainId":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.ChainId = f x.ChainId = f
} }
} }
@ -1145,35 +1065,19 @@ func (x *RemoveChainRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -1477,35 +1381,19 @@ func (x *RemoveChainResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -1650,16 +1538,10 @@ func (x *ListChainsRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"target\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out) x.Target.MarshalEasyJSON(out)
} }
out.RawByte('}') out.RawByte('}')
@ -1853,35 +1735,19 @@ func (x *ListChainsRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -2029,16 +1895,10 @@ func (x *ListChainsResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"chains\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"chains\":"
out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Chains { for i := range x.Chains {
if i != 0 { if i != 0 {
@ -2246,35 +2106,19 @@ func (x *ListChainsResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }

View file

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

View file

@ -13,7 +13,6 @@ import (
easyproto "github.com/VictoriaMetrics/easyproto" easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer" jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter" jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
) )
type Container_Attribute struct { type Container_Attribute struct {
@ -116,25 +115,14 @@ func (x *Container_Attribute) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"key\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
out.String(x.Key) out.String(x.Key)
} }
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Value) out.String(x.Value)
} }
@ -382,59 +370,29 @@ func (x *Container) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"version\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out) x.Version.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"ownerID\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerID\":"
out.RawString(prefix) out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out) x.OwnerId.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"nonce\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nonce\":"
out.RawString(prefix) out.RawString(prefix)
if x.Nonce != nil {
out.Base64Bytes(x.Nonce) out.Base64Bytes(x.Nonce)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"basicACL\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"basicACL\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.BasicAcl) out.Uint32(x.BasicAcl)
} }
{ {
if !first { const prefix string = ",\"attributes\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"attributes\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Attributes { for i := range x.Attributes {
@ -446,12 +404,7 @@ func (x *Container) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"placementPolicy\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"placementPolicy\":"
out.RawString(prefix) out.RawString(prefix)
x.PlacementPolicy.MarshalEasyJSON(out) x.PlacementPolicy.MarshalEasyJSON(out)
} }
@ -500,27 +453,13 @@ func (x *Container) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "nonce": case "nonce":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Nonce = f x.Nonce = f
} }
case "basicACL": case "basicACL":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.BasicAcl = f
} }
case "attributes": 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] $ git tag -s vX.Y.Z[-rc.N] && git push origin vX.Y.Z[-rc.N]
``` ```
## Make a proper release ## Make a Github release
Using git.frostfs.info web interface create a new release based on just created tag Using Github's web interface create a new release based on just created tag
with the same changes from changelog and publish it. with the same changes from changelog and publish it.
## Close milestone ## Close github milestone
Close corresponding vX.Y.Z milestone. Close corresponding vX.Y.Z github milestone.

14
go.mod
View file

@ -7,9 +7,9 @@ require (
github.com/VictoriaMetrics/easyproto v0.1.4 github.com/VictoriaMetrics/easyproto v0.1.4
github.com/mailru/easyjson v0.7.7 github.com/mailru/easyjson v0.7.7
github.com/stretchr/testify v1.8.3 github.com/stretchr/testify v1.8.3
golang.org/x/sync v0.7.0 golang.org/x/sync v0.6.0
google.golang.org/grpc v1.66.2 google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.34.1 google.golang.org/protobuf v1.33.0
) )
require ( require (
@ -19,10 +19,10 @@ require (
github.com/kr/pretty v0.1.0 // indirect github.com/kr/pretty v0.1.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.26.0 // indirect golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.21.0 // indirect golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.1 // 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.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 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= 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-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 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 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View file

@ -100,16 +100,10 @@ func (x *Lock) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"members\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"members\":"
out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Members { for i := range x.Members {
if i != 0 { if i != 0 {

View file

@ -257,35 +257,19 @@ func (x *LocalNodeInfoRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -453,25 +437,14 @@ func (x *LocalNodeInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"version\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out) x.Version.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"nodeInfo\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nodeInfo\":"
out.RawString(prefix) out.RawString(prefix)
x.NodeInfo.MarshalEasyJSON(out) x.NodeInfo.MarshalEasyJSON(out)
} }
@ -673,35 +646,19 @@ func (x *LocalNodeInfoResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -1005,35 +962,19 @@ func (x *NetworkInfoRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -1178,16 +1119,10 @@ func (x *NetworkInfoResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"networkInfo\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"networkInfo\":"
out.RawString(prefix)
x.NetworkInfo.MarshalEasyJSON(out) x.NetworkInfo.MarshalEasyJSON(out)
} }
out.RawByte('}') out.RawByte('}')
@ -1381,35 +1316,19 @@ func (x *NetworkInfoResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -1713,35 +1632,19 @@ func (x *NetmapSnapshotRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -1886,16 +1789,10 @@ func (x *NetmapSnapshotResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"netmap\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"netmap\":"
out.RawString(prefix)
x.Netmap.MarshalEasyJSON(out) x.Netmap.MarshalEasyJSON(out)
} }
out.RawByte('}') out.RawByte('}')
@ -2089,35 +1986,19 @@ func (x *NetmapSnapshotResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }

View file

@ -40,14 +40,14 @@ type NetmapServiceClient interface {
// information about the server has been successfully read; // information about the server has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON). // - Common failures (SECTION_FAILURE_COMMON).
LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error)
// Read recent information about the FrostFS network. // Read recent information about the NeoFS network.
// //
// Statuses: // Statuses:
// - **OK** (0, SECTION_SUCCESS): // - **OK** (0, SECTION_SUCCESS):
// information about the current network state has been successfully read; // information about the current network state has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON). // - Common failures (SECTION_FAILURE_COMMON).
NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error)
// Returns network map snapshot of the current FrostFS epoch. // Returns network map snapshot of the current NeoFS epoch.
// //
// Statuses: // Statuses:
// - **OK** (0, SECTION_SUCCESS): // - **OK** (0, SECTION_SUCCESS):
@ -107,14 +107,14 @@ type NetmapServiceServer interface {
// information about the server has been successfully read; // information about the server has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON). // - Common failures (SECTION_FAILURE_COMMON).
LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error)
// Read recent information about the FrostFS network. // Read recent information about the NeoFS network.
// //
// Statuses: // Statuses:
// - **OK** (0, SECTION_SUCCESS): // - **OK** (0, SECTION_SUCCESS):
// information about the current network state has been successfully read; // information about the current network state has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON). // - Common failures (SECTION_FAILURE_COMMON).
NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error)
// Returns network map snapshot of the current FrostFS epoch. // Returns network map snapshot of the current NeoFS epoch.
// //
// Statuses: // Statuses:
// - **OK** (0, SECTION_SUCCESS): // - **OK** (0, SECTION_SUCCESS):

View file

@ -274,60 +274,29 @@ func (x *Filter) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"name\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"name\":"
out.RawString(prefix)
out.String(x.Name) out.String(x.Name)
} }
{ {
if !first { const prefix string = ",\"key\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Key) out.String(x.Key)
} }
{ {
if !first { const prefix string = ",\"op\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"op\":"
out.RawString(prefix) out.RawString(prefix)
v := int32(x.Op) out.Int32(int32(x.Op))
if vv, ok := Operation_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Value) out.String(x.Value)
} }
{ {
if !first { const prefix string = ",\"filters\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"filters\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Filters { for i := range x.Filters {
@ -589,60 +558,29 @@ func (x *Selector) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"name\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"name\":"
out.RawString(prefix)
out.String(x.Name) out.String(x.Name)
} }
{ {
if !first { const prefix string = ",\"count\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"count\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.Count) out.Uint32(x.Count)
} }
{ {
if !first { const prefix string = ",\"clause\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"clause\":"
out.RawString(prefix) out.RawString(prefix)
v := int32(x.Clause) out.Int32(int32(x.Clause))
if vv, ok := Clause_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
{ {
if !first { const prefix string = ",\"attribute\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"attribute\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Attribute) out.String(x.Attribute)
} }
{ {
if !first { const prefix string = ",\"filter\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"filter\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Filter) out.String(x.Filter)
} }
@ -683,15 +621,7 @@ func (x *Selector) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "count": case "count":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Count = f
} }
case "clause": case "clause":
@ -877,45 +807,24 @@ func (x *Replica) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"count\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"count\":"
out.RawString(prefix)
out.Uint32(x.Count) out.Uint32(x.Count)
} }
{ {
if !first { const prefix string = ",\"selector\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"selector\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Selector) out.String(x.Selector)
} }
{ {
if !first { const prefix string = ",\"ecDataCount\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ecDataCount\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.EcDataCount) out.Uint32(x.EcDataCount)
} }
{ {
if !first { const prefix string = ",\"ecParityCount\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ecParityCount\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.EcParityCount) out.Uint32(x.EcParityCount)
} }
@ -950,15 +859,7 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "count": case "count":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Count = f
} }
case "selector": case "selector":
@ -970,29 +871,13 @@ func (x *Replica) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "ecDataCount": case "ecDataCount":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.EcDataCount = f
} }
case "ecParityCount": case "ecParityCount":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.EcParityCount = f
} }
} }
@ -1182,16 +1067,10 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"replicas\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"replicas\":"
out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Replicas { for i := range x.Replicas {
if i != 0 { if i != 0 {
@ -1202,22 +1081,12 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"containerBackupFactor\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"containerBackupFactor\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.ContainerBackupFactor) out.Uint32(x.ContainerBackupFactor)
} }
{ {
if !first { const prefix string = ",\"selectors\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"selectors\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Selectors { for i := range x.Selectors {
@ -1229,12 +1098,7 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"filters\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"filters\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Filters { for i := range x.Filters {
@ -1246,12 +1110,7 @@ func (x *PlacementPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"unique\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"unique\":"
out.RawString(prefix) out.RawString(prefix)
out.Bool(x.Unique) out.Bool(x.Unique)
} }
@ -1300,15 +1159,7 @@ func (x *PlacementPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "containerBackupFactor": case "containerBackupFactor":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.ContainerBackupFactor = f
} }
case "selectors": case "selectors":
@ -1512,35 +1363,19 @@ func (x *NodeInfo_Attribute) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"key\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
out.String(x.Key) out.String(x.Key)
} }
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Value) out.String(x.Value)
} }
{ {
if !first { const prefix string = ",\"parents\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"parents\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Parents { for i := range x.Parents {
@ -1759,29 +1594,14 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"publicKey\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"publicKey\":"
out.RawString(prefix)
if x.PublicKey != nil {
out.Base64Bytes(x.PublicKey) out.Base64Bytes(x.PublicKey)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"addresses\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"addresses\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Addresses { for i := range x.Addresses {
@ -1793,12 +1613,7 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"attributes\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"attributes\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Attributes { for i := range x.Attributes {
@ -1810,19 +1625,9 @@ func (x *NodeInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"state\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"state\":"
out.RawString(prefix) out.RawString(prefix)
v := int32(x.State) out.Int32(int32(x.State))
if vv, ok := NodeInfo_State_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -1855,13 +1660,7 @@ func (x *NodeInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "publicKey": case "publicKey":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.PublicKey = f x.PublicKey = f
} }
case "addresses": case "addresses":
@ -2028,27 +1827,14 @@ func (x *Netmap) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"epoch\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Uint64(x.Epoch)
first = false
}
const prefix string = "\"epoch\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"nodes\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nodes\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Nodes { for i := range x.Nodes {
@ -2090,15 +1876,7 @@ func (x *Netmap) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "epoch": case "epoch":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Epoch = f
} }
case "nodes": case "nodes":
@ -2224,35 +2002,16 @@ func (x *NetworkConfig_Parameter) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"key\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
if x.Key != nil {
out.Base64Bytes(x.Key) out.Base64Bytes(x.Key)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix) out.RawString(prefix)
if x.Value != nil {
out.Base64Bytes(x.Value) out.Base64Bytes(x.Value)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -2285,25 +2044,13 @@ func (x *NetworkConfig_Parameter) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "key": case "key":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Key = f x.Key = f
} }
case "value": case "value":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Value = f x.Value = f
} }
} }
@ -2401,16 +2148,10 @@ func (x *NetworkConfig) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"parameters\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"parameters\":"
out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Parameters { for i := range x.Parameters {
if i != 0 { if i != 0 {
@ -2614,51 +2355,24 @@ func (x *NetworkInfo) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"currentEpoch\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Uint64(x.CurrentEpoch)
first = false
}
const prefix string = "\"currentEpoch\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.CurrentEpoch, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"magicNumber\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"magicNumber\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.MagicNumber)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"msPerBlock\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"msPerBlock\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Int64(x.MsPerBlock)
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.MsPerBlock, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"networkConfig\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"networkConfig\":"
out.RawString(prefix) out.RawString(prefix)
x.NetworkConfig.MarshalEasyJSON(out) x.NetworkConfig.MarshalEasyJSON(out)
} }
@ -2693,43 +2407,19 @@ func (x *NetworkInfo) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "currentEpoch": case "currentEpoch":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.CurrentEpoch = f
} }
case "magicNumber": case "magicNumber":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.MagicNumber = f
} }
case "msPerBlock": case "msPerBlock":
{ {
var f int64 var f int64
r := in.JsonNumber() f = in.Int64()
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 x.MsPerBlock = f
} }
case "networkConfig": 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. // provided session token has expired.
Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error) Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error)
// Search objects in container. Search query allows to match by Object // Search objects in container. Search query allows to match by Object
// Header's filed values. Please see the corresponding FrostFS Technical // Header's filed values. Please see the corresponding NeoFS Technical
// Specification section for more details. // Specification section for more details.
// //
// Extended headers can change `Search` behaviour: // Extended headers can change `Search` behaviour:
@ -301,20 +301,16 @@ type ObjectServiceClient interface {
// provided session token has expired. // provided session token has expired.
PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error) PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error)
// Patch the object. Request uses gRPC stream. First message must set // 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 // the address of the object that is going to get patched. If the object's attributes
// attributes are patched, then these attrubutes must be set only within the // are patched, then these attrubutes must be set only within the first stream message.
// first stream message.
// //
// If the patch request is performed by NOT the object's owner but if the // If the patch request is performed by NOT the object's owner but if the actor has the permission
// actor has the permission to perform the patch, then `OwnerID` of the object // to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner
// is changed. In this case the object's owner loses the object's ownership // loses the object's ownership after the patch request is successfully done.
// after the patch request is successfully done.
// //
// As objects are content-addressable the patching causes new object ID // As objects are content-addressable the patching causes new object ID generation for the patched object.
// generation for the patched object. This object id is set witihn // This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases:
// `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;
// 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; // 2. The patch that reverts the changes applied by preceding patch;
// 3. The application of the same patches for the object a few times. // 3. The application of the same patches for the object a few times.
// //
@ -698,7 +694,7 @@ type ObjectServiceServer interface {
// provided session token has expired. // provided session token has expired.
Head(context.Context, *HeadRequest) (*HeadResponse, error) Head(context.Context, *HeadRequest) (*HeadResponse, error)
// Search objects in container. Search query allows to match by Object // Search objects in container. Search query allows to match by Object
// Header's filed values. Please see the corresponding FrostFS Technical // Header's filed values. Please see the corresponding NeoFS Technical
// Specification section for more details. // Specification section for more details.
// //
// Extended headers can change `Search` behaviour: // Extended headers can change `Search` behaviour:
@ -829,20 +825,16 @@ type ObjectServiceServer interface {
// provided session token has expired. // provided session token has expired.
PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error) PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error)
// Patch the object. Request uses gRPC stream. First message must set // 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 // the address of the object that is going to get patched. If the object's attributes
// attributes are patched, then these attrubutes must be set only within the // are patched, then these attrubutes must be set only within the first stream message.
// first stream message.
// //
// If the patch request is performed by NOT the object's owner but if the // If the patch request is performed by NOT the object's owner but if the actor has the permission
// actor has the permission to perform the patch, then `OwnerID` of the object // to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner
// is changed. In this case the object's owner loses the object's ownership // loses the object's ownership after the patch request is successfully done.
// after the patch request is successfully done.
// //
// As objects are content-addressable the patching causes new object ID // As objects are content-addressable the patching causes new object ID generation for the patched object.
// generation for the patched object. This object id is set witihn // This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases:
// `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;
// 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; // 2. The patch that reverts the changes applied by preceding patch;
// 3. The application of the same patches for the object a few times. // 3. The application of the same patches for the object a few times.
// //

View file

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

View file

@ -190,25 +190,14 @@ func (x *Address) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"containerID\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"containerID\":"
out.RawString(prefix)
x.ContainerId.MarshalEasyJSON(out) x.ContainerId.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"objectID\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"objectID\":"
out.RawString(prefix) out.RawString(prefix)
x.ObjectId.MarshalEasyJSON(out) x.ObjectId.MarshalEasyJSON(out)
} }
@ -343,21 +332,11 @@ func (x *ObjectID) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
if x.Value != nil {
out.Base64Bytes(x.Value) out.Base64Bytes(x.Value)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -390,13 +369,7 @@ func (x *ObjectID) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "value": case "value":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Value = f x.Value = f
} }
} }
@ -488,21 +461,11 @@ func (x *ContainerID) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
if x.Value != nil {
out.Base64Bytes(x.Value) out.Base64Bytes(x.Value)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -535,13 +498,7 @@ func (x *ContainerID) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "value": case "value":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Value = f x.Value = f
} }
} }
@ -633,21 +590,11 @@ func (x *OwnerID) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
if x.Value != nil {
out.Base64Bytes(x.Value) out.Base64Bytes(x.Value)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -680,13 +627,7 @@ func (x *OwnerID) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "value": case "value":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Value = f x.Value = f
} }
} }
@ -798,25 +739,14 @@ func (x *Version) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"major\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"major\":"
out.RawString(prefix)
out.Uint32(x.Major) out.Uint32(x.Major)
} }
{ {
if !first { const prefix string = ",\"minor\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"minor\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.Minor) out.Uint32(x.Minor)
} }
@ -851,29 +781,13 @@ func (x *Version) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "major": case "major":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Major = f
} }
case "minor": case "minor":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Minor = f
} }
} }
@ -1005,50 +919,21 @@ func (x *Signature) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"key\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
if x.Key != nil {
out.Base64Bytes(x.Key) out.Base64Bytes(x.Key)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"signature\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix) out.RawString(prefix)
if x.Sign != nil {
out.Base64Bytes(x.Sign) out.Base64Bytes(x.Sign)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"scheme\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"scheme\":"
out.RawString(prefix) out.RawString(prefix)
v := int32(x.Scheme) out.Int32(int32(x.Scheme))
if vv, ok := SignatureScheme_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -1081,25 +966,13 @@ func (x *Signature) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "key": case "key":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Key = f x.Key = f
} }
case "signature": case "signature":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Sign = f x.Sign = f
} }
case "scheme": case "scheme":
@ -1233,35 +1106,16 @@ func (x *SignatureRFC6979) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"key\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
if x.Key != nil {
out.Base64Bytes(x.Key) out.Base64Bytes(x.Key)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"signature\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix) out.RawString(prefix)
if x.Sign != nil {
out.Base64Bytes(x.Sign) out.Base64Bytes(x.Sign)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -1294,25 +1148,13 @@ func (x *SignatureRFC6979) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "key": case "key":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Key = f x.Key = f
} }
case "signature": case "signature":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Sign = f x.Sign = f
} }
} }
@ -1424,36 +1266,16 @@ func (x *Checksum) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"type\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Int32(int32(x.Type))
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)
}
} }
{ {
if !first { const prefix string = ",\"sum\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sum\":"
out.RawString(prefix) out.RawString(prefix)
if x.Sum != nil {
out.Base64Bytes(x.Sum) out.Base64Bytes(x.Sum)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -1508,13 +1330,7 @@ func (x *Checksum) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "sum": case "sum":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Sum = f x.Sum = f
} }
} }

View file

@ -2,8 +2,6 @@ package client
import ( import (
"context" "context"
"google.golang.org/grpc"
) )
// CallOption is a messaging session option within Protobuf RPC. // CallOption is a messaging session option within Protobuf RPC.
@ -11,7 +9,6 @@ type CallOption func(*callParameters)
type callParameters struct { type callParameters struct {
ctx context.Context // nolint:containedctx ctx context.Context // nolint:containedctx
dialer func(context.Context, grpc.ClientConnInterface) error
} }
func defaultCallParameters() *callParameters { func defaultCallParameters() *callParameters {
@ -30,11 +27,3 @@ func WithContext(ctx context.Context) CallOption {
prm.ctx = ctx 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") var errInvalidEndpoint = errors.New("invalid endpoint options")
func (c *Client) openGRPCConn(ctx context.Context, dialer func(ctx context.Context, cc grpcstd.ClientConnInterface) error) error { func (c *Client) openGRPCConn(ctx context.Context) error {
if c.conn != nil { if c.conn != nil {
return nil return nil
} }
@ -21,22 +21,16 @@ func (c *Client) openGRPCConn(ctx context.Context, dialer func(ctx context.Conte
return errInvalidEndpoint return errInvalidEndpoint
} }
dialCtx, cancel := context.WithTimeout(ctx, c.dialTimeout)
var err error var err error
c.conn, err = grpcstd.NewClient(c.addr, c.grpcDialOpts...) c.conn, err = grpcstd.DialContext(dialCtx, c.addr, c.grpcDialOpts...)
cancel()
if err != nil { if err != nil {
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 fmt.Errorf("gRPC dial: %w", err)
} }
}
return nil return nil
} }

View file

@ -46,7 +46,7 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe
opt(prm) opt(prm)
} }
if err := c.openGRPCConn(prm.ctx, prm.dialer); err != nil { if err := c.openGRPCConn(prm.ctx); err != nil {
return nil, err return nil, err
} }

View file

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

View file

@ -12,7 +12,6 @@ import (
easyproto "github.com/VictoriaMetrics/easyproto" easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer" jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter" jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
) )
type CreateRequest_Body struct { type CreateRequest_Body struct {
@ -118,29 +117,16 @@ func (x *CreateRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"ownerId\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"ownerId\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out) x.OwnerId.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"expiration\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"expiration\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.Expiration)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Expiration, 10)
out.RawByte('"')
} }
out.RawByte('}') out.RawByte('}')
} }
@ -180,15 +166,7 @@ func (x *CreateRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "expiration": case "expiration":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Expiration = f
} }
} }
@ -347,35 +325,19 @@ func (x *CreateRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }
@ -537,35 +499,16 @@ func (x *CreateResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"id\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"id\":"
out.RawString(prefix)
if x.Id != nil {
out.Base64Bytes(x.Id) out.Base64Bytes(x.Id)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"sessionKey\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sessionKey\":"
out.RawString(prefix) out.RawString(prefix)
if x.SessionKey != nil {
out.Base64Bytes(x.SessionKey) out.Base64Bytes(x.SessionKey)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -598,25 +541,13 @@ func (x *CreateResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "id": case "id":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Id = f x.Id = f
} }
case "sessionKey": case "sessionKey":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.SessionKey = f x.SessionKey = f
} }
} }
@ -775,35 +706,19 @@ func (x *CreateResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out) x.MetaHeader.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"verifyHeader\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix) out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out) x.VerifyHeader.MarshalEasyJSON(out)
} }

View file

@ -179,25 +179,14 @@ func (x *ObjectSessionContext_Target) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"container\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"container\":"
out.RawString(prefix)
x.Container.MarshalEasyJSON(out) x.Container.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"objects\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"objects\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Objects { for i := range x.Objects {
@ -369,30 +358,14 @@ func (x *ObjectSessionContext) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"verb\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Int32(int32(x.Verb))
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)
}
} }
{ {
if !first { const prefix string = ",\"target\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix) out.RawString(prefix)
x.Target.MarshalEasyJSON(out) x.Target.MarshalEasyJSON(out)
} }
@ -623,40 +596,19 @@ func (x *ContainerSessionContext) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"verb\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Int32(int32(x.Verb))
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)
}
} }
{ {
if !first { const prefix string = ",\"wildcard\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"wildcard\":"
out.RawString(prefix) out.RawString(prefix)
out.Bool(x.Wildcard) out.Bool(x.Wildcard)
} }
{ {
if !first { const prefix string = ",\"containerID\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"containerID\":"
out.RawString(prefix) out.RawString(prefix)
x.ContainerId.MarshalEasyJSON(out) x.ContainerId.MarshalEasyJSON(out)
} }
@ -852,43 +804,21 @@ func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"exp\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Uint64(x.Exp)
first = false
}
const prefix string = "\"exp\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"nbf\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nbf\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.Nbf)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"iat\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"iat\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.Iat)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10)
out.RawByte('"')
} }
out.RawByte('}') out.RawByte('}')
} }
@ -921,43 +851,19 @@ func (x *SessionToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "exp": case "exp":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Exp = f
} }
case "nbf": case "nbf":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Nbf = f
} }
case "iat": case "iat":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Iat = f
} }
} }
@ -1179,76 +1085,37 @@ func (x *SessionToken_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"id\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"id\":"
out.RawString(prefix)
if x.Id != nil {
out.Base64Bytes(x.Id) out.Base64Bytes(x.Id)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"ownerID\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerID\":"
out.RawString(prefix) out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out) x.OwnerId.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"lifetime\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"lifetime\":"
out.RawString(prefix) out.RawString(prefix)
x.Lifetime.MarshalEasyJSON(out) x.Lifetime.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"sessionKey\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sessionKey\":"
out.RawString(prefix) out.RawString(prefix)
if x.SessionKey != nil {
out.Base64Bytes(x.SessionKey) out.Base64Bytes(x.SessionKey)
} else {
out.String("")
}
} }
switch xx := x.Context.(type) { switch xx := x.Context.(type) {
case *SessionToken_Body_Object: case *SessionToken_Body_Object:
{ {
if !first { const prefix string = ",\"object\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"object\":"
out.RawString(prefix) out.RawString(prefix)
xx.Object.MarshalEasyJSON(out) xx.Object.MarshalEasyJSON(out)
} }
case *SessionToken_Body_Container: case *SessionToken_Body_Container:
{ {
if !first { const prefix string = ",\"container\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"container\":"
out.RawString(prefix) out.RawString(prefix)
xx.Container.MarshalEasyJSON(out) xx.Container.MarshalEasyJSON(out)
} }
@ -1284,13 +1151,7 @@ func (x *SessionToken_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "id": case "id":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Id = f x.Id = f
} }
case "ownerID": case "ownerID":
@ -1310,13 +1171,7 @@ func (x *SessionToken_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "sessionKey": case "sessionKey":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.SessionKey = f x.SessionKey = f
} }
case "object": case "object":
@ -1468,25 +1323,14 @@ func (x *SessionToken) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"body\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out) x.Body.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"signature\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix) out.RawString(prefix)
x.Signature.MarshalEasyJSON(out) x.Signature.MarshalEasyJSON(out)
} }
@ -1641,25 +1485,14 @@ func (x *XHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"key\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
out.String(x.Key) out.String(x.Key)
} }
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Value) out.String(x.Value)
} }
@ -1950,47 +1783,24 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"version\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out) x.Version.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"epoch\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"epoch\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.Epoch)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"ttl\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ttl\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.Ttl) out.Uint32(x.Ttl)
} }
{ {
if !first { const prefix string = ",\"xHeaders\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"xHeaders\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.XHeaders { for i := range x.XHeaders {
@ -2002,46 +1812,24 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"sessionToken\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sessionToken\":"
out.RawString(prefix) out.RawString(prefix)
x.SessionToken.MarshalEasyJSON(out) x.SessionToken.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"bearerToken\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"bearerToken\":"
out.RawString(prefix) out.RawString(prefix)
x.BearerToken.MarshalEasyJSON(out) x.BearerToken.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"origin\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"origin\":"
out.RawString(prefix) out.RawString(prefix)
x.Origin.MarshalEasyJSON(out) x.Origin.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"magicNumber\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"magicNumber\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.MagicNumber)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10)
out.RawByte('"')
} }
out.RawByte('}') out.RawByte('}')
} }
@ -2081,29 +1869,13 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "epoch": case "epoch":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Epoch = f
} }
case "ttl": case "ttl":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Ttl = f
} }
case "xHeaders": case "xHeaders":
@ -2144,15 +1916,7 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "magicNumber": case "magicNumber":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.MagicNumber = f
} }
} }
@ -2359,47 +2123,24 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"version\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out) x.Version.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"epoch\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"epoch\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.Epoch)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"ttl\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ttl\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.Ttl) out.Uint32(x.Ttl)
} }
{ {
if !first { const prefix string = ",\"xHeaders\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"xHeaders\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.XHeaders { for i := range x.XHeaders {
@ -2411,22 +2152,12 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"origin\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"origin\":"
out.RawString(prefix) out.RawString(prefix)
x.Origin.MarshalEasyJSON(out) x.Origin.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"status\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"status\":"
out.RawString(prefix) out.RawString(prefix)
x.Status.MarshalEasyJSON(out) x.Status.MarshalEasyJSON(out)
} }
@ -2468,29 +2199,13 @@ func (x *ResponseMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "epoch": case "epoch":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.Epoch = f
} }
case "ttl": case "ttl":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Ttl = f
} }
case "xHeaders": case "xHeaders":
@ -2682,45 +2397,24 @@ func (x *RequestVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"bodySignature\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"bodySignature\":"
out.RawString(prefix)
x.BodySignature.MarshalEasyJSON(out) x.BodySignature.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaSignature\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaSignature\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaSignature.MarshalEasyJSON(out) x.MetaSignature.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"originSignature\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"originSignature\":"
out.RawString(prefix) out.RawString(prefix)
x.OriginSignature.MarshalEasyJSON(out) x.OriginSignature.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"origin\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"origin\":"
out.RawString(prefix) out.RawString(prefix)
x.Origin.MarshalEasyJSON(out) x.Origin.MarshalEasyJSON(out)
} }
@ -2941,45 +2635,24 @@ func (x *ResponseVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"bodySignature\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"bodySignature\":"
out.RawString(prefix)
x.BodySignature.MarshalEasyJSON(out) x.BodySignature.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"metaSignature\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaSignature\":"
out.RawString(prefix) out.RawString(prefix)
x.MetaSignature.MarshalEasyJSON(out) x.MetaSignature.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"originSignature\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"originSignature\":"
out.RawString(prefix) out.RawString(prefix)
x.OriginSignature.MarshalEasyJSON(out) x.OriginSignature.MarshalEasyJSON(out)
} }
{ {
if !first { const prefix string = ",\"origin\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"origin\":"
out.RawString(prefix) out.RawString(prefix)
x.Origin.MarshalEasyJSON(out) x.Origin.MarshalEasyJSON(out)
} }

View file

@ -368,31 +368,16 @@ func (x *Status_Detail) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"id\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"id\":"
out.RawString(prefix)
out.Uint32(x.Id) out.Uint32(x.Id)
} }
{ {
if !first { const prefix string = ",\"value\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix) out.RawString(prefix)
if x.Value != nil {
out.Base64Bytes(x.Value) out.Base64Bytes(x.Value)
} else {
out.String("")
}
} }
out.RawByte('}') out.RawByte('}')
} }
@ -425,27 +410,13 @@ func (x *Status_Detail) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "id": case "id":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Id = f
} }
case "value": case "value":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Value = f x.Value = f
} }
} }
@ -583,35 +554,19 @@ func (x *Status) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"code\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"code\":"
out.RawString(prefix)
out.Uint32(x.Code) out.Uint32(x.Code)
} }
{ {
if !first { const prefix string = ",\"message\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"message\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.Message) out.String(x.Message)
} }
{ {
if !first { const prefix string = ",\"details\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"details\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Details { for i := range x.Details {
@ -653,15 +608,7 @@ func (x *Status) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "code": case "code":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.Code = f
} }
case "message": case "message":

View file

@ -63,8 +63,6 @@ const (
SignatureVerificationFail SignatureVerificationFail
// NodeUnderMaintenance is a local Code value for NODE_UNDER_MAINTENANCE status. // NodeUnderMaintenance is a local Code value for NODE_UNDER_MAINTENANCE status.
NodeUnderMaintenance NodeUnderMaintenance
// InvalidArgument is a local Code value for INVALID_ARGUMENT status.
InvalidArgument
) )
const ( const (

View file

@ -12,7 +12,6 @@ import (
easyproto "github.com/VictoriaMetrics/easyproto" easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer" jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter" jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
) )
type Tombstone struct { type Tombstone struct {
@ -141,41 +140,19 @@ func (x *Tombstone) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"expirationEpoch\":"
out.RawByte(',') out.RawString(prefix[1:])
} else { out.Uint64(x.ExpirationEpoch)
first = false
}
const prefix string = "\"expirationEpoch\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.ExpirationEpoch, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"splitID\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"splitID\":"
out.RawString(prefix) out.RawString(prefix)
if x.SplitId != nil {
out.Base64Bytes(x.SplitId) out.Base64Bytes(x.SplitId)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"members\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"members\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.Members { for i := range x.Members {
@ -217,27 +194,13 @@ func (x *Tombstone) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "expirationEpoch": case "expirationEpoch":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.ExpirationEpoch = f
} }
case "splitID": case "splitID":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.SplitId = f x.SplitId = f
} }
case "members": case "members":

View file

@ -26,35 +26,12 @@ func nonZero[T protoInt]() T {
func TestStableMarshalSingle(t *testing.T) { func TestStableMarshalSingle(t *testing.T) {
t.Run("empty", func(t *testing.T) { t.Run("empty", func(t *testing.T) {
t.Run("proto", func(t *testing.T) {
input := &generated.Primitives{} input := &generated.Primitives{}
require.Zero(t, input.StableSize()) require.Zero(t, input.StableSize())
r := input.MarshalProtobuf(nil) r := input.MarshalProtobuf(nil)
require.Empty(t, r) 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 { marshalCases := []struct {
name string name string
@ -99,12 +76,6 @@ func TestStableMarshalSingle(t *testing.T) {
var actual test.Primitives var actual test.Primitives
require.NoError(t, protojson.Unmarshal(r, &actual)) 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 var actualFrostfs generated.Primitives
require.NoError(t, actualFrostfs.UnmarshalJSON(r)) require.NoError(t, actualFrostfs.UnmarshalJSON(r))
require.Equal(t, tc.input, &actualFrostfs) require.Equal(t, tc.input, &actualFrostfs)
@ -117,7 +88,6 @@ func TestStableMarshalSingle(t *testing.T) {
func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) { func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) {
// Compare each field directly, because proto-generated code has private fields. // 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.FieldA, b.FieldA)
require.Equal(t, a.FieldB, b.FieldB) require.Equal(t, a.FieldB, b.FieldB)
require.Equal(t, a.FieldC, b.FieldC) require.Equal(t, a.FieldC, b.FieldC)

View file

@ -130,16 +130,10 @@ func (x *Primitives_Aux) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"innerField\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"innerField\":"
out.RawString(prefix)
out.Uint32(x.InnerField) out.Uint32(x.InnerField)
} }
out.RawByte('}') out.RawByte('}')
@ -173,15 +167,7 @@ func (x *Primitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "innerField": case "innerField":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.InnerField = f
} }
} }
@ -574,168 +560,78 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"fieldA\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"fieldA\":"
out.RawString(prefix)
if x.FieldA != nil {
out.Base64Bytes(x.FieldA) out.Base64Bytes(x.FieldA)
} else {
out.String("")
}
} }
{ {
if !first { const prefix string = ",\"fieldB\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldB\":"
out.RawString(prefix) out.RawString(prefix)
out.String(x.FieldB) out.String(x.FieldB)
} }
{ {
if !first { const prefix string = ",\"fieldC\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldC\":"
out.RawString(prefix) out.RawString(prefix)
out.Bool(x.FieldC) out.Bool(x.FieldC)
} }
{ {
if !first { const prefix string = ",\"fieldD\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldD\":"
out.RawString(prefix) out.RawString(prefix)
out.Int32(x.FieldD) out.Int32(x.FieldD)
} }
{ {
if !first { const prefix string = ",\"fieldE\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldE\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.FieldE) out.Uint32(x.FieldE)
} }
{ {
if !first { const prefix string = ",\"fieldF\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldF\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Int64(x.FieldF)
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldF, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"fieldG\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldG\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.FieldG)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldG, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"fieldI\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldI\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('"') out.Uint64(x.FieldI)
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldI, 10)
out.RawByte('"')
} }
{ {
if !first { const prefix string = ",\"fieldJ\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldJ\":"
out.RawString(prefix) out.RawString(prefix)
out.Float64(x.FieldJ) out.Float64(x.FieldJ)
} }
{ {
if !first { const prefix string = ",\"fieldK\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldK\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(x.FieldK) out.Uint32(x.FieldK)
} }
{ {
if !first { const prefix string = ",\"fieldH\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldH\":"
out.RawString(prefix) out.RawString(prefix)
v := int32(x.FieldH) out.Int32(int32(x.FieldH))
if vv, ok := Primitives_SomeEnum_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
} }
switch xx := x.FieldM.(type) { switch xx := x.FieldM.(type) {
case *Primitives_FieldMa: case *Primitives_FieldMa:
{ {
if !first { const prefix string = ",\"fieldMa\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldMa\":"
out.RawString(prefix) out.RawString(prefix)
if xx.FieldMa != nil {
out.Base64Bytes(xx.FieldMa) out.Base64Bytes(xx.FieldMa)
} else {
out.String("")
}
} }
case *Primitives_FieldMe: case *Primitives_FieldMe:
{ {
if !first { const prefix string = ",\"fieldMe\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldMe\":"
out.RawString(prefix) out.RawString(prefix)
out.Uint32(xx.FieldMe) out.Uint32(xx.FieldMe)
} }
case *Primitives_FieldAux: case *Primitives_FieldAux:
{ {
if !first { const prefix string = ",\"fieldAux\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldAux\":"
out.RawString(prefix) out.RawString(prefix)
xx.FieldAux.MarshalEasyJSON(out) xx.FieldAux.MarshalEasyJSON(out)
} }
@ -771,13 +667,7 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "fieldA": case "fieldA":
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.FieldA = f x.FieldA = f
} }
case "fieldB": case "fieldB":
@ -795,71 +685,31 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "fieldD": case "fieldD":
{ {
var f int32 var f int32
r := in.JsonNumber() f = in.Int32()
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 x.FieldD = f
} }
case "fieldE": case "fieldE":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.FieldE = f
} }
case "fieldF": case "fieldF":
{ {
var f int64 var f int64
r := in.JsonNumber() f = in.Int64()
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 x.FieldF = f
} }
case "fieldG": case "fieldG":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.FieldG = f
} }
case "fieldI": case "fieldI":
{ {
var f uint64 var f uint64
r := in.JsonNumber() f = in.Uint64()
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 x.FieldI = f
} }
case "fieldJ": case "fieldJ":
@ -871,15 +721,7 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "fieldK": case "fieldK":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.FieldK = f
} }
case "fieldH": case "fieldH":
@ -909,13 +751,7 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
x.FieldM = xx x.FieldM = xx
{ {
var f []byte var f []byte
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
xx.FieldMa = f xx.FieldMa = f
} }
case "fieldMe": case "fieldMe":
@ -923,15 +759,7 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
x.FieldM = xx x.FieldM = xx
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 xx.FieldMe = f
} }
case "fieldAux": case "fieldAux":
@ -1054,16 +882,10 @@ func (x *RepPrimitives_Aux) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"innerField\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"innerField\":"
out.RawString(prefix)
out.Uint32(x.InnerField) out.Uint32(x.InnerField)
} }
out.RawByte('}') out.RawByte('}')
@ -1097,15 +919,7 @@ func (x *RepPrimitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "innerField": case "innerField":
{ {
var f uint32 var f uint32
r := in.JsonNumber() f = in.Uint32()
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 x.InnerField = f
} }
} }
@ -1350,36 +1164,21 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null") out.RawString("null")
return return
} }
first := true
out.RawByte('{') out.RawByte('{')
{ {
if !first { const prefix string = ",\"fieldA\":"
out.RawByte(',') out.RawString(prefix[1:])
} else {
first = false
}
const prefix string = "\"fieldA\":"
out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.FieldA { for i := range x.FieldA {
if i != 0 { if i != 0 {
out.RawByte(',') out.RawByte(',')
} }
if x.FieldA[i] != nil {
out.Base64Bytes(x.FieldA[i]) out.Base64Bytes(x.FieldA[i])
} else {
out.String("")
}
} }
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"fieldB\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldB\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.FieldB { for i := range x.FieldB {
@ -1391,12 +1190,7 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"fieldC\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldC\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.FieldC { for i := range x.FieldC {
@ -1408,12 +1202,7 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"fieldD\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldD\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.FieldD { for i := range x.FieldD {
@ -1425,69 +1214,43 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"fieldE\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldE\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.FieldE { for i := range x.FieldE {
if i != 0 { if i != 0 {
out.RawByte(',') out.RawByte(',')
} }
out.RawByte('"') out.Int64(x.FieldE[i])
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldE[i], 10)
out.RawByte('"')
} }
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"fieldF\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldF\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.FieldF { for i := range x.FieldF {
if i != 0 { if i != 0 {
out.RawByte(',') out.RawByte(',')
} }
out.RawByte('"') out.Uint64(x.FieldF[i])
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldF[i], 10)
out.RawByte('"')
} }
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"fieldFu\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldFu\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.FieldFu { for i := range x.FieldFu {
if i != 0 { if i != 0 {
out.RawByte(',') out.RawByte(',')
} }
out.RawByte('"') out.Uint64(x.FieldFu[i])
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldFu[i], 10)
out.RawByte('"')
} }
out.RawByte(']') out.RawByte(']')
} }
{ {
if !first { const prefix string = ",\"fieldAux\":"
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldAux\":"
out.RawString(prefix) out.RawString(prefix)
out.RawByte('[') out.RawByte('[')
for i := range x.FieldAux { for i := range x.FieldAux {
@ -1532,13 +1295,7 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list [][]byte var list [][]byte
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
{ f = in.Bytes()
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
list = append(list, f) list = append(list, f)
in.WantComma() in.WantComma()
} }
@ -1564,15 +1321,7 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []int32 var list []int32
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
r := in.JsonNumber() f = in.Int32()
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) list = append(list, f)
in.WantComma() in.WantComma()
} }
@ -1585,15 +1334,7 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []uint32 var list []uint32
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
r := in.JsonNumber() f = in.Uint32()
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) list = append(list, f)
in.WantComma() in.WantComma()
} }
@ -1606,15 +1347,7 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []int64 var list []int64
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
r := in.JsonNumber() f = in.Int64()
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) list = append(list, f)
in.WantComma() in.WantComma()
} }
@ -1627,15 +1360,7 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []uint64 var list []uint64
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
r := in.JsonNumber() f = in.Uint64()
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) list = append(list, f)
in.WantComma() in.WantComma()
} }
@ -1648,15 +1373,7 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []uint64 var list []uint64
in.Delim('[') in.Delim('[')
for !in.IsDelim(']') { for !in.IsDelim(']') {
r := in.JsonNumber() f = in.Uint64()
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) list = append(list, f)
in.WantComma() in.WantComma()
} }

View file

@ -59,35 +59,6 @@ func emitJSONUnmarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
g.P("}") 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) { func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string) {
g.P("{") g.P("{")
defer g.P("}") defer g.P("}")
@ -112,20 +83,30 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string
enumType := fieldType(g, f).String() enumType := fieldType(g, f).String()
g.P("var parsedValue " + enumType) g.P("var parsedValue " + enumType)
emitJSONReadEnum(g, "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)
}`)
template = "%s = parsedValue" template = "%s = parsedValue"
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
emitJSONParseInteger(g, "pv", "ParseInt", 32, "int32") template = "%s = in.Int32()"
template = "%s = pv"
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
emitJSONParseInteger(g, "pv", "ParseUint", 32, "uint32") template = "%s = in.Uint32()"
template = "%s = pv"
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
emitJSONParseInteger(g, "pv", "ParseInt", 64, "int64") template = "%s = in.Int64()"
template = "%s = pv"
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
emitJSONParseInteger(g, "pv", "ParseUint", 64, "uint64") template = "%s = in.Uint64()"
template = "%s = pv"
case protoreflect.FloatKind: case protoreflect.FloatKind:
template = "%s = in.Float32()" template = "%s = in.Float32()"
case protoreflect.DoubleKind: case protoreflect.DoubleKind:
@ -133,17 +114,7 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string
case protoreflect.StringKind: case protoreflect.StringKind:
template = "%s = in.String()" template = "%s = in.String()"
case protoreflect.BytesKind: case protoreflect.BytesKind:
// Since some time ago proto3 support optional keyword, thus the presence is not tracked by default: template = "%s = in.Bytes()"
// 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: case protoreflect.MessageKind:
if f.Desc.IsList() { if f.Desc.IsList() {
g.P("f = ", fieldType(g, f)[2:], "{}") g.P("f = ", fieldType(g, f)[2:], "{}")
@ -176,11 +147,8 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
g.P("func (x *", msg.GoIdent.GoName, ") MarshalEasyJSON(out *", jwriterPackage.Ident("Writer"), ") {") g.P("func (x *", msg.GoIdent.GoName, ") MarshalEasyJSON(out *", jwriterPackage.Ident("Writer"), ") {")
g.P(`if x == nil { out.RawString("null"); return }`) g.P(`if x == nil { out.RawString("null"); return }`)
if len(msg.Fields) != 0 {
g.P("first := true")
}
g.P("out.RawByte('{')") g.P("out.RawByte('{')")
for _, f := range msg.Fields { for i, f := range msg.Fields {
if f.Oneof != nil { if f.Oneof != nil {
if f.Oneof.Fields[0] != f { if f.Oneof.Fields[0] != f {
continue continue
@ -189,38 +157,29 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
g.P("switch xx := x.", f.Oneof.GoName, ".(type) {") g.P("switch xx := x.", f.Oneof.GoName, ".(type) {")
for _, ff := range f.Oneof.Fields { for _, ff := range f.Oneof.Fields {
g.P("case *", ff.GoIdent, ":") g.P("case *", ff.GoIdent, ":")
emitJSONFieldWrite(g, ff, "xx") emitJSONFieldWrite(g, ff, "xx", i == 0)
} }
g.P("}") g.P("}")
continue continue
} }
emitJSONFieldWrite(g, f, "x") emitJSONFieldWrite(g, f, "x", i == 0)
} }
g.P("out.RawByte('}')") g.P("out.RawByte('}')")
g.P("}") g.P("}")
} }
func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string) { func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string, first bool) {
g.P("{") g.P("{")
defer g.P("}") defer g.P("}")
selector := name + "." + f.GoName g.P("const prefix string = ", `",\"`, fieldJSONName(f), `\":"`)
if first {
// This code is responsible for ignoring default values. g.P("out.RawString(prefix[1:])")
// We will restore it after having parametrized JSON marshaling. } else {
//
// 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)") g.P("out.RawString(prefix)")
}
selector := name + "." + f.GoName
if f.Desc.IsList() { if f.Desc.IsList() {
selector += "[i]" selector += "[i]"
g.P("out.RawByte('[')") g.P("out.RawByte('[')")
@ -236,27 +195,15 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin
case protoreflect.BoolKind: case protoreflect.BoolKind:
template = "out.Bool(%s)" template = "out.Bool(%s)"
case protoreflect.EnumKind: case protoreflect.EnumKind:
enumType := fieldType(g, f).String() template = "out.Int32(int32(%s))"
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: case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
template = "out.Int32(%s)" template = "out.Int32(%s)"
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
template = "out.Uint32(%s)" template = "out.Uint32(%s)"
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
g.P("out.RawByte('\"')") template = "out.Int64(%s)"
g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendInt"), "(out.Buffer.Buf, ", selector, ", 10)")
g.P("out.RawByte('\"')")
return
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
g.P("out.RawByte('\"')") template = "out.Uint64(%s)"
g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendUint"), "(out.Buffer.Buf, ", selector, ", 10)")
g.P("out.RawByte('\"')")
return
case protoreflect.FloatKind: case protoreflect.FloatKind:
template = "out.Float32(%s)" template = "out.Float32(%s)"
case protoreflect.DoubleKind: case protoreflect.DoubleKind:
@ -264,10 +211,7 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin
case protoreflect.StringKind: case protoreflect.StringKind:
template = "out.String(%s)" template = "out.String(%s)"
case protoreflect.BytesKind: case protoreflect.BytesKind:
g.P("if ", selector, "!= nil {") template = "out.Base64Bytes(%s)"
g.P("out.Base64Bytes(", selector, ")")
g.P("} else { out.String(\"\") }")
return
case protoreflect.MessageKind: case protoreflect.MessageKind:
template = "%s.MarshalEasyJSON(out)" template = "%s.MarshalEasyJSON(out)"
case protoreflect.GroupKind: case protoreflect.GroupKind: