[#136] localstorage: Make local storage to use new metabase

Replace meta Bucket with meta.DB instance in local storage implementation.
Adopt all dependent components to new local storage.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-10-29 20:16:49 +03:00 committed by Alex Vanin
parent a61f8d44d1
commit c0aa892161
10 changed files with 42 additions and 500 deletions

View file

@ -14,15 +14,15 @@ func (q *jobQueue) Select(limit int) ([]*object.Address, error) {
// We can prioritize objects for migration, newly arrived objects, etc.
// It is recommended to make changes after updating the metabase
res := make([]*object.Address, 0, limit)
if err := q.localStorage.Iterate(nil, func(meta *localstore.ObjectMeta) bool {
res = append(res, meta.Head().Address())
return len(res) >= limit
}); err != nil {
// FIXME: add the ability to limit Select result
res, err := q.localStorage.Select(object.SearchFilters{})
if err != nil {
return nil, err
}
return res, nil
if len(res) < limit {
return res, nil
}
return res[:limit], nil
}