github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/common/ledger/blockledger/fileledger/mock/block_store_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/common/ledger/blkstorage" 8 ) 9 10 type BlockStoreProvider struct { 11 CloseStub func() 12 closeMutex sync.RWMutex 13 closeArgsForCall []struct { 14 } 15 DropStub func(string) error 16 dropMutex sync.RWMutex 17 dropArgsForCall []struct { 18 arg1 string 19 } 20 dropReturns struct { 21 result1 error 22 } 23 dropReturnsOnCall map[int]struct { 24 result1 error 25 } 26 ListStub func() ([]string, error) 27 listMutex sync.RWMutex 28 listArgsForCall []struct { 29 } 30 listReturns struct { 31 result1 []string 32 result2 error 33 } 34 listReturnsOnCall map[int]struct { 35 result1 []string 36 result2 error 37 } 38 OpenStub func(string) (*blkstorage.BlockStore, error) 39 openMutex sync.RWMutex 40 openArgsForCall []struct { 41 arg1 string 42 } 43 openReturns struct { 44 result1 *blkstorage.BlockStore 45 result2 error 46 } 47 openReturnsOnCall map[int]struct { 48 result1 *blkstorage.BlockStore 49 result2 error 50 } 51 invocations map[string][][]interface{} 52 invocationsMutex sync.RWMutex 53 } 54 55 func (fake *BlockStoreProvider) Close() { 56 fake.closeMutex.Lock() 57 fake.closeArgsForCall = append(fake.closeArgsForCall, struct { 58 }{}) 59 fake.recordInvocation("Close", []interface{}{}) 60 fake.closeMutex.Unlock() 61 if fake.CloseStub != nil { 62 fake.CloseStub() 63 } 64 } 65 66 func (fake *BlockStoreProvider) CloseCallCount() int { 67 fake.closeMutex.RLock() 68 defer fake.closeMutex.RUnlock() 69 return len(fake.closeArgsForCall) 70 } 71 72 func (fake *BlockStoreProvider) CloseCalls(stub func()) { 73 fake.closeMutex.Lock() 74 defer fake.closeMutex.Unlock() 75 fake.CloseStub = stub 76 } 77 78 func (fake *BlockStoreProvider) Drop(arg1 string) error { 79 fake.dropMutex.Lock() 80 ret, specificReturn := fake.dropReturnsOnCall[len(fake.dropArgsForCall)] 81 fake.dropArgsForCall = append(fake.dropArgsForCall, struct { 82 arg1 string 83 }{arg1}) 84 fake.recordInvocation("Drop", []interface{}{arg1}) 85 fake.dropMutex.Unlock() 86 if fake.DropStub != nil { 87 return fake.DropStub(arg1) 88 } 89 if specificReturn { 90 return ret.result1 91 } 92 fakeReturns := fake.dropReturns 93 return fakeReturns.result1 94 } 95 96 func (fake *BlockStoreProvider) DropCallCount() int { 97 fake.dropMutex.RLock() 98 defer fake.dropMutex.RUnlock() 99 return len(fake.dropArgsForCall) 100 } 101 102 func (fake *BlockStoreProvider) DropCalls(stub func(string) error) { 103 fake.dropMutex.Lock() 104 defer fake.dropMutex.Unlock() 105 fake.DropStub = stub 106 } 107 108 func (fake *BlockStoreProvider) DropArgsForCall(i int) string { 109 fake.dropMutex.RLock() 110 defer fake.dropMutex.RUnlock() 111 argsForCall := fake.dropArgsForCall[i] 112 return argsForCall.arg1 113 } 114 115 func (fake *BlockStoreProvider) DropReturns(result1 error) { 116 fake.dropMutex.Lock() 117 defer fake.dropMutex.Unlock() 118 fake.DropStub = nil 119 fake.dropReturns = struct { 120 result1 error 121 }{result1} 122 } 123 124 func (fake *BlockStoreProvider) DropReturnsOnCall(i int, result1 error) { 125 fake.dropMutex.Lock() 126 defer fake.dropMutex.Unlock() 127 fake.DropStub = nil 128 if fake.dropReturnsOnCall == nil { 129 fake.dropReturnsOnCall = make(map[int]struct { 130 result1 error 131 }) 132 } 133 fake.dropReturnsOnCall[i] = struct { 134 result1 error 135 }{result1} 136 } 137 138 func (fake *BlockStoreProvider) List() ([]string, error) { 139 fake.listMutex.Lock() 140 ret, specificReturn := fake.listReturnsOnCall[len(fake.listArgsForCall)] 141 fake.listArgsForCall = append(fake.listArgsForCall, struct { 142 }{}) 143 fake.recordInvocation("List", []interface{}{}) 144 fake.listMutex.Unlock() 145 if fake.ListStub != nil { 146 return fake.ListStub() 147 } 148 if specificReturn { 149 return ret.result1, ret.result2 150 } 151 fakeReturns := fake.listReturns 152 return fakeReturns.result1, fakeReturns.result2 153 } 154 155 func (fake *BlockStoreProvider) ListCallCount() int { 156 fake.listMutex.RLock() 157 defer fake.listMutex.RUnlock() 158 return len(fake.listArgsForCall) 159 } 160 161 func (fake *BlockStoreProvider) ListCalls(stub func() ([]string, error)) { 162 fake.listMutex.Lock() 163 defer fake.listMutex.Unlock() 164 fake.ListStub = stub 165 } 166 167 func (fake *BlockStoreProvider) ListReturns(result1 []string, result2 error) { 168 fake.listMutex.Lock() 169 defer fake.listMutex.Unlock() 170 fake.ListStub = nil 171 fake.listReturns = struct { 172 result1 []string 173 result2 error 174 }{result1, result2} 175 } 176 177 func (fake *BlockStoreProvider) ListReturnsOnCall(i int, result1 []string, result2 error) { 178 fake.listMutex.Lock() 179 defer fake.listMutex.Unlock() 180 fake.ListStub = nil 181 if fake.listReturnsOnCall == nil { 182 fake.listReturnsOnCall = make(map[int]struct { 183 result1 []string 184 result2 error 185 }) 186 } 187 fake.listReturnsOnCall[i] = struct { 188 result1 []string 189 result2 error 190 }{result1, result2} 191 } 192 193 func (fake *BlockStoreProvider) Open(arg1 string) (*blkstorage.BlockStore, error) { 194 fake.openMutex.Lock() 195 ret, specificReturn := fake.openReturnsOnCall[len(fake.openArgsForCall)] 196 fake.openArgsForCall = append(fake.openArgsForCall, struct { 197 arg1 string 198 }{arg1}) 199 fake.recordInvocation("Open", []interface{}{arg1}) 200 fake.openMutex.Unlock() 201 if fake.OpenStub != nil { 202 return fake.OpenStub(arg1) 203 } 204 if specificReturn { 205 return ret.result1, ret.result2 206 } 207 fakeReturns := fake.openReturns 208 return fakeReturns.result1, fakeReturns.result2 209 } 210 211 func (fake *BlockStoreProvider) OpenCallCount() int { 212 fake.openMutex.RLock() 213 defer fake.openMutex.RUnlock() 214 return len(fake.openArgsForCall) 215 } 216 217 func (fake *BlockStoreProvider) OpenCalls(stub func(string) (*blkstorage.BlockStore, error)) { 218 fake.openMutex.Lock() 219 defer fake.openMutex.Unlock() 220 fake.OpenStub = stub 221 } 222 223 func (fake *BlockStoreProvider) OpenArgsForCall(i int) string { 224 fake.openMutex.RLock() 225 defer fake.openMutex.RUnlock() 226 argsForCall := fake.openArgsForCall[i] 227 return argsForCall.arg1 228 } 229 230 func (fake *BlockStoreProvider) OpenReturns(result1 *blkstorage.BlockStore, result2 error) { 231 fake.openMutex.Lock() 232 defer fake.openMutex.Unlock() 233 fake.OpenStub = nil 234 fake.openReturns = struct { 235 result1 *blkstorage.BlockStore 236 result2 error 237 }{result1, result2} 238 } 239 240 func (fake *BlockStoreProvider) OpenReturnsOnCall(i int, result1 *blkstorage.BlockStore, result2 error) { 241 fake.openMutex.Lock() 242 defer fake.openMutex.Unlock() 243 fake.OpenStub = nil 244 if fake.openReturnsOnCall == nil { 245 fake.openReturnsOnCall = make(map[int]struct { 246 result1 *blkstorage.BlockStore 247 result2 error 248 }) 249 } 250 fake.openReturnsOnCall[i] = struct { 251 result1 *blkstorage.BlockStore 252 result2 error 253 }{result1, result2} 254 } 255 256 func (fake *BlockStoreProvider) Invocations() map[string][][]interface{} { 257 fake.invocationsMutex.RLock() 258 defer fake.invocationsMutex.RUnlock() 259 fake.closeMutex.RLock() 260 defer fake.closeMutex.RUnlock() 261 fake.dropMutex.RLock() 262 defer fake.dropMutex.RUnlock() 263 fake.listMutex.RLock() 264 defer fake.listMutex.RUnlock() 265 fake.openMutex.RLock() 266 defer fake.openMutex.RUnlock() 267 copiedInvocations := map[string][][]interface{}{} 268 for key, value := range fake.invocations { 269 copiedInvocations[key] = value 270 } 271 return copiedInvocations 272 } 273 274 func (fake *BlockStoreProvider) recordInvocation(key string, args []interface{}) { 275 fake.invocationsMutex.Lock() 276 defer fake.invocationsMutex.Unlock() 277 if fake.invocations == nil { 278 fake.invocations = map[string][][]interface{}{} 279 } 280 if fake.invocations[key] == nil { 281 fake.invocations[key] = [][]interface{}{} 282 } 283 fake.invocations[key] = append(fake.invocations[key], args) 284 }