Documentation ¶
Index ¶
- Constants
- type BlockAndPeer
- type Downloader
- func (d *Downloader) AddEpochBlockHashesResponse(data *protos.EpochBlockHashesResponse, peer *Peer)
- func (d *Downloader) AddPeer(p *Peer)
- func (d *Downloader) BlockDownloader(targetSlotNumbers []*HashesAndPeerInfo, lastBlockHeaderToDownload common.Hash, ...)
- func (d *Downloader) Consumer(lastBlockHeaderToDownload common.Hash, peerGroup []*Peer)
- func (d *Downloader) DownloadMonitor()
- func (d *Downloader) Exit()
- func (d *Downloader) Initialize(peerGroup []*Peer, startingNonFinalizedEpoch uint64, ...)
- func (d *Downloader) RemovePeer(p *Peer) bool
- func (d *Downloader) RequestForBlock(targetSlotNumbers []*HashesAndPeerInfo, nextIndexForRequest int, ...) (int, int, error)
- type EBHRespInfo
- type HashesAndPeerInfo
- type MRDataConn
- type MessageReceipt
- func (mr *MessageReceipt) Get(messageHash []byte) *protos.LegacyMessage
- func (mr *MessageReceipt) GetHashMsg(msgHash string) (value *protos.LegacyMessage, ok bool)
- func (mr *MessageReceipt) GetRequestedHash(msgHash string) (value *MessageRequest, ok bool)
- func (mr *MessageReceipt) IsRequested(msgHashBytes common.Hash, peer *Peer) bool
- func (mr *MessageReceipt) Register(msgHash string, msg *protos.LegacyMessage)
- func (mr *MessageReceipt) RemoveRequestedHash(msgHash string)
- type MessageRequest
- type Msg
- type OrderedMap
- type OutgoingMessage
- type Peer
- func (p *Peer) ChainState() *protos.NodeChainState
- func (p *Peer) Disconnect()
- func (p *Peer) GetEpochToBeRequested() uint64
- func (p *Peer) GetTotalStakeAmount() []byte
- func (p *Peer) HandleAttestTransaction(msg *Msg, txData *protos.ProtocolTransactionData) error
- func (p *Peer) HandleBlock(pbBlock *protos.Block)
- func (p *Peer) HandleBlockForAttestation(pbBlock *protos.Block, signature []byte)
- func (p *Peer) HandleChainState(nodeChainState *protos.NodeChainState)
- func (p *Peer) HandleTransaction(msg *Msg, txData *protos.Transaction) error
- func (p *Peer) ID() string
- func (p *Peer) IP() string
- func (p *Peer) IncreaseEpochToBeRequested()
- func (p *Peer) ReadMsg() (msg *Msg, size uint32, err error)
- func (p *Peer) Send(msg *Msg) error
- func (p *Peer) SendEBHReq(epoch uint64, finalizedHeaderHash []byte) error
- func (p *Peer) SendFetchBlock(blockHeaderHash common.Hash) error
- func (p *Peer) SendNext() error
- func (p *Peer) SendPeerList()
- func (p *Peer) SendSync()
- func (p *Peer) SendVersion()
- func (p *Peer) UpdateEpochToBeRequested(epoch uint64)
- type PeerIPWithPLData
- type PriorityQueue
- type RequestTracker
- func (r *RequestTracker) AddPeerRequest(headerHash string, peer *Peer)
- func (r *RequestTracker) GetPeerByHeaderHash(headerHash string) (*Peer, bool)
- func (r *RequestTracker) GetSequenceByIndex(index int) string
- func (r *RequestTracker) RemoveFirstElementFromSequence()
- func (r *RequestTracker) RemoveRequestKey(headerHash string)
- func (r *RequestTracker) TotalRequest() int
- type Server
- func (srv *Server) BlockReceived(peer *Peer, b *block.Block)
- func (srv *Server) BroadcastAttestationTransaction(attestTx *transactions.Attest, slotNumber uint64, blockProposer []byte, ...)
- func (srv *Server) BroadcastBlock(block *block.Block)
- func (srv *Server) BroadcastBlockForAttestation(block *block.Block, signature []byte)
- func (srv *Server) ConnectPeer(dest string) error
- func (srv *Server) ConnectPeers() error
- func (srv *Server) GetAttestationReceivedForBlock() chan *transactions.Attest
- func (srv *Server) GetBlockReceivedForAttestation() chan *block.Block
- func (srv *Server) GetRegisterAndBroadcastChan() chan *messages.RegisterMessage
- func (srv *Server) HandleTransaction(mrDataConn *MRDataConn)
- func (srv *Server) RequestFullMessage(mrData *protos.MRData)
- func (srv *Server) Start(keys crypto.PrivKey) (err error)
- func (srv *Server) Stop() (err error)
- func (srv *Server) UpdatePeerList(p *PeerIPWithPLData) error
Constants ¶
View Source
const MaxRequest = 40 // Size has to be calculated based on maximum possible values on Queue
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockAndPeer ¶
type BlockAndPeer struct {
// contains filtered or unexported fields
}
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
func NewDownloader ¶
func NewDownloader(c *chain.Chain) (d *Downloader)
func (*Downloader) AddEpochBlockHashesResponse ¶
func (d *Downloader) AddEpochBlockHashesResponse(data *protos.EpochBlockHashesResponse, peer *Peer)
func (*Downloader) AddPeer ¶
func (d *Downloader) AddPeer(p *Peer)
func (*Downloader) BlockDownloader ¶
func (d *Downloader) BlockDownloader(targetSlotNumbers []*HashesAndPeerInfo, lastBlockHeaderToDownload common.Hash, peerGroup []*Peer)
func (*Downloader) Consumer ¶
func (d *Downloader) Consumer(lastBlockHeaderToDownload common.Hash, peerGroup []*Peer)
func (*Downloader) DownloadMonitor ¶
func (d *Downloader) DownloadMonitor()
func (*Downloader) Exit ¶
func (d *Downloader) Exit()
func (*Downloader) Initialize ¶
func (d *Downloader) Initialize(peerGroup []*Peer, startingNonFinalizedEpoch uint64, finalizedHeaderHash common.Hash)
func (*Downloader) RemovePeer ¶
func (d *Downloader) RemovePeer(p *Peer) bool
func (*Downloader) RequestForBlock ¶
func (d *Downloader) RequestForBlock(targetSlotNumbers []*HashesAndPeerInfo, nextIndexForRequest int, numberOfRequests int) (int, int, error)
type EBHRespInfo ¶
type EBHRespInfo struct { Data *protos.EpochBlockHashesResponse Timestamp uint64 }
type HashesAndPeerInfo ¶
type HashesAndPeerInfo struct {
// contains filtered or unexported fields
}
type MRDataConn ¶
type MRDataConn struct {
// contains filtered or unexported fields
}
type MessageReceipt ¶
type MessageReceipt struct {
// contains filtered or unexported fields
}
func CreateMR ¶
func CreateMR() (mr *MessageReceipt)
func (*MessageReceipt) Get ¶
func (mr *MessageReceipt) Get(messageHash []byte) *protos.LegacyMessage
func (*MessageReceipt) GetHashMsg ¶
func (mr *MessageReceipt) GetHashMsg(msgHash string) (value *protos.LegacyMessage, ok bool)
func (*MessageReceipt) GetRequestedHash ¶
func (mr *MessageReceipt) GetRequestedHash(msgHash string) (value *MessageRequest, ok bool)
func (*MessageReceipt) IsRequested ¶
func (mr *MessageReceipt) IsRequested(msgHashBytes common.Hash, peer *Peer) bool
func (*MessageReceipt) Register ¶
func (mr *MessageReceipt) Register(msgHash string, msg *protos.LegacyMessage)
func (*MessageReceipt) RemoveRequestedHash ¶
func (mr *MessageReceipt) RemoveRequestedHash(msgHash string)
type MessageRequest ¶
type MessageRequest struct {
// contains filtered or unexported fields
}
func CreateMessageRequest ¶
func CreateMessageRequest(mrData *protos.MRData, peer *Peer) (messageRequest *MessageRequest)
func (*MessageRequest) GetPeer ¶
func (messageRequest *MessageRequest) GetPeer() *Peer
func (*MessageRequest) GetRequested ¶
func (messageRequest *MessageRequest) GetRequested() bool
func (*MessageRequest) SetPeer ¶
func (messageRequest *MessageRequest) SetPeer(peer *Peer, value bool)
func (*MessageRequest) SetRequested ¶
func (messageRequest *MessageRequest) SetRequested(value bool)
type OrderedMap ¶
type OrderedMap struct {
// contains filtered or unexported fields
}
func (*OrderedMap) Delete ¶
func (o *OrderedMap) Delete(k string)
func (*OrderedMap) Get ¶
func (o *OrderedMap) Get(k string) *MessageRequest
func (*OrderedMap) Put ¶
func (o *OrderedMap) Put(k string, v *MessageRequest)
type OutgoingMessage ¶
type OutgoingMessage struct {
// contains filtered or unexported fields
}
func CreateOutgoingMessage ¶
func CreateOutgoingMessage(priority uint64, msg *protos.LegacyMessage) *OutgoingMessage
func (*OutgoingMessage) IsExpired ¶
func (o *OutgoingMessage) IsExpired() bool
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) ChainState ¶
func (p *Peer) ChainState() *protos.NodeChainState
func (*Peer) Disconnect ¶
func (p *Peer) Disconnect()
func (*Peer) GetEpochToBeRequested ¶
func (*Peer) GetTotalStakeAmount ¶
func (*Peer) HandleAttestTransaction ¶
func (p *Peer) HandleAttestTransaction(msg *Msg, txData *protos.ProtocolTransactionData) error
func (*Peer) HandleBlock ¶
func (*Peer) HandleBlockForAttestation ¶
func (*Peer) HandleChainState ¶
func (p *Peer) HandleChainState(nodeChainState *protos.NodeChainState)
func (*Peer) HandleTransaction ¶
func (p *Peer) HandleTransaction(msg *Msg, txData *protos.Transaction) error
func (*Peer) IncreaseEpochToBeRequested ¶
func (p *Peer) IncreaseEpochToBeRequested()
func (*Peer) SendPeerList ¶
func (p *Peer) SendPeerList()
func (*Peer) SendVersion ¶
func (p *Peer) SendVersion()
func (*Peer) UpdateEpochToBeRequested ¶
type PeerIPWithPLData ¶
type PriorityQueue ¶
type PriorityQueue []*OutgoingMessage
func (PriorityQueue) Full ¶
func (pq PriorityQueue) Full() bool
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (*PriorityQueue) RemoveExpiredMessages ¶
func (pq *PriorityQueue) RemoveExpiredMessages()
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
type RequestTracker ¶
type RequestTracker struct {
// contains filtered or unexported fields
}
func NewRequestTracker ¶
func NewRequestTracker() *RequestTracker
func (*RequestTracker) AddPeerRequest ¶
func (r *RequestTracker) AddPeerRequest(headerHash string, peer *Peer)
func (*RequestTracker) GetPeerByHeaderHash ¶
func (r *RequestTracker) GetPeerByHeaderHash(headerHash string) (*Peer, bool)
func (*RequestTracker) GetSequenceByIndex ¶
func (r *RequestTracker) GetSequenceByIndex(index int) string
func (*RequestTracker) RemoveFirstElementFromSequence ¶
func (r *RequestTracker) RemoveFirstElementFromSequence()
func (*RequestTracker) RemoveRequestKey ¶
func (r *RequestTracker) RemoveRequestKey(headerHash string)
func (*RequestTracker) TotalRequest ¶
func (r *RequestTracker) TotalRequest() int
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) BroadcastAttestationTransaction ¶
func (*Server) BroadcastBlock ¶
func (*Server) BroadcastBlockForAttestation ¶
func (*Server) ConnectPeer ¶
func (*Server) ConnectPeers ¶
func (*Server) GetAttestationReceivedForBlock ¶
func (srv *Server) GetAttestationReceivedForBlock() chan *transactions.Attest
func (*Server) GetBlockReceivedForAttestation ¶
func (*Server) GetRegisterAndBroadcastChan ¶
func (srv *Server) GetRegisterAndBroadcastChan() chan *messages.RegisterMessage
func (*Server) HandleTransaction ¶
func (srv *Server) HandleTransaction(mrDataConn *MRDataConn)
func (*Server) RequestFullMessage ¶
func (*Server) UpdatePeerList ¶
func (srv *Server) UpdatePeerList(p *PeerIPWithPLData) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.