Compare commits

..

1 commit

Author SHA1 Message Date
349d6b6140 [#276] Merge repo with frostfs-api-go
Some checks failed
DCO / DCO (pull_request) Successful in 54s
Tests and linters / Tests (pull_request) Failing after 1m7s
Tests and linters / Lint (pull_request) Successful in 1m58s
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
2024-10-08 14:45:37 +03:00
23 changed files with 3848 additions and 767 deletions

View file

@ -98,10 +98,16 @@ func (x *BalanceRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"ownerId\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerId\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out)
}
out.RawByte('}')
@ -295,19 +301,35 @@ func (x *BalanceRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"verifyHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
@ -452,10 +474,16 @@ func (x *BalanceResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"balance\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"balance\":"
out.RawString(prefix)
x.Balance.MarshalEasyJSON(out)
}
out.RawByte('}')
@ -649,19 +677,35 @@ func (x *BalanceResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"verifyHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}

View file

@ -26,7 +26,7 @@ const (
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AccountingServiceClient interface {
// Returns the amount of funds in GAS token for the requested NeoFS account.
// Returns the amount of funds in GAS token for the requested FrostFS account.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS):
@ -56,7 +56,7 @@ func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceReques
// All implementations should embed UnimplementedAccountingServiceServer
// for forward compatibility
type AccountingServiceServer interface {
// Returns the amount of funds in GAS token for the requested NeoFS account.
// Returns the amount of funds in GAS token for the requested FrostFS account.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS):

View file

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

View file

@ -352,24 +352,55 @@ func (x *EACLRecord_Filter) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"headerType\":"
out.RawString(prefix[1:])
out.Int32(int32(x.HeaderType))
}
{
const prefix string = ",\"matchType\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"headerType\":"
out.RawString(prefix)
out.Int32(int32(x.MatchType))
v := int32(x.HeaderType)
if vv, ok := HeaderType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"key\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"matchType\":"
out.RawString(prefix)
v := int32(x.MatchType)
if vv, ok := MatchType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
out.String(x.Key)
}
{
const prefix string = ",\"value\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
out.String(x.Value)
}
@ -566,21 +597,41 @@ func (x *EACLRecord_Target) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"role\":"
out.RawString(prefix[1:])
out.Int32(int32(x.Role))
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"role\":"
out.RawString(prefix)
v := int32(x.Role)
if vv, ok := Role_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"keys\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"keys\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Keys {
if i != 0 {
out.RawByte(',')
}
out.Base64Bytes(x.Keys[i])
if x.Keys[i] != nil {
out.Base64Bytes(x.Keys[i])
} else {
out.String("")
}
}
out.RawByte(']')
}
@ -808,19 +859,45 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"operation\":"
out.RawString(prefix[1:])
out.Int32(int32(x.Operation))
}
{
const prefix string = ",\"action\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"operation\":"
out.RawString(prefix)
out.Int32(int32(x.Action))
v := int32(x.Operation)
if vv, ok := Operation_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"filters\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"action\":"
out.RawString(prefix)
v := int32(x.Action)
if vv, ok := Action_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"filters\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Filters {
@ -832,7 +909,12 @@ func (x *EACLRecord) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"targets\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"targets\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Targets {
@ -1084,19 +1166,35 @@ func (x *EACLTable) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"version\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out)
}
{
const prefix string = ",\"containerID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"containerID\":"
out.RawString(prefix)
x.ContainerId.MarshalEasyJSON(out)
}
{
const prefix string = ",\"records\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"records\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Records {
@ -1292,21 +1390,43 @@ func (x *BearerToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"exp\":"
out.RawString(prefix[1:])
out.Uint64(x.Exp)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"exp\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10)
out.RawByte('"')
}
{
const prefix string = ",\"nbf\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nbf\":"
out.RawString(prefix)
out.Uint64(x.Nbf)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10)
out.RawByte('"')
}
{
const prefix string = ",\"iat\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"iat\":"
out.RawString(prefix)
out.Uint64(x.Iat)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10)
out.RawByte('"')
}
out.RawByte('}')
}
@ -1339,19 +1459,43 @@ func (x *BearerToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "exp":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Exp = f
}
case "nbf":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Nbf = f
}
case "iat":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Iat = f
}
}
@ -1472,14 +1616,25 @@ func (x *BearerToken_Body_APEOverride) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"target\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out)
}
{
const prefix string = ",\"chains\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chains\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Chains {
@ -1720,29 +1875,55 @@ func (x *BearerToken_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"eaclTable\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"eaclTable\":"
out.RawString(prefix)
x.EaclTable.MarshalEasyJSON(out)
}
{
const prefix string = ",\"ownerID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerID\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out)
}
{
const prefix string = ",\"lifetime\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"lifetime\":"
out.RawString(prefix)
x.Lifetime.MarshalEasyJSON(out)
}
{
const prefix string = ",\"allowImpersonate\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"allowImpersonate\":"
out.RawString(prefix)
out.Bool(x.AllowImpersonate)
}
{
const prefix string = ",\"apeOverride\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"apeOverride\":"
out.RawString(prefix)
x.ApeOverride.MarshalEasyJSON(out)
}
@ -1923,14 +2104,25 @@ func (x *BearerToken) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"signature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix)
x.Signature.MarshalEasyJSON(out)
}

View file

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

View file

@ -121,14 +121,25 @@ func (x *AddChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"target\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out)
}
{
const prefix string = ",\"chain\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chain\":"
out.RawString(prefix)
x.Chain.MarshalEasyJSON(out)
}
@ -330,19 +341,35 @@ func (x *AddChainRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"verifyHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
@ -484,11 +511,21 @@ func (x *AddChainResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"chainId\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.ChainId)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chainId\":"
out.RawString(prefix)
if x.ChainId != nil {
out.Base64Bytes(x.ChainId)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -680,19 +717,35 @@ func (x *AddChainResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"verifyHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
@ -857,16 +910,31 @@ func (x *RemoveChainRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"target\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out)
}
{
const prefix string = ",\"chainId\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chainId\":"
out.RawString(prefix)
out.Base64Bytes(x.ChainId)
if x.ChainId != nil {
out.Base64Bytes(x.ChainId)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -1065,19 +1133,35 @@ func (x *RemoveChainRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"verifyHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
@ -1381,19 +1465,35 @@ func (x *RemoveChainResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"verifyHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
@ -1538,10 +1638,16 @@ func (x *ListChainsRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"target\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out)
}
out.RawByte('}')
@ -1735,19 +1841,35 @@ func (x *ListChainsRequest) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"verifyHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
@ -1895,10 +2017,16 @@ func (x *ListChainsResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"chains\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"chains\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Chains {
if i != 0 {
@ -2106,19 +2234,35 @@ func (x *ListChainsResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
const prefix string = ",\"verifyHeader\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}

View file

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

View file

@ -13,6 +13,7 @@ import (
easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
)
type Container_Attribute struct {
@ -115,14 +116,25 @@ func (x *Container_Attribute) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"key\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
out.String(x.Key)
}
{
const prefix string = ",\"value\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
out.String(x.Value)
}
@ -370,29 +382,59 @@ func (x *Container) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"version\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out)
}
{
const prefix string = ",\"ownerID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerID\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out)
}
{
const prefix string = ",\"nonce\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nonce\":"
out.RawString(prefix)
out.Base64Bytes(x.Nonce)
if x.Nonce != nil {
out.Base64Bytes(x.Nonce)
} else {
out.String("")
}
}
{
const prefix string = ",\"basicACL\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"basicACL\":"
out.RawString(prefix)
out.Uint32(x.BasicAcl)
}
{
const prefix string = ",\"attributes\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"attributes\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Attributes {
@ -404,7 +446,12 @@ func (x *Container) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"placementPolicy\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"placementPolicy\":"
out.RawString(prefix)
x.PlacementPolicy.MarshalEasyJSON(out)
}
@ -459,7 +506,15 @@ func (x *Container) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "basicACL":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.BasicAcl = f
}
case "attributes":

View file

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

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

@ -170,7 +170,7 @@ type ObjectServiceClient interface {
// provided session token has expired.
Head(ctx context.Context, in *HeadRequest, opts ...grpc.CallOption) (*HeadResponse, error)
// Search objects in container. Search query allows to match by Object
// Header's filed values. Please see the corresponding NeoFS Technical
// Header's filed values. Please see the corresponding FrostFS Technical
// Specification section for more details.
//
// Extended headers can change `Search` behaviour:
@ -301,16 +301,20 @@ type ObjectServiceClient interface {
// provided session token has expired.
PutSingle(ctx context.Context, in *PutSingleRequest, opts ...grpc.CallOption) (*PutSingleResponse, error)
// Patch the object. Request uses gRPC stream. First message must set
// the address of the object that is going to get patched. If the object's attributes
// are patched, then these attrubutes must be set only within the first stream message.
// the address of the object that is going to get patched. If the object's
// attributes are patched, then these attrubutes must be set only within the
// first stream message.
//
// If the patch request is performed by NOT the object's owner but if the actor has the permission
// to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner
// loses the object's ownership after the patch request is successfully done.
// If the patch request is performed by NOT the object's owner but if the
// actor has the permission to perform the patch, then `OwnerID` of the object
// is changed. In this case the object's owner loses the object's ownership
// after the patch request is successfully done.
//
// As objects are content-addressable the patching causes new object ID generation for the patched object.
// This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases:
// 1. The chunk of the applying patch contains the same value as the object's payload within the same range;
// As objects are content-addressable the patching causes new object ID
// generation for the patched object. This object id is set witihn
// `PatchResponse`. But the object id may remain unchanged in such cases:
// 1. The chunk of the applying patch contains the same value as the object's
// payload within the same range;
// 2. The patch that reverts the changes applied by preceding patch;
// 3. The application of the same patches for the object a few times.
//
@ -694,7 +698,7 @@ type ObjectServiceServer interface {
// provided session token has expired.
Head(context.Context, *HeadRequest) (*HeadResponse, error)
// Search objects in container. Search query allows to match by Object
// Header's filed values. Please see the corresponding NeoFS Technical
// Header's filed values. Please see the corresponding FrostFS Technical
// Specification section for more details.
//
// Extended headers can change `Search` behaviour:
@ -825,16 +829,20 @@ type ObjectServiceServer interface {
// provided session token has expired.
PutSingle(context.Context, *PutSingleRequest) (*PutSingleResponse, error)
// Patch the object. Request uses gRPC stream. First message must set
// the address of the object that is going to get patched. If the object's attributes
// are patched, then these attrubutes must be set only within the first stream message.
// the address of the object that is going to get patched. If the object's
// attributes are patched, then these attrubutes must be set only within the
// first stream message.
//
// If the patch request is performed by NOT the object's owner but if the actor has the permission
// to perform the patch, then `OwnerID` of the object is changed. In this case the object's owner
// loses the object's ownership after the patch request is successfully done.
// If the patch request is performed by NOT the object's owner but if the
// actor has the permission to perform the patch, then `OwnerID` of the object
// is changed. In this case the object's owner loses the object's ownership
// after the patch request is successfully done.
//
// As objects are content-addressable the patching causes new object ID generation for the patched object.
// This object id is set witihn `PatchResponse`. But the object id may remain unchanged in such cases:
// 1. The chunk of the applying patch contains the same value as the object's payload within the same range;
// As objects are content-addressable the patching causes new object ID
// generation for the patched object. This object id is set witihn
// `PatchResponse`. But the object id may remain unchanged in such cases:
// 1. The chunk of the applying patch contains the same value as the object's
// payload within the same range;
// 2. The patch that reverts the changes applied by preceding patch;
// 3. The application of the same patches for the object a few times.
//

View file

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

View file

@ -190,14 +190,25 @@ func (x *Address) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"containerID\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"containerID\":"
out.RawString(prefix)
x.ContainerId.MarshalEasyJSON(out)
}
{
const prefix string = ",\"objectID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"objectID\":"
out.RawString(prefix)
x.ObjectId.MarshalEasyJSON(out)
}
@ -332,11 +343,21 @@ func (x *ObjectID) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"value\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.Value)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
if x.Value != nil {
out.Base64Bytes(x.Value)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -461,11 +482,21 @@ func (x *ContainerID) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"value\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.Value)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
if x.Value != nil {
out.Base64Bytes(x.Value)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -590,11 +621,21 @@ func (x *OwnerID) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"value\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.Value)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
if x.Value != nil {
out.Base64Bytes(x.Value)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -739,14 +780,25 @@ func (x *Version) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"major\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"major\":"
out.RawString(prefix)
out.Uint32(x.Major)
}
{
const prefix string = ",\"minor\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"minor\":"
out.RawString(prefix)
out.Uint32(x.Minor)
}
@ -781,13 +833,29 @@ func (x *Version) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "major":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.Major = f
}
case "minor":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.Minor = f
}
}
@ -919,21 +987,50 @@ func (x *Signature) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"key\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.Key)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
if x.Key != nil {
out.Base64Bytes(x.Key)
} else {
out.String("")
}
}
{
const prefix string = ",\"signature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix)
out.Base64Bytes(x.Sign)
if x.Sign != nil {
out.Base64Bytes(x.Sign)
} else {
out.String("")
}
}
{
const prefix string = ",\"scheme\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"scheme\":"
out.RawString(prefix)
out.Int32(int32(x.Scheme))
v := int32(x.Scheme)
if vv, ok := SignatureScheme_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
out.RawByte('}')
}
@ -1106,16 +1203,35 @@ func (x *SignatureRFC6979) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"key\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.Key)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
if x.Key != nil {
out.Base64Bytes(x.Key)
} else {
out.String("")
}
}
{
const prefix string = ",\"signature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix)
out.Base64Bytes(x.Sign)
if x.Sign != nil {
out.Base64Bytes(x.Sign)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -1266,16 +1382,36 @@ func (x *Checksum) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"type\":"
out.RawString(prefix[1:])
out.Int32(int32(x.Type))
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"type\":"
out.RawString(prefix)
v := int32(x.Type)
if vv, ok := ChecksumType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"sum\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sum\":"
out.RawString(prefix)
out.Base64Bytes(x.Sum)
if x.Sum != nil {
out.Base64Bytes(x.Sum)
} else {
out.String("")
}
}
out.RawByte('}')
}

View file

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

View file

@ -179,14 +179,25 @@ func (x *ObjectSessionContext_Target) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"container\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"container\":"
out.RawString(prefix)
x.Container.MarshalEasyJSON(out)
}
{
const prefix string = ",\"objects\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"objects\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Objects {
@ -358,14 +369,30 @@ func (x *ObjectSessionContext) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"verb\":"
out.RawString(prefix[1:])
out.Int32(int32(x.Verb))
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verb\":"
out.RawString(prefix)
v := int32(x.Verb)
if vv, ok := ObjectSessionContext_Verb_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"target\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"target\":"
out.RawString(prefix)
x.Target.MarshalEasyJSON(out)
}
@ -596,19 +623,40 @@ func (x *ContainerSessionContext) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"verb\":"
out.RawString(prefix[1:])
out.Int32(int32(x.Verb))
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verb\":"
out.RawString(prefix)
v := int32(x.Verb)
if vv, ok := ContainerSessionContext_Verb_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
const prefix string = ",\"wildcard\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"wildcard\":"
out.RawString(prefix)
out.Bool(x.Wildcard)
}
{
const prefix string = ",\"containerID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"containerID\":"
out.RawString(prefix)
x.ContainerId.MarshalEasyJSON(out)
}
@ -804,21 +852,43 @@ func (x *SessionToken_Body_TokenLifetime) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"exp\":"
out.RawString(prefix[1:])
out.Uint64(x.Exp)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"exp\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Exp, 10)
out.RawByte('"')
}
{
const prefix string = ",\"nbf\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nbf\":"
out.RawString(prefix)
out.Uint64(x.Nbf)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Nbf, 10)
out.RawByte('"')
}
{
const prefix string = ",\"iat\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"iat\":"
out.RawString(prefix)
out.Uint64(x.Iat)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Iat, 10)
out.RawByte('"')
}
out.RawByte('}')
}
@ -851,19 +921,43 @@ func (x *SessionToken_Body_TokenLifetime) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "exp":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Exp = f
}
case "nbf":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Nbf = f
}
case "iat":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Iat = f
}
}
@ -1085,37 +1179,76 @@ func (x *SessionToken_Body) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"id\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.Id)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"id\":"
out.RawString(prefix)
if x.Id != nil {
out.Base64Bytes(x.Id)
} else {
out.String("")
}
}
{
const prefix string = ",\"ownerID\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerID\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out)
}
{
const prefix string = ",\"lifetime\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"lifetime\":"
out.RawString(prefix)
x.Lifetime.MarshalEasyJSON(out)
}
{
const prefix string = ",\"sessionKey\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sessionKey\":"
out.RawString(prefix)
out.Base64Bytes(x.SessionKey)
if x.SessionKey != nil {
out.Base64Bytes(x.SessionKey)
} else {
out.String("")
}
}
switch xx := x.Context.(type) {
case *SessionToken_Body_Object:
{
const prefix string = ",\"object\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"object\":"
out.RawString(prefix)
xx.Object.MarshalEasyJSON(out)
}
case *SessionToken_Body_Container:
{
const prefix string = ",\"container\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"container\":"
out.RawString(prefix)
xx.Container.MarshalEasyJSON(out)
}
@ -1323,14 +1456,25 @@ func (x *SessionToken) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"body\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
const prefix string = ",\"signature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"signature\":"
out.RawString(prefix)
x.Signature.MarshalEasyJSON(out)
}
@ -1485,14 +1629,25 @@ func (x *XHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"key\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
out.String(x.Key)
}
{
const prefix string = ",\"value\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
out.String(x.Value)
}
@ -1783,24 +1938,47 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"version\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out)
}
{
const prefix string = ",\"epoch\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"epoch\":"
out.RawString(prefix)
out.Uint64(x.Epoch)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10)
out.RawByte('"')
}
{
const prefix string = ",\"ttl\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ttl\":"
out.RawString(prefix)
out.Uint32(x.Ttl)
}
{
const prefix string = ",\"xHeaders\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"xHeaders\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.XHeaders {
@ -1812,24 +1990,46 @@ func (x *RequestMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"sessionToken\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sessionToken\":"
out.RawString(prefix)
x.SessionToken.MarshalEasyJSON(out)
}
{
const prefix string = ",\"bearerToken\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"bearerToken\":"
out.RawString(prefix)
x.BearerToken.MarshalEasyJSON(out)
}
{
const prefix string = ",\"origin\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"origin\":"
out.RawString(prefix)
x.Origin.MarshalEasyJSON(out)
}
{
const prefix string = ",\"magicNumber\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"magicNumber\":"
out.RawString(prefix)
out.Uint64(x.MagicNumber)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.MagicNumber, 10)
out.RawByte('"')
}
out.RawByte('}')
}
@ -1869,13 +2069,29 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "epoch":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Epoch = f
}
case "ttl":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.Ttl = f
}
case "xHeaders":
@ -1916,7 +2132,15 @@ func (x *RequestMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "magicNumber":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.MagicNumber = f
}
}
@ -2123,24 +2347,47 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"version\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out)
}
{
const prefix string = ",\"epoch\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"epoch\":"
out.RawString(prefix)
out.Uint64(x.Epoch)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Epoch, 10)
out.RawByte('"')
}
{
const prefix string = ",\"ttl\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ttl\":"
out.RawString(prefix)
out.Uint32(x.Ttl)
}
{
const prefix string = ",\"xHeaders\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"xHeaders\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.XHeaders {
@ -2152,12 +2399,22 @@ func (x *ResponseMetaHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"origin\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"origin\":"
out.RawString(prefix)
x.Origin.MarshalEasyJSON(out)
}
{
const prefix string = ",\"status\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"status\":"
out.RawString(prefix)
x.Status.MarshalEasyJSON(out)
}
@ -2199,13 +2456,29 @@ func (x *ResponseMetaHeader) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "epoch":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Epoch = f
}
case "ttl":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.Ttl = f
}
case "xHeaders":
@ -2397,24 +2670,45 @@ func (x *RequestVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"bodySignature\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"bodySignature\":"
out.RawString(prefix)
x.BodySignature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaSignature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaSignature\":"
out.RawString(prefix)
x.MetaSignature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"originSignature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"originSignature\":"
out.RawString(prefix)
x.OriginSignature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"origin\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"origin\":"
out.RawString(prefix)
x.Origin.MarshalEasyJSON(out)
}
@ -2635,24 +2929,45 @@ func (x *ResponseVerificationHeader) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"bodySignature\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"bodySignature\":"
out.RawString(prefix)
x.BodySignature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"metaSignature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaSignature\":"
out.RawString(prefix)
x.MetaSignature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"originSignature\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"originSignature\":"
out.RawString(prefix)
x.OriginSignature.MarshalEasyJSON(out)
}
{
const prefix string = ",\"origin\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"origin\":"
out.RawString(prefix)
x.Origin.MarshalEasyJSON(out)
}

View file

@ -368,16 +368,31 @@ func (x *Status_Detail) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"id\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"id\":"
out.RawString(prefix)
out.Uint32(x.Id)
}
{
const prefix string = ",\"value\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
out.Base64Bytes(x.Value)
if x.Value != nil {
out.Base64Bytes(x.Value)
} else {
out.String("")
}
}
out.RawByte('}')
}
@ -410,7 +425,15 @@ func (x *Status_Detail) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "id":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.Id = f
}
case "value":
@ -554,19 +577,35 @@ func (x *Status) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"code\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"code\":"
out.RawString(prefix)
out.Uint32(x.Code)
}
{
const prefix string = ",\"message\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"message\":"
out.RawString(prefix)
out.String(x.Message)
}
{
const prefix string = ",\"details\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"details\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Details {
@ -608,7 +647,15 @@ func (x *Status) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "code":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.Code = f
}
case "message":

View file

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

View file

@ -26,11 +26,37 @@ func nonZero[T protoInt]() T {
func TestStableMarshalSingle(t *testing.T) {
t.Run("empty", func(t *testing.T) {
input := &generated.Primitives{}
require.Zero(t, input.StableSize())
t.Run("proto", func(t *testing.T) {
input := &generated.Primitives{}
require.Zero(t, input.StableSize())
r := input.MarshalProtobuf(nil)
require.Empty(t, r)
r := input.MarshalProtobuf(nil)
require.Empty(t, r)
})
t.Run("json", func(t *testing.T) {
input := &generated.Primitives{}
r, err := input.MarshalJSON()
require.NoError(t, err)
require.NotEmpty(t, r)
var actual test.Primitives
require.NoError(t, protojson.Unmarshal(r, &actual))
t.Run("protojson compatibility", func(t *testing.T) {
data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(&actual)
require.NoError(t, err)
require.JSONEq(t, string(data), string(r))
})
var actualFrostfs generated.Primitives
require.NoError(t, actualFrostfs.UnmarshalJSON(r))
if len(actualFrostfs.FieldA) == 0 {
actualFrostfs.FieldA = nil
}
require.Equal(t, input, &actualFrostfs)
primitivesEqual(t, input, &actual)
})
})
marshalCases := []struct {
@ -76,8 +102,17 @@ func TestStableMarshalSingle(t *testing.T) {
var actual test.Primitives
require.NoError(t, protojson.Unmarshal(r, &actual))
t.Run("protojson compatibility", func(t *testing.T) {
data, err := protojson.MarshalOptions{EmitUnpopulated: true}.Marshal(&actual)
require.NoError(t, err)
require.JSONEq(t, string(data), string(r))
})
var actualFrostfs generated.Primitives
require.NoError(t, actualFrostfs.UnmarshalJSON(r))
if len(actualFrostfs.FieldA) == 0 {
actualFrostfs.FieldA = nil
}
require.Equal(t, tc.input, &actualFrostfs)
primitivesEqual(t, tc.input, &actual)
@ -88,7 +123,10 @@ func TestStableMarshalSingle(t *testing.T) {
func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives) {
// Compare each field directly, because proto-generated code has private fields.
require.Equal(t, a.FieldA, b.FieldA)
require.Equal(t, len(a.FieldA), len(b.FieldA))
if len(a.FieldA) != 0 {
require.Equal(t, a.FieldA, b.FieldA)
}
require.Equal(t, a.FieldB, b.FieldB)
require.Equal(t, a.FieldC, b.FieldC)
require.Equal(t, a.FieldD, b.FieldD)

View file

@ -130,10 +130,16 @@ func (x *Primitives_Aux) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"innerField\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"innerField\":"
out.RawString(prefix)
out.Uint32(x.InnerField)
}
out.RawByte('}')
@ -167,7 +173,15 @@ func (x *Primitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "innerField":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.InnerField = f
}
}
@ -560,78 +574,168 @@ func (x *Primitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"fieldA\":"
out.RawString(prefix[1:])
out.Base64Bytes(x.FieldA)
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldA\":"
out.RawString(prefix)
if x.FieldA != nil {
out.Base64Bytes(x.FieldA)
} else {
out.String("")
}
}
{
const prefix string = ",\"fieldB\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldB\":"
out.RawString(prefix)
out.String(x.FieldB)
}
{
const prefix string = ",\"fieldC\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldC\":"
out.RawString(prefix)
out.Bool(x.FieldC)
}
{
const prefix string = ",\"fieldD\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldD\":"
out.RawString(prefix)
out.Int32(x.FieldD)
}
{
const prefix string = ",\"fieldE\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldE\":"
out.RawString(prefix)
out.Uint32(x.FieldE)
}
{
const prefix string = ",\"fieldF\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldF\":"
out.RawString(prefix)
out.Int64(x.FieldF)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldF, 10)
out.RawByte('"')
}
{
const prefix string = ",\"fieldG\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldG\":"
out.RawString(prefix)
out.Uint64(x.FieldG)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldG, 10)
out.RawByte('"')
}
{
const prefix string = ",\"fieldI\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldI\":"
out.RawString(prefix)
out.Uint64(x.FieldI)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldI, 10)
out.RawByte('"')
}
{
const prefix string = ",\"fieldJ\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldJ\":"
out.RawString(prefix)
out.Float64(x.FieldJ)
}
{
const prefix string = ",\"fieldK\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldK\":"
out.RawString(prefix)
out.Uint32(x.FieldK)
}
{
const prefix string = ",\"fieldH\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldH\":"
out.RawString(prefix)
out.Int32(int32(x.FieldH))
v := int32(x.FieldH)
if vv, ok := Primitives_SomeEnum_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
switch xx := x.FieldM.(type) {
case *Primitives_FieldMa:
{
const prefix string = ",\"fieldMa\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldMa\":"
out.RawString(prefix)
out.Base64Bytes(xx.FieldMa)
if xx.FieldMa != nil {
out.Base64Bytes(xx.FieldMa)
} else {
out.String("")
}
}
case *Primitives_FieldMe:
{
const prefix string = ",\"fieldMe\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldMe\":"
out.RawString(prefix)
out.Uint32(xx.FieldMe)
}
case *Primitives_FieldAux:
{
const prefix string = ",\"fieldAux\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldAux\":"
out.RawString(prefix)
xx.FieldAux.MarshalEasyJSON(out)
}
@ -685,31 +789,71 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "fieldD":
{
var f int32
f = in.Int32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseInt(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := int32(v)
f = pv
x.FieldD = f
}
case "fieldE":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.FieldE = f
}
case "fieldF":
{
var f int64
f = in.Int64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseInt(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := int64(v)
f = pv
x.FieldF = f
}
case "fieldG":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.FieldG = f
}
case "fieldI":
{
var f uint64
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.FieldI = f
}
case "fieldJ":
@ -721,7 +865,15 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "fieldK":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.FieldK = f
}
case "fieldH":
@ -759,7 +911,15 @@ func (x *Primitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
x.FieldM = xx
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
xx.FieldMe = f
}
case "fieldAux":
@ -882,10 +1042,16 @@ func (x *RepPrimitives_Aux) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"innerField\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"innerField\":"
out.RawString(prefix)
out.Uint32(x.InnerField)
}
out.RawByte('}')
@ -919,7 +1085,15 @@ func (x *RepPrimitives_Aux) UnmarshalEasyJSON(in *jlexer.Lexer) {
case "innerField":
{
var f uint32
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.InnerField = f
}
}
@ -1164,21 +1338,36 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
const prefix string = ",\"fieldA\":"
out.RawString(prefix[1:])
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldA\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldA {
if i != 0 {
out.RawByte(',')
}
out.Base64Bytes(x.FieldA[i])
if x.FieldA[i] != nil {
out.Base64Bytes(x.FieldA[i])
} else {
out.String("")
}
}
out.RawByte(']')
}
{
const prefix string = ",\"fieldB\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldB\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldB {
@ -1190,7 +1379,12 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"fieldC\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldC\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldC {
@ -1202,7 +1396,12 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"fieldD\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldD\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldD {
@ -1214,43 +1413,69 @@ func (x *RepPrimitives) MarshalEasyJSON(out *jwriter.Writer) {
out.RawByte(']')
}
{
const prefix string = ",\"fieldE\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldE\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldE {
if i != 0 {
out.RawByte(',')
}
out.Int64(x.FieldE[i])
out.RawByte('"')
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.FieldE[i], 10)
out.RawByte('"')
}
out.RawByte(']')
}
{
const prefix string = ",\"fieldF\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldF\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldF {
if i != 0 {
out.RawByte(',')
}
out.Uint64(x.FieldF[i])
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldF[i], 10)
out.RawByte('"')
}
out.RawByte(']')
}
{
const prefix string = ",\"fieldFu\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldFu\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldFu {
if i != 0 {
out.RawByte(',')
}
out.Uint64(x.FieldFu[i])
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.FieldFu[i], 10)
out.RawByte('"')
}
out.RawByte(']')
}
{
const prefix string = ",\"fieldAux\":"
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"fieldAux\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.FieldAux {
@ -1321,7 +1546,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []int32
in.Delim('[')
for !in.IsDelim(']') {
f = in.Int32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseInt(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := int32(v)
f = pv
list = append(list, f)
in.WantComma()
}
@ -1334,7 +1567,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []uint32
in.Delim('[')
for !in.IsDelim(']') {
f = in.Uint32()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
list = append(list, f)
in.WantComma()
}
@ -1347,7 +1588,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []int64
in.Delim('[')
for !in.IsDelim(']') {
f = in.Int64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseInt(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := int64(v)
f = pv
list = append(list, f)
in.WantComma()
}
@ -1360,7 +1609,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []uint64
in.Delim('[')
for !in.IsDelim(']') {
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
list = append(list, f)
in.WantComma()
}
@ -1373,7 +1630,15 @@ func (x *RepPrimitives) UnmarshalEasyJSON(in *jlexer.Lexer) {
var list []uint64
in.Delim('[')
for !in.IsDelim(']') {
f = in.Uint64()
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
list = append(list, f)
in.WantComma()
}

View file

@ -59,6 +59,17 @@ func emitJSONUnmarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
g.P("}")
}
func emitJSONParseInteger(g *protogen.GeneratedFile, ident string, method string, bitSize int, typ string) {
g.P("r := in.JsonNumber()")
g.P("n := r.String()")
g.P("v, err := ", strconvPackage.Ident(method), "(n, 10, ", bitSize, ")")
g.P("if err != nil {")
g.P(" in.AddError(err)")
g.P(" return")
g.P("}")
g.P(ident, " := ", typ, "(v)")
}
func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string) {
g.P("{")
defer g.P("}")
@ -100,13 +111,17 @@ func emitJSONFieldRead(g *protogen.GeneratedFile, f *protogen.Field, name string
}`)
template = "%s = parsedValue"
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
template = "%s = in.Int32()"
emitJSONParseInteger(g, "pv", "ParseInt", 32, "int32")
template = "%s = pv"
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
template = "%s = in.Uint32()"
emitJSONParseInteger(g, "pv", "ParseUint", 32, "uint32")
template = "%s = pv"
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
template = "%s = in.Int64()"
emitJSONParseInteger(g, "pv", "ParseInt", 64, "int64")
template = "%s = pv"
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
template = "%s = in.Uint64()"
emitJSONParseInteger(g, "pv", "ParseUint", 64, "uint64")
template = "%s = pv"
case protoreflect.FloatKind:
template = "%s = in.Float32()"
case protoreflect.DoubleKind:
@ -147,8 +162,11 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
g.P("func (x *", msg.GoIdent.GoName, ") MarshalEasyJSON(out *", jwriterPackage.Ident("Writer"), ") {")
g.P(`if x == nil { out.RawString("null"); return }`)
if len(msg.Fields) != 0 {
g.P("first := true")
}
g.P("out.RawByte('{')")
for i, f := range msg.Fields {
for _, f := range msg.Fields {
if f.Oneof != nil {
if f.Oneof.Fields[0] != f {
continue
@ -157,29 +175,38 @@ func emitJSONMarshal(g *protogen.GeneratedFile, msg *protogen.Message) {
g.P("switch xx := x.", f.Oneof.GoName, ".(type) {")
for _, ff := range f.Oneof.Fields {
g.P("case *", ff.GoIdent, ":")
emitJSONFieldWrite(g, ff, "xx", i == 0)
emitJSONFieldWrite(g, ff, "xx")
}
g.P("}")
continue
}
emitJSONFieldWrite(g, f, "x", i == 0)
emitJSONFieldWrite(g, f, "x")
}
g.P("out.RawByte('}')")
g.P("}")
}
func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string, first bool) {
func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name string) {
g.P("{")
defer g.P("}")
g.P("const prefix string = ", `",\"`, fieldJSONName(f), `\":"`)
if first {
g.P("out.RawString(prefix[1:])")
} else {
g.P("out.RawString(prefix)")
}
selector := name + "." + f.GoName
// This code is responsible for ignoring default values.
// We will restore it after having parametrized JSON marshaling.
//
// isNotDefault := notNil
// if f.Desc.IsList() {
// isNotDefault = notEmpty
// } else if f.Desc.Kind() != protoreflect.MessageKind {
// _, isNotDefault = easyprotoKindInfo(f.Desc.Kind())
// }
// g.P("if ", isNotDefault(selector), "{")
// defer g.P("}")
g.P("if !first { out.RawByte(','); } else { first = false; }")
g.P("const prefix string = ", `"\"`, fieldJSONName(f), `\":"`)
g.P("out.RawString(prefix)")
if f.Desc.IsList() {
selector += "[i]"
g.P("out.RawByte('[')")
@ -195,15 +222,27 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin
case protoreflect.BoolKind:
template = "out.Bool(%s)"
case protoreflect.EnumKind:
template = "out.Int32(int32(%s))"
enumType := fieldType(g, f).String()
template = `v := int32(%s)
if vv, ok := ` + enumType + `_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}`
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
template = "out.Int32(%s)"
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
template = "out.Uint32(%s)"
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
template = "out.Int64(%s)"
g.P("out.RawByte('\"')")
g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendInt"), "(out.Buffer.Buf, ", selector, ", 10)")
g.P("out.RawByte('\"')")
return
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
template = "out.Uint64(%s)"
g.P("out.RawByte('\"')")
g.P("out.Buffer.Buf = ", strconvPackage.Ident("AppendUint"), "(out.Buffer.Buf, ", selector, ", 10)")
g.P("out.RawByte('\"')")
return
case protoreflect.FloatKind:
template = "out.Float32(%s)"
case protoreflect.DoubleKind:
@ -211,7 +250,10 @@ func emitJSONFieldWrite(g *protogen.GeneratedFile, f *protogen.Field, name strin
case protoreflect.StringKind:
template = "out.String(%s)"
case protoreflect.BytesKind:
template = "out.Base64Bytes(%s)"
g.P("if ", selector, "!= nil {")
g.P("out.Base64Bytes(", selector, ")")
g.P("} else { out.String(\"\") }")
return
case protoreflect.MessageKind:
template = "%s.MarshalEasyJSON(out)"
case protoreflect.GroupKind: