[#235] v2/audit: Regenerate protobuf

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-23 18:45:00 +03:00 committed by Leonard Lyubich
parent 1c25c3904b
commit aafeb70bdb
8 changed files with 116 additions and 0 deletions

View file

@ -124,6 +124,34 @@ func (r *Result) SetComplete(v bool) {
SetComplete(v)
}
// Requests returns number of requests made by PoR audit check to get
// all headers of the objects inside storage groups.
func (r *Result) Requests() uint32 {
return (*audit.DataAuditResult)(r).
GetRequests()
}
// SetRequests sets number of requests made by PoR audit check to get
// all headers of the objects inside storage groups.
func (r *Result) SetRequests(v uint32) {
(*audit.DataAuditResult)(r).
SetRequests(v)
}
// Retries returns number of retries made by PoR audit check to get
// all headers of the objects inside storage groups.
func (r *Result) Retries() uint32 {
return (*audit.DataAuditResult)(r).
GetRetries()
}
// SetRetries sets number of retries made by PoR audit check to get
// all headers of the objects inside storage groups.
func (r *Result) SetRetries(v uint32) {
(*audit.DataAuditResult)(r).
SetRetries(v)
}
// PassSG returns list of Storage Groups that passed audit PoR stage.
func (r *Result) PassSG() []*object.ID {
mV2 := (*audit.DataAuditResult)(r).

View file

@ -50,6 +50,14 @@ func TestResult(t *testing.T) {
r.SetComplete(true)
require.True(t, r.Complete())
requests := uint32(2)
r.SetRequests(requests)
require.Equal(t, requests, r.Requests())
retries := uint32(1)
r.SetRetries(retries)
require.Equal(t, retries, r.Retries())
passSG := []*object.ID{testOID(), testOID()}
r.SetPassSG(passSG)
require.Equal(t, passSG, r.PassSG())
@ -86,6 +94,8 @@ func TestStorageGroupEncoding(t *testing.T) {
r.SetPublicKey([]byte{1, 2, 3})
r.SetPassSG([]*object.ID{testOID(), testOID()})
r.SetFailSG([]*object.ID{testOID(), testOID()})
r.SetRequests(3)
r.SetRetries(2)
r.SetHit(1)
r.SetMiss(2)
r.SetFail(3)

View file

@ -36,6 +36,9 @@ func DataAuditResultToGRPCMessage(a *DataAuditResult) *audit.DataAuditResult {
refs.ObjectIDListToGRPCMessage(a.GetFailSG()),
)
m.SetRequests(a.GetRequests())
m.SetRetries(a.GetRetries())
m.SetHit(a.GetHit())
m.SetMiss(a.GetMiss())
m.SetFail(a.GetFail())
@ -77,6 +80,9 @@ func DataAuditResultFromGRPCMessage(m *audit.DataAuditResult) *DataAuditResult {
refs.ObjectIDListFromGRPCMessage(m.GetFailSg()),
)
a.SetRequests(m.GetRequests())
a.SetRetries(m.GetRetries())
a.SetHit(m.GetHit())
a.SetMiss(m.GetMiss())
a.SetFail(m.GetFail())

View file

@ -39,6 +39,20 @@ func (x *DataAuditResult) SetComplete(v bool) {
}
}
// SetRequests is a Requests field setter.
func (x *DataAuditResult) SetRequests(v uint32) {
if x != nil {
x.Requests = v
}
}
// SetRetries is a Retries field setter.
func (x *DataAuditResult) SetRetries(v uint32) {
if x != nil {
x.Retries = v
}
}
// SetPassSg is a PassSg field setter.
func (x *DataAuditResult) SetPassSg(v []*refs.ObjectID) {
if x != nil {

Binary file not shown.

View file

@ -14,6 +14,8 @@ const (
cidFNum
pubKeyFNum
completeFNum
requestsFNum
retriesFNum
passSGFNum
failSGFNum
hitFNum
@ -74,6 +76,20 @@ func (a *DataAuditResult) StableMarshal(buf []byte) ([]byte, error) {
offset += n
n, err = proto.UInt32Marshal(requestsFNum, buf[offset:], a.requests)
if err != nil {
return nil, err
}
offset += n
n, err = proto.UInt32Marshal(retriesFNum, buf[offset:], a.retries)
if err != nil {
return nil, err
}
offset += n
n, err = refs.ObjectIDNestedListMarshal(passSGFNum, buf[offset:], a.passSG)
if err != nil {
return nil, err
@ -136,6 +152,8 @@ func (a *DataAuditResult) StableSize() (size int) {
size += proto.NestedStructureSize(cidFNum, a.cid)
size += proto.BytesSize(pubKeyFNum, a.pubKey)
size += proto.BoolSize(completeFNum, a.complete)
size += proto.UInt32Size(requestsFNum, a.requests)
size += proto.UInt32Size(retriesFNum, a.retries)
size += refs.ObjectIDNestedListSize(passSGFNum, a.passSG)
size += refs.ObjectIDNestedListSize(failSGFNum, a.failSG)
size += proto.UInt32Size(hitFNum, a.hit)

View file

@ -43,6 +43,8 @@ func generateDataAuditResult() *audit.DataAuditResult {
a.SetContainerID(cid)
a.SetPublicKey([]byte("Public key"))
a.SetComplete(true)
a.SetRequests(10)
a.SetRetries(9)
a.SetPassSG([]*refs.ObjectID{oid1, oid2})
a.SetFailSG([]*refs.ObjectID{oid2, oid1})
a.SetHit(1)

View file

@ -11,6 +11,8 @@ type DataAuditResult struct {
auditEpoch uint64
requests, retries uint32
hit, miss, fail uint32
cid *refs.ContainerID
@ -120,6 +122,42 @@ func (a *DataAuditResult) SetFailSG(v []*refs.ObjectID) {
}
}
// GetRequests returns number of requests made by PoR audit check to get
// all headers of the objects inside storage groups.
func (a *DataAuditResult) GetRequests() uint32 {
if a != nil {
return a.requests
}
return 0
}
// SetRequests sets number of requests made by PoR audit check to get
// all headers of the objects inside storage groups.
func (a *DataAuditResult) SetRequests(v uint32) {
if a != nil {
a.requests = v
}
}
// GetRetries returns number of retries made by PoR audit check to get
// all headers of the objects inside storage groups.
func (a *DataAuditResult) GetRetries() uint32 {
if a != nil {
return a.retries
}
return 0
}
// SetRetries sets number of retries made by PoR audit check to get
// all headers of the objects inside storage groups.
func (a *DataAuditResult) SetRetries(v uint32) {
if a != nil {
a.retries = v
}
}
// GetHit returns number of sampled objects under audit placed
// in an optimal way according to the containers placement policy
// when checking PoP.