forked from TrueCloudLab/frostfs-sdk-go
[#168] storagegroup: Replace []*oid.ID with []oid.ID
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
d4a8b1755c
commit
022f412584
3 changed files with 8 additions and 8 deletions
|
@ -67,17 +67,17 @@ func (sg *StorageGroup) SetExpirationEpoch(epoch uint64) {
|
||||||
|
|
||||||
// Members returns strictly ordered list of
|
// Members returns strictly ordered list of
|
||||||
// storage group member objects.
|
// storage group member objects.
|
||||||
func (sg *StorageGroup) Members() []*oid.ID {
|
func (sg *StorageGroup) Members() []oid.ID {
|
||||||
mV2 := (*storagegroup.StorageGroup)(sg).GetMembers()
|
mV2 := (*storagegroup.StorageGroup)(sg).GetMembers()
|
||||||
|
|
||||||
if mV2 == nil {
|
if mV2 == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
m := make([]*oid.ID, len(mV2))
|
m := make([]oid.ID, len(mV2))
|
||||||
|
|
||||||
for i := range mV2 {
|
for i := range mV2 {
|
||||||
m[i] = oid.NewIDFromV2(mV2[i])
|
m[i] = *oid.NewIDFromV2(&mV2[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
@ -85,7 +85,7 @@ func (sg *StorageGroup) Members() []*oid.ID {
|
||||||
|
|
||||||
// SetMembers sets strictly ordered list of
|
// SetMembers sets strictly ordered list of
|
||||||
// storage group member objects.
|
// storage group member objects.
|
||||||
func (sg *StorageGroup) SetMembers(members []*oid.ID) {
|
func (sg *StorageGroup) SetMembers(members []oid.ID) {
|
||||||
mV2 := (*storagegroup.StorageGroup)(sg).GetMembers()
|
mV2 := (*storagegroup.StorageGroup)(sg).GetMembers()
|
||||||
|
|
||||||
if members == nil {
|
if members == nil {
|
||||||
|
@ -96,11 +96,11 @@ func (sg *StorageGroup) SetMembers(members []*oid.ID) {
|
||||||
if cap(mV2) >= ln {
|
if cap(mV2) >= ln {
|
||||||
mV2 = mV2[:0]
|
mV2 = mV2[:0]
|
||||||
} else {
|
} else {
|
||||||
mV2 = make([]*refs.ObjectID, 0, ln)
|
mV2 = make([]refs.ObjectID, ln)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < ln; i++ {
|
for i := 0; i < ln; i++ {
|
||||||
mV2 = append(mV2, members[i].ToV2())
|
mV2[i] = *members[i].ToV2()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ func TestStorageGroup(t *testing.T) {
|
||||||
sg.SetExpirationEpoch(exp)
|
sg.SetExpirationEpoch(exp)
|
||||||
require.Equal(t, exp, sg.ExpirationEpoch())
|
require.Equal(t, exp, sg.ExpirationEpoch())
|
||||||
|
|
||||||
members := []*oid.ID{oidtest.ID(), oidtest.ID()}
|
members := []oid.ID{*oidtest.ID(), *oidtest.ID()}
|
||||||
sg.SetMembers(members)
|
sg.SetMembers(members)
|
||||||
require.Equal(t, members, sg.Members())
|
require.Equal(t, members, sg.Members())
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ func StorageGroup() *storagegroup.StorageGroup {
|
||||||
x.SetExpirationEpoch(66)
|
x.SetExpirationEpoch(66)
|
||||||
x.SetValidationDataSize(322)
|
x.SetValidationDataSize(322)
|
||||||
x.SetValidationDataHash(checksumtest.Checksum())
|
x.SetValidationDataHash(checksumtest.Checksum())
|
||||||
x.SetMembers([]*oid.ID{oidtest.ID(), oidtest.ID()})
|
x.SetMembers([]oid.ID{*oidtest.ID(), *oidtest.ID()})
|
||||||
|
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue