mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 04:00:05 +00:00
9ab76dc1f6
Former-commit-id: 797bc1cf3a759f2a55dbf1ce790c3f599682448c [formerly 8f4e5d953c3e553944db263a76c142ffccad516d] Former-commit-id: c7c1e3e2d340c8cd5f97e4549fa46a7959be06c6
45 lines
1014 B
Go
45 lines
1014 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 p2p 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
|
|
// https://github.com/prysmaticlabs/geth-sharding/issues/175
|
|
}
|
|
|
|
// Broadcast a message to the world.
|
|
func (s *Server) Broadcast(msg interface{}) {
|
|
// TODO
|
|
// https://github.com/prysmaticlabs/geth-sharding/issues/176
|
|
}
|