connection.go 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  1. // Code generated by counterfeiter. DO NOT EDIT.
  2. package mocks
  3. import (
  4. "context"
  5. "net"
  6. "sync"
  7. "time"
  8. "github.com/syncthing/syncthing/lib/protocol"
  9. )
  10. type Connection struct {
  11. CloseStub func(error)
  12. closeMutex sync.RWMutex
  13. closeArgsForCall []struct {
  14. arg1 error
  15. }
  16. ClosedStub func() <-chan struct{}
  17. closedMutex sync.RWMutex
  18. closedArgsForCall []struct {
  19. }
  20. closedReturns struct {
  21. result1 <-chan struct{}
  22. }
  23. closedReturnsOnCall map[int]struct {
  24. result1 <-chan struct{}
  25. }
  26. ClusterConfigStub func(*protocol.ClusterConfig, map[string]string)
  27. clusterConfigMutex sync.RWMutex
  28. clusterConfigArgsForCall []struct {
  29. arg1 *protocol.ClusterConfig
  30. arg2 map[string]string
  31. }
  32. ConnectionIDStub func() string
  33. connectionIDMutex sync.RWMutex
  34. connectionIDArgsForCall []struct {
  35. }
  36. connectionIDReturns struct {
  37. result1 string
  38. }
  39. connectionIDReturnsOnCall map[int]struct {
  40. result1 string
  41. }
  42. CryptoStub func() string
  43. cryptoMutex sync.RWMutex
  44. cryptoArgsForCall []struct {
  45. }
  46. cryptoReturns struct {
  47. result1 string
  48. }
  49. cryptoReturnsOnCall map[int]struct {
  50. result1 string
  51. }
  52. DeviceIDStub func() protocol.DeviceID
  53. deviceIDMutex sync.RWMutex
  54. deviceIDArgsForCall []struct {
  55. }
  56. deviceIDReturns struct {
  57. result1 protocol.DeviceID
  58. }
  59. deviceIDReturnsOnCall map[int]struct {
  60. result1 protocol.DeviceID
  61. }
  62. DownloadProgressStub func(context.Context, *protocol.DownloadProgress)
  63. downloadProgressMutex sync.RWMutex
  64. downloadProgressArgsForCall []struct {
  65. arg1 context.Context
  66. arg2 *protocol.DownloadProgress
  67. }
  68. EstablishedAtStub func() time.Time
  69. establishedAtMutex sync.RWMutex
  70. establishedAtArgsForCall []struct {
  71. }
  72. establishedAtReturns struct {
  73. result1 time.Time
  74. }
  75. establishedAtReturnsOnCall map[int]struct {
  76. result1 time.Time
  77. }
  78. IndexStub func(context.Context, *protocol.Index) error
  79. indexMutex sync.RWMutex
  80. indexArgsForCall []struct {
  81. arg1 context.Context
  82. arg2 *protocol.Index
  83. }
  84. indexReturns struct {
  85. result1 error
  86. }
  87. indexReturnsOnCall map[int]struct {
  88. result1 error
  89. }
  90. IndexUpdateStub func(context.Context, *protocol.IndexUpdate) error
  91. indexUpdateMutex sync.RWMutex
  92. indexUpdateArgsForCall []struct {
  93. arg1 context.Context
  94. arg2 *protocol.IndexUpdate
  95. }
  96. indexUpdateReturns struct {
  97. result1 error
  98. }
  99. indexUpdateReturnsOnCall map[int]struct {
  100. result1 error
  101. }
  102. IsLocalStub func() bool
  103. isLocalMutex sync.RWMutex
  104. isLocalArgsForCall []struct {
  105. }
  106. isLocalReturns struct {
  107. result1 bool
  108. }
  109. isLocalReturnsOnCall map[int]struct {
  110. result1 bool
  111. }
  112. PriorityStub func() int
  113. priorityMutex sync.RWMutex
  114. priorityArgsForCall []struct {
  115. }
  116. priorityReturns struct {
  117. result1 int
  118. }
  119. priorityReturnsOnCall map[int]struct {
  120. result1 int
  121. }
  122. RemoteAddrStub func() net.Addr
  123. remoteAddrMutex sync.RWMutex
  124. remoteAddrArgsForCall []struct {
  125. }
  126. remoteAddrReturns struct {
  127. result1 net.Addr
  128. }
  129. remoteAddrReturnsOnCall map[int]struct {
  130. result1 net.Addr
  131. }
  132. RequestStub func(context.Context, *protocol.Request) ([]byte, error)
  133. requestMutex sync.RWMutex
  134. requestArgsForCall []struct {
  135. arg1 context.Context
  136. arg2 *protocol.Request
  137. }
  138. requestReturns struct {
  139. result1 []byte
  140. result2 error
  141. }
  142. requestReturnsOnCall map[int]struct {
  143. result1 []byte
  144. result2 error
  145. }
  146. StartStub func()
  147. startMutex sync.RWMutex
  148. startArgsForCall []struct {
  149. }
  150. StatisticsStub func() protocol.Statistics
  151. statisticsMutex sync.RWMutex
  152. statisticsArgsForCall []struct {
  153. }
  154. statisticsReturns struct {
  155. result1 protocol.Statistics
  156. }
  157. statisticsReturnsOnCall map[int]struct {
  158. result1 protocol.Statistics
  159. }
  160. StringStub func() string
  161. stringMutex sync.RWMutex
  162. stringArgsForCall []struct {
  163. }
  164. stringReturns struct {
  165. result1 string
  166. }
  167. stringReturnsOnCall map[int]struct {
  168. result1 string
  169. }
  170. TransportStub func() string
  171. transportMutex sync.RWMutex
  172. transportArgsForCall []struct {
  173. }
  174. transportReturns struct {
  175. result1 string
  176. }
  177. transportReturnsOnCall map[int]struct {
  178. result1 string
  179. }
  180. TypeStub func() string
  181. typeMutex sync.RWMutex
  182. typeArgsForCall []struct {
  183. }
  184. typeReturns struct {
  185. result1 string
  186. }
  187. typeReturnsOnCall map[int]struct {
  188. result1 string
  189. }
  190. invocations map[string][][]interface{}
  191. invocationsMutex sync.RWMutex
  192. }
  193. func (fake *Connection) Close(arg1 error) {
  194. fake.closeMutex.Lock()
  195. fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
  196. arg1 error
  197. }{arg1})
  198. stub := fake.CloseStub
  199. fake.recordInvocation("Close", []interface{}{arg1})
  200. fake.closeMutex.Unlock()
  201. if stub != nil {
  202. fake.CloseStub(arg1)
  203. }
  204. }
  205. func (fake *Connection) CloseCallCount() int {
  206. fake.closeMutex.RLock()
  207. defer fake.closeMutex.RUnlock()
  208. return len(fake.closeArgsForCall)
  209. }
  210. func (fake *Connection) CloseCalls(stub func(error)) {
  211. fake.closeMutex.Lock()
  212. defer fake.closeMutex.Unlock()
  213. fake.CloseStub = stub
  214. }
  215. func (fake *Connection) CloseArgsForCall(i int) error {
  216. fake.closeMutex.RLock()
  217. defer fake.closeMutex.RUnlock()
  218. argsForCall := fake.closeArgsForCall[i]
  219. return argsForCall.arg1
  220. }
  221. func (fake *Connection) Closed() <-chan struct{} {
  222. fake.closedMutex.Lock()
  223. ret, specificReturn := fake.closedReturnsOnCall[len(fake.closedArgsForCall)]
  224. fake.closedArgsForCall = append(fake.closedArgsForCall, struct {
  225. }{})
  226. stub := fake.ClosedStub
  227. fakeReturns := fake.closedReturns
  228. fake.recordInvocation("Closed", []interface{}{})
  229. fake.closedMutex.Unlock()
  230. if stub != nil {
  231. return stub()
  232. }
  233. if specificReturn {
  234. return ret.result1
  235. }
  236. return fakeReturns.result1
  237. }
  238. func (fake *Connection) ClosedCallCount() int {
  239. fake.closedMutex.RLock()
  240. defer fake.closedMutex.RUnlock()
  241. return len(fake.closedArgsForCall)
  242. }
  243. func (fake *Connection) ClosedCalls(stub func() <-chan struct{}) {
  244. fake.closedMutex.Lock()
  245. defer fake.closedMutex.Unlock()
  246. fake.ClosedStub = stub
  247. }
  248. func (fake *Connection) ClosedReturns(result1 <-chan struct{}) {
  249. fake.closedMutex.Lock()
  250. defer fake.closedMutex.Unlock()
  251. fake.ClosedStub = nil
  252. fake.closedReturns = struct {
  253. result1 <-chan struct{}
  254. }{result1}
  255. }
  256. func (fake *Connection) ClosedReturnsOnCall(i int, result1 <-chan struct{}) {
  257. fake.closedMutex.Lock()
  258. defer fake.closedMutex.Unlock()
  259. fake.ClosedStub = nil
  260. if fake.closedReturnsOnCall == nil {
  261. fake.closedReturnsOnCall = make(map[int]struct {
  262. result1 <-chan struct{}
  263. })
  264. }
  265. fake.closedReturnsOnCall[i] = struct {
  266. result1 <-chan struct{}
  267. }{result1}
  268. }
  269. func (fake *Connection) ClusterConfig(arg1 *protocol.ClusterConfig, arg2 map[string]string) {
  270. fake.clusterConfigMutex.Lock()
  271. fake.clusterConfigArgsForCall = append(fake.clusterConfigArgsForCall, struct {
  272. arg1 *protocol.ClusterConfig
  273. arg2 map[string]string
  274. }{arg1, arg2})
  275. stub := fake.ClusterConfigStub
  276. fake.recordInvocation("ClusterConfig", []interface{}{arg1, arg2})
  277. fake.clusterConfigMutex.Unlock()
  278. if stub != nil {
  279. fake.ClusterConfigStub(arg1, arg2)
  280. }
  281. }
  282. func (fake *Connection) ClusterConfigCallCount() int {
  283. fake.clusterConfigMutex.RLock()
  284. defer fake.clusterConfigMutex.RUnlock()
  285. return len(fake.clusterConfigArgsForCall)
  286. }
  287. func (fake *Connection) ClusterConfigCalls(stub func(*protocol.ClusterConfig, map[string]string)) {
  288. fake.clusterConfigMutex.Lock()
  289. defer fake.clusterConfigMutex.Unlock()
  290. fake.ClusterConfigStub = stub
  291. }
  292. func (fake *Connection) ClusterConfigArgsForCall(i int) (*protocol.ClusterConfig, map[string]string) {
  293. fake.clusterConfigMutex.RLock()
  294. defer fake.clusterConfigMutex.RUnlock()
  295. argsForCall := fake.clusterConfigArgsForCall[i]
  296. return argsForCall.arg1, argsForCall.arg2
  297. }
  298. func (fake *Connection) ConnectionID() string {
  299. fake.connectionIDMutex.Lock()
  300. ret, specificReturn := fake.connectionIDReturnsOnCall[len(fake.connectionIDArgsForCall)]
  301. fake.connectionIDArgsForCall = append(fake.connectionIDArgsForCall, struct {
  302. }{})
  303. stub := fake.ConnectionIDStub
  304. fakeReturns := fake.connectionIDReturns
  305. fake.recordInvocation("ConnectionID", []interface{}{})
  306. fake.connectionIDMutex.Unlock()
  307. if stub != nil {
  308. return stub()
  309. }
  310. if specificReturn {
  311. return ret.result1
  312. }
  313. return fakeReturns.result1
  314. }
  315. func (fake *Connection) ConnectionIDCallCount() int {
  316. fake.connectionIDMutex.RLock()
  317. defer fake.connectionIDMutex.RUnlock()
  318. return len(fake.connectionIDArgsForCall)
  319. }
  320. func (fake *Connection) ConnectionIDCalls(stub func() string) {
  321. fake.connectionIDMutex.Lock()
  322. defer fake.connectionIDMutex.Unlock()
  323. fake.ConnectionIDStub = stub
  324. }
  325. func (fake *Connection) ConnectionIDReturns(result1 string) {
  326. fake.connectionIDMutex.Lock()
  327. defer fake.connectionIDMutex.Unlock()
  328. fake.ConnectionIDStub = nil
  329. fake.connectionIDReturns = struct {
  330. result1 string
  331. }{result1}
  332. }
  333. func (fake *Connection) ConnectionIDReturnsOnCall(i int, result1 string) {
  334. fake.connectionIDMutex.Lock()
  335. defer fake.connectionIDMutex.Unlock()
  336. fake.ConnectionIDStub = nil
  337. if fake.connectionIDReturnsOnCall == nil {
  338. fake.connectionIDReturnsOnCall = make(map[int]struct {
  339. result1 string
  340. })
  341. }
  342. fake.connectionIDReturnsOnCall[i] = struct {
  343. result1 string
  344. }{result1}
  345. }
  346. func (fake *Connection) Crypto() string {
  347. fake.cryptoMutex.Lock()
  348. ret, specificReturn := fake.cryptoReturnsOnCall[len(fake.cryptoArgsForCall)]
  349. fake.cryptoArgsForCall = append(fake.cryptoArgsForCall, struct {
  350. }{})
  351. stub := fake.CryptoStub
  352. fakeReturns := fake.cryptoReturns
  353. fake.recordInvocation("Crypto", []interface{}{})
  354. fake.cryptoMutex.Unlock()
  355. if stub != nil {
  356. return stub()
  357. }
  358. if specificReturn {
  359. return ret.result1
  360. }
  361. return fakeReturns.result1
  362. }
  363. func (fake *Connection) CryptoCallCount() int {
  364. fake.cryptoMutex.RLock()
  365. defer fake.cryptoMutex.RUnlock()
  366. return len(fake.cryptoArgsForCall)
  367. }
  368. func (fake *Connection) CryptoCalls(stub func() string) {
  369. fake.cryptoMutex.Lock()
  370. defer fake.cryptoMutex.Unlock()
  371. fake.CryptoStub = stub
  372. }
  373. func (fake *Connection) CryptoReturns(result1 string) {
  374. fake.cryptoMutex.Lock()
  375. defer fake.cryptoMutex.Unlock()
  376. fake.CryptoStub = nil
  377. fake.cryptoReturns = struct {
  378. result1 string
  379. }{result1}
  380. }
  381. func (fake *Connection) CryptoReturnsOnCall(i int, result1 string) {
  382. fake.cryptoMutex.Lock()
  383. defer fake.cryptoMutex.Unlock()
  384. fake.CryptoStub = nil
  385. if fake.cryptoReturnsOnCall == nil {
  386. fake.cryptoReturnsOnCall = make(map[int]struct {
  387. result1 string
  388. })
  389. }
  390. fake.cryptoReturnsOnCall[i] = struct {
  391. result1 string
  392. }{result1}
  393. }
  394. func (fake *Connection) DeviceID() protocol.DeviceID {
  395. fake.deviceIDMutex.Lock()
  396. ret, specificReturn := fake.deviceIDReturnsOnCall[len(fake.deviceIDArgsForCall)]
  397. fake.deviceIDArgsForCall = append(fake.deviceIDArgsForCall, struct {
  398. }{})
  399. stub := fake.DeviceIDStub
  400. fakeReturns := fake.deviceIDReturns
  401. fake.recordInvocation("DeviceID", []interface{}{})
  402. fake.deviceIDMutex.Unlock()
  403. if stub != nil {
  404. return stub()
  405. }
  406. if specificReturn {
  407. return ret.result1
  408. }
  409. return fakeReturns.result1
  410. }
  411. func (fake *Connection) DeviceIDCallCount() int {
  412. fake.deviceIDMutex.RLock()
  413. defer fake.deviceIDMutex.RUnlock()
  414. return len(fake.deviceIDArgsForCall)
  415. }
  416. func (fake *Connection) DeviceIDCalls(stub func() protocol.DeviceID) {
  417. fake.deviceIDMutex.Lock()
  418. defer fake.deviceIDMutex.Unlock()
  419. fake.DeviceIDStub = stub
  420. }
  421. func (fake *Connection) DeviceIDReturns(result1 protocol.DeviceID) {
  422. fake.deviceIDMutex.Lock()
  423. defer fake.deviceIDMutex.Unlock()
  424. fake.DeviceIDStub = nil
  425. fake.deviceIDReturns = struct {
  426. result1 protocol.DeviceID
  427. }{result1}
  428. }
  429. func (fake *Connection) DeviceIDReturnsOnCall(i int, result1 protocol.DeviceID) {
  430. fake.deviceIDMutex.Lock()
  431. defer fake.deviceIDMutex.Unlock()
  432. fake.DeviceIDStub = nil
  433. if fake.deviceIDReturnsOnCall == nil {
  434. fake.deviceIDReturnsOnCall = make(map[int]struct {
  435. result1 protocol.DeviceID
  436. })
  437. }
  438. fake.deviceIDReturnsOnCall[i] = struct {
  439. result1 protocol.DeviceID
  440. }{result1}
  441. }
  442. func (fake *Connection) DownloadProgress(arg1 context.Context, arg2 *protocol.DownloadProgress) {
  443. fake.downloadProgressMutex.Lock()
  444. fake.downloadProgressArgsForCall = append(fake.downloadProgressArgsForCall, struct {
  445. arg1 context.Context
  446. arg2 *protocol.DownloadProgress
  447. }{arg1, arg2})
  448. stub := fake.DownloadProgressStub
  449. fake.recordInvocation("DownloadProgress", []interface{}{arg1, arg2})
  450. fake.downloadProgressMutex.Unlock()
  451. if stub != nil {
  452. fake.DownloadProgressStub(arg1, arg2)
  453. }
  454. }
  455. func (fake *Connection) DownloadProgressCallCount() int {
  456. fake.downloadProgressMutex.RLock()
  457. defer fake.downloadProgressMutex.RUnlock()
  458. return len(fake.downloadProgressArgsForCall)
  459. }
  460. func (fake *Connection) DownloadProgressCalls(stub func(context.Context, *protocol.DownloadProgress)) {
  461. fake.downloadProgressMutex.Lock()
  462. defer fake.downloadProgressMutex.Unlock()
  463. fake.DownloadProgressStub = stub
  464. }
  465. func (fake *Connection) DownloadProgressArgsForCall(i int) (context.Context, *protocol.DownloadProgress) {
  466. fake.downloadProgressMutex.RLock()
  467. defer fake.downloadProgressMutex.RUnlock()
  468. argsForCall := fake.downloadProgressArgsForCall[i]
  469. return argsForCall.arg1, argsForCall.arg2
  470. }
  471. func (fake *Connection) EstablishedAt() time.Time {
  472. fake.establishedAtMutex.Lock()
  473. ret, specificReturn := fake.establishedAtReturnsOnCall[len(fake.establishedAtArgsForCall)]
  474. fake.establishedAtArgsForCall = append(fake.establishedAtArgsForCall, struct {
  475. }{})
  476. stub := fake.EstablishedAtStub
  477. fakeReturns := fake.establishedAtReturns
  478. fake.recordInvocation("EstablishedAt", []interface{}{})
  479. fake.establishedAtMutex.Unlock()
  480. if stub != nil {
  481. return stub()
  482. }
  483. if specificReturn {
  484. return ret.result1
  485. }
  486. return fakeReturns.result1
  487. }
  488. func (fake *Connection) EstablishedAtCallCount() int {
  489. fake.establishedAtMutex.RLock()
  490. defer fake.establishedAtMutex.RUnlock()
  491. return len(fake.establishedAtArgsForCall)
  492. }
  493. func (fake *Connection) EstablishedAtCalls(stub func() time.Time) {
  494. fake.establishedAtMutex.Lock()
  495. defer fake.establishedAtMutex.Unlock()
  496. fake.EstablishedAtStub = stub
  497. }
  498. func (fake *Connection) EstablishedAtReturns(result1 time.Time) {
  499. fake.establishedAtMutex.Lock()
  500. defer fake.establishedAtMutex.Unlock()
  501. fake.EstablishedAtStub = nil
  502. fake.establishedAtReturns = struct {
  503. result1 time.Time
  504. }{result1}
  505. }
  506. func (fake *Connection) EstablishedAtReturnsOnCall(i int, result1 time.Time) {
  507. fake.establishedAtMutex.Lock()
  508. defer fake.establishedAtMutex.Unlock()
  509. fake.EstablishedAtStub = nil
  510. if fake.establishedAtReturnsOnCall == nil {
  511. fake.establishedAtReturnsOnCall = make(map[int]struct {
  512. result1 time.Time
  513. })
  514. }
  515. fake.establishedAtReturnsOnCall[i] = struct {
  516. result1 time.Time
  517. }{result1}
  518. }
  519. func (fake *Connection) Index(arg1 context.Context, arg2 *protocol.Index) error {
  520. fake.indexMutex.Lock()
  521. ret, specificReturn := fake.indexReturnsOnCall[len(fake.indexArgsForCall)]
  522. fake.indexArgsForCall = append(fake.indexArgsForCall, struct {
  523. arg1 context.Context
  524. arg2 *protocol.Index
  525. }{arg1, arg2})
  526. stub := fake.IndexStub
  527. fakeReturns := fake.indexReturns
  528. fake.recordInvocation("Index", []interface{}{arg1, arg2})
  529. fake.indexMutex.Unlock()
  530. if stub != nil {
  531. return stub(arg1, arg2)
  532. }
  533. if specificReturn {
  534. return ret.result1
  535. }
  536. return fakeReturns.result1
  537. }
  538. func (fake *Connection) IndexCallCount() int {
  539. fake.indexMutex.RLock()
  540. defer fake.indexMutex.RUnlock()
  541. return len(fake.indexArgsForCall)
  542. }
  543. func (fake *Connection) IndexCalls(stub func(context.Context, *protocol.Index) error) {
  544. fake.indexMutex.Lock()
  545. defer fake.indexMutex.Unlock()
  546. fake.IndexStub = stub
  547. }
  548. func (fake *Connection) IndexArgsForCall(i int) (context.Context, *protocol.Index) {
  549. fake.indexMutex.RLock()
  550. defer fake.indexMutex.RUnlock()
  551. argsForCall := fake.indexArgsForCall[i]
  552. return argsForCall.arg1, argsForCall.arg2
  553. }
  554. func (fake *Connection) IndexReturns(result1 error) {
  555. fake.indexMutex.Lock()
  556. defer fake.indexMutex.Unlock()
  557. fake.IndexStub = nil
  558. fake.indexReturns = struct {
  559. result1 error
  560. }{result1}
  561. }
  562. func (fake *Connection) IndexReturnsOnCall(i int, result1 error) {
  563. fake.indexMutex.Lock()
  564. defer fake.indexMutex.Unlock()
  565. fake.IndexStub = nil
  566. if fake.indexReturnsOnCall == nil {
  567. fake.indexReturnsOnCall = make(map[int]struct {
  568. result1 error
  569. })
  570. }
  571. fake.indexReturnsOnCall[i] = struct {
  572. result1 error
  573. }{result1}
  574. }
  575. func (fake *Connection) IndexUpdate(arg1 context.Context, arg2 *protocol.IndexUpdate) error {
  576. fake.indexUpdateMutex.Lock()
  577. ret, specificReturn := fake.indexUpdateReturnsOnCall[len(fake.indexUpdateArgsForCall)]
  578. fake.indexUpdateArgsForCall = append(fake.indexUpdateArgsForCall, struct {
  579. arg1 context.Context
  580. arg2 *protocol.IndexUpdate
  581. }{arg1, arg2})
  582. stub := fake.IndexUpdateStub
  583. fakeReturns := fake.indexUpdateReturns
  584. fake.recordInvocation("IndexUpdate", []interface{}{arg1, arg2})
  585. fake.indexUpdateMutex.Unlock()
  586. if stub != nil {
  587. return stub(arg1, arg2)
  588. }
  589. if specificReturn {
  590. return ret.result1
  591. }
  592. return fakeReturns.result1
  593. }
  594. func (fake *Connection) IndexUpdateCallCount() int {
  595. fake.indexUpdateMutex.RLock()
  596. defer fake.indexUpdateMutex.RUnlock()
  597. return len(fake.indexUpdateArgsForCall)
  598. }
  599. func (fake *Connection) IndexUpdateCalls(stub func(context.Context, *protocol.IndexUpdate) error) {
  600. fake.indexUpdateMutex.Lock()
  601. defer fake.indexUpdateMutex.Unlock()
  602. fake.IndexUpdateStub = stub
  603. }
  604. func (fake *Connection) IndexUpdateArgsForCall(i int) (context.Context, *protocol.IndexUpdate) {
  605. fake.indexUpdateMutex.RLock()
  606. defer fake.indexUpdateMutex.RUnlock()
  607. argsForCall := fake.indexUpdateArgsForCall[i]
  608. return argsForCall.arg1, argsForCall.arg2
  609. }
  610. func (fake *Connection) IndexUpdateReturns(result1 error) {
  611. fake.indexUpdateMutex.Lock()
  612. defer fake.indexUpdateMutex.Unlock()
  613. fake.IndexUpdateStub = nil
  614. fake.indexUpdateReturns = struct {
  615. result1 error
  616. }{result1}
  617. }
  618. func (fake *Connection) IndexUpdateReturnsOnCall(i int, result1 error) {
  619. fake.indexUpdateMutex.Lock()
  620. defer fake.indexUpdateMutex.Unlock()
  621. fake.IndexUpdateStub = nil
  622. if fake.indexUpdateReturnsOnCall == nil {
  623. fake.indexUpdateReturnsOnCall = make(map[int]struct {
  624. result1 error
  625. })
  626. }
  627. fake.indexUpdateReturnsOnCall[i] = struct {
  628. result1 error
  629. }{result1}
  630. }
  631. func (fake *Connection) IsLocal() bool {
  632. fake.isLocalMutex.Lock()
  633. ret, specificReturn := fake.isLocalReturnsOnCall[len(fake.isLocalArgsForCall)]
  634. fake.isLocalArgsForCall = append(fake.isLocalArgsForCall, struct {
  635. }{})
  636. stub := fake.IsLocalStub
  637. fakeReturns := fake.isLocalReturns
  638. fake.recordInvocation("IsLocal", []interface{}{})
  639. fake.isLocalMutex.Unlock()
  640. if stub != nil {
  641. return stub()
  642. }
  643. if specificReturn {
  644. return ret.result1
  645. }
  646. return fakeReturns.result1
  647. }
  648. func (fake *Connection) IsLocalCallCount() int {
  649. fake.isLocalMutex.RLock()
  650. defer fake.isLocalMutex.RUnlock()
  651. return len(fake.isLocalArgsForCall)
  652. }
  653. func (fake *Connection) IsLocalCalls(stub func() bool) {
  654. fake.isLocalMutex.Lock()
  655. defer fake.isLocalMutex.Unlock()
  656. fake.IsLocalStub = stub
  657. }
  658. func (fake *Connection) IsLocalReturns(result1 bool) {
  659. fake.isLocalMutex.Lock()
  660. defer fake.isLocalMutex.Unlock()
  661. fake.IsLocalStub = nil
  662. fake.isLocalReturns = struct {
  663. result1 bool
  664. }{result1}
  665. }
  666. func (fake *Connection) IsLocalReturnsOnCall(i int, result1 bool) {
  667. fake.isLocalMutex.Lock()
  668. defer fake.isLocalMutex.Unlock()
  669. fake.IsLocalStub = nil
  670. if fake.isLocalReturnsOnCall == nil {
  671. fake.isLocalReturnsOnCall = make(map[int]struct {
  672. result1 bool
  673. })
  674. }
  675. fake.isLocalReturnsOnCall[i] = struct {
  676. result1 bool
  677. }{result1}
  678. }
  679. func (fake *Connection) Priority() int {
  680. fake.priorityMutex.Lock()
  681. ret, specificReturn := fake.priorityReturnsOnCall[len(fake.priorityArgsForCall)]
  682. fake.priorityArgsForCall = append(fake.priorityArgsForCall, struct {
  683. }{})
  684. stub := fake.PriorityStub
  685. fakeReturns := fake.priorityReturns
  686. fake.recordInvocation("Priority", []interface{}{})
  687. fake.priorityMutex.Unlock()
  688. if stub != nil {
  689. return stub()
  690. }
  691. if specificReturn {
  692. return ret.result1
  693. }
  694. return fakeReturns.result1
  695. }
  696. func (fake *Connection) PriorityCallCount() int {
  697. fake.priorityMutex.RLock()
  698. defer fake.priorityMutex.RUnlock()
  699. return len(fake.priorityArgsForCall)
  700. }
  701. func (fake *Connection) PriorityCalls(stub func() int) {
  702. fake.priorityMutex.Lock()
  703. defer fake.priorityMutex.Unlock()
  704. fake.PriorityStub = stub
  705. }
  706. func (fake *Connection) PriorityReturns(result1 int) {
  707. fake.priorityMutex.Lock()
  708. defer fake.priorityMutex.Unlock()
  709. fake.PriorityStub = nil
  710. fake.priorityReturns = struct {
  711. result1 int
  712. }{result1}
  713. }
  714. func (fake *Connection) PriorityReturnsOnCall(i int, result1 int) {
  715. fake.priorityMutex.Lock()
  716. defer fake.priorityMutex.Unlock()
  717. fake.PriorityStub = nil
  718. if fake.priorityReturnsOnCall == nil {
  719. fake.priorityReturnsOnCall = make(map[int]struct {
  720. result1 int
  721. })
  722. }
  723. fake.priorityReturnsOnCall[i] = struct {
  724. result1 int
  725. }{result1}
  726. }
  727. func (fake *Connection) RemoteAddr() net.Addr {
  728. fake.remoteAddrMutex.Lock()
  729. ret, specificReturn := fake.remoteAddrReturnsOnCall[len(fake.remoteAddrArgsForCall)]
  730. fake.remoteAddrArgsForCall = append(fake.remoteAddrArgsForCall, struct {
  731. }{})
  732. stub := fake.RemoteAddrStub
  733. fakeReturns := fake.remoteAddrReturns
  734. fake.recordInvocation("RemoteAddr", []interface{}{})
  735. fake.remoteAddrMutex.Unlock()
  736. if stub != nil {
  737. return stub()
  738. }
  739. if specificReturn {
  740. return ret.result1
  741. }
  742. return fakeReturns.result1
  743. }
  744. func (fake *Connection) RemoteAddrCallCount() int {
  745. fake.remoteAddrMutex.RLock()
  746. defer fake.remoteAddrMutex.RUnlock()
  747. return len(fake.remoteAddrArgsForCall)
  748. }
  749. func (fake *Connection) RemoteAddrCalls(stub func() net.Addr) {
  750. fake.remoteAddrMutex.Lock()
  751. defer fake.remoteAddrMutex.Unlock()
  752. fake.RemoteAddrStub = stub
  753. }
  754. func (fake *Connection) RemoteAddrReturns(result1 net.Addr) {
  755. fake.remoteAddrMutex.Lock()
  756. defer fake.remoteAddrMutex.Unlock()
  757. fake.RemoteAddrStub = nil
  758. fake.remoteAddrReturns = struct {
  759. result1 net.Addr
  760. }{result1}
  761. }
  762. func (fake *Connection) RemoteAddrReturnsOnCall(i int, result1 net.Addr) {
  763. fake.remoteAddrMutex.Lock()
  764. defer fake.remoteAddrMutex.Unlock()
  765. fake.RemoteAddrStub = nil
  766. if fake.remoteAddrReturnsOnCall == nil {
  767. fake.remoteAddrReturnsOnCall = make(map[int]struct {
  768. result1 net.Addr
  769. })
  770. }
  771. fake.remoteAddrReturnsOnCall[i] = struct {
  772. result1 net.Addr
  773. }{result1}
  774. }
  775. func (fake *Connection) Request(arg1 context.Context, arg2 *protocol.Request) ([]byte, error) {
  776. fake.requestMutex.Lock()
  777. ret, specificReturn := fake.requestReturnsOnCall[len(fake.requestArgsForCall)]
  778. fake.requestArgsForCall = append(fake.requestArgsForCall, struct {
  779. arg1 context.Context
  780. arg2 *protocol.Request
  781. }{arg1, arg2})
  782. stub := fake.RequestStub
  783. fakeReturns := fake.requestReturns
  784. fake.recordInvocation("Request", []interface{}{arg1, arg2})
  785. fake.requestMutex.Unlock()
  786. if stub != nil {
  787. return stub(arg1, arg2)
  788. }
  789. if specificReturn {
  790. return ret.result1, ret.result2
  791. }
  792. return fakeReturns.result1, fakeReturns.result2
  793. }
  794. func (fake *Connection) RequestCallCount() int {
  795. fake.requestMutex.RLock()
  796. defer fake.requestMutex.RUnlock()
  797. return len(fake.requestArgsForCall)
  798. }
  799. func (fake *Connection) RequestCalls(stub func(context.Context, *protocol.Request) ([]byte, error)) {
  800. fake.requestMutex.Lock()
  801. defer fake.requestMutex.Unlock()
  802. fake.RequestStub = stub
  803. }
  804. func (fake *Connection) RequestArgsForCall(i int) (context.Context, *protocol.Request) {
  805. fake.requestMutex.RLock()
  806. defer fake.requestMutex.RUnlock()
  807. argsForCall := fake.requestArgsForCall[i]
  808. return argsForCall.arg1, argsForCall.arg2
  809. }
  810. func (fake *Connection) RequestReturns(result1 []byte, result2 error) {
  811. fake.requestMutex.Lock()
  812. defer fake.requestMutex.Unlock()
  813. fake.RequestStub = nil
  814. fake.requestReturns = struct {
  815. result1 []byte
  816. result2 error
  817. }{result1, result2}
  818. }
  819. func (fake *Connection) RequestReturnsOnCall(i int, result1 []byte, result2 error) {
  820. fake.requestMutex.Lock()
  821. defer fake.requestMutex.Unlock()
  822. fake.RequestStub = nil
  823. if fake.requestReturnsOnCall == nil {
  824. fake.requestReturnsOnCall = make(map[int]struct {
  825. result1 []byte
  826. result2 error
  827. })
  828. }
  829. fake.requestReturnsOnCall[i] = struct {
  830. result1 []byte
  831. result2 error
  832. }{result1, result2}
  833. }
  834. func (fake *Connection) Start() {
  835. fake.startMutex.Lock()
  836. fake.startArgsForCall = append(fake.startArgsForCall, struct {
  837. }{})
  838. stub := fake.StartStub
  839. fake.recordInvocation("Start", []interface{}{})
  840. fake.startMutex.Unlock()
  841. if stub != nil {
  842. fake.StartStub()
  843. }
  844. }
  845. func (fake *Connection) StartCallCount() int {
  846. fake.startMutex.RLock()
  847. defer fake.startMutex.RUnlock()
  848. return len(fake.startArgsForCall)
  849. }
  850. func (fake *Connection) StartCalls(stub func()) {
  851. fake.startMutex.Lock()
  852. defer fake.startMutex.Unlock()
  853. fake.StartStub = stub
  854. }
  855. func (fake *Connection) Statistics() protocol.Statistics {
  856. fake.statisticsMutex.Lock()
  857. ret, specificReturn := fake.statisticsReturnsOnCall[len(fake.statisticsArgsForCall)]
  858. fake.statisticsArgsForCall = append(fake.statisticsArgsForCall, struct {
  859. }{})
  860. stub := fake.StatisticsStub
  861. fakeReturns := fake.statisticsReturns
  862. fake.recordInvocation("Statistics", []interface{}{})
  863. fake.statisticsMutex.Unlock()
  864. if stub != nil {
  865. return stub()
  866. }
  867. if specificReturn {
  868. return ret.result1
  869. }
  870. return fakeReturns.result1
  871. }
  872. func (fake *Connection) StatisticsCallCount() int {
  873. fake.statisticsMutex.RLock()
  874. defer fake.statisticsMutex.RUnlock()
  875. return len(fake.statisticsArgsForCall)
  876. }
  877. func (fake *Connection) StatisticsCalls(stub func() protocol.Statistics) {
  878. fake.statisticsMutex.Lock()
  879. defer fake.statisticsMutex.Unlock()
  880. fake.StatisticsStub = stub
  881. }
  882. func (fake *Connection) StatisticsReturns(result1 protocol.Statistics) {
  883. fake.statisticsMutex.Lock()
  884. defer fake.statisticsMutex.Unlock()
  885. fake.StatisticsStub = nil
  886. fake.statisticsReturns = struct {
  887. result1 protocol.Statistics
  888. }{result1}
  889. }
  890. func (fake *Connection) StatisticsReturnsOnCall(i int, result1 protocol.Statistics) {
  891. fake.statisticsMutex.Lock()
  892. defer fake.statisticsMutex.Unlock()
  893. fake.StatisticsStub = nil
  894. if fake.statisticsReturnsOnCall == nil {
  895. fake.statisticsReturnsOnCall = make(map[int]struct {
  896. result1 protocol.Statistics
  897. })
  898. }
  899. fake.statisticsReturnsOnCall[i] = struct {
  900. result1 protocol.Statistics
  901. }{result1}
  902. }
  903. func (fake *Connection) String() string {
  904. fake.stringMutex.Lock()
  905. ret, specificReturn := fake.stringReturnsOnCall[len(fake.stringArgsForCall)]
  906. fake.stringArgsForCall = append(fake.stringArgsForCall, struct {
  907. }{})
  908. stub := fake.StringStub
  909. fakeReturns := fake.stringReturns
  910. fake.recordInvocation("String", []interface{}{})
  911. fake.stringMutex.Unlock()
  912. if stub != nil {
  913. return stub()
  914. }
  915. if specificReturn {
  916. return ret.result1
  917. }
  918. return fakeReturns.result1
  919. }
  920. func (fake *Connection) StringCallCount() int {
  921. fake.stringMutex.RLock()
  922. defer fake.stringMutex.RUnlock()
  923. return len(fake.stringArgsForCall)
  924. }
  925. func (fake *Connection) StringCalls(stub func() string) {
  926. fake.stringMutex.Lock()
  927. defer fake.stringMutex.Unlock()
  928. fake.StringStub = stub
  929. }
  930. func (fake *Connection) StringReturns(result1 string) {
  931. fake.stringMutex.Lock()
  932. defer fake.stringMutex.Unlock()
  933. fake.StringStub = nil
  934. fake.stringReturns = struct {
  935. result1 string
  936. }{result1}
  937. }
  938. func (fake *Connection) StringReturnsOnCall(i int, result1 string) {
  939. fake.stringMutex.Lock()
  940. defer fake.stringMutex.Unlock()
  941. fake.StringStub = nil
  942. if fake.stringReturnsOnCall == nil {
  943. fake.stringReturnsOnCall = make(map[int]struct {
  944. result1 string
  945. })
  946. }
  947. fake.stringReturnsOnCall[i] = struct {
  948. result1 string
  949. }{result1}
  950. }
  951. func (fake *Connection) Transport() string {
  952. fake.transportMutex.Lock()
  953. ret, specificReturn := fake.transportReturnsOnCall[len(fake.transportArgsForCall)]
  954. fake.transportArgsForCall = append(fake.transportArgsForCall, struct {
  955. }{})
  956. stub := fake.TransportStub
  957. fakeReturns := fake.transportReturns
  958. fake.recordInvocation("Transport", []interface{}{})
  959. fake.transportMutex.Unlock()
  960. if stub != nil {
  961. return stub()
  962. }
  963. if specificReturn {
  964. return ret.result1
  965. }
  966. return fakeReturns.result1
  967. }
  968. func (fake *Connection) TransportCallCount() int {
  969. fake.transportMutex.RLock()
  970. defer fake.transportMutex.RUnlock()
  971. return len(fake.transportArgsForCall)
  972. }
  973. func (fake *Connection) TransportCalls(stub func() string) {
  974. fake.transportMutex.Lock()
  975. defer fake.transportMutex.Unlock()
  976. fake.TransportStub = stub
  977. }
  978. func (fake *Connection) TransportReturns(result1 string) {
  979. fake.transportMutex.Lock()
  980. defer fake.transportMutex.Unlock()
  981. fake.TransportStub = nil
  982. fake.transportReturns = struct {
  983. result1 string
  984. }{result1}
  985. }
  986. func (fake *Connection) TransportReturnsOnCall(i int, result1 string) {
  987. fake.transportMutex.Lock()
  988. defer fake.transportMutex.Unlock()
  989. fake.TransportStub = nil
  990. if fake.transportReturnsOnCall == nil {
  991. fake.transportReturnsOnCall = make(map[int]struct {
  992. result1 string
  993. })
  994. }
  995. fake.transportReturnsOnCall[i] = struct {
  996. result1 string
  997. }{result1}
  998. }
  999. func (fake *Connection) Type() string {
  1000. fake.typeMutex.Lock()
  1001. ret, specificReturn := fake.typeReturnsOnCall[len(fake.typeArgsForCall)]
  1002. fake.typeArgsForCall = append(fake.typeArgsForCall, struct {
  1003. }{})
  1004. stub := fake.TypeStub
  1005. fakeReturns := fake.typeReturns
  1006. fake.recordInvocation("Type", []interface{}{})
  1007. fake.typeMutex.Unlock()
  1008. if stub != nil {
  1009. return stub()
  1010. }
  1011. if specificReturn {
  1012. return ret.result1
  1013. }
  1014. return fakeReturns.result1
  1015. }
  1016. func (fake *Connection) TypeCallCount() int {
  1017. fake.typeMutex.RLock()
  1018. defer fake.typeMutex.RUnlock()
  1019. return len(fake.typeArgsForCall)
  1020. }
  1021. func (fake *Connection) TypeCalls(stub func() string) {
  1022. fake.typeMutex.Lock()
  1023. defer fake.typeMutex.Unlock()
  1024. fake.TypeStub = stub
  1025. }
  1026. func (fake *Connection) TypeReturns(result1 string) {
  1027. fake.typeMutex.Lock()
  1028. defer fake.typeMutex.Unlock()
  1029. fake.TypeStub = nil
  1030. fake.typeReturns = struct {
  1031. result1 string
  1032. }{result1}
  1033. }
  1034. func (fake *Connection) TypeReturnsOnCall(i int, result1 string) {
  1035. fake.typeMutex.Lock()
  1036. defer fake.typeMutex.Unlock()
  1037. fake.TypeStub = nil
  1038. if fake.typeReturnsOnCall == nil {
  1039. fake.typeReturnsOnCall = make(map[int]struct {
  1040. result1 string
  1041. })
  1042. }
  1043. fake.typeReturnsOnCall[i] = struct {
  1044. result1 string
  1045. }{result1}
  1046. }
  1047. func (fake *Connection) Invocations() map[string][][]interface{} {
  1048. fake.invocationsMutex.RLock()
  1049. defer fake.invocationsMutex.RUnlock()
  1050. copiedInvocations := map[string][][]interface{}{}
  1051. for key, value := range fake.invocations {
  1052. copiedInvocations[key] = value
  1053. }
  1054. return copiedInvocations
  1055. }
  1056. func (fake *Connection) recordInvocation(key string, args []interface{}) {
  1057. fake.invocationsMutex.Lock()
  1058. defer fake.invocationsMutex.Unlock()
  1059. if fake.invocations == nil {
  1060. fake.invocations = map[string][][]interface{}{}
  1061. }
  1062. if fake.invocations[key] == nil {
  1063. fake.invocations[key] = [][]interface{}{}
  1064. }
  1065. fake.invocations[key] = append(fake.invocations[key], args)
  1066. }
  1067. var _ protocol.Connection = new(Connection)