Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
[#235] v2/audit: Regenerate protobuf
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Vanin <[email protected]>
  • Loading branch information
alexvanin authored and Leonard Lyubich committed Dec 25, 2020
1 parent 1c25c39 commit aafeb70
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 28 deletions.
28 changes: 28 additions & 0 deletions pkg/audit/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
10 changes: 10 additions & 0 deletions pkg/audit/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions v2/audit/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
14 changes: 14 additions & 0 deletions v2/audit/grpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
78 changes: 50 additions & 28 deletions v2/audit/grpc/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions v2/audit/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const (
cidFNum
pubKeyFNum
completeFNum
requestsFNum
retriesFNum
passSGFNum
failSGFNum
hitFNum
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions v2/audit/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
38 changes: 38 additions & 0 deletions v2/audit/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type DataAuditResult struct {

auditEpoch uint64

requests, retries uint32

hit, miss, fail uint32

cid *refs.ContainerID
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit aafeb70

Please sign in to comment.