Documentation
¶
Index ¶
- func NewRaftCluster(cfg *types.Consensus, sub []byte) queue.Module
- type BlockInfo
- type Client
- func (client *Client) CheckBlock(parent *types.Block, current *types.BlockDetail) error
- func (client *Client) CheckBlockInfo(info *BlockInfo) bool
- func (client *Client) Close()
- func (client *Client) CmpBestBlock(newBlock *types.Block, cmpBlock *types.Block) bool
- func (client *Client) CreateBlock()
- func (client *Client) CreateGenesisTx() (ret []*types.Transaction)
- func (client *Client) GetCurrentInfo() *BlockInfo
- func (client *Client) GetCurrentInfoHeight() int64
- func (client *Client) GetGenesisBlockTime() int64
- func (client *Client) ProcEvent(msg *queue.Message) bool
- func (client *Client) SetCurrentInfo(info *BlockInfo)
- func (client *Client) SetQueueClient(c queue.Client)
- type Node
- func (rc Node) IsIDRemoved(id uint64) bool
- func (rc Node) Process(ctx context.Context, m raftpb.Message) error
- func (rc Node) ReportSnapshot(id uint64, status raft.SnapshotStatus)
- func (rc Node) ReportUnreachable(id uint64)
- func (node *Node) SetClient(client *Client)
- func (rc Node) Status() raft.Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
*drivers.BaseClient
// contains filtered or unexported fields
}
Client Raft implementation
func NewBlockstore ¶
func NewBlockstore(ctx context.Context, cfg *types.Consensus, snapshotter *snap.Snapshotter, proposeC chan<- BlockInfo, commitC <-chan *BlockInfo, errorC <-chan error, validatorC <-chan bool, cancel context.CancelFunc) *Client
NewBlockstore create Raft Client
func (*Client) CheckBlock ¶
CheckBlock method
func (*Client) CheckBlockInfo ¶
CheckBlockInfo check corresponding block
func (*Client) CmpBestBlock ¶
比较newBlock是不是最优区块
func (*Client) CreateGenesisTx ¶
func (client *Client) CreateGenesisTx() (ret []*types.Transaction)
CreateGenesisTx get genesis tx
func (*Client) GetCurrentInfo ¶
GetCurrentInfo ...
func (*Client) GetCurrentInfoHeight ¶
GetCurrentInfoHeight ...
func (*Client) GetGenesisBlockTime ¶
GetGenesisBlockTime get genesis blocktime
func (*Client) SetCurrentInfo ¶
SetCurrentInfo ...
func (*Client) SetQueueClient ¶
SetQueueClient method
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func NewRaftNode ¶
func NewRaftNode(ctx context.Context, id int, join bool, peers []string, readOnlyPeers []string, addPeers []string, getSnapshot func() ([]byte, error), proposeC <-chan BlockInfo, confChangeC <-chan raftpb.ConfChange) (*Node, <-chan *BlockInfo, <-chan error, <-chan *snap.Snapshotter, <-chan bool)
NewRaftNode create raft node
func (Node) IsIDRemoved ¶
func (Node) ReportSnapshot ¶
func (rc Node) ReportSnapshot(id uint64, status raft.SnapshotStatus)
func (Node) ReportUnreachable ¶
func (rc Node) ReportUnreachable(id uint64)
Click to show internal directories.
Click to hide internal directories.