[#460] reputation: Add Router to reputation server

Add `Router` to the reputation server. `Router` is
called on every incoming request and inits `Writer`
that sends `Trust`s to the next route point or
handle(logs in that implementation) them if current
node is the end point of the route.

Rename `onlyKeyRemoteServerInfo` struct for container
to separate it from the same implementation of the
same `ServerInfo` interface for reputation.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-04-06 20:15:09 +03:00 committed by Leonard Lyubich
parent 39f55611c6
commit 60cc3b3e16
3 changed files with 123 additions and 17 deletions

View file

@ -380,7 +380,7 @@ func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *container
var passedRoute []loadroute.ServerInfo
for hdr := req.GetVerificationHeader(); hdr != nil; hdr = hdr.GetOrigin() {
passedRoute = append(passedRoute, &onlyKeyRemoteServerInfo{
passedRoute = append(passedRoute, &containerOnlyKeyRemoteServerInfo{
key: hdr.GetBodySignature().GetKey(),
})
}
@ -412,15 +412,15 @@ func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *container
var errNodeOutsideContainer = errors.New("node outside the container")
type onlyKeyRemoteServerInfo struct {
type containerOnlyKeyRemoteServerInfo struct {
key []byte
}
func (i *onlyKeyRemoteServerInfo) PublicKey() []byte {
func (i *containerOnlyKeyRemoteServerInfo) PublicKey() []byte {
return i.key
}
func (*onlyKeyRemoteServerInfo) Address() string {
func (*containerOnlyKeyRemoteServerInfo) Address() string {
return ""
}