forked from TrueCloudLab/frostfs-node
[#428] reputation: Implement local trust controller
Implement `Controller` designed to analyze the values collected by the local node (the source is hidden behind Writer/WriterProvider interfaces) and transfer them to the destination (hidden behind Iterator / IteratorProvider interface). Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
eadb3204f0
commit
29e974df93
5 changed files with 420 additions and 0 deletions
30
pkg/services/reputation/local/controller/util.go
Normal file
30
pkg/services/reputation/local/controller/util.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package trustcontroller
|
||||
|
||||
type storageWrapper struct {
|
||||
w Writer
|
||||
i Iterator
|
||||
}
|
||||
|
||||
func (s storageWrapper) InitIterator(Context) (Iterator, error) {
|
||||
return s.i, nil
|
||||
}
|
||||
|
||||
func (s storageWrapper) InitWriter(Context) (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 Writer) WriterProvider {
|
||||
return &storageWrapper{
|
||||
w: w,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue