2021-03-23 18:28:05 +00:00
|
|
|
package trustcontroller
|
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
import "github.com/TrueCloudLab/frostfs-node/pkg/services/reputation/common"
|
2021-04-17 17:13:29 +00:00
|
|
|
|
2021-03-23 18:28:05 +00:00
|
|
|
type storageWrapper struct {
|
2021-04-17 17:13:29 +00:00
|
|
|
w common.Writer
|
2021-03-23 18:28:05 +00:00
|
|
|
i Iterator
|
|
|
|
}
|
|
|
|
|
2021-04-17 17:13:29 +00:00
|
|
|
func (s storageWrapper) InitIterator(common.Context) (Iterator, error) {
|
2021-03-23 18:28:05 +00:00
|
|
|
return s.i, nil
|
|
|
|
}
|
|
|
|
|
2021-04-17 17:13:29 +00:00
|
|
|
func (s storageWrapper) InitWriter(common.Context) (common.Writer, error) {
|
2021-03-23 18:28:05 +00:00
|
|
|
return s.w, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SimpleIteratorProvider returns IteratorProvider that provides
|
|
|
|
// static context-independent Iterator.
|
|
|
|
func SimpleIteratorProvider(i Iterator) IteratorProvider {
|
|
|
|
return &storageWrapper{
|
|
|
|
i: i,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SimpleWriterProvider returns WriterProvider that provides
|
|
|
|
// static context-independent Writer.
|
2021-04-17 17:13:29 +00:00
|
|
|
func SimpleWriterProvider(w common.Writer) common.WriterProvider {
|
2021-03-23 18:28:05 +00:00
|
|
|
return &storageWrapper{
|
|
|
|
w: w,
|
|
|
|
}
|
|
|
|
}
|