github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/audit/types.go (about) 1 package audit 2 3 import ( 4 "github.com/TrueCloudLab/frostfs-api-go/v2/refs" 5 ) 6 7 // DataAuditResult is a unified structure of 8 // DataAuditResult message from proto definition. 9 type DataAuditResult struct { 10 version *refs.Version 11 12 auditEpoch uint64 13 14 requests, retries uint32 15 16 hit, miss, fail uint32 17 18 cid *refs.ContainerID 19 20 pubKey []byte 21 22 passSG, failSG []refs.ObjectID 23 24 failNodes, passNodes [][]byte 25 26 complete bool 27 } 28 29 // GetVersion returns version of Data Audit structure. 30 func (a *DataAuditResult) GetVersion() *refs.Version { 31 if a != nil { 32 return a.version 33 } 34 35 return nil 36 } 37 38 // SetVersion sets version of Data Audit structure. 39 func (a *DataAuditResult) SetVersion(v *refs.Version) { 40 a.version = v 41 } 42 43 // GetAuditEpoch returns epoch number when the Data Audit was conducted. 44 func (a *DataAuditResult) GetAuditEpoch() uint64 { 45 if a != nil { 46 return a.auditEpoch 47 } 48 49 return 0 50 } 51 52 // SetAuditEpoch sets epoch number when the Data Audit was conducted. 53 func (a *DataAuditResult) SetAuditEpoch(v uint64) { 54 a.auditEpoch = v 55 } 56 57 // GetContainerID returns container under audit. 58 func (a *DataAuditResult) GetContainerID() *refs.ContainerID { 59 if a != nil { 60 return a.cid 61 } 62 63 return nil 64 } 65 66 // SetContainerID sets container under audit. 67 func (a *DataAuditResult) SetContainerID(v *refs.ContainerID) { 68 a.cid = v 69 } 70 71 // GetPublicKey returns public key of the auditing InnerRing node in a binary format. 72 func (a *DataAuditResult) GetPublicKey() []byte { 73 if a != nil { 74 return a.pubKey 75 } 76 77 return nil 78 } 79 80 // SetPublicKey sets public key of the auditing InnerRing node in a binary format. 81 func (a *DataAuditResult) SetPublicKey(v []byte) { 82 a.pubKey = v 83 } 84 85 // GetPassSG returns list of Storage Groups that passed audit PoR stage. 86 func (a *DataAuditResult) GetPassSG() []refs.ObjectID { 87 if a != nil { 88 return a.passSG 89 } 90 91 return nil 92 } 93 94 // SetPassSG sets list of Storage Groups that passed audit PoR stage. 95 func (a *DataAuditResult) SetPassSG(v []refs.ObjectID) { 96 a.passSG = v 97 } 98 99 // GetFailSG returns list of Storage Groups that failed audit PoR stage. 100 func (a *DataAuditResult) GetFailSG() []refs.ObjectID { 101 if a != nil { 102 return a.failSG 103 } 104 105 return nil 106 } 107 108 // SetFailSG sets list of Storage Groups that failed audit PoR stage. 109 func (a *DataAuditResult) SetFailSG(v []refs.ObjectID) { 110 a.failSG = v 111 } 112 113 // GetRequests returns number of requests made by PoR audit check to get 114 // all headers of the objects inside storage groups. 115 func (a *DataAuditResult) GetRequests() uint32 { 116 if a != nil { 117 return a.requests 118 } 119 120 return 0 121 } 122 123 // SetRequests sets number of requests made by PoR audit check to get 124 // all headers of the objects inside storage groups. 125 func (a *DataAuditResult) SetRequests(v uint32) { 126 a.requests = v 127 } 128 129 // GetRetries returns number of retries made by PoR audit check to get 130 // all headers of the objects inside storage groups. 131 func (a *DataAuditResult) GetRetries() uint32 { 132 if a != nil { 133 return a.retries 134 } 135 136 return 0 137 } 138 139 // SetRetries sets number of retries made by PoR audit check to get 140 // all headers of the objects inside storage groups. 141 func (a *DataAuditResult) SetRetries(v uint32) { 142 a.retries = v 143 } 144 145 // GetHit returns number of sampled objects under audit placed 146 // in an optimal way according to the containers placement policy 147 // when checking PoP. 148 func (a *DataAuditResult) GetHit() uint32 { 149 if a != nil { 150 return a.hit 151 } 152 153 return 0 154 } 155 156 // SetHit sets number of sampled objects under audit placed 157 // in an optimal way according to the containers placement policy 158 // when checking PoP. 159 func (a *DataAuditResult) SetHit(v uint32) { 160 a.hit = v 161 } 162 163 // GetMiss returns number of sampled objects under audit placed 164 // in suboptimal way according to the containers placement policy, 165 // but still at a satisfactory level when checking PoP. 166 func (a *DataAuditResult) GetMiss() uint32 { 167 if a != nil { 168 return a.miss 169 } 170 171 return 0 172 } 173 174 // SetMiss sets number of sampled objects under audit placed 175 // in suboptimal way according to the containers placement policy, 176 // but still at a satisfactory level when checking PoP. 177 func (a *DataAuditResult) SetMiss(v uint32) { 178 a.miss = v 179 } 180 181 // GetFail returns number of sampled objects under audit stored 182 // in a way not confirming placement policy or not found at all 183 // when checking PoP. 184 func (a *DataAuditResult) GetFail() uint32 { 185 if a != nil { 186 return a.fail 187 } 188 189 return 0 190 } 191 192 // SetFail sets number of sampled objects under audit stored 193 // in a way not confirming placement policy or not found at all 194 // when checking PoP. 195 func (a *DataAuditResult) SetFail(v uint32) { 196 a.fail = v 197 } 198 199 // GetPassNodes returns list of storage node public keys that 200 // passed at least one PDP. 201 func (a *DataAuditResult) GetPassNodes() [][]byte { 202 if a != nil { 203 return a.passNodes 204 } 205 206 return nil 207 } 208 209 // SetPassNodes sets list of storage node public keys that 210 // passed at least one PDP. 211 func (a *DataAuditResult) SetPassNodes(v [][]byte) { 212 a.passNodes = v 213 } 214 215 // GetFailNodes returns list of storage node public keys that 216 // failed at least one PDP. 217 func (a *DataAuditResult) GetFailNodes() [][]byte { 218 if a != nil { 219 return a.failNodes 220 } 221 222 return nil 223 } 224 225 // SetFailNodes sets list of storage node public keys that 226 // failed at least one PDP. 227 func (a *DataAuditResult) SetFailNodes(v [][]byte) { 228 a.failNodes = v 229 } 230 231 // GetComplete returns boolean completion statement of audit result. 232 func (a *DataAuditResult) GetComplete() bool { 233 if a != nil { 234 return a.complete 235 } 236 237 return false // bool default 238 } 239 240 // SetComplete sets boolean completion statement of audit result. 241 func (a *DataAuditResult) SetComplete(v bool) { 242 a.complete = v 243 }