github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/ledger/kvledger/txmgmt/statedb/mock/namespace_provider.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hechain20/hechain/core/ledger/kvledger/txmgmt/statedb"
     8  )
     9  
    10  type NamespaceProvider struct {
    11  	PossibleNamespacesStub        func(statedb.VersionedDB) ([]string, error)
    12  	possibleNamespacesMutex       sync.RWMutex
    13  	possibleNamespacesArgsForCall []struct {
    14  		arg1 statedb.VersionedDB
    15  	}
    16  	possibleNamespacesReturns struct {
    17  		result1 []string
    18  		result2 error
    19  	}
    20  	possibleNamespacesReturnsOnCall map[int]struct {
    21  		result1 []string
    22  		result2 error
    23  	}
    24  	invocations      map[string][][]interface{}
    25  	invocationsMutex sync.RWMutex
    26  }
    27  
    28  func (fake *NamespaceProvider) PossibleNamespaces(arg1 statedb.VersionedDB) ([]string, error) {
    29  	fake.possibleNamespacesMutex.Lock()
    30  	ret, specificReturn := fake.possibleNamespacesReturnsOnCall[len(fake.possibleNamespacesArgsForCall)]
    31  	fake.possibleNamespacesArgsForCall = append(fake.possibleNamespacesArgsForCall, struct {
    32  		arg1 statedb.VersionedDB
    33  	}{arg1})
    34  	fake.recordInvocation("PossibleNamespaces", []interface{}{arg1})
    35  	fake.possibleNamespacesMutex.Unlock()
    36  	if fake.PossibleNamespacesStub != nil {
    37  		return fake.PossibleNamespacesStub(arg1)
    38  	}
    39  	if specificReturn {
    40  		return ret.result1, ret.result2
    41  	}
    42  	fakeReturns := fake.possibleNamespacesReturns
    43  	return fakeReturns.result1, fakeReturns.result2
    44  }
    45  
    46  func (fake *NamespaceProvider) PossibleNamespacesCallCount() int {
    47  	fake.possibleNamespacesMutex.RLock()
    48  	defer fake.possibleNamespacesMutex.RUnlock()
    49  	return len(fake.possibleNamespacesArgsForCall)
    50  }
    51  
    52  func (fake *NamespaceProvider) PossibleNamespacesCalls(stub func(statedb.VersionedDB) ([]string, error)) {
    53  	fake.possibleNamespacesMutex.Lock()
    54  	defer fake.possibleNamespacesMutex.Unlock()
    55  	fake.PossibleNamespacesStub = stub
    56  }
    57  
    58  func (fake *NamespaceProvider) PossibleNamespacesArgsForCall(i int) statedb.VersionedDB {
    59  	fake.possibleNamespacesMutex.RLock()
    60  	defer fake.possibleNamespacesMutex.RUnlock()
    61  	argsForCall := fake.possibleNamespacesArgsForCall[i]
    62  	return argsForCall.arg1
    63  }
    64  
    65  func (fake *NamespaceProvider) PossibleNamespacesReturns(result1 []string, result2 error) {
    66  	fake.possibleNamespacesMutex.Lock()
    67  	defer fake.possibleNamespacesMutex.Unlock()
    68  	fake.PossibleNamespacesStub = nil
    69  	fake.possibleNamespacesReturns = struct {
    70  		result1 []string
    71  		result2 error
    72  	}{result1, result2}
    73  }
    74  
    75  func (fake *NamespaceProvider) PossibleNamespacesReturnsOnCall(i int, result1 []string, result2 error) {
    76  	fake.possibleNamespacesMutex.Lock()
    77  	defer fake.possibleNamespacesMutex.Unlock()
    78  	fake.PossibleNamespacesStub = nil
    79  	if fake.possibleNamespacesReturnsOnCall == nil {
    80  		fake.possibleNamespacesReturnsOnCall = make(map[int]struct {
    81  			result1 []string
    82  			result2 error
    83  		})
    84  	}
    85  	fake.possibleNamespacesReturnsOnCall[i] = struct {
    86  		result1 []string
    87  		result2 error
    88  	}{result1, result2}
    89  }
    90  
    91  func (fake *NamespaceProvider) Invocations() map[string][][]interface{} {
    92  	fake.invocationsMutex.RLock()
    93  	defer fake.invocationsMutex.RUnlock()
    94  	fake.possibleNamespacesMutex.RLock()
    95  	defer fake.possibleNamespacesMutex.RUnlock()
    96  	copiedInvocations := map[string][][]interface{}{}
    97  	for key, value := range fake.invocations {
    98  		copiedInvocations[key] = value
    99  	}
   100  	return copiedInvocations
   101  }
   102  
   103  func (fake *NamespaceProvider) recordInvocation(key string, args []interface{}) {
   104  	fake.invocationsMutex.Lock()
   105  	defer fake.invocationsMutex.Unlock()
   106  	if fake.invocations == nil {
   107  		fake.invocations = map[string][][]interface{}{}
   108  	}
   109  	if fake.invocations[key] == nil {
   110  		fake.invocations[key] = [][]interface{}{}
   111  	}
   112  	fake.invocations[key] = append(fake.invocations[key], args)
   113  }
   114  
   115  var _ statedb.NamespaceProvider = new(NamespaceProvider)