refactor: add NetworkId() to node

This commit is contained in:
Derrick Hammer 2024-01-07 09:02:39 -05:00
parent ebd95f59d4
commit 3ce371986b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 6 additions and 0 deletions

View File

@ -18,4 +18,5 @@ type Node interface {
Start() error Start() error
GetCachedStorageLocations(hash *encoding.Multihash, types []int) (map[string]StorageLocation, error) GetCachedStorageLocations(hash *encoding.Multihash, types []int) (map[string]StorageLocation, error)
AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.NodeId, location StorageLocation, message []byte, config *config.NodeConfig) error AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.NodeId, location StorageLocation, message []byte, config *config.NodeConfig) error
NetworkId() string
} }

View File

@ -19,4 +19,5 @@ type P2PService interface {
ReadNodeScore(nodeId *encoding.NodeId) (NodeVotes, error) ReadNodeScore(nodeId *encoding.NodeId) (NodeVotes, error)
GetNodeScore(nodeId *encoding.NodeId) (float64, error) GetNodeScore(nodeId *encoding.NodeId) (float64, error)
SortNodesByScore(nodes []*encoding.NodeId) ([]*encoding.NodeId, error) SortNodesByScore(nodes []*encoding.NodeId) ([]*encoding.NodeId, error)
SignMessageSimple(message []byte) ([]byte, error)
} }

View File

@ -27,6 +27,10 @@ type NodeImpl struct {
cacheBucket *bolt.Bucket cacheBucket *bolt.Bucket
} }
func (n *NodeImpl) NetworkId() string {
return n.nodeConfig.P2P.Network
}
func (n *NodeImpl) Services() interfaces.Services { func (n *NodeImpl) Services() interfaces.Services {
return n.services return n.services
} }