frostfs-node/pkg/services/reputation/local/controller/util.go
Pavel Karpy ac8441b718 [#482] reputation/router: Make route pkg independent
Make route package independent from
controller package. Add common interfaces
to `./common` directory.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-04-19 11:47:04 +03:00

32 lines
755 B
Go

package trustcontroller
import "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
type storageWrapper struct {
w common.Writer
i Iterator
}
func (s storageWrapper) InitIterator(common.Context) (Iterator, error) {
return s.i, nil
}
func (s storageWrapper) InitWriter(common.Context) (common.Writer, error) {
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.
func SimpleWriterProvider(w common.Writer) common.WriterProvider {
return &storageWrapper{
w: w,
}
}