2020-10-21 09:24:02 +00:00
|
|
|
package policer
|
|
|
|
|
|
|
|
import (
|
2023-06-06 09:27:19 +00:00
|
|
|
"context"
|
2021-11-10 08:34:00 +00:00
|
|
|
"fmt"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/engine"
|
2020-10-21 09:24:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type jobQueue struct {
|
2020-11-19 08:22:43 +00:00
|
|
|
localStorage *engine.StorageEngine
|
2020-10-21 09:24:02 +00:00
|
|
|
}
|
|
|
|
|
2023-06-06 09:27:19 +00:00
|
|
|
func (q *jobQueue) Select(ctx context.Context, cursor *engine.Cursor, count uint32) ([]objectcore.AddressWithType, *engine.Cursor, error) {
|
2022-05-23 13:12:32 +00:00
|
|
|
var prm engine.ListWithCursorPrm
|
2021-11-10 08:34:00 +00:00
|
|
|
prm.WithCursor(cursor)
|
|
|
|
prm.WithCount(count)
|
2020-10-21 09:24:02 +00:00
|
|
|
|
2023-06-06 09:27:19 +00:00
|
|
|
res, err := q.localStorage.ListWithCursor(ctx, prm)
|
2020-10-29 17:16:49 +00:00
|
|
|
if err != nil {
|
2021-11-10 08:34:00 +00:00
|
|
|
return nil, nil, fmt.Errorf("cannot list objects in engine: %w", err)
|
2020-10-29 17:16:49 +00:00
|
|
|
}
|
|
|
|
|
2021-11-10 08:34:00 +00:00
|
|
|
return res.AddressList(), res.Cursor(), nil
|
2020-10-21 09:24:02 +00:00
|
|
|
}
|