Documentation ¶
Index ¶
- func BlockDataHash(b *cb.BlockData) []byte
- func NewBlock(seqNum uint64, previousHash []byte) *cb.Block
- type Config
- type DhtNode
- func (dhtn *DhtNode) Cut() []*cb.Envelope
- func (dhtn *DhtNode) DhtInsideTransBlock(block *cb.Block) error
- func (dhtn *DhtNode) Ordered(msg *cb.Envelope) (messageBatches [][]*cb.Envelope, pending bool)
- func (dhtn *DhtNode) PreCreateNextBlock(messages []*cb.Envelope) *cb.Block
- func (dhtn *DhtNode) PrevBlock(sendMsgChan chan *chord.Message)
- func (dhtn *DhtNode) TransPrevBlockClient() error
- type GrpcTransport
- type MainNode
- type OrdererConfigFetcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockDataHash ¶
Types ¶
type Config ¶
type Config struct { DialOpts []grpc.DialOption Timeout time.Duration // 作为WithTimeout()函数参数 MaxIdle time.Duration // 超过maxidle自动关闭连接 }
Client(outbound) dial config
type DhtNode ¶
type DhtNode struct { IsMainNode bool PendingBatchStartTime time.Time ChannelID string *chord.Node Transport *GrpcTransport // contains filtered or unexported fields }
func NewDhtNode ¶
NewDhtNode 创建DhtNode
func (*DhtNode) DhtInsideTransBlock ¶
func (*DhtNode) Ordered ¶
Ordered should be invoked sequentially as messages are ordered
messageBatches length: 0, pending: false
- impossible, as we have just received a message
messageBatches length: 0, pending: true
- no batch is cut and there are messages pending
messageBatches length: 1, pending: false
- the message count reaches BatchSize.MaxMessageCount
messageBatches length: 1, pending: true
- the current message will cause the pending batch size in bytes to exceed BatchSize.PreferredMaxBytes.
messageBatches length: 2, pending: false
- the current message size in bytes exceeds BatchSize.PreferredMaxBytes, therefore isolated in its own batch.
messageBatches length: 2, pending: true
- impossible
Note that messageBatches can not be greater than 2.
func (*DhtNode) PreCreateNextBlock ¶
CreateNextBlock creates a new block with the next block number, and the given contents.
func (*DhtNode) TransPrevBlockClient ¶
type GrpcTransport ¶
type GrpcTransport struct {
// contains filtered or unexported fields
}
func NewGrpcTransport ¶
func NewGrpcTransport() *GrpcTransport
func NewGrpcTransport(config *Config) (cm.ChordClient, error) {
func (*GrpcTransport) Start ¶
func (g *GrpcTransport) Start() error
func (*GrpcTransport) Stop ¶
func (g *GrpcTransport) Stop() error
Close all outbound connection in the pool
type MainNode ¶
type MainNode interface { StartDht(id string, address string) StartTransMsgServer(address string) StartTransBlockServer(address string) Stop() }
MainNode 主节点,负责接受Orderer的Msg,通过node的内部机制转发给其它DhtNode 接受其它DhtNode及自身的出块,排序后发送给Orderer
func NewMainNode ¶
NewMainNode 创建mainNode节点 其中会向Orderer询问配置,如果无法通信,则等待1分钟
type OrdererConfigFetcher ¶
type OrdererConfigFetcher interface {
OrdererConfig() (channelconfig.Orderer, bool)
}