Documentation ¶
Overview ¶
Package sync provides block synchronization mechanism following the BFT protocol.
Index ¶
- Constants
- type Downloader
- type GetBlocksFromIDRequest
- func (e *GetBlocksFromIDRequest) Decode(data []byte) error
- func (e *GetBlocksFromIDRequest) DecodeFromReader(reader *codec.Reader) error
- func (e *GetBlocksFromIDRequest) DecodeStrict(data []byte) error
- func (e *GetBlocksFromIDRequest) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *GetBlocksFromIDRequest) Encode() []byte
- func (e *GetBlocksFromIDRequest) MustDecode(data []byte)
- type GetBlocksFromIDResponse
- func (e *GetBlocksFromIDResponse) Decode(data []byte) error
- func (e *GetBlocksFromIDResponse) DecodeFromReader(reader *codec.Reader) error
- func (e *GetBlocksFromIDResponse) DecodeStrict(data []byte) error
- func (e *GetBlocksFromIDResponse) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *GetBlocksFromIDResponse) Encode() []byte
- func (e *GetBlocksFromIDResponse) MustDecode(data []byte)
- type GetHighestCommonBlockRequest
- func (e *GetHighestCommonBlockRequest) Decode(data []byte) error
- func (e *GetHighestCommonBlockRequest) DecodeFromReader(reader *codec.Reader) error
- func (e *GetHighestCommonBlockRequest) DecodeStrict(data []byte) error
- func (e *GetHighestCommonBlockRequest) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *GetHighestCommonBlockRequest) Encode() []byte
- func (e *GetHighestCommonBlockRequest) MustDecode(data []byte)
- type GetHighestCommonBlockResponse
- func (e *GetHighestCommonBlockResponse) Decode(data []byte) error
- func (e *GetHighestCommonBlockResponse) DecodeFromReader(reader *codec.Reader) error
- func (e *GetHighestCommonBlockResponse) DecodeStrict(data []byte) error
- func (e *GetHighestCommonBlockResponse) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *GetHighestCommonBlockResponse) Encode() []byte
- func (e *GetHighestCommonBlockResponse) MustDecode(data []byte)
- type NodeInfo
- func (e *NodeInfo) Decode(data []byte) error
- func (e *NodeInfo) DecodeFromReader(reader *codec.Reader) error
- func (e *NodeInfo) DecodeStrict(data []byte) error
- func (e *NodeInfo) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *NodeInfo) Encode() []byte
- func (e *NodeInfo) MustDecode(data []byte)
- type SyncContext
- type Syncer
Constants ¶
View Source
const ( RPCEndpointGetLastBlock = "getLastBlock" RPCEndpointGetHighestCommonBlock = "getHighestCommonBlock" RPCEndpointGetBlocksFromID = "getBlocksFromId" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
func NewDownloader ¶
func NewDownloader( ctx context.Context, logger log.Logger, conn *p2p.Connection, chain *blockchain.Chain, peerID p2p.PeerID, startID []byte, startHeight uint32, endID []byte, endHeight uint32, ) *Downloader
func (*Downloader) Downloaded ¶
func (d *Downloader) Downloaded() <-chan *downloadedContent
func (*Downloader) Start ¶
func (d *Downloader) Start()
func (*Downloader) Stop ¶
func (d *Downloader) Stop()
type GetBlocksFromIDRequest ¶
func (*GetBlocksFromIDRequest) Decode ¶
func (e *GetBlocksFromIDRequest) Decode(data []byte) error
func (*GetBlocksFromIDRequest) DecodeFromReader ¶
func (e *GetBlocksFromIDRequest) DecodeFromReader(reader *codec.Reader) error
func (*GetBlocksFromIDRequest) DecodeStrict ¶
func (e *GetBlocksFromIDRequest) DecodeStrict(data []byte) error
func (*GetBlocksFromIDRequest) DecodeStrictFromReader ¶
func (e *GetBlocksFromIDRequest) DecodeStrictFromReader(reader *codec.Reader) error
func (*GetBlocksFromIDRequest) Encode ¶
func (e *GetBlocksFromIDRequest) Encode() []byte
func (*GetBlocksFromIDRequest) MustDecode ¶
func (e *GetBlocksFromIDRequest) MustDecode(data []byte)
type GetBlocksFromIDResponse ¶
type GetBlocksFromIDResponse struct {
Blocks []*blockchain.Block `json:"blocks" fieldNumber:"1"`
}
func (*GetBlocksFromIDResponse) Decode ¶
func (e *GetBlocksFromIDResponse) Decode(data []byte) error
func (*GetBlocksFromIDResponse) DecodeFromReader ¶
func (e *GetBlocksFromIDResponse) DecodeFromReader(reader *codec.Reader) error
func (*GetBlocksFromIDResponse) DecodeStrict ¶
func (e *GetBlocksFromIDResponse) DecodeStrict(data []byte) error
func (*GetBlocksFromIDResponse) DecodeStrictFromReader ¶
func (e *GetBlocksFromIDResponse) DecodeStrictFromReader(reader *codec.Reader) error
func (*GetBlocksFromIDResponse) Encode ¶
func (e *GetBlocksFromIDResponse) Encode() []byte
func (*GetBlocksFromIDResponse) MustDecode ¶
func (e *GetBlocksFromIDResponse) MustDecode(data []byte)
type GetHighestCommonBlockRequest ¶
type GetHighestCommonBlockRequest struct {
IDs [][]byte `json:"ids" fieldNumber:"1"`
}
func (*GetHighestCommonBlockRequest) Decode ¶
func (e *GetHighestCommonBlockRequest) Decode(data []byte) error
func (*GetHighestCommonBlockRequest) DecodeFromReader ¶
func (e *GetHighestCommonBlockRequest) DecodeFromReader(reader *codec.Reader) error
func (*GetHighestCommonBlockRequest) DecodeStrict ¶
func (e *GetHighestCommonBlockRequest) DecodeStrict(data []byte) error
func (*GetHighestCommonBlockRequest) DecodeStrictFromReader ¶
func (e *GetHighestCommonBlockRequest) DecodeStrictFromReader(reader *codec.Reader) error
func (*GetHighestCommonBlockRequest) Encode ¶
func (e *GetHighestCommonBlockRequest) Encode() []byte
func (*GetHighestCommonBlockRequest) MustDecode ¶
func (e *GetHighestCommonBlockRequest) MustDecode(data []byte)
type GetHighestCommonBlockResponse ¶
type GetHighestCommonBlockResponse struct {
ID []byte `json:"id" fieldNumber:"1"`
}
func (*GetHighestCommonBlockResponse) Decode ¶
func (e *GetHighestCommonBlockResponse) Decode(data []byte) error
func (*GetHighestCommonBlockResponse) DecodeFromReader ¶
func (e *GetHighestCommonBlockResponse) DecodeFromReader(reader *codec.Reader) error
func (*GetHighestCommonBlockResponse) DecodeStrict ¶
func (e *GetHighestCommonBlockResponse) DecodeStrict(data []byte) error
func (*GetHighestCommonBlockResponse) DecodeStrictFromReader ¶
func (e *GetHighestCommonBlockResponse) DecodeStrictFromReader(reader *codec.Reader) error
func (*GetHighestCommonBlockResponse) Encode ¶
func (e *GetHighestCommonBlockResponse) Encode() []byte
func (*GetHighestCommonBlockResponse) MustDecode ¶
func (e *GetHighestCommonBlockResponse) MustDecode(data []byte)
type NodeInfo ¶
func NewNodeInfo ¶
func (*NodeInfo) DecodeStrict ¶
func (*NodeInfo) DecodeStrictFromReader ¶
func (*NodeInfo) MustDecode ¶
type SyncContext ¶
type SyncContext struct { Ctx context.Context Block *blockchain.Block FinalizedBlockHeader *blockchain.BlockHeader PeerID p2p.PeerID CurrentValidators []codec.Lisk32 }
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer sync the block with network.
func NewSyncer ¶
func NewSyncer( chain *blockchain.Chain, blockslot *validator.BlockSlot, conn *p2p.Connection, logger log.Logger, processor processFn, reverter revertFn, ) *Syncer
func (*Syncer) HandleRPCEndpointGetBlocksFromID ¶
func (s *Syncer) HandleRPCEndpointGetBlocksFromID() p2p.RPCHandler
func (*Syncer) HandleRPCEndpointGetHighestCommonBlock ¶
func (s *Syncer) HandleRPCEndpointGetHighestCommonBlock() p2p.RPCHandler
func (*Syncer) HandleRPCEndpointGetLastBlock ¶
func (s *Syncer) HandleRPCEndpointGetLastBlock() p2p.RPCHandler
Click to show internal directories.
Click to hide internal directories.