forked from TrueCloudLab/frostfs-api-go
[#388] *: Remove nil check from setters
I knew one day `sed` would save me an hour of manual work: ``` sed -i -n -e ' s/) Set/) Set/ p t setter b end :setter n s/nil/nil/ t hasif p b end :hasif n :loop p n s/}/}/ t end b loop :end ' $@ goimports -w $@ ``` Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
50162741ac
commit
732dd51b1b
32 changed files with 714 additions and 2104 deletions
|
@ -37,9 +37,7 @@ func (a *DataAuditResult) GetVersion() *refs.Version {
|
|||
|
||||
// SetVersion sets version of Data Audit structure.
|
||||
func (a *DataAuditResult) SetVersion(v *refs.Version) {
|
||||
if a != nil {
|
||||
a.version = v
|
||||
}
|
||||
a.version = v
|
||||
}
|
||||
|
||||
// GetAuditEpoch returns epoch number when the Data Audit was conducted.
|
||||
|
@ -53,9 +51,7 @@ func (a *DataAuditResult) GetAuditEpoch() uint64 {
|
|||
|
||||
// SetAuditEpoch sets epoch number when the Data Audit was conducted.
|
||||
func (a *DataAuditResult) SetAuditEpoch(v uint64) {
|
||||
if a != nil {
|
||||
a.auditEpoch = v
|
||||
}
|
||||
a.auditEpoch = v
|
||||
}
|
||||
|
||||
// GetContainerID returns container under audit.
|
||||
|
@ -69,9 +65,7 @@ func (a *DataAuditResult) GetContainerID() *refs.ContainerID {
|
|||
|
||||
// SetContainerID sets container under audit.
|
||||
func (a *DataAuditResult) SetContainerID(v *refs.ContainerID) {
|
||||
if a != nil {
|
||||
a.cid = v
|
||||
}
|
||||
a.cid = v
|
||||
}
|
||||
|
||||
// GetPublicKey returns public key of the auditing InnerRing node in a binary format.
|
||||
|
@ -85,9 +79,7 @@ func (a *DataAuditResult) GetPublicKey() []byte {
|
|||
|
||||
// SetPublicKey sets public key of the auditing InnerRing node in a binary format.
|
||||
func (a *DataAuditResult) SetPublicKey(v []byte) {
|
||||
if a != nil {
|
||||
a.pubKey = v
|
||||
}
|
||||
a.pubKey = v
|
||||
}
|
||||
|
||||
// GetPassSG returns list of Storage Groups that passed audit PoR stage.
|
||||
|
@ -101,9 +93,7 @@ func (a *DataAuditResult) GetPassSG() []refs.ObjectID {
|
|||
|
||||
// SetPassSG sets list of Storage Groups that passed audit PoR stage.
|
||||
func (a *DataAuditResult) SetPassSG(v []refs.ObjectID) {
|
||||
if a != nil {
|
||||
a.passSG = v
|
||||
}
|
||||
a.passSG = v
|
||||
}
|
||||
|
||||
// GetFailSG returns list of Storage Groups that failed audit PoR stage.
|
||||
|
@ -117,9 +107,7 @@ func (a *DataAuditResult) GetFailSG() []refs.ObjectID {
|
|||
|
||||
// SetFailSG sets list of Storage Groups that failed audit PoR stage.
|
||||
func (a *DataAuditResult) SetFailSG(v []refs.ObjectID) {
|
||||
if a != nil {
|
||||
a.failSG = v
|
||||
}
|
||||
a.failSG = v
|
||||
}
|
||||
|
||||
// GetRequests returns number of requests made by PoR audit check to get
|
||||
|
@ -135,9 +123,7 @@ func (a *DataAuditResult) GetRequests() uint32 {
|
|||
// 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
|
||||
}
|
||||
a.requests = v
|
||||
}
|
||||
|
||||
// GetRetries returns number of retries made by PoR audit check to get
|
||||
|
@ -153,9 +139,7 @@ func (a *DataAuditResult) GetRetries() uint32 {
|
|||
// 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
|
||||
}
|
||||
a.retries = v
|
||||
}
|
||||
|
||||
// GetHit returns number of sampled objects under audit placed
|
||||
|
@ -173,9 +157,7 @@ func (a *DataAuditResult) GetHit() uint32 {
|
|||
// in an optimal way according to the containers placement policy
|
||||
// when checking PoP.
|
||||
func (a *DataAuditResult) SetHit(v uint32) {
|
||||
if a != nil {
|
||||
a.hit = v
|
||||
}
|
||||
a.hit = v
|
||||
}
|
||||
|
||||
// GetMiss returns number of sampled objects under audit placed
|
||||
|
@ -193,9 +175,7 @@ func (a *DataAuditResult) GetMiss() uint32 {
|
|||
// in suboptimal way according to the containers placement policy,
|
||||
// but still at a satisfactory level when checking PoP.
|
||||
func (a *DataAuditResult) SetMiss(v uint32) {
|
||||
if a != nil {
|
||||
a.miss = v
|
||||
}
|
||||
a.miss = v
|
||||
}
|
||||
|
||||
// GetFail returns number of sampled objects under audit stored
|
||||
|
@ -213,9 +193,7 @@ func (a *DataAuditResult) GetFail() uint32 {
|
|||
// in a way not confirming placement policy or not found at all
|
||||
// when checking PoP.
|
||||
func (a *DataAuditResult) SetFail(v uint32) {
|
||||
if a != nil {
|
||||
a.fail = v
|
||||
}
|
||||
a.fail = v
|
||||
}
|
||||
|
||||
// GetPassNodes returns list of storage node public keys that
|
||||
|
@ -231,9 +209,7 @@ func (a *DataAuditResult) GetPassNodes() [][]byte {
|
|||
// SetPassNodes sets list of storage node public keys that
|
||||
// passed at least one PDP.
|
||||
func (a *DataAuditResult) SetPassNodes(v [][]byte) {
|
||||
if a != nil {
|
||||
a.passNodes = v
|
||||
}
|
||||
a.passNodes = v
|
||||
}
|
||||
|
||||
// GetFailNodes returns list of storage node public keys that
|
||||
|
@ -249,9 +225,7 @@ func (a *DataAuditResult) GetFailNodes() [][]byte {
|
|||
// SetFailNodes sets list of storage node public keys that
|
||||
// failed at least one PDP.
|
||||
func (a *DataAuditResult) SetFailNodes(v [][]byte) {
|
||||
if a != nil {
|
||||
a.failNodes = v
|
||||
}
|
||||
a.failNodes = v
|
||||
}
|
||||
|
||||
// GetComplete returns boolean completion statement of audit result.
|
||||
|
@ -265,7 +239,5 @@ func (a *DataAuditResult) GetComplete() bool {
|
|||
|
||||
// SetComplete sets boolean completion statement of audit result.
|
||||
func (a *DataAuditResult) SetComplete(v bool) {
|
||||
if a != nil {
|
||||
a.complete = v
|
||||
}
|
||||
a.complete = v
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue