[#168] storagegroup: Replace []*oid.ID with []oid.ID

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-03-11 11:54:54 +03:00 committed by Alex Vanin
parent d4a8b1755c
commit 022f412584
3 changed files with 8 additions and 8 deletions

View file

@ -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()
}
}

View file

@ -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())
}

View file

@ -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
}