feat: create provider store interface for use in hash query
This commit is contained in:
parent
9b464e0932
commit
d734e1a89b
|
@ -29,4 +29,6 @@ type Node interface {
|
||||||
GetMetadataByCID(cid *encoding.CID) (metadata.Metadata, error)
|
GetMetadataByCID(cid *encoding.CID) (metadata.Metadata, error)
|
||||||
WaitOnConnectedPeers()
|
WaitOnConnectedPeers()
|
||||||
ConnectionTracker() *sync.WaitGroup
|
ConnectionTracker() *sync.WaitGroup
|
||||||
|
SetProviderStore(store ProviderStore)
|
||||||
|
ProviderStore() ProviderStore
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package interfaces
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
|
||||||
|
"git.lumeweb.com/LumeWeb/libs5-go/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ProviderStore interface {
|
||||||
|
CanProvide(hash *encoding.Multihash, kind []types.StorageLocationType) bool
|
||||||
|
Provide(hash *encoding.Multihash, kind []types.StorageLocationType) (StorageLocation, error)
|
||||||
|
}
|
|
@ -34,6 +34,7 @@ type NodeImpl struct {
|
||||||
services interfaces.Services
|
services interfaces.Services
|
||||||
httpClient *resty.Client
|
httpClient *resty.Client
|
||||||
connections sync.WaitGroup
|
connections sync.WaitGroup
|
||||||
|
providerStore interfaces.ProviderStore
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NodeImpl) NetworkId() string {
|
func (n *NodeImpl) NetworkId() string {
|
||||||
|
@ -333,3 +334,11 @@ func (n *NodeImpl) WaitOnConnectedPeers() {
|
||||||
func (n *NodeImpl) ConnectionTracker() *sync.WaitGroup {
|
func (n *NodeImpl) ConnectionTracker() *sync.WaitGroup {
|
||||||
return &n.connections
|
return &n.connections
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *NodeImpl) SetProviderStore(store interfaces.ProviderStore) {
|
||||||
|
n.providerStore = store
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *NodeImpl) ProviderStore() interfaces.ProviderStore {
|
||||||
|
return n.providerStore
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue