Skip to content

Commit

Permalink
engine: drop List function
Browse files Browse the repository at this point in the history
Drop the function that was not called anywhere because there is a similar
function `ListWithCursor` that is being used.

Signed-off-by: Andrey Butusov <[email protected]>
  • Loading branch information
End-rey committed Feb 11, 2025
1 parent 48a607c commit 87441c3
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions pkg/local_object_storage/engine/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,46 +49,3 @@ func (e *StorageEngine) Select(cnr cid.ID, filters object.SearchFilters) ([]oid.

return addrList, nil
}

// List returns `limit` available physically storage object addresses in engine.
// If limit is zero, then returns all available object addresses.
//
// Returns an error if executions are blocked (see BlockExecution).
func (e *StorageEngine) List(limit uint64) ([]oid.Address, error) {
if e.metrics != nil {
defer elapsed(e.metrics.AddListObjectsDuration)()
}

e.blockMtx.RLock()
defer e.blockMtx.RUnlock()

if e.blockErr != nil {
return nil, e.blockErr
}

addrList := make([]oid.Address, 0, limit)
uniqueMap := make(map[string]struct{})
ln := uint64(0)

// consider iterating over shuffled shards
for _, sh := range e.unsortedShards() {
res, err := sh.List() // consider limit result of shard iterator
if err != nil {
e.reportShardError(sh, "could not select objects from shard", err)
continue
}
for _, addr := range res { // save only unique values
if _, ok := uniqueMap[addr.EncodeToString()]; !ok {
uniqueMap[addr.EncodeToString()] = struct{}{}
addrList = append(addrList, addr)

ln++
if limit > 0 && ln >= limit {
return addrList, nil
}
}
}
}

return addrList, nil
}

0 comments on commit 87441c3

Please sign in to comment.