From 022f412584f02463c07a0f2aa33659fdbe9a7fa3 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 11 Mar 2022 11:54:54 +0300 Subject: [PATCH] [#168] storagegroup: Replace []*oid.ID with []oid.ID Signed-off-by: Alex Vanin --- storagegroup/storagegroup.go | 12 ++++++------ storagegroup/storagegroup_test.go | 2 +- storagegroup/test/generate.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/storagegroup/storagegroup.go b/storagegroup/storagegroup.go index 8ceb5b5c..e3d09520 100644 --- a/storagegroup/storagegroup.go +++ b/storagegroup/storagegroup.go @@ -67,17 +67,17 @@ func (sg *StorageGroup) SetExpirationEpoch(epoch uint64) { // Members returns strictly ordered list of // storage group member objects. -func (sg *StorageGroup) Members() []*oid.ID { +func (sg *StorageGroup) Members() []oid.ID { mV2 := (*storagegroup.StorageGroup)(sg).GetMembers() if mV2 == nil { return nil } - m := make([]*oid.ID, len(mV2)) + m := make([]oid.ID, len(mV2)) for i := range mV2 { - m[i] = oid.NewIDFromV2(mV2[i]) + m[i] = *oid.NewIDFromV2(&mV2[i]) } return m @@ -85,7 +85,7 @@ func (sg *StorageGroup) Members() []*oid.ID { // SetMembers sets strictly ordered list of // storage group member objects. -func (sg *StorageGroup) SetMembers(members []*oid.ID) { +func (sg *StorageGroup) SetMembers(members []oid.ID) { mV2 := (*storagegroup.StorageGroup)(sg).GetMembers() if members == nil { @@ -96,11 +96,11 @@ func (sg *StorageGroup) SetMembers(members []*oid.ID) { if cap(mV2) >= ln { mV2 = mV2[:0] } else { - mV2 = make([]*refs.ObjectID, 0, ln) + mV2 = make([]refs.ObjectID, ln) } for i := 0; i < ln; i++ { - mV2 = append(mV2, members[i].ToV2()) + mV2[i] = *members[i].ToV2() } } diff --git a/storagegroup/storagegroup_test.go b/storagegroup/storagegroup_test.go index 2418b5a9..07bafa7a 100644 --- a/storagegroup/storagegroup_test.go +++ b/storagegroup/storagegroup_test.go @@ -27,7 +27,7 @@ func TestStorageGroup(t *testing.T) { sg.SetExpirationEpoch(exp) require.Equal(t, exp, sg.ExpirationEpoch()) - members := []*oid.ID{oidtest.ID(), oidtest.ID()} + members := []oid.ID{*oidtest.ID(), *oidtest.ID()} sg.SetMembers(members) require.Equal(t, members, sg.Members()) } diff --git a/storagegroup/test/generate.go b/storagegroup/test/generate.go index b8bffaae..76415f01 100644 --- a/storagegroup/test/generate.go +++ b/storagegroup/test/generate.go @@ -14,7 +14,7 @@ func StorageGroup() *storagegroup.StorageGroup { x.SetExpirationEpoch(66) x.SetValidationDataSize(322) x.SetValidationDataHash(checksumtest.Checksum()) - x.SetMembers([]*oid.ID{oidtest.ID(), oidtest.ID()}) + x.SetMembers([]oid.ID{*oidtest.ID(), *oidtest.ID()}) return x }