MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / Remove

Method Remove

db/channel_cache.go:260–281  ·  view source on GitHub ↗

Remove purges the given doc IDs from all channel caches and returns the number of items removed. count will be larger than the input slice if the same document is removed from multiple channel caches.

(ctx context.Context, collectionID uint32, docIDs []string, startTime time.Time)

Source from the content-addressed store, hash-verified

258// Remove purges the given doc IDs from all channel caches and returns the number of items removed.
259// count will be larger than the input slice if the same document is removed from multiple channel caches.
260func (c *channelCacheImpl) Remove(ctx context.Context, collectionID uint32, docIDs []string, startTime time.Time) (count int) {
261 // Exit early if there's no work to do
262 if len(docIDs) == 0 {
263 return 0
264 }
265
266 removeCallback := func(v interface{}) bool {
267 channelCache := AsSingleChannelCache(ctx, v)
268 if channelCache == nil {
269 return false
270 }
271 if channelCache.ChannelID().CollectionID != collectionID {
272 return true
273 }
274 count += channelCache.Remove(ctx, collectionID, docIDs, startTime)
275 return true
276 }
277
278 c.channelCaches.Range(removeCallback)
279
280 return count
281}
282
283func (c *channelCacheImpl) GetChanges(ctx context.Context, ch channels.ID, options ChangesOptions) ([]*LogEntry, error) {
284

Callers

nothing calls this directly

Calls 4

AsSingleChannelCacheFunction · 0.85
RangeMethod · 0.80
ChannelIDMethod · 0.65
RemoveMethod · 0.65

Tested by

no test coverage detected