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

Method GetCachedChanges

db/channel_cache_single.go:322–337  ·  view source on GitHub ↗

Returns all of the cached entries for sequences greater than 'since' in the given channel. Entries are returned in increasing-sequence order.

(options ChangesOptions)

Source from the content-addressed store, hash-verified

320// Returns all of the cached entries for sequences greater than 'since' in the given channel.
321// Entries are returned in increasing-sequence order.
322func (c *singleChannelCacheImpl) GetCachedChanges(options ChangesOptions) (validFrom uint64, result []*LogEntry) {
323 c.lock.RLock()
324 defer c.lock.RUnlock()
325 c.recentlyUsed.Set(true)
326 sinceSeq := options.Since.SafeSequence()
327 limit := options.Limit
328
329 // If the activeOnly option is set, then do not limit the number of entries returned
330 // we don't know how many non active entries will be discarded from the entry set
331 // by the caller, so the additional entries may be needed to return up to the limit requested
332 if options.ActiveOnly {
333 limit = 0
334 }
335
336 return c._getCachedChanges(sinceSeq, limit)
337}
338
339func (c *singleChannelCacheImpl) _getCachedChanges(sinceSeq uint64, limit int) (validFrom uint64, result []*LogEntry) {
340 // Find the first entry in the log to return:

Callers 1

GetChangesMethod · 0.95

Calls 5

_getCachedChangesMethod · 0.95
RLockMethod · 0.80
RUnlockMethod · 0.80
SafeSequenceMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected