Documentation ¶
Index ¶
- Constants
- func NewCounterOpts(old metrics.CounterOpts, labelNames []string) metrics.CounterOpts
- func NewGaugeOpts(old metrics.GaugeOpts, labelNames []string) metrics.GaugeOpts
- func NewHistogramOpts(old metrics.HistogramOpts, labelNames []string) metrics.HistogramOpts
- type Application
- type Assembler
- type Comm
- type Logger
- type MembershipNotifier
- type Metrics
- type MetricsBlacklist
- type MetricsConsensus
- type MetricsRequestPool
- type MetricsView
- type MetricsViewChange
- type RequestInspector
- type Signer
- type Synchronizer
- type Verifier
- type WriteAheadLog
Constants ¶
const ( ReasonRequestMaxBytes = "MAX_BYTES" ReasonSemaphoreAcquireFail = "SEMAPHORE_ACQUIRE_FAIL" )
Variables ¶
This section is empty.
Functions ¶
func NewCounterOpts ¶
func NewCounterOpts(old metrics.CounterOpts, labelNames []string) metrics.CounterOpts
func NewHistogramOpts ¶
func NewHistogramOpts(old metrics.HistogramOpts, labelNames []string) metrics.HistogramOpts
Types ¶
type Application ¶
type Application interface { // Deliver delivers the given proposal and signatures. // After the call returns we assume that this proposal is stored in persistent memory. // It returns whether this proposal was a reconfiguration and the current config. Deliver(proposal bft.Proposal, signature []bft.Signature) bft.Reconfig }
Application delivers the consented proposal and corresponding signatures.
type Assembler ¶
type Assembler interface { // AssembleProposal creates a proposal which includes // the given requests (when permitting) and metadata. AssembleProposal(metadata []byte, requests [][]byte) bft.Proposal }
Assembler creates proposals.
type Comm ¶
type Comm interface { // SendConsensus sends the consensus protocol related message m to the node with id targetID. SendConsensus(targetID uint64, m *protos.Message) // SendTransaction sends the given client's request to the node with id targetID. SendTransaction(targetID uint64, request []byte) // Nodes returns a set of ids of participating nodes. // In case you need to change or keep this slice, create a copy. Nodes() []uint64 }
Comm enables the communications between the nodes.
type Logger ¶
type Logger interface { Debugf(template string, args ...interface{}) Infof(template string, args ...interface{}) Errorf(template string, args ...interface{}) Warnf(template string, args ...interface{}) Panicf(template string, args ...interface{}) }
Logger defines the contract for logging.
type MembershipNotifier ¶
type MembershipNotifier interface { // MembershipChange returns true if there was a membership change in the last proposal. MembershipChange() bool }
MembershipNotifier notifies if there was a membership change in the last proposal.
type Metrics ¶
type Metrics struct { MetricsRequestPool *MetricsRequestPool MetricsBlacklist *MetricsBlacklist MetricsConsensus *MetricsConsensus MetricsView *MetricsView MetricsViewChange *MetricsViewChange }
func (*Metrics) Initialize ¶
type MetricsBlacklist ¶
type MetricsBlacklist struct { CountBlackList metrics.Gauge NodesInBlackList metrics.Gauge // contains filtered or unexported fields }
MetricsBlacklist encapsulates blacklist metrics
func NewMetricsBlacklist ¶
func NewMetricsBlacklist(p metrics.Provider, labelNames ...string) *MetricsBlacklist
NewMetricsBlacklist create new blacklist metrics
func (*MetricsBlacklist) Initialize ¶
func (m *MetricsBlacklist) Initialize(nodes []uint64)
func (*MetricsBlacklist) LabelsForWith ¶
func (m *MetricsBlacklist) LabelsForWith(labelValues ...string) []string
func (*MetricsBlacklist) With ¶
func (m *MetricsBlacklist) With(labelValues ...string) *MetricsBlacklist
type MetricsConsensus ¶
type MetricsConsensus struct { CountConsensusReconfig metrics.Counter LatencySync metrics.Histogram }
MetricsConsensus encapsulates consensus metrics
func NewMetricsConsensus ¶
func NewMetricsConsensus(p metrics.Provider, labelNames ...string) *MetricsConsensus
NewMetricsConsensus create new consensus metrics
func (*MetricsConsensus) Initialize ¶
func (m *MetricsConsensus) Initialize()
func (*MetricsConsensus) With ¶
func (m *MetricsConsensus) With(labelValues ...string) *MetricsConsensus
type MetricsRequestPool ¶
type MetricsRequestPool struct { CountOfRequestPool metrics.Gauge CountOfFailAddRequestToPool metrics.Counter CountOfLeaderForwardRequest metrics.Counter CountTimeoutTwoStep metrics.Counter CountOfDeleteRequestPool metrics.Counter CountOfRequestPoolAll metrics.Counter LatencyOfRequestPool metrics.Histogram // contains filtered or unexported fields }
MetricsRequestPool encapsulates request pool metrics
func NewMetricsRequestPool ¶
func NewMetricsRequestPool(p metrics.Provider, labelNames ...string) *MetricsRequestPool
NewMetricsRequestPool create new request pool metrics
func (*MetricsRequestPool) Initialize ¶
func (m *MetricsRequestPool) Initialize()
func (*MetricsRequestPool) LabelsForWith ¶
func (m *MetricsRequestPool) LabelsForWith(labelValues ...string) []string
func (*MetricsRequestPool) With ¶
func (m *MetricsRequestPool) With(labelValues ...string) *MetricsRequestPool
type MetricsView ¶
type MetricsView struct { ViewNumber metrics.Gauge LeaderID metrics.Gauge ProposalSequence metrics.Gauge DecisionsInView metrics.Gauge Phase metrics.Gauge CountTxsInBatch metrics.Gauge CountBatchAll metrics.Counter CountTxsAll metrics.Counter SizeOfBatch metrics.Counter LatencyBatchProcessing metrics.Histogram LatencyBatchSave metrics.Histogram }
MetricsView encapsulates view metrics
func NewMetricsView ¶
func NewMetricsView(p metrics.Provider, labelNames ...string) *MetricsView
NewMetricsView create new view metrics
func (*MetricsView) Initialize ¶
func (m *MetricsView) Initialize()
func (*MetricsView) With ¶
func (m *MetricsView) With(labelValues ...string) *MetricsView
type MetricsViewChange ¶
type MetricsViewChange struct { CurrentView metrics.Gauge NextView metrics.Gauge RealView metrics.Gauge }
MetricsViewChange encapsulates view change metrics
func NewMetricsViewChange ¶
func NewMetricsViewChange(p metrics.Provider, labelNames ...string) *MetricsViewChange
NewMetricsViewChange create new view change metrics
func (*MetricsViewChange) Initialize ¶
func (m *MetricsViewChange) Initialize()
func (*MetricsViewChange) With ¶
func (m *MetricsViewChange) With(labelValues ...string) *MetricsViewChange
type RequestInspector ¶
type RequestInspector interface { // RequestID returns info about the given request. RequestID(req []byte) bft.RequestInfo }
RequestInspector extracts info (i.e. request id and client id) from a given request.
type Signer ¶
type Signer interface { // Sign signs on the given data and returns the signature. Sign([]byte) []byte // SignProposal signs on the given proposal and returns a composite Signature. SignProposal(proposal bft.Proposal, auxiliaryInput []byte) *bft.Signature }
Signer signs on the given data.
type Synchronizer ¶
type Synchronizer interface { // Sync blocks indefinitely until the replica's state is synchronized to the latest decision, // and returns it with info about reconfiguration. Sync() bft.SyncResponse }
Synchronizer reaches the cluster nodes and fetches blocks in order to sync the replica's state.
type Verifier ¶
type Verifier interface { // VerifyProposal verifies the given proposal and returns the included requests' info. VerifyProposal(proposal bft.Proposal) ([]bft.RequestInfo, error) // VerifyRequest verifies the given request and returns its info. VerifyRequest(val []byte) (bft.RequestInfo, error) // VerifyConsenterSig verifies the signature for the given proposal. // It returns the auxiliary data in the signature. VerifyConsenterSig(signature bft.Signature, prop bft.Proposal) ([]byte, error) // VerifySignature verifies the signature. VerifySignature(signature bft.Signature) error // VerificationSequence returns the current verification sequence. VerificationSequence() uint64 // RequestsFromProposal returns from the given proposal the included requests' info RequestsFromProposal(proposal bft.Proposal) []bft.RequestInfo // AuxiliaryData extracts the auxiliary data from a signature's message AuxiliaryData([]byte) []byte }
Verifier validates data and verifies signatures.
type WriteAheadLog ¶
type WriteAheadLog interface { // Append appends a data item to the end of the WAL // and indicate whether this entry is a truncation point. Append(entry []byte, truncateTo bool) error }
WriteAheadLog is write ahead log.