2021-01-27 19:00:35 +00:00
|
|
|
package loadcontroller
|
|
|
|
|
2021-01-28 11:10:16 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
"github.com/TrueCloudLab/frostfs-sdk-go/container"
|
2021-01-28 11:10:16 +00:00
|
|
|
)
|
2021-01-27 19:00:35 +00:00
|
|
|
|
|
|
|
func usedSpaceFilterEpochEQ(epoch uint64) UsedSpaceFilter {
|
2022-06-28 07:01:05 +00:00
|
|
|
return func(a container.SizeEstimation) bool {
|
2021-01-27 19:00:35 +00:00
|
|
|
return a.Epoch() == epoch
|
|
|
|
}
|
|
|
|
}
|
2021-01-28 11:10:16 +00:00
|
|
|
|
|
|
|
type storageWrapper struct {
|
|
|
|
w Writer
|
|
|
|
i Iterator
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s storageWrapper) InitIterator(context.Context) (Iterator, error) {
|
|
|
|
return s.i, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s storageWrapper) InitWriter(context.Context) (Writer, error) {
|
|
|
|
return s.w, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func SimpleIteratorProvider(i Iterator) IteratorProvider {
|
|
|
|
return &storageWrapper{
|
|
|
|
i: i,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func SimpleWriterProvider(w Writer) WriterProvider {
|
|
|
|
return &storageWrapper{
|
|
|
|
w: w,
|
|
|
|
}
|
|
|
|
}
|