Documentation
¶
Index ¶
- Constants
- type Broadcast
- type Commit
- type Committed
- type FetchCommitted
- type Lbft
- func (lbft *Lbft) BroadcastConsensusChannel() <-chan *consensus.BroadcastConsensus
- func (lbft *Lbft) CommittedTxsChannel() <-chan *consensus.OutputTxs
- func (lbft *Lbft) Quorum() int
- func (lbft *Lbft) RecvConsensus(payload []byte)
- func (lbft *Lbft) Start()
- func (lbft *Lbft) Stop()
- func (lbft *Lbft) String() string
- type Message
- func (msg *Message) Deserialize(payload []byte) error
- func (m *Message) GetCommit() *Commit
- func (m *Message) GetCommitted() *Committed
- func (m *Message) GetFetchCommitted() *FetchCommitted
- func (m *Message) GetNullRequest() *NullRequest
- func (m *Message) GetPrePrepare() *PrePrepare
- func (m *Message) GetPrepare() *Prepare
- func (m *Message) GetRequestBatch() *RequestBatch
- func (m *Message) GetViewChange() *ViewChange
- func (msg *Message) Serialize() []byte
- type MessageType
- type NullRequest
- type Options
- type PrePrepare
- type Prepare
- type Request
- type RequestBatch
- type Serializer
- type Uint64Slice
- type ViewChange
Constants ¶
const EMPTYBLOCK = 1136160000
EMPTYBLOCK empty block id
const MINQUORUM = 3
MINQUORUM Define min quorum
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcast ¶
type Broadcast struct {
// contains filtered or unexported fields
}
Broadcast Define consensus data for broadcast
type Commit ¶
type Commit struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
PrimaryID string `protobuf:"bytes,2,opt,name=primaryID" json:"primaryID,omitempty"`
Chain string `protobuf:"bytes,3,opt,name=chain" json:"chain,omitempty"`
ReplicaID string `protobuf:"bytes,4,opt,name=replicaID" json:"replicaID,omitempty"`
SeqNo uint64 `protobuf:"varint,5,opt,name=seqNo" json:"seqNo,omitempty"`
Digest string `protobuf:"bytes,6,opt,name=digest" json:"digest,omitempty"`
Quorum uint64 `protobuf:"varint,7,opt,name=quorum" json:"quorum,omitempty"`
}
Commit Define struct
type Committed ¶
type Committed struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
PrimaryID string `protobuf:"bytes,2,opt,name=primaryID" json:"primaryID,omitempty"`
Chain string `protobuf:"bytes,3,opt,name=chain" json:"chain,omitempty"`
ReplicaID string `protobuf:"bytes,4,opt,name=replicaID" json:"replicaID,omitempty"`
SeqNo uint64 `protobuf:"varint,5,opt,name=seqNo" json:"seqNo,omitempty"`
RequestBatch *RequestBatch `protobuf:"bytes,6,opt,name=requestBatch" json:"requestBatch,omitempty"`
}
Committed Define struct
type FetchCommitted ¶
type FetchCommitted struct {
Chain string `protobuf:"bytes,1,opt,name=chain" json:"chain,omitempty"`
ReplicaID string `protobuf:"bytes,2,opt,name=replicaID" json:"replicaID,omitempty"`
SeqNo uint64 `protobuf:"varint,3,opt,name=seqNo" json:"seqNo,omitempty"`
}
FetchCommitted Define struct
type Lbft ¶
type Lbft struct {
// contains filtered or unexported fields
}
Lbft Define lbft consenter
func (*Lbft) BroadcastConsensusChannel ¶
func (lbft *Lbft) BroadcastConsensusChannel() <-chan *consensus.BroadcastConsensus
BroadcastConsensusChannel Broadcast consensus data
func (*Lbft) CommittedTxsChannel ¶
CommittedTxsChannel Commit block data
func (*Lbft) RecvConsensus ¶
RecvConsensus Receive consensus data for consenter
type Message ¶
type Message struct {
// Types that are valid to be assigned to Payload:
// *RequestBatch
// *PrePrepare
// *Prepare
// *Commit
// *Committed
// *FetchCommitted
// *Viewchange
// *NullReqest
Type MessageType
Payload []byte `protobuf_oneof:"payload"`
}
Message Define lbft message struct
func (*Message) Deserialize ¶
Deserialize Deserialize
func (*Message) GetFetchCommitted ¶
func (m *Message) GetFetchCommitted() *FetchCommitted
GetFetchCommitted
type MessageType ¶
type MessageType uint32
MessageType
const ( MESSAGEUNDEFINED MessageType = 0 MESSAGEREQUESTBATCH MessageType = 1 MESSAGEPREPREPARE MessageType = 2 MESSAGEPREPARE MessageType = 3 MESSAGECOMMIT MessageType = 4 MESSAGECOMMITTED MessageType = 5 MESSAGEFETCHCOMMITTED MessageType = 6 MESSAGEVIEWCHANGE MessageType = 11 MESSAGENULLREQUEST MessageType = 12 )
type NullRequest ¶
type NullRequest struct {
ReplicaID string `protobuf:"bytes,1,opt,name=replicaID" json:"replicaID,omitempty"`
Chain string `protobuf:"bytes,2,opt,name=chain" json:"chain,omitempty"`
PrimaryID string `protobuf:"bytes,3,opt,name=primaryID" json:"primaryID,omitempty"`
SeqNo uint64 `protobuf:"varint,5,opt,name=seqNo" json:"seqNo,omitempty"`
Height uint32 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"`
}
NullRequest Define struct
type Options ¶
type Options struct {
Chain string
ID string
Primary string
AutoVote bool
N int
Q int
K int
BlockSize int
BlockTimeout time.Duration
BlockInterval time.Duration
BlockDelay time.Duration // BlockDelay > BlockInterval > BlockTimeout
ViewChange time.Duration
ResendViewChange time.Duration
ViewChangePeriod time.Duration
NullRequest time.Duration
BufferSize int
MaxConcurrentNumFrom int
MaxConcurrentNumTo int
}
Options Define nbft options
func NewDefaultOptions ¶
func NewDefaultOptions() *Options
NewDefaultOptions Create nbft options with default value
type PrePrepare ¶
type PrePrepare struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
PrimaryID string `protobuf:"bytes,2,opt,name=primaryID" json:"primaryID,omitempty"`
Chain string `protobuf:"bytes,3,opt,name=chain" json:"chain,omitempty"`
ReplicaID string `protobuf:"bytes,4,opt,name=replicaID" json:"replicaID,omitempty"`
SeqNo uint64 `protobuf:"varint,5,opt,name=seqNo" json:"seqNo,omitempty"`
Digest string `protobuf:"bytes,6,opt,name=digest" json:"digest,omitempty"`
Quorum uint64 `protobuf:"varint,7,opt,name=quorum" json:"quorum,omitempty"`
Requests *RequestBatch `protobuf:"bytes,8,opt,name=requests" json:"requests,omitempty"`
}
PrePrepare Define struct
type Prepare ¶
type Prepare struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
PrimaryID string `protobuf:"bytes,2,opt,name=primaryID" json:"primaryID,omitempty"`
Chain string `protobuf:"bytes,3,opt,name=chain" json:"chain,omitempty"`
ReplicaID string `protobuf:"bytes,4,opt,name=replicaID" json:"replicaID,omitempty"`
SeqNo uint64 `protobuf:"varint,5,opt,name=seqNo" json:"seqNo,omitempty"`
Digest string `protobuf:"bytes,6,opt,name=digest" json:"digest,omitempty"`
Quorum uint64 `protobuf:"varint,7,opt,name=quorum" json:"quorum,omitempty"`
}
Prepare Define struct
type Request ¶
type Request struct {
Transaction *types.Transaction `protobuf:"bytes,2,opt,name=transaction,proto3" json:"transaction,omitempty"`
}
Request Define struct
type RequestBatch ¶
RequestBatch Define struct
type Serializer ¶
type Serializer interface {
Serialize() []byte
}
Serializer Supply Serialize() interface
type Uint64Slice ¶
type Uint64Slice []uint64
Uint64Slice sortable
func (Uint64Slice) Len ¶
func (us Uint64Slice) Len() int
func (Uint64Slice) Less ¶
func (us Uint64Slice) Less(i, j int) bool
func (Uint64Slice) Swap ¶
func (us Uint64Slice) Swap(i, j int)
type ViewChange ¶
type ViewChange struct {
ReplicaID string `protobuf:"bytes,1,opt,name=replicaID" json:"replicaID,omitempty"`
Chain string `protobuf:"bytes,2,opt,name=chain" json:"chain,omitempty"`
Priority int64 `protobuf:"varint,3,opt,name=priority" json:"priority,omitempty"`
PrimaryID string `protobuf:"bytes,4,opt,name=primaryID" json:"primaryID,omitempty"`
SeqNo uint64 `protobuf:"varint,5,opt,name=seqNo" json:"seqNo,omitempty"`
Height uint32 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"`
}
ViewChange Define struct