{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v0.6.1-preview","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package helper\n\n## Constants\n\n```go\nconst (\n\t// DefaultConsensusQueueSize value of 1000\n\tDefaultConsensusQueueSize int = 1000\n)\n```\n\n## Functions\n\n```go\nfunc GetEngine(coord peer.MessageHandlerCoordinator) (peer.Engine, error)\n```\nGetEngine returns initialized peer.Engine\n\n```go\nfunc NewConsensusHandler(coord peer.MessageHandlerCoordinator,\n\tstream peer.ChatStream, initiatedStream bool) (peer.MessageHandler, error)\n```\nNewConsensusHandler constructs a new MessageHandler for the plugin. Is instance of peer.HandlerFactory\n\n## Types\n\n```go\ntype ConsensusHandler struct {\n\tpeer.MessageHandler\n\t// contains filtered or unexported fields\n}\n```\nConsensusHandler handles consensus messages. It also implements the Stack.\n\n```go\nfunc (handler *ConsensusHandler) HandleMessage(msg *pb.Message) error\n```\nHandleMessage handles the incoming Fabric messages for the Peer\n\n```go\ntype EngineImpl struct {\n\t// contains filtered or unexported fields\n}\n```\nEngineImpl implements a struct to hold consensus.Consenter, PeerEndpoint and MessageFan\n\n```go\nfunc (eng *EngineImpl) GetHandlerFactory() peer.HandlerFactory\n```\nGetHandlerFactory returns new NewConsensusHandler\n\n```go\nfunc (eng *EngineImpl) ProcessTransactionMsg(msg *pb.Message, tx *pb.Transaction) (response *pb.Response)\n```\nProcessTransactionMsg processes a Message in context of a Transaction\n\n```go\ntype Helper struct {\n\tpersist.Helper\n\t// contains filtered or unexported fields\n}\n```\nHelper contains the reference to the peer's MessageHandlerCoordinator\n\n```go\nfunc NewHelper(mhc peer.MessageHandlerCoordinator) *Helper\n```\nNewHelper constructs the consensus helper object\n\n```go\nfunc (h *Helper) BeginTxBatch(id interface{}) error\n```\nBeginTxBatch gets invoked when the next round of transaction-batch execution begins\n\n```go\nfunc (h *Helper) Broadcast(msg *pb.Message, peerType pb.PeerEndpoint_Type) error\n```\nBroadcast sends a message to all validating peers\n\n```go\nfunc (h *Helper) Commit(tag interface{}, metadata []byte)\n```\nCommit will commit whatever transactions have been executed\n\n```go\nfunc (h *Helper) CommitTxBatch(id interface{}, metadata []byte) (*pb.Block, error)\n```\nCommitTxBatch 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.\n\n```go\nfunc (h *Helper) Committed(tag interface{}, target *pb.BlockchainInfo)\n```\nCommitted is called whenever Commit completes\n\n```go\nfunc (h *Helper) ExecTxs(id interface{}, txs []*pb.Transaction) ([]byte, error)\n```\nExecTxs 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.\n\n```go\nfunc (h *Helper) Execute(tag interface{}, txs []*pb.Transaction)\n```\nExecute will execute a set of transactions, this may be called in succession\n\n```go\nfunc (h *Helper) Executed(tag interface{})\n```\nExecuted is called whenever Execute completes\n\n```go\nfunc (h *Helper) GetBlock(blockNumber uint64) (block *pb.Block, err error)\n```\nGetBlock returns a block from the chain\n\n```go\nfunc (h *Helper) GetBlockHeadMetadata() ([]byte, error)\n```\nGetBlockHeadMetadata returns metadata from block at the head of the blockchain\n\n```go\nfunc (h *Helper) GetBlockchainInfo() *pb.BlockchainInfo\n```\nGetBlockchainInfo gets the ledger's BlockchainInfo\n\n```go\nfunc (h *Helper) GetBlockchainInfoBlob() []byte\n```\nGetBlockchainInfoBlob marshals a ledger's BlockchainInfo into a protobuf\n\n```go\nfunc (h *Helper) GetBlockchainSize() uint64\n```\nGetBlockchainSize returns the current size of the blockchain\n\n```go\nfunc (h *Helper) GetCurrentStateHash() (stateHash []byte, err error)\n```\nGetCurrentStateHash returns the current/temporary state hash\n\n```go\nfunc (h *Helper) GetNetworkHandles() (self *pb.PeerID, network []*pb.PeerID, err error)\n```\nGetNetworkHandles returns the PeerIDs of the current validator and the entire validating network\n\n```go\nfunc (h *Helper) GetNetworkInfo() (self *pb.PeerEndpoint, network []*pb.PeerEndpoint, err error)\n```\nGetNetworkInfo returns the PeerEndpoints of the current validator and the entire validating network\n\n```go\nfunc (h *Helper) Halt()\n```\nHalt is a byproduct of the consensus API needing some cleaning, for now it's a no-op\n\n```go\nfunc (h *Helper) InvalidateState()\n```\nInvalidateState is invoked to tell us that consensus realizes the ledger is out of sync\n\n```go\nfunc (h *Helper) PreviewCommitTxBatch(id interface{}, metadata []byte) ([]byte, error)\n```\nPreviewCommitTxBatch 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.\n\n```go\nfunc (h *Helper) Rollback(tag interface{})\n```\nRollback will roll back whatever transactions have been executed\n\n```go\nfunc (h *Helper) RollbackTxBatch(id interface{}) error\n```\nRollbackTxBatch discards all the state changes that may have taken place during the execution of current transaction-batch\n\n```go\nfunc (h *Helper) RolledBack(tag interface{})\n```\nRolledBack is called whenever a Rollback completes\n\n```go\nfunc (h *Helper) Sign(msg []byte) ([]byte, error)\n```\nSign a message with this validator's signing key\n\n```go\nfunc (h *Helper) Start()\n```\nStart his is a byproduct of the consensus API needing some cleaning, for now it's a no-op\n\n```go\nfunc (h *Helper) StateUpdated(tag interface{}, target *pb.BlockchainInfo)\n```\nStateUpdated is called when state transfer completes, if target is nil, this indicates a failure and a new target should be supplied\n\n```go\nfunc (h *Helper) Unicast(msg *pb.Message, receiverHandle *pb.PeerID) error\n```\nUnicast sends a message to a specified receiver\n\n```go\nfunc (h *Helper) UpdateState(tag interface{}, target *pb.BlockchainInfo, peers []*pb.PeerID)\n```\nUpdateState attempts to synchronize state to a particular target, implicitly calls rollback if needed\n\n```go\nfunc (h *Helper) ValidateState()\n```\nValidateState is invoked to tell us that consensus has the ledger back in sync\n\n```go\nfunc (h *Helper) Verify(replicaID *pb.PeerID, signature []byte, message []byte) error\n```\nVerify 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\n\n","path":"github.com/eric-erki/https-hyperledger.org/consensus/helper","name":"helper","synopsis":"","isRedistributable":true}
