2021-03-23 18:28:05 +00:00
|
|
|
package trustcontroller
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
import "git.frostfs.info/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
|
|
|
|
}
|
|
|
|
|
2023-04-05 07:44:40 +00:00
|
|
|
func (s storageWrapper) InitIterator(common.EpochProvider) (Iterator, error) {
|
2021-03-23 18:28:05 +00:00
|
|
|
return s.i, nil
|
|
|
|
}
|
|
|
|
|
2023-04-05 07:44:40 +00:00
|
|
|
func (s storageWrapper) InitWriter(common.EpochProvider) (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,
|
|
|
|
}
|
|
|
|
}
|