buffered_subscription.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. // Code generated by counterfeiter. DO NOT EDIT.
  2. package mocks
  3. import (
  4. "sync"
  5. "time"
  6. "github.com/syncthing/syncthing/lib/events"
  7. )
  8. type BufferedSubscription struct {
  9. MaskStub func() events.EventType
  10. maskMutex sync.RWMutex
  11. maskArgsForCall []struct {
  12. }
  13. maskReturns struct {
  14. result1 events.EventType
  15. }
  16. maskReturnsOnCall map[int]struct {
  17. result1 events.EventType
  18. }
  19. SinceStub func(int, []events.Event, time.Duration) []events.Event
  20. sinceMutex sync.RWMutex
  21. sinceArgsForCall []struct {
  22. arg1 int
  23. arg2 []events.Event
  24. arg3 time.Duration
  25. }
  26. sinceReturns struct {
  27. result1 []events.Event
  28. }
  29. sinceReturnsOnCall map[int]struct {
  30. result1 []events.Event
  31. }
  32. invocations map[string][][]interface{}
  33. invocationsMutex sync.RWMutex
  34. }
  35. func (fake *BufferedSubscription) Mask() events.EventType {
  36. fake.maskMutex.Lock()
  37. ret, specificReturn := fake.maskReturnsOnCall[len(fake.maskArgsForCall)]
  38. fake.maskArgsForCall = append(fake.maskArgsForCall, struct {
  39. }{})
  40. stub := fake.MaskStub
  41. fakeReturns := fake.maskReturns
  42. fake.recordInvocation("Mask", []interface{}{})
  43. fake.maskMutex.Unlock()
  44. if stub != nil {
  45. return stub()
  46. }
  47. if specificReturn {
  48. return ret.result1
  49. }
  50. return fakeReturns.result1
  51. }
  52. func (fake *BufferedSubscription) MaskCallCount() int {
  53. fake.maskMutex.RLock()
  54. defer fake.maskMutex.RUnlock()
  55. return len(fake.maskArgsForCall)
  56. }
  57. func (fake *BufferedSubscription) MaskCalls(stub func() events.EventType) {
  58. fake.maskMutex.Lock()
  59. defer fake.maskMutex.Unlock()
  60. fake.MaskStub = stub
  61. }
  62. func (fake *BufferedSubscription) MaskReturns(result1 events.EventType) {
  63. fake.maskMutex.Lock()
  64. defer fake.maskMutex.Unlock()
  65. fake.MaskStub = nil
  66. fake.maskReturns = struct {
  67. result1 events.EventType
  68. }{result1}
  69. }
  70. func (fake *BufferedSubscription) MaskReturnsOnCall(i int, result1 events.EventType) {
  71. fake.maskMutex.Lock()
  72. defer fake.maskMutex.Unlock()
  73. fake.MaskStub = nil
  74. if fake.maskReturnsOnCall == nil {
  75. fake.maskReturnsOnCall = make(map[int]struct {
  76. result1 events.EventType
  77. })
  78. }
  79. fake.maskReturnsOnCall[i] = struct {
  80. result1 events.EventType
  81. }{result1}
  82. }
  83. func (fake *BufferedSubscription) Since(arg1 int, arg2 []events.Event, arg3 time.Duration) []events.Event {
  84. var arg2Copy []events.Event
  85. if arg2 != nil {
  86. arg2Copy = make([]events.Event, len(arg2))
  87. copy(arg2Copy, arg2)
  88. }
  89. fake.sinceMutex.Lock()
  90. ret, specificReturn := fake.sinceReturnsOnCall[len(fake.sinceArgsForCall)]
  91. fake.sinceArgsForCall = append(fake.sinceArgsForCall, struct {
  92. arg1 int
  93. arg2 []events.Event
  94. arg3 time.Duration
  95. }{arg1, arg2Copy, arg3})
  96. stub := fake.SinceStub
  97. fakeReturns := fake.sinceReturns
  98. fake.recordInvocation("Since", []interface{}{arg1, arg2Copy, arg3})
  99. fake.sinceMutex.Unlock()
  100. if stub != nil {
  101. return stub(arg1, arg2, arg3)
  102. }
  103. if specificReturn {
  104. return ret.result1
  105. }
  106. return fakeReturns.result1
  107. }
  108. func (fake *BufferedSubscription) SinceCallCount() int {
  109. fake.sinceMutex.RLock()
  110. defer fake.sinceMutex.RUnlock()
  111. return len(fake.sinceArgsForCall)
  112. }
  113. func (fake *BufferedSubscription) SinceCalls(stub func(int, []events.Event, time.Duration) []events.Event) {
  114. fake.sinceMutex.Lock()
  115. defer fake.sinceMutex.Unlock()
  116. fake.SinceStub = stub
  117. }
  118. func (fake *BufferedSubscription) SinceArgsForCall(i int) (int, []events.Event, time.Duration) {
  119. fake.sinceMutex.RLock()
  120. defer fake.sinceMutex.RUnlock()
  121. argsForCall := fake.sinceArgsForCall[i]
  122. return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
  123. }
  124. func (fake *BufferedSubscription) SinceReturns(result1 []events.Event) {
  125. fake.sinceMutex.Lock()
  126. defer fake.sinceMutex.Unlock()
  127. fake.SinceStub = nil
  128. fake.sinceReturns = struct {
  129. result1 []events.Event
  130. }{result1}
  131. }
  132. func (fake *BufferedSubscription) SinceReturnsOnCall(i int, result1 []events.Event) {
  133. fake.sinceMutex.Lock()
  134. defer fake.sinceMutex.Unlock()
  135. fake.SinceStub = nil
  136. if fake.sinceReturnsOnCall == nil {
  137. fake.sinceReturnsOnCall = make(map[int]struct {
  138. result1 []events.Event
  139. })
  140. }
  141. fake.sinceReturnsOnCall[i] = struct {
  142. result1 []events.Event
  143. }{result1}
  144. }
  145. func (fake *BufferedSubscription) Invocations() map[string][][]interface{} {
  146. fake.invocationsMutex.RLock()
  147. defer fake.invocationsMutex.RUnlock()
  148. copiedInvocations := map[string][][]interface{}{}
  149. for key, value := range fake.invocations {
  150. copiedInvocations[key] = value
  151. }
  152. return copiedInvocations
  153. }
  154. func (fake *BufferedSubscription) recordInvocation(key string, args []interface{}) {
  155. fake.invocationsMutex.Lock()
  156. defer fake.invocationsMutex.Unlock()
  157. if fake.invocations == nil {
  158. fake.invocations = map[string][][]interface{}{}
  159. }
  160. if fake.invocations[key] == nil {
  161. fake.invocations[key] = [][]interface{}{}
  162. }
  163. fake.invocations[key] = append(fake.invocations[key], args)
  164. }
  165. var _ events.BufferedSubscription = new(BufferedSubscription)