2021-01-27 19:00:35 +00:00
|
|
|
package loadcontroller
|
|
|
|
|
2021-01-28 11:10:16 +00:00
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/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
|
|
|
|
}
|
|
|
|
|
2023-04-05 11:52:13 +00:00
|
|
|
func (s storageWrapper) InitIterator() (Iterator, error) {
|
2021-01-28 11:10:16 +00:00
|
|
|
return s.i, nil
|
|
|
|
}
|
|
|
|
|
2023-04-05 11:52:13 +00:00
|
|
|
func (s storageWrapper) InitWriter([]ServerInfo) (Writer, error) {
|
2021-01-28 11:10:16 +00:00
|
|
|
return s.w, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func SimpleIteratorProvider(i Iterator) IteratorProvider {
|
|
|
|
return &storageWrapper{
|
|
|
|
i: i,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func SimpleWriterProvider(w Writer) WriterProvider {
|
|
|
|
return &storageWrapper{
|
|
|
|
w: w,
|
|
|
|
}
|
|
|
|
}
|