forked from TrueCloudLab/frostfs-node
[#488] reputation: Change Writer
interface
Includes: - Delete first `ctx` argument in `Write` method. - Move intermediate Initial trust struct and method to `calculator` file. - Change Alpha to 0.1. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
0d34d7c508
commit
d1db54acf8
14 changed files with 61 additions and 63 deletions
|
@ -2,7 +2,6 @@ package intermediate
|
|||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/storage/daughters"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
|
@ -21,10 +20,11 @@ type DaughterStorageWriterProvider struct {
|
|||
type DaughterTrustWriter struct {
|
||||
log *logger.Logger
|
||||
storage *daughters.Storage
|
||||
ctx reputationcommon.Context
|
||||
}
|
||||
|
||||
func (w *DaughterTrustWriter) Write(ctx common.Context, t reputation.Trust) error {
|
||||
w.storage.Put(ctx.Epoch(), t)
|
||||
func (w *DaughterTrustWriter) Write(t reputation.Trust) error {
|
||||
w.storage.Put(w.ctx.Epoch(), t)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,10 @@ func (w *DaughterTrustWriter) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *DaughterStorageWriterProvider) InitWriter(_ reputationcommon.Context) (reputationcommon.Writer, error) {
|
||||
func (s *DaughterStorageWriterProvider) InitWriter(ctx reputationcommon.Context) (reputationcommon.Writer, error) {
|
||||
return &DaughterTrustWriter{
|
||||
log: s.Log,
|
||||
storage: s.Storage,
|
||||
ctx: ctx,
|
||||
}, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue