pbft

package
v6.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2019 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckPointPeriod uint32 = 128
	ConstantFactor   uint32 = 2
)

constant

Variables

This section is empty.

Functions

func EQ

func EQ(d1 []byte, d2 []byte) bool

EQ Digest

func NewPbft

func NewPbft(cfg *pb.Consensus, sub []byte) queue.Module

NewPbft create pbft cluster

func NewReplica

func NewReplica(id uint32, PeersURL string, addr string) (chan *pb.ClientReply, chan *pb.Request, bool)

NewReplica create Replica instance

func ReadMessage

func ReadMessage(conn io.Reader, msg proto.Message) error

ReadMessage read proto message

func RepDigest

func RepDigest(reply fmt.Stringer) []byte

RepDigest method

func ReqDigest

func ReqDigest(req *types.Request) []byte

ReqDigest method

func ToCheckpoint

func ToCheckpoint(sequence uint32, digest []byte) *types.Checkpoint

ToCheckpoint method

func ToEntry

func ToEntry(sequence uint32, digest []byte, view uint32) *types.Entry

ToEntry method

func ToReply

func ToReply(view uint32, timestamp, client string, replica uint32, result *types.Result) *types.ClientReply

ToReply method

func ToRequestAck

func ToRequestAck(view, replica, viewchanger uint32, digest []byte) *types.Request

ToRequestAck method

func ToRequestCheckpoint

func ToRequestCheckpoint(sequence uint32, digest []byte, replica uint32) *types.Request

ToRequestCheckpoint method

func ToRequestClient

func ToRequestClient(op *types.Operation, timestamp, client string) *types.Request

ToRequestClient method

func ToRequestCommit

func ToRequestCommit(view, sequence, replica uint32) *types.Request

ToRequestCommit method

func ToRequestNewView

func ToRequestNewView(view uint32, viewChanges []*types.ViewChange, summaries []*types.Summary, replica uint32) *types.Request

ToRequestNewView method

func ToRequestPrepare

func ToRequestPrepare(view, sequence uint32, digest []byte, replica uint32) *types.Request

ToRequestPrepare method

func ToRequestPreprepare

func ToRequestPreprepare(view, sequence uint32, digest []byte, replica uint32) *types.Request

ToRequestPreprepare method

func ToRequestViewChange

func ToRequestViewChange(view, sequence uint32, checkpoints []*types.Checkpoint, preps, prePreps []*types.Entry, replica uint32) *types.Request

ToRequestViewChange method

func ToSummary

func ToSummary(sequence uint32, digest []byte) *types.Summary

ToSummary method

func ToViewChange

func ToViewChange(viewchanger uint32, digest []byte) *types.ViewChange

ToViewChange method

func WriteMessage

func WriteMessage(addr string, msg proto.Message) error

WriteMessage write proto message

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

func (client *Client) CheckBlock(parent *types.Block, current *types.BlockDetail) error

CheckBlock method

func (*Client) CreateBlock

func (client *Client) CreateBlock()

CreateBlock method

func (*Client) CreateGenesisTx

func (client *Client) CreateGenesisTx() (ret []*types.Transaction)

CreateGenesisTx get genesis tx

func (*Client) GetGenesisBlockTime

func (client *Client) GetGenesisBlockTime() int64

GetGenesisBlockTime get genesis blocktime

func (*Client) ProcEvent

func (client *Client) ProcEvent(msg queue.Message) bool

ProcEvent method

func (*Client) Propose

func (client *Client) Propose(block *types.Block)

Propose method

func (*Client) SetQueueClient

func (client *Client) SetQueueClient(c queue.Client)

SetQueueClient method

type Replica

type Replica struct {
	ID uint32
	// contains filtered or unexported fields
}

Replica struct

func (*Replica) Startnode

func (rep *Replica) Startnode(addr string)

Startnode method

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL