github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/orderer/common/follower/mocks/channel_participation_metrics_reporter.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hechain20/hechain/orderer/common/follower"
     8  	"github.com/hechain20/hechain/orderer/common/types"
     9  )
    10  
    11  type ChannelParticipationMetricsReporter struct {
    12  	ReportConsensusRelationAndStatusMetricsStub        func(string, types.ConsensusRelation, types.Status)
    13  	reportConsensusRelationAndStatusMetricsMutex       sync.RWMutex
    14  	reportConsensusRelationAndStatusMetricsArgsForCall []struct {
    15  		arg1 string
    16  		arg2 types.ConsensusRelation
    17  		arg3 types.Status
    18  	}
    19  	invocations      map[string][][]interface{}
    20  	invocationsMutex sync.RWMutex
    21  }
    22  
    23  func (fake *ChannelParticipationMetricsReporter) ReportConsensusRelationAndStatusMetrics(arg1 string, arg2 types.ConsensusRelation, arg3 types.Status) {
    24  	fake.reportConsensusRelationAndStatusMetricsMutex.Lock()
    25  	fake.reportConsensusRelationAndStatusMetricsArgsForCall = append(fake.reportConsensusRelationAndStatusMetricsArgsForCall, struct {
    26  		arg1 string
    27  		arg2 types.ConsensusRelation
    28  		arg3 types.Status
    29  	}{arg1, arg2, arg3})
    30  	fake.recordInvocation("ReportConsensusRelationAndStatusMetrics", []interface{}{arg1, arg2, arg3})
    31  	fake.reportConsensusRelationAndStatusMetricsMutex.Unlock()
    32  	if fake.ReportConsensusRelationAndStatusMetricsStub != nil {
    33  		fake.ReportConsensusRelationAndStatusMetricsStub(arg1, arg2, arg3)
    34  	}
    35  }
    36  
    37  func (fake *ChannelParticipationMetricsReporter) ReportConsensusRelationAndStatusMetricsCallCount() int {
    38  	fake.reportConsensusRelationAndStatusMetricsMutex.RLock()
    39  	defer fake.reportConsensusRelationAndStatusMetricsMutex.RUnlock()
    40  	return len(fake.reportConsensusRelationAndStatusMetricsArgsForCall)
    41  }
    42  
    43  func (fake *ChannelParticipationMetricsReporter) ReportConsensusRelationAndStatusMetricsCalls(stub func(string, types.ConsensusRelation, types.Status)) {
    44  	fake.reportConsensusRelationAndStatusMetricsMutex.Lock()
    45  	defer fake.reportConsensusRelationAndStatusMetricsMutex.Unlock()
    46  	fake.ReportConsensusRelationAndStatusMetricsStub = stub
    47  }
    48  
    49  func (fake *ChannelParticipationMetricsReporter) ReportConsensusRelationAndStatusMetricsArgsForCall(i int) (string, types.ConsensusRelation, types.Status) {
    50  	fake.reportConsensusRelationAndStatusMetricsMutex.RLock()
    51  	defer fake.reportConsensusRelationAndStatusMetricsMutex.RUnlock()
    52  	argsForCall := fake.reportConsensusRelationAndStatusMetricsArgsForCall[i]
    53  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    54  }
    55  
    56  func (fake *ChannelParticipationMetricsReporter) Invocations() map[string][][]interface{} {
    57  	fake.invocationsMutex.RLock()
    58  	defer fake.invocationsMutex.RUnlock()
    59  	fake.reportConsensusRelationAndStatusMetricsMutex.RLock()
    60  	defer fake.reportConsensusRelationAndStatusMetricsMutex.RUnlock()
    61  	copiedInvocations := map[string][][]interface{}{}
    62  	for key, value := range fake.invocations {
    63  		copiedInvocations[key] = value
    64  	}
    65  	return copiedInvocations
    66  }
    67  
    68  func (fake *ChannelParticipationMetricsReporter) recordInvocation(key string, args []interface{}) {
    69  	fake.invocationsMutex.Lock()
    70  	defer fake.invocationsMutex.Unlock()
    71  	if fake.invocations == nil {
    72  		fake.invocations = map[string][][]interface{}{}
    73  	}
    74  	if fake.invocations[key] == nil {
    75  		fake.invocations[key] = [][]interface{}{}
    76  	}
    77  	fake.invocations[key] = append(fake.invocations[key], args)
    78  }
    79  
    80  var _ follower.ChannelParticipationMetricsReporter = new(ChannelParticipationMetricsReporter)