[#1239] innerring: Use pointer-less slices for object IDs

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
remotes/fyrchik/write-cache-head
Evgenii Stratonikov 2022-03-28 16:15:15 +03:00 committed by Alex Vanin
parent 6ec104d686
commit 2ad8016d75
5 changed files with 12 additions and 13 deletions

View File

@ -48,11 +48,11 @@ func (x *SearchSGPrm) SetContainerID(id *cid.ID) {
// SearchSGRes groups resulting values of SearchSG operation.
type SearchSGRes struct {
cliRes []*oid.ID
cliRes []oid.ID
}
// IDList returns list of IDs of storage groups in container.
func (x SearchSGRes) IDList() []*oid.ID {
func (x SearchSGRes) IDList() []oid.ID {
return x.cliRes
}
@ -75,15 +75,14 @@ func (x Client) SearchSG(prm SearchSGPrm) (*SearchSGRes, error) {
rdr.UseKey(*x.key)
buf := make([]oid.ID, 10)
var list []*oid.ID
var list []oid.ID
var n int
var ok bool
for {
n, ok = rdr.Read(buf)
for i := 0; i < n; i++ {
v := buf[i]
list = append(list, &v)
list = append(list, buf[i])
}
if !ok {
break

View File

@ -107,8 +107,8 @@ func (ap *Processor) processStartAudit(epoch uint64) {
}
}
func (ap *Processor) findStorageGroups(cid *cid.ID, shuffled netmap.Nodes) []*oidSDK.ID {
var sg []*oidSDK.ID
func (ap *Processor) findStorageGroups(cid *cid.ID, shuffled netmap.Nodes) []oidSDK.ID {
var sg []oidSDK.ID
ln := len(shuffled)

View File

@ -89,11 +89,11 @@ func (x SearchSGPrm) NodeInfo() client.NodeInfo {
// SearchSGDst groups target values which Processor expects from SG searching to process.
type SearchSGDst struct {
ids []*oidSDK.ID
ids []oidSDK.ID
}
// WriteIDList writes list of identifiers of storage group objects stored in the container.
func (x *SearchSGDst) WriteIDList(ids []*oidSDK.ID) {
func (x *SearchSGDst) WriteIDList(ids []oidSDK.ID) {
x.ids = ids
}

View File

@ -22,7 +22,7 @@ func (c *Context) executePoR() {
sg := sgs[i]
if err := c.porWorkerPool.Submit(func() {
c.checkStorageGroupPoR(i, sg)
c.checkStorageGroupPoR(i, &sg)
wg.Done()
}); err != nil {
wg.Done()

View File

@ -23,7 +23,7 @@ type Task struct {
cnrNodes netmap.ContainerNodes
sgList []*oidSDK.ID
sgList []oidSDK.ID
}
// WithReporter sets audit report writer.
@ -111,7 +111,7 @@ func (t *Task) ContainerNodes() netmap.ContainerNodes {
}
// WithStorageGroupList sets list of storage groups from container under audit.
func (t *Task) WithStorageGroupList(sgList []*oidSDK.ID) *Task {
func (t *Task) WithStorageGroupList(sgList []oidSDK.ID) *Task {
if t != nil {
t.sgList = sgList
}
@ -120,6 +120,6 @@ func (t *Task) WithStorageGroupList(sgList []*oidSDK.ID) *Task {
}
// StorageGroupList returns list of storage groups from container under audit.
func (t *Task) StorageGroupList() []*oidSDK.ID {
func (t *Task) StorageGroupList() []oidSDK.ID {
return t.sgList
}