fix: need to fix construction od node and stick to using interfaces

This commit is contained in:
Derrick Hammer 2024-01-07 04:16:18 -05:00
parent 99167b4cec
commit 311b03737c
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import (
"git.lumeweb.com/LumeWeb/libs5-go/config" "git.lumeweb.com/LumeWeb/libs5-go/config"
"git.lumeweb.com/LumeWeb/libs5-go/encoding" "git.lumeweb.com/LumeWeb/libs5-go/encoding"
"git.lumeweb.com/LumeWeb/libs5-go/interfaces" "git.lumeweb.com/LumeWeb/libs5-go/interfaces"
"git.lumeweb.com/LumeWeb/libs5-go/service"
"git.lumeweb.com/LumeWeb/libs5-go/structs" "git.lumeweb.com/LumeWeb/libs5-go/structs"
"git.lumeweb.com/LumeWeb/libs5-go/utils" "git.lumeweb.com/LumeWeb/libs5-go/utils"
"github.com/vmihailenco/msgpack/v5" "github.com/vmihailenco/msgpack/v5"
@ -29,13 +30,16 @@ func (n *NodeImpl) Services() interfaces.Services {
return n.services return n.services
} }
func NewNode(config *config.NodeConfig) *NodeImpl { func NewNode(config *config.NodeConfig) interfaces.Node {
return &NodeImpl{ n := &NodeImpl{
nodeConfig: config, nodeConfig: config,
metadataCache: structs.NewMap(), metadataCache: structs.NewMap(),
started: false, started: false,
hashQueryRoutingTable: structs.NewMap(), hashQueryRoutingTable: structs.NewMap(),
} }
n.services = NewServices(service.NewP2P(n))
return n
} }
func (n *NodeImpl) HashQueryRoutingTable() structs.Map { func (n *NodeImpl) HashQueryRoutingTable() structs.Map {
return n.hashQueryRoutingTable return n.hashQueryRoutingTable