{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package broadcast\n\n## Functions\n\n```go\nfunc ClassifyError(err error) cb.Status\n```\nClassifyError converts an error type into a status code.\n\n## Types\n\n```go\ntype ChannelSupport interface {\n\tmsgprocessor.Processor\n\tConsenter\n}\n```\nChannelSupport provides the backing resources needed to support broadcast on a channel\n\n```go\ntype ChannelSupportRegistrar interface {\n\t// BroadcastChannelSupport returns the message channel header, whether the message is a config update\n\t// and the channel resources for a message or an error if the message is not a message which can\n\t// be processed directly (like CONFIG and ORDERER_TRANSACTION messages)\n\tBroadcastChannelSupport(msg *cb.Envelope) (*cb.ChannelHeader, bool, ChannelSupport, error)\n}\n```\nChannelSupportRegistrar provides a way for the Handler to look up the Support for a channel\n\n```go\ntype Consenter interface {\n\t// Order accepts a message or returns an error indicating the cause of failure\n\t// It ultimately passes through to the consensus.Chain interface\n\tOrder(env *cb.Envelope, configSeq uint64) error\n\n\t// Configure accepts a reconfiguration or returns an error indicating the cause of failure\n\t// It ultimately passes through to the consensus.Chain interface\n\tConfigure(config *cb.Envelope, configSeq uint64) error\n\n\t// WaitReady blocks waiting for consenter to be ready for accepting new messages.\n\t// This is useful when consenter needs to temporarily block ingress messages so\n\t// that in-flight messages can be consumed. It could return error if consenter is\n\t// in erroneous states. If this blocking behavior is not desired, consenter could\n\t// simply return nil.\n\tWaitReady() error\n}\n```\nConsenter provides methods to send messages through consensus\n\n```go\ntype Handler struct {\n\tSupportRegistrar ChannelSupportRegistrar\n\tMetrics          *Metrics\n}\n```\nHandler is designed to handle connections from Broadcast AB gRPC service\n\n```go\nfunc (bh *Handler) Handle(srv ab.AtomicBroadcast_BroadcastServer) error\n```\nHandle reads requests from a Broadcast stream, processes them, and returns the responses to the stream\n\n```go\nfunc (bh *Handler) ProcessMessage(msg *cb.Envelope, addr string) (resp *ab.BroadcastResponse)\n```\nProcessMessage validates and enqueues a single message\n\n```go\ntype Metrics struct {\n\tValidateDuration metrics.Histogram\n\tEnqueueDuration  metrics.Histogram\n\tProcessedCount   metrics.Counter\n}\n```\n\n```go\nfunc NewMetrics(p metrics.Provider) *Metrics\n```\n\n```go\ntype MetricsTracker struct {\n\tValidateStartTime time.Time\n\tEnqueueStartTime  time.Time\n\tValidateDuration  time.Duration\n\tChannelID         string\n\tTxType            string\n\tMetrics           *Metrics\n}\n```\n\n```go\nfunc (mt *MetricsTracker) BeginEnqueue()\n```\n\n```go\nfunc (mt *MetricsTracker) BeginValidate()\n```\n\n```go\nfunc (mt *MetricsTracker) EndValidate()\n```\n\n```go\nfunc (mt *MetricsTracker) Record(resp *ab.BroadcastResponse)\n```\n\n","path":"github.com/eric-erki/https-hyperledger.org/orderer/common/broadcast","name":"broadcast","synopsis":"","isRedistributable":true}
