nimbus-eth2/beacon_chain/gossipsub_protocol.nim

39 lines
1.1 KiB
Nim
Raw Normal View History

import
2018-11-26 13:33:06 +00:00
tables, sets,
2018-11-29 01:08:34 +00:00
asyncdispatch2, chronicles, rlp, eth_p2p, eth_p2p/rlpx
type
2018-11-26 13:33:06 +00:00
TopicMsgHandler = proc(data: seq[byte]): Future[void]
2018-11-29 01:08:34 +00:00
GossibSubPeer = ref object
sentMessages: HashSet[string]
GossipSubNetwork = ref object
2018-11-26 13:33:06 +00:00
deliveredMessages: Table[Peer, HashSet[string]]
topicSubscribers: Table[string, seq[TopicMsgHandler]]
2018-11-29 01:08:34 +00:00
p2pProtocol GossipSub(version = 1,
shortName = "gss",
peerState = GossibSubPeer,
networkState = GossipSubNetwork):
2018-11-26 13:33:06 +00:00
# This is a very barebones emulation of the GossipSub protocol
# available in LibP2P:
2018-11-29 01:08:34 +00:00
proc interestedIn(peer: Peer, topic: string)
proc emit(peer: Peer, topic: string, msgId: string, data: openarray[byte])
2018-11-26 13:33:06 +00:00
proc subscribeImpl(node: EthereumNode,
topic: string,
subscriber: TopicMsgHandler) =
discard
proc broadcastImpl(node: EthereumNode, topic: string, data: seq[byte]) =
discard
2018-11-29 01:08:34 +00:00
macro subscribe*(node: EthereumNode, topic: string, handler: untyped): untyped =
2018-11-26 13:33:06 +00:00
discard
2018-11-29 01:08:34 +00:00
proc broadcast*(node: EthereumNode, topic: string, data: auto) {.async.} =
2018-11-26 13:33:06 +00:00
discard