| 194 | } |
| 195 | |
| 196 | func (c *changeCache) Start(initialSequence uint64) error { |
| 197 | |
| 198 | // Unlock the cache after this function returns. |
| 199 | defer c.lock.Unlock() |
| 200 | |
| 201 | // Set initial sequence for sequence buffering |
| 202 | c._setInitialSequence(initialSequence) |
| 203 | |
| 204 | // Set initial sequence for cache (validFrom) |
| 205 | c.channelCache.Init(initialSequence) |
| 206 | |
| 207 | if !c.started.CompareAndSwap(false, true) { |
| 208 | return errors.New("changeCache already started") |
| 209 | } |
| 210 | |
| 211 | return nil |
| 212 | } |
| 213 | |
| 214 | // Stops the cache. Clears its state and tells the housekeeping task to stop. |
| 215 | func (c *changeCache) Stop(ctx context.Context) { |