Documentation ¶
Index ¶
- Constants
- func EQ(d1 []byte, d2 []byte) bool
- func NewPbft(cfg *pb.Consensus, sub []byte) queue.Module
- func NewReplica(id uint32, PeersURL string, addr string) (chan *pb.ClientReply, chan *pb.Request, bool)
- func ReadMessage(conn io.Reader, msg proto.Message) error
- func RepDigest(reply fmt.Stringer) []byte
- func ReqDigest(req *types.Request) []byte
- func ToCheckpoint(sequence uint32, digest []byte) *types.Checkpoint
- func ToEntry(sequence uint32, digest []byte, view uint32) *types.Entry
- func ToReply(view uint32, timestamp, client string, replica uint32, result *types.Result) *types.ClientReply
- func ToRequestAck(view, replica, viewchanger uint32, digest []byte) *types.Request
- func ToRequestCheckpoint(sequence uint32, digest []byte, replica uint32) *types.Request
- func ToRequestClient(op *types.Operation, timestamp, client string) *types.Request
- func ToRequestCommit(view, sequence, replica uint32) *types.Request
- func ToRequestNewView(view uint32, viewChanges []*types.ViewChange, summaries []*types.Summary, ...) *types.Request
- func ToRequestPrepare(view, sequence uint32, digest []byte, replica uint32) *types.Request
- func ToRequestPreprepare(view, sequence uint32, digest []byte, replica uint32) *types.Request
- func ToRequestViewChange(view, sequence uint32, checkpoints []*types.Checkpoint, ...) *types.Request
- func ToSummary(sequence uint32, digest []byte) *types.Summary
- func ToViewChange(viewchanger uint32, digest []byte) *types.ViewChange
- func WriteMessage(addr string, msg proto.Message) error
- type Client
- func (client *Client) CheckBlock(parent *types.Block, current *types.BlockDetail) error
- 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) GetGenesisBlockTime() int64
- func (client *Client) ProcEvent(msg *queue.Message) bool
- func (client *Client) Propose(block *types.Block)
- func (client *Client) SetQueueClient(c queue.Client)
- type Replica
Constants ¶
View Source
const ( CheckPointPeriod uint32 = 128 ConstantFactor uint32 = 2 )
constant
Variables ¶
This section is empty.
Functions ¶
func NewReplica ¶
func NewReplica(id uint32, PeersURL string, addr string) (chan *pb.ClientReply, chan *pb.Request, bool)
NewReplica create Replica instance
func ReadMessage ¶
ReadMessage read proto message
func ToCheckpoint ¶
func ToCheckpoint(sequence uint32, digest []byte) *types.Checkpoint
ToCheckpoint method
func ToReply ¶
func ToReply(view uint32, timestamp, client string, replica uint32, result *types.Result) *types.ClientReply
ToReply method
func ToRequestAck ¶
ToRequestAck method
func ToRequestCheckpoint ¶
ToRequestCheckpoint method
func ToRequestClient ¶
ToRequestClient method
func ToRequestCommit ¶
ToRequestCommit method
func ToRequestNewView ¶
func ToRequestNewView(view uint32, viewChanges []*types.ViewChange, summaries []*types.Summary, replica uint32) *types.Request
ToRequestNewView method
func ToRequestPrepare ¶
ToRequestPrepare method
func ToRequestPreprepare ¶
ToRequestPreprepare method
func ToRequestViewChange ¶
func ToRequestViewChange(view, sequence uint32, checkpoints []*types.Checkpoint, preps, prePreps []*types.Entry, replica uint32) *types.Request
ToRequestViewChange method
func ToViewChange ¶
func ToViewChange(viewchanger uint32, digest []byte) *types.ViewChange
ToViewChange method
Types ¶
type Client ¶
type Client struct { *drivers.BaseClient // contains filtered or unexported fields }
Client Pbft implementation
func NewBlockstore ¶
func NewBlockstore(cfg *types.Consensus, replyChan chan *types.ClientReply, requestChan chan *types.Request, isPrimary bool) *Client
NewBlockstore create Pbft Client
func (*Client) CheckBlock ¶
CheckBlock method
func (*Client) CmpBestBlock ¶
CmpBestBlock 比较newBlock是不是最优区块
func (*Client) CreateGenesisTx ¶
func (client *Client) CreateGenesisTx() (ret []*types.Transaction)
CreateGenesisTx get genesis tx
func (*Client) GetGenesisBlockTime ¶
GetGenesisBlockTime get genesis blocktime
func (*Client) SetQueueClient ¶
SetQueueClient method
Click to show internal directories.
Click to hide internal directories.