2024-01-07 08:13:35 +00:00
|
|
|
package interfaces
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
|
|
|
|
"git.lumeweb.com/LumeWeb/libs5-go/net"
|
|
|
|
"git.lumeweb.com/LumeWeb/libs5-go/structs"
|
2024-01-09 11:59:12 +00:00
|
|
|
"git.lumeweb.com/LumeWeb/libs5-go/types"
|
2024-01-07 08:13:35 +00:00
|
|
|
"net/url"
|
|
|
|
)
|
|
|
|
|
2024-01-08 05:16:32 +00:00
|
|
|
//go:generate mockgen -source=p2p.go -destination=../mocks/interfaces/p2p.go -package=interfaces
|
|
|
|
|
2024-01-07 08:13:35 +00:00
|
|
|
type P2PService interface {
|
2024-01-07 08:54:32 +00:00
|
|
|
Node() Node
|
|
|
|
Peers() structs.Map
|
2024-01-07 08:13:35 +00:00
|
|
|
ConnectToNode(connectionUris []*url.URL, retried bool) error
|
2024-01-07 11:35:41 +00:00
|
|
|
OnNewPeer(peer net.Peer, verifyId bool) error
|
|
|
|
OnNewPeerListen(peer net.Peer, verifyId bool)
|
2024-01-07 08:54:50 +00:00
|
|
|
GetNodeScore(nodeId *encoding.NodeId) (float64, error)
|
2024-01-07 08:13:35 +00:00
|
|
|
SortNodesByScore(nodes []*encoding.NodeId) ([]*encoding.NodeId, error)
|
2024-01-07 14:02:39 +00:00
|
|
|
SignMessageSimple(message []byte) ([]byte, error)
|
2024-01-08 17:09:21 +00:00
|
|
|
AddPeer(peer net.Peer) error
|
|
|
|
SendPublicPeersToPeer(peer net.Peer, peersToSend []net.Peer) error
|
2024-01-09 11:59:12 +00:00
|
|
|
SendHashRequest(hash *encoding.Multihash, kinds []types.StorageLocationType) error
|
|
|
|
UpVote(nodeId *encoding.NodeId) error
|
|
|
|
DownVote(nodeId *encoding.NodeId) error
|
2024-01-09 16:43:33 +00:00
|
|
|
NodeId() *encoding.NodeId
|
2024-01-10 11:21:03 +00:00
|
|
|
Service
|
2024-01-07 08:13:35 +00:00
|
|
|
}
|