forked from TrueCloudLab/frostfs-node
2e605b2435
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
31 lines
739 B
Go
31 lines
739 B
Go
package policer
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/localstore"
|
|
)
|
|
|
|
type jobQueue struct {
|
|
localStorage *localstore.Storage
|
|
}
|
|
|
|
func (q *jobQueue) Select(limit int) ([]*object.Address, error) {
|
|
// TODO: optimize the logic for selecting objects
|
|
// We can prioritize objects for migration, newly arrived objects, etc.
|
|
// It is recommended to make changes after updating the metabase
|
|
|
|
jobFilter := object.NewSearchFilters()
|
|
jobFilter.AddPhyFilter()
|
|
|
|
// FIXME: add the ability to limit Select result
|
|
res, err := q.localStorage.Select(jobFilter)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if len(res) < limit {
|
|
return res, nil
|
|
}
|
|
|
|
return res[:limit], nil
|
|
}
|