prysm-pulse/beacon-chain/p2p/interfaces.go
Preston Van Loon 81f868bd48
Regular Sync - First Pass (#3201)
* checkpoint

* checkpoint

* varint prefix for ssz

* move the encoding API around a little bit to support reader writer

* add a simple test for the happy path subscribe

* move wait timeout to testutil

* Add inverted topic mapping

* Add varint prefixing to ssz network encoder

* fix spacing

* fix comments

* fix comments

* make anon methods more clear

* clean up log fields

* move topic mapping, reformat TODOs, get ready for brutal team review

* lint

* lint

* lint

* Update beacon-chain/p2p/gossip_topic_mappings.go

Co-Authored-By: Nishant Das <nishdas93@gmail.com>

* PR feedback

* PR feedback

* PR feedback

* PR feedback

* PR feedback

* Update WORKSPACE

* Update WORKSPACE
2019-08-16 13:13:04 -04:00

37 lines
919 B
Go

package p2p
import (
"github.com/gogo/protobuf/proto"
"github.com/libp2p/go-libp2p-core/network"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder"
)
// P2P represents the full p2p interface composed of all of the sub-interfaces.
type P2P interface {
Broadcaster
SetStreamHandler
EncodingProvider
PubSubProvider
}
// Broadcaster broadcasts messages to peers over the p2p pubsub protocol.
type Broadcaster interface {
Broadcast(proto.Message)
}
// SetStreamHandler configures p2p to handle streams of a certain topic ID.
type SetStreamHandler interface {
SetStreamHandler(topic string, handler network.StreamHandler)
}
// EncodingProvider provides p2p network encoding.
type EncodingProvider interface {
Encoding() encoder.NetworkEncoding
}
// PubSubProvider provides the p2p pubsub protocol.
type PubSubProvider interface {
PubSub() *pubsub.PubSub
}