[#255] ir: Replace Server.WriteReport method to another source file

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-12-22 14:45:33 +03:00 committed by Alex Vanin
parent 54523d2949
commit 754cd8b579
2 changed files with 10 additions and 8 deletions

View file

@ -20,7 +20,6 @@ import (
auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper" auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/event"
"github.com/nspcc-dev/neofs-node/pkg/morph/subscriber" "github.com/nspcc-dev/neofs-node/pkg/morph/subscriber"
auditSvc "github.com/nspcc-dev/neofs-node/pkg/services/audit"
audittask "github.com/nspcc-dev/neofs-node/pkg/services/audit/taskmanager" audittask "github.com/nspcc-dev/neofs-node/pkg/services/audit/taskmanager"
"github.com/nspcc-dev/neofs-node/pkg/util/precision" "github.com/nspcc-dev/neofs-node/pkg/util/precision"
"github.com/panjf2000/ants/v2" "github.com/panjf2000/ants/v2"
@ -140,13 +139,6 @@ func (s *Server) Stop() {
go s.mainnetListener.Stop() go s.mainnetListener.Stop()
} }
func (s *Server) WriteReport(r *auditSvc.Report) error {
res := r.Result()
res.SetPublicKey(s.pubKey)
return s.auditClient.PutAuditResult(res)
}
// New creates instance of inner ring sever structure. // New creates instance of inner ring sever structure.
func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error) { func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error) {
var err error var err error

View file

@ -3,6 +3,7 @@ package innerring
import ( import (
"github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neofs-node/pkg/innerring/invoke" "github.com/nspcc-dev/neofs-node/pkg/innerring/invoke"
"github.com/nspcc-dev/neofs-node/pkg/services/audit"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -73,3 +74,12 @@ func (s *Server) InitAndVoteForSidechainValidator(validators []keys.PublicKey) e
return s.voteForSidechainValidator(validators) return s.voteForSidechainValidator(validators)
} }
// WriteReport composes audit result structure from audit report
// and sends it to Audit contract.
func (s *Server) WriteReport(r *audit.Report) error {
res := r.Result()
res.SetPublicKey(s.pubKey)
return s.auditClient.PutAuditResult(res)
}