Documentation
¶
Index ¶
- Constants
- func GetEngine(coord peer.MessageHandlerCoordinator) (peer.Engine, error)
- func NewConsensusHandler(coord peer.MessageHandlerCoordinator, stream peer.ChatStream, ...) (peer.MessageHandler, error)
- type ConsensusHandler
- type EngineImpl
- type Helper
- func (h *Helper) BeginTxBatch(id interface{}) error
- func (h *Helper) Broadcast(msg *pb.Message, peerType pb.PeerEndpoint_Type) error
- func (h *Helper) Commit(tag interface{}, metadata []byte)
- func (h *Helper) CommitTxBatch(id interface{}, metadata []byte) (*pb.Block, error)
- func (h *Helper) Committed(tag interface{}, target *pb.BlockchainInfo)
- func (h *Helper) ExecTxs(id interface{}, txs []*pb.Transaction) ([]byte, error)
- func (h *Helper) Execute(tag interface{}, txs []*pb.Transaction)
- func (h *Helper) Executed(tag interface{})
- func (h *Helper) GetBlock(blockNumber uint64) (block *pb.Block, err error)
- func (h *Helper) GetBlockHeadMetadata() ([]byte, error)
- func (h *Helper) GetBlockchainInfo() *pb.BlockchainInfo
- func (h *Helper) GetBlockchainInfoBlob() []byte
- func (h *Helper) GetBlockchainSize() uint64
- func (h *Helper) GetCurrentStateHash() (stateHash []byte, err error)
- func (h *Helper) GetNetworkHandles() (self *pb.PeerID, network []*pb.PeerID, err error)
- func (h *Helper) GetNetworkInfo() (self *pb.PeerEndpoint, network []*pb.PeerEndpoint, err error)
- func (h *Helper) Halt()
- func (h *Helper) InvalidateState()
- func (h *Helper) PreviewCommitTxBatch(id interface{}, metadata []byte) ([]byte, error)
- func (h *Helper) Rollback(tag interface{})
- func (h *Helper) RollbackTxBatch(id interface{}) error
- func (h *Helper) RolledBack(tag interface{})
- func (h *Helper) Sign(msg []byte) ([]byte, error)
- func (h *Helper) Start()
- func (h *Helper) StateUpdated(tag interface{}, target *pb.BlockchainInfo)
- func (h *Helper) Unicast(msg *pb.Message, receiverHandle *pb.PeerID) error
- func (h *Helper) UpdateState(tag interface{}, target *pb.BlockchainInfo, peers []*pb.PeerID)
- func (h *Helper) ValidateState()
- func (h *Helper) Verify(replicaID *pb.PeerID, signature []byte, message []byte) error
Constants ¶
const ( // DefaultConsensusQueueSize value of 1000 DefaultConsensusQueueSize int = 1000 )
Variables ¶
This section is empty.
Functions ¶
func GetEngine ¶
func GetEngine(coord peer.MessageHandlerCoordinator) (peer.Engine, error)
GetEngine returns initialized peer.Engine
func NewConsensusHandler ¶
func NewConsensusHandler(coord peer.MessageHandlerCoordinator, stream peer.ChatStream, initiatedStream bool) (peer.MessageHandler, error)
NewConsensusHandler constructs a new MessageHandler for the plugin. Is instance of peer.HandlerFactory
Types ¶
type ConsensusHandler ¶
type ConsensusHandler struct { peer.MessageHandler // contains filtered or unexported fields }
ConsensusHandler handles consensus messages. It also implements the Stack.
func (*ConsensusHandler) HandleMessage ¶
func (handler *ConsensusHandler) HandleMessage(msg *pb.Message) error
HandleMessage handles the incoming Fabric messages for the Peer
type EngineImpl ¶
type EngineImpl struct {
// contains filtered or unexported fields
}
EngineImpl implements a struct to hold consensus.Consenter, PeerEndpoint and MessageFan
func (*EngineImpl) GetHandlerFactory ¶
func (eng *EngineImpl) GetHandlerFactory() peer.HandlerFactory
GetHandlerFactory returns new NewConsensusHandler
func (*EngineImpl) ProcessTransactionMsg ¶
func (eng *EngineImpl) ProcessTransactionMsg(msg *pb.Message, tx *pb.Transaction) (response *pb.Response)
ProcessTransactionMsg processes a Message in context of a Transaction
type Helper ¶
Helper contains the reference to the peer's MessageHandlerCoordinator
func NewHelper ¶
func NewHelper(mhc peer.MessageHandlerCoordinator) *Helper
NewHelper constructs the consensus helper object
func (*Helper) BeginTxBatch ¶
BeginTxBatch gets invoked when the next round of transaction-batch execution begins
func (*Helper) Broadcast ¶
Broadcast sends a message to all validating peers
func (*Helper) Commit ¶
Commit will commit whatever transactions have been executed
func (*Helper) CommitTxBatch ¶
CommitTxBatch gets invoked when the current transaction-batch needs to be committed. This function returns successfully iff the transactions details and state changes (that may have happened during execution of this transaction-batch) have been committed to permanent storage.
func (*Helper) Committed ¶
func (h *Helper) Committed(tag interface{}, target *pb.BlockchainInfo)
Committed is called whenever Commit completes
func (*Helper) ExecTxs ¶
func (h *Helper) ExecTxs(id interface{}, txs []*pb.Transaction) ([]byte, error)
ExecTxs executes all the transactions listed in the txs array one-by-one. If all the executions are successful, it returns the candidate global state hash, and nil error array.
func (*Helper) Execute ¶
func (h *Helper) Execute(tag interface{}, txs []*pb.Transaction)
Execute will execute a set of transactions, this may be called in succession
func (*Helper) Executed ¶
func (h *Helper) Executed(tag interface{})
Executed is called whenever Execute completes
func (*Helper) GetBlock ¶
GetBlock returns a block from the chain
func (*Helper) GetBlockHeadMetadata ¶
GetBlockHeadMetadata returns metadata from block at the head of the blockchain
func (*Helper) GetBlockchainInfo ¶
func (h *Helper) GetBlockchainInfo() *pb.BlockchainInfo
GetBlockchainInfo gets the ledger's BlockchainInfo
func (*Helper) GetBlockchainInfoBlob ¶
GetBlockchainInfoBlob marshals a ledger's BlockchainInfo into a protobuf
func (*Helper) GetBlockchainSize ¶
GetBlockchainSize returns the current size of the blockchain
func (*Helper) GetCurrentStateHash ¶
GetCurrentStateHash returns the current/temporary state hash
func (*Helper) GetNetworkHandles ¶
GetNetworkHandles returns the PeerIDs of the current validator and the entire validating network
func (*Helper) GetNetworkInfo ¶
func (h *Helper) GetNetworkInfo() (self *pb.PeerEndpoint, network []*pb.PeerEndpoint, err error)
GetNetworkInfo returns the PeerEndpoints of the current validator and the entire validating network
func (*Helper) Halt ¶
func (h *Helper) Halt()
Halt is a byproduct of the consensus API needing some cleaning, for now it's a no-op
func (*Helper) InvalidateState ¶
func (h *Helper) InvalidateState()
InvalidateState is invoked to tell us that consensus realizes the ledger is out of sync
func (*Helper) PreviewCommitTxBatch ¶
PreviewCommitTxBatch retrieves a preview of the block info blob (as returned by GetBlockchainInfoBlob) that would describe the blockchain if CommitTxBatch were invoked. The blockinfo will change if additional ExecTXs calls are invoked.
func (*Helper) Rollback ¶
func (h *Helper) Rollback(tag interface{})
Rollback will roll back whatever transactions have been executed
func (*Helper) RollbackTxBatch ¶
RollbackTxBatch discards all the state changes that may have taken place during the execution of current transaction-batch
func (*Helper) RolledBack ¶
func (h *Helper) RolledBack(tag interface{})
RolledBack is called whenever a Rollback completes
func (*Helper) Sign ¶
Sign a message with this validator's signing key
func (*Helper) Start ¶
func (h *Helper) Start()
Start his is a byproduct of the consensus API needing some cleaning, for now it's a no-op
func (*Helper) StateUpdated ¶
func (h *Helper) StateUpdated(tag interface{}, target *pb.BlockchainInfo)
StateUpdated is called when state transfer completes, if target is nil, this indicates a failure and a new target should be supplied
func (*Helper) Unicast ¶
Unicast sends a message to a specified receiver
func (*Helper) UpdateState ¶
func (h *Helper) UpdateState(tag interface{}, target *pb.BlockchainInfo, peers []*pb.PeerID)
UpdateState attempts to synchronize state to a particular target, implicitly calls rollback if needed
func (*Helper) ValidateState ¶
func (h *Helper) ValidateState()
ValidateState is invoked to tell us that consensus has the ledger back in sync
func (*Helper) Verify ¶
Verify that the given signature is valid under the given replicaID's verification key If replicaID is nil, use this validator's verification key If the signature is valid, the function should return nil
Source Files
¶
- engine.go
- handler.go
- helper.go