satellite/contact: remove dependency on overlay.NodeDossier
`overlay.NodeDossier` contains information that satellite tracks about a storagenode. As part of the work to remove the type column from the nodes table https://github.com/storj/storj/issues/5426, we would have to remove the `Type` field in the `overlay.NodeDossier` since it is only about the storagenode. The `Local` method on the contact service is also removed because it is unused. When needed we can create a seperate `SatelliteInfo` struct which the `Local` method will return. Change-Id: If0c1a25d9df397a9492bbf1d7f33ba5b6a918878
This commit is contained in:
parent
32b7b80666
commit
0d144ee5af
@ -318,28 +318,12 @@ func NewAPI(log *zap.Logger, full *identity.FullIdentity, db DB,
|
||||
}
|
||||
|
||||
{ // setup contact service
|
||||
pbVersion, err := versionInfo.Proto()
|
||||
if err != nil {
|
||||
return nil, errs.Combine(err, peer.Close())
|
||||
}
|
||||
|
||||
self := &overlay.NodeDossier{
|
||||
Node: pb.Node{
|
||||
Id: peer.ID(),
|
||||
Address: &pb.NodeAddress{
|
||||
Address: peer.Addr(),
|
||||
},
|
||||
},
|
||||
Type: pb.NodeType_SATELLITE,
|
||||
Version: *pbVersion,
|
||||
}
|
||||
|
||||
authority, err := loadAuthorities(full.PeerIdentity(), config.TagAuthorities)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
peer.Contact.Service = contact.NewService(peer.Log.Named("contact:service"), self, peer.Overlay.Service, peer.DB.PeerIdentities(), peer.Dialer, authority, config.Contact)
|
||||
peer.Contact.Service = contact.NewService(peer.Log.Named("contact:service"), peer.Overlay.Service, peer.DB.PeerIdentities(), peer.Dialer, authority, config.Contact)
|
||||
peer.Contact.Endpoint = contact.NewEndpoint(peer.Log.Named("contact:endpoint"), peer.Contact.Service)
|
||||
if err := pb.DRPCRegisterNode(peer.Server.DRPC(), peer.Contact.Endpoint); err != nil {
|
||||
return nil, errs.Combine(err, peer.Close())
|
||||
|
@ -6,7 +6,6 @@ package contact
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/zeebo/errs"
|
||||
@ -41,9 +40,6 @@ type Config struct {
|
||||
type Service struct {
|
||||
log *zap.Logger
|
||||
|
||||
mutex sync.Mutex
|
||||
self *overlay.NodeDossier
|
||||
|
||||
overlay *overlay.Service
|
||||
peerIDs overlay.PeerIdentities
|
||||
dialer rpc.Dialer
|
||||
@ -56,10 +52,9 @@ type Service struct {
|
||||
}
|
||||
|
||||
// NewService creates a new contact service.
|
||||
func NewService(log *zap.Logger, self *overlay.NodeDossier, overlay *overlay.Service, peerIDs overlay.PeerIdentities, dialer rpc.Dialer, authority nodetag.Authority, config Config) *Service {
|
||||
func NewService(log *zap.Logger, overlay *overlay.Service, peerIDs overlay.PeerIdentities, dialer rpc.Dialer, authority nodetag.Authority, config Config) *Service {
|
||||
return &Service{
|
||||
log: log,
|
||||
self: self,
|
||||
overlay: overlay,
|
||||
peerIDs: peerIDs,
|
||||
dialer: dialer,
|
||||
@ -70,13 +65,6 @@ func NewService(log *zap.Logger, self *overlay.NodeDossier, overlay *overlay.Ser
|
||||
}
|
||||
}
|
||||
|
||||
// Local returns the satellite node dossier.
|
||||
func (service *Service) Local() overlay.NodeDossier {
|
||||
service.mutex.Lock()
|
||||
defer service.mutex.Unlock()
|
||||
return *service.self
|
||||
}
|
||||
|
||||
// Close closes resources.
|
||||
func (service *Service) Close() error { return nil }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user