2020-12-21 07:52:34 +00:00
|
|
|
package audit
|
|
|
|
|
|
|
|
import (
|
2023-03-07 10:38:56 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
2020-12-21 07:52:34 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// DataAuditResult is a unified structure of
|
|
|
|
// DataAuditResult message from proto definition.
|
|
|
|
type DataAuditResult struct {
|
2020-12-21 14:35:03 +00:00
|
|
|
version *refs.Version
|
|
|
|
|
2020-12-21 07:52:34 +00:00
|
|
|
auditEpoch uint64
|
|
|
|
|
2020-12-23 15:45:00 +00:00
|
|
|
requests, retries uint32
|
|
|
|
|
2020-12-21 07:52:34 +00:00
|
|
|
hit, miss, fail uint32
|
|
|
|
|
|
|
|
cid *refs.ContainerID
|
|
|
|
|
|
|
|
pubKey []byte
|
|
|
|
|
2022-03-01 12:50:09 +00:00
|
|
|
passSG, failSG []refs.ObjectID
|
2020-12-21 07:52:34 +00:00
|
|
|
|
|
|
|
failNodes, passNodes [][]byte
|
2020-12-21 14:35:03 +00:00
|
|
|
|
|
|
|
complete bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetVersion returns version of Data Audit structure.
|
|
|
|
func (a *DataAuditResult) GetVersion() *refs.Version {
|
|
|
|
if a != nil {
|
|
|
|
return a.version
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetVersion sets version of Data Audit structure.
|
|
|
|
func (a *DataAuditResult) SetVersion(v *refs.Version) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.version = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetAuditEpoch returns epoch number when the Data Audit was conducted.
|
|
|
|
func (a *DataAuditResult) GetAuditEpoch() uint64 {
|
|
|
|
if a != nil {
|
|
|
|
return a.auditEpoch
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAuditEpoch sets epoch number when the Data Audit was conducted.
|
|
|
|
func (a *DataAuditResult) SetAuditEpoch(v uint64) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.auditEpoch = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetContainerID returns container under audit.
|
|
|
|
func (a *DataAuditResult) GetContainerID() *refs.ContainerID {
|
|
|
|
if a != nil {
|
|
|
|
return a.cid
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetContainerID sets container under audit.
|
|
|
|
func (a *DataAuditResult) SetContainerID(v *refs.ContainerID) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.cid = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetPublicKey returns public key of the auditing InnerRing node in a binary format.
|
|
|
|
func (a *DataAuditResult) GetPublicKey() []byte {
|
|
|
|
if a != nil {
|
|
|
|
return a.pubKey
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPublicKey sets public key of the auditing InnerRing node in a binary format.
|
|
|
|
func (a *DataAuditResult) SetPublicKey(v []byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.pubKey = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetPassSG returns list of Storage Groups that passed audit PoR stage.
|
2022-03-01 12:50:09 +00:00
|
|
|
func (a *DataAuditResult) GetPassSG() []refs.ObjectID {
|
2020-12-21 07:52:34 +00:00
|
|
|
if a != nil {
|
|
|
|
return a.passSG
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPassSG sets list of Storage Groups that passed audit PoR stage.
|
2022-03-01 12:50:09 +00:00
|
|
|
func (a *DataAuditResult) SetPassSG(v []refs.ObjectID) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.passSG = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetFailSG returns list of Storage Groups that failed audit PoR stage.
|
2022-03-01 12:50:09 +00:00
|
|
|
func (a *DataAuditResult) GetFailSG() []refs.ObjectID {
|
2020-12-21 07:52:34 +00:00
|
|
|
if a != nil {
|
|
|
|
return a.failSG
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetFailSG sets list of Storage Groups that failed audit PoR stage.
|
2022-03-01 12:50:09 +00:00
|
|
|
func (a *DataAuditResult) SetFailSG(v []refs.ObjectID) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.failSG = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
2020-12-23 15:45:00 +00:00
|
|
|
// 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) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.requests = v
|
2020-12-23 15:45:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.retries = v
|
2020-12-23 15:45:00 +00:00
|
|
|
}
|
|
|
|
|
2020-12-21 07:52:34 +00:00
|
|
|
// GetHit returns number of sampled objects under audit placed
|
|
|
|
// in an optimal way according to the containers placement policy
|
|
|
|
// when checking PoP.
|
|
|
|
func (a *DataAuditResult) GetHit() uint32 {
|
|
|
|
if a != nil {
|
|
|
|
return a.hit
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetHit sets number of sampled objects under audit placed
|
|
|
|
// in an optimal way according to the containers placement policy
|
|
|
|
// when checking PoP.
|
|
|
|
func (a *DataAuditResult) SetHit(v uint32) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.hit = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetMiss returns number of sampled objects under audit placed
|
|
|
|
// in suboptimal way according to the containers placement policy,
|
|
|
|
// but still at a satisfactory level when checking PoP.
|
|
|
|
func (a *DataAuditResult) GetMiss() uint32 {
|
|
|
|
if a != nil {
|
|
|
|
return a.miss
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMiss sets number of sampled objects under audit placed
|
|
|
|
// in suboptimal way according to the containers placement policy,
|
|
|
|
// but still at a satisfactory level when checking PoP.
|
|
|
|
func (a *DataAuditResult) SetMiss(v uint32) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.miss = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetFail returns number of sampled objects under audit stored
|
|
|
|
// in a way not confirming placement policy or not found at all
|
|
|
|
// when checking PoP.
|
|
|
|
func (a *DataAuditResult) GetFail() uint32 {
|
|
|
|
if a != nil {
|
|
|
|
return a.fail
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetFail sets number of sampled objects under audit stored
|
|
|
|
// in a way not confirming placement policy or not found at all
|
|
|
|
// when checking PoP.
|
|
|
|
func (a *DataAuditResult) SetFail(v uint32) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.fail = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetPassNodes returns list of storage node public keys that
|
|
|
|
// passed at least one PDP.
|
|
|
|
func (a *DataAuditResult) GetPassNodes() [][]byte {
|
|
|
|
if a != nil {
|
|
|
|
return a.passNodes
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPassNodes sets list of storage node public keys that
|
|
|
|
// passed at least one PDP.
|
|
|
|
func (a *DataAuditResult) SetPassNodes(v [][]byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.passNodes = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetFailNodes returns list of storage node public keys that
|
|
|
|
// failed at least one PDP.
|
|
|
|
func (a *DataAuditResult) GetFailNodes() [][]byte {
|
|
|
|
if a != nil {
|
|
|
|
return a.failNodes
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetFailNodes sets list of storage node public keys that
|
|
|
|
// failed at least one PDP.
|
|
|
|
func (a *DataAuditResult) SetFailNodes(v [][]byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.failNodes = v
|
2020-12-21 07:52:34 +00:00
|
|
|
}
|
2020-12-21 14:35:03 +00:00
|
|
|
|
|
|
|
// GetComplete returns boolean completion statement of audit result.
|
|
|
|
func (a *DataAuditResult) GetComplete() bool {
|
|
|
|
if a != nil {
|
|
|
|
return a.complete
|
|
|
|
}
|
|
|
|
|
|
|
|
return false // bool default
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetComplete sets boolean completion statement of audit result.
|
|
|
|
func (a *DataAuditResult) SetComplete(v bool) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.complete = v
|
2020-12-21 14:35:03 +00:00
|
|
|
}
|