Documentation ¶
Index ¶
- func GrpcSentryClient(ctx context.Context, sentryAddr string) (proto_sentry.SentryClient, error)
- func Loop(ctx context.Context, db ethdb.Database, sync *stagedsync.StagedSync, ...)
- func MakeProtocols(ctx context.Context, readNodeInfo func() *eth.NodeInfo, ...) []p2p.Protocol
- func NewStagedSync(ctx context.Context, db ethdb.RwKV, sm ethdb.StorageMode, ...) (*stagedsync.StagedSync, error)
- func RecvMessage(ctx context.Context, sentry proto_sentry.SentryClient, ...)
- func RecvUploadMessage(ctx context.Context, sentry proto_sentry.SentryClient, ...)
- func Sentry(datadir string, natSetting string, port int, sentryAddr string, ...) error
- func SetSentryStatus(ctx context.Context, sentries []proto_sentry.SentryClient, ...) error
- type ControlServerImpl
- func (cs *ControlServerImpl) BroadcastNewBlock(ctx context.Context, block *types.Block, td *big.Int)
- func (cs *ControlServerImpl) HandleInboundMessage(ctx context.Context, inreq *proto_sentry.InboundMessage, ...) error
- func (cs *ControlServerImpl) PropagateNewBlockHashes(ctx context.Context, announces []headerdownload.Announce)
- type PeerInfo
- type SentryClientDirect
- func (scd *SentryClientDirect) PeerMinBlock(ctx context.Context, in *proto_sentry.PeerMinBlockRequest, ...) (*empty.Empty, error)
- func (scd *SentryClientDirect) PenalizePeer(ctx context.Context, in *proto_sentry.PenalizePeerRequest, ...) (*empty.Empty, error)
- func (scd *SentryClientDirect) ReceiveMessages(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (proto_sentry.Sentry_ReceiveMessagesClient, error)
- func (scd *SentryClientDirect) ReceiveTxMessages(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (proto_sentry.Sentry_ReceiveTxMessagesClient, error)
- func (scd *SentryClientDirect) ReceiveUploadMessages(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (proto_sentry.Sentry_ReceiveUploadMessagesClient, error)
- func (scd *SentryClientDirect) SendMessageById(ctx context.Context, in *proto_sentry.SendMessageByIdRequest, ...) (*proto_sentry.SentPeers, error)
- func (scd *SentryClientDirect) SendMessageByMinBlock(ctx context.Context, in *proto_sentry.SendMessageByMinBlockRequest, ...) (*proto_sentry.SentPeers, error)
- func (scd *SentryClientDirect) SendMessageToAll(ctx context.Context, in *proto_sentry.OutboundMessageData, ...) (*proto_sentry.SentPeers, error)
- func (scd *SentryClientDirect) SendMessageToRandomPeers(ctx context.Context, in *proto_sentry.SendMessageToRandomPeersRequest, ...) (*proto_sentry.SentPeers, error)
- func (scd *SentryClientDirect) SetServer(sentryServer proto_sentry.SentryServer)
- func (scd *SentryClientDirect) SetStatus(ctx context.Context, in *proto_sentry.StatusData, opts ...grpc.CallOption) (*emptypb.Empty, error)
- type SentryReceiveClientDirect
- type SentryReceiveServerDirect
- type SentryServerImpl
- func (ss *SentryServerImpl) GetStatus() *proto_sentry.StatusData
- func (ss *SentryServerImpl) PeerMinBlock(_ context.Context, req *proto_sentry.PeerMinBlockRequest) (*empty.Empty, error)
- func (ss *SentryServerImpl) PenalizePeer(_ context.Context, req *proto_sentry.PenalizePeerRequest) (*empty.Empty, error)
- func (ss *SentryServerImpl) ReceiveMessages(_ *emptypb.Empty, server proto_sentry.Sentry_ReceiveMessagesServer) error
- func (ss *SentryServerImpl) ReceiveTxMessages(_ *emptypb.Empty, server proto_sentry.Sentry_ReceiveTxMessagesServer) error
- func (ss *SentryServerImpl) ReceiveUploadMessages(_ *emptypb.Empty, server proto_sentry.Sentry_ReceiveUploadMessagesServer) error
- func (ss *SentryServerImpl) SendMessageById(_ context.Context, inreq *proto_sentry.SendMessageByIdRequest) (*proto_sentry.SentPeers, error)
- func (ss *SentryServerImpl) SendMessageByMinBlock(_ context.Context, inreq *proto_sentry.SendMessageByMinBlockRequest) (*proto_sentry.SentPeers, error)
- func (ss *SentryServerImpl) SendMessageToAll(ctx context.Context, req *proto_sentry.OutboundMessageData) (*proto_sentry.SentPeers, error)
- func (ss *SentryServerImpl) SendMessageToRandomPeers(ctx context.Context, req *proto_sentry.SendMessageToRandomPeersRequest) (*proto_sentry.SentPeers, error)
- func (ss *SentryServerImpl) SetStatus(_ context.Context, statusData *proto_sentry.StatusData) (*emptypb.Empty, error)
- type StreamMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GrpcSentryClient ¶
func GrpcSentryClient(ctx context.Context, sentryAddr string) (proto_sentry.SentryClient, error)
func Loop ¶
func Loop(ctx context.Context, db ethdb.Database, sync *stagedsync.StagedSync, controlServer *ControlServerImpl, notifier stagedsync.ChainEventNotifier, waitForDone chan struct{})
Deprecated - use stages.StageLoop
func MakeProtocols ¶
func NewStagedSync ¶
func NewStagedSync( ctx context.Context, db ethdb.RwKV, sm ethdb.StorageMode, batchSize datasize.ByteSize, bodyDownloadTimeout int, controlServer *ControlServerImpl, tmpdir string, txPool *core.TxPool, txPoolServer *eth.TxPoolServer, ) (*stagedsync.StagedSync, error)
func RecvMessage ¶
func RecvMessage(ctx context.Context, sentry proto_sentry.SentryClient, handleInboundMessage func(ctx context.Context, inreq *proto_sentry.InboundMessage, sentry proto_sentry.SentryClient) error)
func RecvUploadMessage ¶
func RecvUploadMessage(ctx context.Context, sentry proto_sentry.SentryClient, handleInboundMessage func(ctx context.Context, inreq *proto_sentry.InboundMessage, sentry proto_sentry.SentryClient) error)
func Sentry ¶
func Sentry(datadir string, natSetting string, port int, sentryAddr string, staticPeers []string, discovery bool, netRestrict string) error
Sentry creates and runs standalone sentry
func SetSentryStatus ¶
func SetSentryStatus(ctx context.Context, sentries []proto_sentry.SentryClient, controlServer *ControlServerImpl) error
Types ¶
type ControlServerImpl ¶
type ControlServerImpl struct {
// contains filtered or unexported fields
}
func NewControlServer ¶
func NewControlServer(db ethdb.RwKV, nodeName string, chainConfig *params.ChainConfig, genesisHash common.Hash, engine consensus.Engine, networkID uint64, sentries []proto_sentry.SentryClient, window int) (*ControlServerImpl, error)
func (*ControlServerImpl) BroadcastNewBlock ¶
func (*ControlServerImpl) HandleInboundMessage ¶
func (cs *ControlServerImpl) HandleInboundMessage(ctx context.Context, inreq *proto_sentry.InboundMessage, sentry proto_sentry.SentryClient) error
func (*ControlServerImpl) PropagateNewBlockHashes ¶
func (cs *ControlServerImpl) PropagateNewBlockHashes(ctx context.Context, announces []headerdownload.Announce)
type PeerInfo ¶
type PeerInfo struct {
// contains filtered or unexported fields
}
PeerInfo collects various extra bits of information about the peer, for example deadlines that is used for regulating requests sent to the peer
func (*PeerInfo) AddDeadline ¶
AddDeadline adds given deadline to the list of deadlines Deadlines must be added in the chronological order for the function ClearDeadlines to work correctly (it uses binary search)
func (*PeerInfo) ClearDeadlines ¶
ClearDeadlines goes through the deadlines of given peers and removes the ones that have passed Optionally, it also clears one extra deadline - this is used when response is received It returns the number of deadlines left
type SentryClientDirect ¶
type SentryClientDirect struct {
// contains filtered or unexported fields
}
SentryClientDirect implements SentryClient interface by connecting the instance of the client directly with the corresponding instance of SentryServer
func (*SentryClientDirect) PeerMinBlock ¶
func (scd *SentryClientDirect) PeerMinBlock(ctx context.Context, in *proto_sentry.PeerMinBlockRequest, opts ...grpc.CallOption) (*empty.Empty, error)
func (*SentryClientDirect) PenalizePeer ¶
func (scd *SentryClientDirect) PenalizePeer(ctx context.Context, in *proto_sentry.PenalizePeerRequest, opts ...grpc.CallOption) (*empty.Empty, error)
func (*SentryClientDirect) ReceiveMessages ¶
func (scd *SentryClientDirect) ReceiveMessages(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (proto_sentry.Sentry_ReceiveMessagesClient, error)
func (*SentryClientDirect) ReceiveTxMessages ¶
func (scd *SentryClientDirect) ReceiveTxMessages(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (proto_sentry.Sentry_ReceiveTxMessagesClient, error)
func (*SentryClientDirect) ReceiveUploadMessages ¶
func (scd *SentryClientDirect) ReceiveUploadMessages(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (proto_sentry.Sentry_ReceiveUploadMessagesClient, error)
func (*SentryClientDirect) SendMessageById ¶
func (scd *SentryClientDirect) SendMessageById(ctx context.Context, in *proto_sentry.SendMessageByIdRequest, opts ...grpc.CallOption) (*proto_sentry.SentPeers, error)
func (*SentryClientDirect) SendMessageByMinBlock ¶
func (scd *SentryClientDirect) SendMessageByMinBlock(ctx context.Context, in *proto_sentry.SendMessageByMinBlockRequest, opts ...grpc.CallOption) (*proto_sentry.SentPeers, error)
func (*SentryClientDirect) SendMessageToAll ¶
func (scd *SentryClientDirect) SendMessageToAll(ctx context.Context, in *proto_sentry.OutboundMessageData, opts ...grpc.CallOption) (*proto_sentry.SentPeers, error)
func (*SentryClientDirect) SendMessageToRandomPeers ¶
func (scd *SentryClientDirect) SendMessageToRandomPeers(ctx context.Context, in *proto_sentry.SendMessageToRandomPeersRequest, opts ...grpc.CallOption) (*proto_sentry.SentPeers, error)
func (*SentryClientDirect) SetServer ¶
func (scd *SentryClientDirect) SetServer(sentryServer proto_sentry.SentryServer)
SetServer injects a reference to the SentryServer into the client
func (*SentryClientDirect) SetStatus ¶
func (scd *SentryClientDirect) SetStatus(ctx context.Context, in *proto_sentry.StatusData, opts ...grpc.CallOption) (*emptypb.Empty, error)
type SentryReceiveClientDirect ¶
type SentryReceiveClientDirect struct { grpc.ClientStream // contains filtered or unexported fields }
func (*SentryReceiveClientDirect) Recv ¶
func (c *SentryReceiveClientDirect) Recv() (*proto_sentry.InboundMessage, error)
type SentryReceiveServerDirect ¶
type SentryReceiveServerDirect struct { grpc.ServerStream // contains filtered or unexported fields }
implements proto_sentry.Sentry_ReceiveMessagesServer
func (*SentryReceiveServerDirect) Send ¶
func (s *SentryReceiveServerDirect) Send(m *proto_sentry.InboundMessage) error
type SentryServerImpl ¶
type SentryServerImpl struct { proto_sentry.UnimplementedSentryServer Peers sync.Map P2pServer *p2p.Server ReceiveCh chan StreamMsg ReceiveUploadCh chan StreamMsg ReceiveTxCh chan StreamMsg // contains filtered or unexported fields }
func NewSentryServer ¶
func NewSentryServer(ctx context.Context, datadir string, p2pListenAddr string) *SentryServerImpl
func (*SentryServerImpl) GetStatus ¶
func (ss *SentryServerImpl) GetStatus() *proto_sentry.StatusData
func (*SentryServerImpl) PeerMinBlock ¶
func (ss *SentryServerImpl) PeerMinBlock(_ context.Context, req *proto_sentry.PeerMinBlockRequest) (*empty.Empty, error)
func (*SentryServerImpl) PenalizePeer ¶
func (ss *SentryServerImpl) PenalizePeer(_ context.Context, req *proto_sentry.PenalizePeerRequest) (*empty.Empty, error)
func (*SentryServerImpl) ReceiveMessages ¶
func (ss *SentryServerImpl) ReceiveMessages(_ *emptypb.Empty, server proto_sentry.Sentry_ReceiveMessagesServer) error
func (*SentryServerImpl) ReceiveTxMessages ¶
func (ss *SentryServerImpl) ReceiveTxMessages(_ *emptypb.Empty, server proto_sentry.Sentry_ReceiveTxMessagesServer) error
func (*SentryServerImpl) ReceiveUploadMessages ¶
func (ss *SentryServerImpl) ReceiveUploadMessages(_ *emptypb.Empty, server proto_sentry.Sentry_ReceiveUploadMessagesServer) error
func (*SentryServerImpl) SendMessageById ¶
func (ss *SentryServerImpl) SendMessageById(_ context.Context, inreq *proto_sentry.SendMessageByIdRequest) (*proto_sentry.SentPeers, error)
func (*SentryServerImpl) SendMessageByMinBlock ¶
func (ss *SentryServerImpl) SendMessageByMinBlock(_ context.Context, inreq *proto_sentry.SendMessageByMinBlockRequest) (*proto_sentry.SentPeers, error)
func (*SentryServerImpl) SendMessageToAll ¶
func (ss *SentryServerImpl) SendMessageToAll(ctx context.Context, req *proto_sentry.OutboundMessageData) (*proto_sentry.SentPeers, error)
func (*SentryServerImpl) SendMessageToRandomPeers ¶
func (ss *SentryServerImpl) SendMessageToRandomPeers(ctx context.Context, req *proto_sentry.SendMessageToRandomPeersRequest) (*proto_sentry.SentPeers, error)
func (*SentryServerImpl) SetStatus ¶
func (ss *SentryServerImpl) SetStatus(_ context.Context, statusData *proto_sentry.StatusData) (*emptypb.Empty, error)