github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/rw_state.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  )
     7  
     8  type ReadWritableState struct {
     9  	CollectionNameStub        func() string
    10  	collectionNameMutex       sync.RWMutex
    11  	collectionNameArgsForCall []struct {
    12  	}
    13  	collectionNameReturns struct {
    14  		result1 string
    15  	}
    16  	collectionNameReturnsOnCall map[int]struct {
    17  		result1 string
    18  	}
    19  	DelStateStub        func(string) error
    20  	delStateMutex       sync.RWMutex
    21  	delStateArgsForCall []struct {
    22  		arg1 string
    23  	}
    24  	delStateReturns struct {
    25  		result1 error
    26  	}
    27  	delStateReturnsOnCall map[int]struct {
    28  		result1 error
    29  	}
    30  	GetStateStub        func(string) ([]byte, error)
    31  	getStateMutex       sync.RWMutex
    32  	getStateArgsForCall []struct {
    33  		arg1 string
    34  	}
    35  	getStateReturns struct {
    36  		result1 []byte
    37  		result2 error
    38  	}
    39  	getStateReturnsOnCall map[int]struct {
    40  		result1 []byte
    41  		result2 error
    42  	}
    43  	GetStateHashStub        func(string) ([]byte, error)
    44  	getStateHashMutex       sync.RWMutex
    45  	getStateHashArgsForCall []struct {
    46  		arg1 string
    47  	}
    48  	getStateHashReturns struct {
    49  		result1 []byte
    50  		result2 error
    51  	}
    52  	getStateHashReturnsOnCall map[int]struct {
    53  		result1 []byte
    54  		result2 error
    55  	}
    56  	GetStateRangeStub        func(string) (map[string][]byte, error)
    57  	getStateRangeMutex       sync.RWMutex
    58  	getStateRangeArgsForCall []struct {
    59  		arg1 string
    60  	}
    61  	getStateRangeReturns struct {
    62  		result1 map[string][]byte
    63  		result2 error
    64  	}
    65  	getStateRangeReturnsOnCall map[int]struct {
    66  		result1 map[string][]byte
    67  		result2 error
    68  	}
    69  	PutStateStub        func(string, []byte) error
    70  	putStateMutex       sync.RWMutex
    71  	putStateArgsForCall []struct {
    72  		arg1 string
    73  		arg2 []byte
    74  	}
    75  	putStateReturns struct {
    76  		result1 error
    77  	}
    78  	putStateReturnsOnCall map[int]struct {
    79  		result1 error
    80  	}
    81  	invocations      map[string][][]interface{}
    82  	invocationsMutex sync.RWMutex
    83  }
    84  
    85  func (fake *ReadWritableState) CollectionName() string {
    86  	fake.collectionNameMutex.Lock()
    87  	ret, specificReturn := fake.collectionNameReturnsOnCall[len(fake.collectionNameArgsForCall)]
    88  	fake.collectionNameArgsForCall = append(fake.collectionNameArgsForCall, struct {
    89  	}{})
    90  	fake.recordInvocation("CollectionName", []interface{}{})
    91  	fake.collectionNameMutex.Unlock()
    92  	if fake.CollectionNameStub != nil {
    93  		return fake.CollectionNameStub()
    94  	}
    95  	if specificReturn {
    96  		return ret.result1
    97  	}
    98  	fakeReturns := fake.collectionNameReturns
    99  	return fakeReturns.result1
   100  }
   101  
   102  func (fake *ReadWritableState) CollectionNameCallCount() int {
   103  	fake.collectionNameMutex.RLock()
   104  	defer fake.collectionNameMutex.RUnlock()
   105  	return len(fake.collectionNameArgsForCall)
   106  }
   107  
   108  func (fake *ReadWritableState) CollectionNameCalls(stub func() string) {
   109  	fake.collectionNameMutex.Lock()
   110  	defer fake.collectionNameMutex.Unlock()
   111  	fake.CollectionNameStub = stub
   112  }
   113  
   114  func (fake *ReadWritableState) CollectionNameReturns(result1 string) {
   115  	fake.collectionNameMutex.Lock()
   116  	defer fake.collectionNameMutex.Unlock()
   117  	fake.CollectionNameStub = nil
   118  	fake.collectionNameReturns = struct {
   119  		result1 string
   120  	}{result1}
   121  }
   122  
   123  func (fake *ReadWritableState) CollectionNameReturnsOnCall(i int, result1 string) {
   124  	fake.collectionNameMutex.Lock()
   125  	defer fake.collectionNameMutex.Unlock()
   126  	fake.CollectionNameStub = nil
   127  	if fake.collectionNameReturnsOnCall == nil {
   128  		fake.collectionNameReturnsOnCall = make(map[int]struct {
   129  			result1 string
   130  		})
   131  	}
   132  	fake.collectionNameReturnsOnCall[i] = struct {
   133  		result1 string
   134  	}{result1}
   135  }
   136  
   137  func (fake *ReadWritableState) DelState(arg1 string) error {
   138  	fake.delStateMutex.Lock()
   139  	ret, specificReturn := fake.delStateReturnsOnCall[len(fake.delStateArgsForCall)]
   140  	fake.delStateArgsForCall = append(fake.delStateArgsForCall, struct {
   141  		arg1 string
   142  	}{arg1})
   143  	fake.recordInvocation("DelState", []interface{}{arg1})
   144  	fake.delStateMutex.Unlock()
   145  	if fake.DelStateStub != nil {
   146  		return fake.DelStateStub(arg1)
   147  	}
   148  	if specificReturn {
   149  		return ret.result1
   150  	}
   151  	fakeReturns := fake.delStateReturns
   152  	return fakeReturns.result1
   153  }
   154  
   155  func (fake *ReadWritableState) DelStateCallCount() int {
   156  	fake.delStateMutex.RLock()
   157  	defer fake.delStateMutex.RUnlock()
   158  	return len(fake.delStateArgsForCall)
   159  }
   160  
   161  func (fake *ReadWritableState) DelStateCalls(stub func(string) error) {
   162  	fake.delStateMutex.Lock()
   163  	defer fake.delStateMutex.Unlock()
   164  	fake.DelStateStub = stub
   165  }
   166  
   167  func (fake *ReadWritableState) DelStateArgsForCall(i int) string {
   168  	fake.delStateMutex.RLock()
   169  	defer fake.delStateMutex.RUnlock()
   170  	argsForCall := fake.delStateArgsForCall[i]
   171  	return argsForCall.arg1
   172  }
   173  
   174  func (fake *ReadWritableState) DelStateReturns(result1 error) {
   175  	fake.delStateMutex.Lock()
   176  	defer fake.delStateMutex.Unlock()
   177  	fake.DelStateStub = nil
   178  	fake.delStateReturns = struct {
   179  		result1 error
   180  	}{result1}
   181  }
   182  
   183  func (fake *ReadWritableState) DelStateReturnsOnCall(i int, result1 error) {
   184  	fake.delStateMutex.Lock()
   185  	defer fake.delStateMutex.Unlock()
   186  	fake.DelStateStub = nil
   187  	if fake.delStateReturnsOnCall == nil {
   188  		fake.delStateReturnsOnCall = make(map[int]struct {
   189  			result1 error
   190  		})
   191  	}
   192  	fake.delStateReturnsOnCall[i] = struct {
   193  		result1 error
   194  	}{result1}
   195  }
   196  
   197  func (fake *ReadWritableState) GetState(arg1 string) ([]byte, error) {
   198  	fake.getStateMutex.Lock()
   199  	ret, specificReturn := fake.getStateReturnsOnCall[len(fake.getStateArgsForCall)]
   200  	fake.getStateArgsForCall = append(fake.getStateArgsForCall, struct {
   201  		arg1 string
   202  	}{arg1})
   203  	fake.recordInvocation("GetState", []interface{}{arg1})
   204  	fake.getStateMutex.Unlock()
   205  	if fake.GetStateStub != nil {
   206  		return fake.GetStateStub(arg1)
   207  	}
   208  	if specificReturn {
   209  		return ret.result1, ret.result2
   210  	}
   211  	fakeReturns := fake.getStateReturns
   212  	return fakeReturns.result1, fakeReturns.result2
   213  }
   214  
   215  func (fake *ReadWritableState) GetStateCallCount() int {
   216  	fake.getStateMutex.RLock()
   217  	defer fake.getStateMutex.RUnlock()
   218  	return len(fake.getStateArgsForCall)
   219  }
   220  
   221  func (fake *ReadWritableState) GetStateCalls(stub func(string) ([]byte, error)) {
   222  	fake.getStateMutex.Lock()
   223  	defer fake.getStateMutex.Unlock()
   224  	fake.GetStateStub = stub
   225  }
   226  
   227  func (fake *ReadWritableState) GetStateArgsForCall(i int) string {
   228  	fake.getStateMutex.RLock()
   229  	defer fake.getStateMutex.RUnlock()
   230  	argsForCall := fake.getStateArgsForCall[i]
   231  	return argsForCall.arg1
   232  }
   233  
   234  func (fake *ReadWritableState) GetStateReturns(result1 []byte, result2 error) {
   235  	fake.getStateMutex.Lock()
   236  	defer fake.getStateMutex.Unlock()
   237  	fake.GetStateStub = nil
   238  	fake.getStateReturns = struct {
   239  		result1 []byte
   240  		result2 error
   241  	}{result1, result2}
   242  }
   243  
   244  func (fake *ReadWritableState) GetStateReturnsOnCall(i int, result1 []byte, result2 error) {
   245  	fake.getStateMutex.Lock()
   246  	defer fake.getStateMutex.Unlock()
   247  	fake.GetStateStub = nil
   248  	if fake.getStateReturnsOnCall == nil {
   249  		fake.getStateReturnsOnCall = make(map[int]struct {
   250  			result1 []byte
   251  			result2 error
   252  		})
   253  	}
   254  	fake.getStateReturnsOnCall[i] = struct {
   255  		result1 []byte
   256  		result2 error
   257  	}{result1, result2}
   258  }
   259  
   260  func (fake *ReadWritableState) GetStateHash(arg1 string) ([]byte, error) {
   261  	fake.getStateHashMutex.Lock()
   262  	ret, specificReturn := fake.getStateHashReturnsOnCall[len(fake.getStateHashArgsForCall)]
   263  	fake.getStateHashArgsForCall = append(fake.getStateHashArgsForCall, struct {
   264  		arg1 string
   265  	}{arg1})
   266  	fake.recordInvocation("GetStateHash", []interface{}{arg1})
   267  	fake.getStateHashMutex.Unlock()
   268  	if fake.GetStateHashStub != nil {
   269  		return fake.GetStateHashStub(arg1)
   270  	}
   271  	if specificReturn {
   272  		return ret.result1, ret.result2
   273  	}
   274  	fakeReturns := fake.getStateHashReturns
   275  	return fakeReturns.result1, fakeReturns.result2
   276  }
   277  
   278  func (fake *ReadWritableState) GetStateHashCallCount() int {
   279  	fake.getStateHashMutex.RLock()
   280  	defer fake.getStateHashMutex.RUnlock()
   281  	return len(fake.getStateHashArgsForCall)
   282  }
   283  
   284  func (fake *ReadWritableState) GetStateHashCalls(stub func(string) ([]byte, error)) {
   285  	fake.getStateHashMutex.Lock()
   286  	defer fake.getStateHashMutex.Unlock()
   287  	fake.GetStateHashStub = stub
   288  }
   289  
   290  func (fake *ReadWritableState) GetStateHashArgsForCall(i int) string {
   291  	fake.getStateHashMutex.RLock()
   292  	defer fake.getStateHashMutex.RUnlock()
   293  	argsForCall := fake.getStateHashArgsForCall[i]
   294  	return argsForCall.arg1
   295  }
   296  
   297  func (fake *ReadWritableState) GetStateHashReturns(result1 []byte, result2 error) {
   298  	fake.getStateHashMutex.Lock()
   299  	defer fake.getStateHashMutex.Unlock()
   300  	fake.GetStateHashStub = nil
   301  	fake.getStateHashReturns = struct {
   302  		result1 []byte
   303  		result2 error
   304  	}{result1, result2}
   305  }
   306  
   307  func (fake *ReadWritableState) GetStateHashReturnsOnCall(i int, result1 []byte, result2 error) {
   308  	fake.getStateHashMutex.Lock()
   309  	defer fake.getStateHashMutex.Unlock()
   310  	fake.GetStateHashStub = nil
   311  	if fake.getStateHashReturnsOnCall == nil {
   312  		fake.getStateHashReturnsOnCall = make(map[int]struct {
   313  			result1 []byte
   314  			result2 error
   315  		})
   316  	}
   317  	fake.getStateHashReturnsOnCall[i] = struct {
   318  		result1 []byte
   319  		result2 error
   320  	}{result1, result2}
   321  }
   322  
   323  func (fake *ReadWritableState) GetStateRange(arg1 string) (map[string][]byte, error) {
   324  	fake.getStateRangeMutex.Lock()
   325  	ret, specificReturn := fake.getStateRangeReturnsOnCall[len(fake.getStateRangeArgsForCall)]
   326  	fake.getStateRangeArgsForCall = append(fake.getStateRangeArgsForCall, struct {
   327  		arg1 string
   328  	}{arg1})
   329  	fake.recordInvocation("GetStateRange", []interface{}{arg1})
   330  	fake.getStateRangeMutex.Unlock()
   331  	if fake.GetStateRangeStub != nil {
   332  		return fake.GetStateRangeStub(arg1)
   333  	}
   334  	if specificReturn {
   335  		return ret.result1, ret.result2
   336  	}
   337  	fakeReturns := fake.getStateRangeReturns
   338  	return fakeReturns.result1, fakeReturns.result2
   339  }
   340  
   341  func (fake *ReadWritableState) GetStateRangeCallCount() int {
   342  	fake.getStateRangeMutex.RLock()
   343  	defer fake.getStateRangeMutex.RUnlock()
   344  	return len(fake.getStateRangeArgsForCall)
   345  }
   346  
   347  func (fake *ReadWritableState) GetStateRangeCalls(stub func(string) (map[string][]byte, error)) {
   348  	fake.getStateRangeMutex.Lock()
   349  	defer fake.getStateRangeMutex.Unlock()
   350  	fake.GetStateRangeStub = stub
   351  }
   352  
   353  func (fake *ReadWritableState) GetStateRangeArgsForCall(i int) string {
   354  	fake.getStateRangeMutex.RLock()
   355  	defer fake.getStateRangeMutex.RUnlock()
   356  	argsForCall := fake.getStateRangeArgsForCall[i]
   357  	return argsForCall.arg1
   358  }
   359  
   360  func (fake *ReadWritableState) GetStateRangeReturns(result1 map[string][]byte, result2 error) {
   361  	fake.getStateRangeMutex.Lock()
   362  	defer fake.getStateRangeMutex.Unlock()
   363  	fake.GetStateRangeStub = nil
   364  	fake.getStateRangeReturns = struct {
   365  		result1 map[string][]byte
   366  		result2 error
   367  	}{result1, result2}
   368  }
   369  
   370  func (fake *ReadWritableState) GetStateRangeReturnsOnCall(i int, result1 map[string][]byte, result2 error) {
   371  	fake.getStateRangeMutex.Lock()
   372  	defer fake.getStateRangeMutex.Unlock()
   373  	fake.GetStateRangeStub = nil
   374  	if fake.getStateRangeReturnsOnCall == nil {
   375  		fake.getStateRangeReturnsOnCall = make(map[int]struct {
   376  			result1 map[string][]byte
   377  			result2 error
   378  		})
   379  	}
   380  	fake.getStateRangeReturnsOnCall[i] = struct {
   381  		result1 map[string][]byte
   382  		result2 error
   383  	}{result1, result2}
   384  }
   385  
   386  func (fake *ReadWritableState) PutState(arg1 string, arg2 []byte) error {
   387  	var arg2Copy []byte
   388  	if arg2 != nil {
   389  		arg2Copy = make([]byte, len(arg2))
   390  		copy(arg2Copy, arg2)
   391  	}
   392  	fake.putStateMutex.Lock()
   393  	ret, specificReturn := fake.putStateReturnsOnCall[len(fake.putStateArgsForCall)]
   394  	fake.putStateArgsForCall = append(fake.putStateArgsForCall, struct {
   395  		arg1 string
   396  		arg2 []byte
   397  	}{arg1, arg2Copy})
   398  	fake.recordInvocation("PutState", []interface{}{arg1, arg2Copy})
   399  	fake.putStateMutex.Unlock()
   400  	if fake.PutStateStub != nil {
   401  		return fake.PutStateStub(arg1, arg2)
   402  	}
   403  	if specificReturn {
   404  		return ret.result1
   405  	}
   406  	fakeReturns := fake.putStateReturns
   407  	return fakeReturns.result1
   408  }
   409  
   410  func (fake *ReadWritableState) PutStateCallCount() int {
   411  	fake.putStateMutex.RLock()
   412  	defer fake.putStateMutex.RUnlock()
   413  	return len(fake.putStateArgsForCall)
   414  }
   415  
   416  func (fake *ReadWritableState) PutStateCalls(stub func(string, []byte) error) {
   417  	fake.putStateMutex.Lock()
   418  	defer fake.putStateMutex.Unlock()
   419  	fake.PutStateStub = stub
   420  }
   421  
   422  func (fake *ReadWritableState) PutStateArgsForCall(i int) (string, []byte) {
   423  	fake.putStateMutex.RLock()
   424  	defer fake.putStateMutex.RUnlock()
   425  	argsForCall := fake.putStateArgsForCall[i]
   426  	return argsForCall.arg1, argsForCall.arg2
   427  }
   428  
   429  func (fake *ReadWritableState) PutStateReturns(result1 error) {
   430  	fake.putStateMutex.Lock()
   431  	defer fake.putStateMutex.Unlock()
   432  	fake.PutStateStub = nil
   433  	fake.putStateReturns = struct {
   434  		result1 error
   435  	}{result1}
   436  }
   437  
   438  func (fake *ReadWritableState) PutStateReturnsOnCall(i int, result1 error) {
   439  	fake.putStateMutex.Lock()
   440  	defer fake.putStateMutex.Unlock()
   441  	fake.PutStateStub = nil
   442  	if fake.putStateReturnsOnCall == nil {
   443  		fake.putStateReturnsOnCall = make(map[int]struct {
   444  			result1 error
   445  		})
   446  	}
   447  	fake.putStateReturnsOnCall[i] = struct {
   448  		result1 error
   449  	}{result1}
   450  }
   451  
   452  func (fake *ReadWritableState) Invocations() map[string][][]interface{} {
   453  	fake.invocationsMutex.RLock()
   454  	defer fake.invocationsMutex.RUnlock()
   455  	fake.collectionNameMutex.RLock()
   456  	defer fake.collectionNameMutex.RUnlock()
   457  	fake.delStateMutex.RLock()
   458  	defer fake.delStateMutex.RUnlock()
   459  	fake.getStateMutex.RLock()
   460  	defer fake.getStateMutex.RUnlock()
   461  	fake.getStateHashMutex.RLock()
   462  	defer fake.getStateHashMutex.RUnlock()
   463  	fake.getStateRangeMutex.RLock()
   464  	defer fake.getStateRangeMutex.RUnlock()
   465  	fake.putStateMutex.RLock()
   466  	defer fake.putStateMutex.RUnlock()
   467  	copiedInvocations := map[string][][]interface{}{}
   468  	for key, value := range fake.invocations {
   469  		copiedInvocations[key] = value
   470  	}
   471  	return copiedInvocations
   472  }
   473  
   474  func (fake *ReadWritableState) recordInvocation(key string, args []interface{}) {
   475  	fake.invocationsMutex.Lock()
   476  	defer fake.invocationsMutex.Unlock()
   477  	if fake.invocations == nil {
   478  		fake.invocations = map[string][][]interface{}{}
   479  	}
   480  	if fake.invocations[key] == nil {
   481  		fake.invocations[key] = [][]interface{}{}
   482  	}
   483  	fake.invocations[key] = append(fake.invocations[key], args)
   484  }