TrackerWithTickFlush allows passing two channels: one that reads a time.Time, and one that returns the number of marked workspaces every time Tracker flushes. For testing only and will panic if used outside of tests.
(tickCh <-chan time.Time, flushCh chan int)
| 89 | // every time Tracker flushes. |
| 90 | // For testing only and will panic if used outside of tests. |
| 91 | func TrackerWithTickFlush(tickCh <-chan time.Time, flushCh chan int) TrackerOption { |
| 92 | if flag.Lookup("test.v") == nil { |
| 93 | panic("developer error: WithTickFlush is not to be used outside of tests.") |
| 94 | } |
| 95 | return func(h *UsageTracker) { |
| 96 | h.tickCh = tickCh |
| 97 | h.stopTick = func() {} |
| 98 | h.flushCh = flushCh |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // Add marks the workspace with the given ID as having been used recently. |
| 103 | // Tracker will periodically flush this to its configured Store. |
no outgoing calls