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

Method UpdateDelta

db/revision_cache_lru.go:183–194  ·  view source on GitHub ↗

Attempt to update the delta on a revision cache entry. If the entry is no longer resident in the cache, fails silently

(ctx context.Context, docID, revID string, collectionID uint32, toDelta RevisionDelta)

Source from the content-addressed store, hash-verified

181// Attempt to update the delta on a revision cache entry. If the entry is no longer resident in the cache,
182// fails silently
183func (rc *LRURevisionCache) UpdateDelta(ctx context.Context, docID, revID string, collectionID uint32, toDelta RevisionDelta) {
184 value := rc.getValue(ctx, docID, revID, collectionID, false)
185 if value != nil {
186 outGoingBytes := value.updateDelta(toDelta)
187 if outGoingBytes != 0 {
188 rc.currMemoryUsage.Add(outGoingBytes)
189 rc.cacheMemoryBytesStat.Add(outGoingBytes)
190 }
191 // check for memory based eviction
192 rc.revCacheMemoryBasedEviction(ctx)
193 }
194}
195
196func (rc *LRURevisionCache) UpdateDeltaCV(ctx context.Context, docID string, cv *Version, collectionID uint32, toDelta RevisionDelta) {
197 value := rc.getValueByCV(ctx, docID, cv, collectionID, false)

Callers 2

Calls 4

getValueMethod · 0.95
updateDeltaMethod · 0.80
AddMethod · 0.45

Tested by 2