prysm-pulse/sharding/p2p/service.go
Preston Van Loon 489eb89f2e Fix typo
Former-commit-id: 04ec02588f6f38a4dcc737126449998fb4f01e29 [formerly c6580d7eb8565c615e3684615e2d87cb101d5ce7]
Former-commit-id: ec51ad69a7ad5062bf285b18e04d4a716f4d04c0
2018-06-12 22:23:12 -04:00

43 lines
895 B
Go

// Package p2p handles peer-to-peer networking for the sharding package.
package p2p
import (
"reflect"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
)
// Server is a placeholder for a shardp2p service. To be designed.
type Server struct {
feeds map[reflect.Type]*event.Feed
}
// NewServer creates a new p2p server instance.
func NewServer() (*Server, error) {
return &Server{
feeds: make(map[reflect.Type]*event.Feed),
}, nil
}
// Start the main routine for an p2p server.
func (s *Server) Start() {
log.Info("Starting shardp2p server")
}
// Stop the main p2p loop.
func (s *Server) Stop() error {
log.Info("Stopping shardp2p server")
return nil
}
// Send a message to a specific peer.
func (s *Server) Send(msg interface{}, peer Peer) {
// TODO
}
// Broadcast a message to the world.
func (s *Server) Broadcast(msg interface{}) {
// TODO
}