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

Method updateDelta

db/revision_cache_lru.go:826–840  ·  view source on GitHub ↗
(toDelta RevisionDelta)

Source from the content-addressed store, hash-verified

824}
825
826func (value *revCacheValue) updateDelta(toDelta RevisionDelta) (diffInBytes int64) {
827 value.lock.Lock()
828 defer value.lock.Unlock()
829 var previousDeltaBytes int64
830 if value.delta != nil {
831 // delta exists, need to pull this to update overall memory size correctly
832 previousDeltaBytes = value.delta.totalDeltaBytes
833 }
834 diffInBytes = toDelta.totalDeltaBytes - previousDeltaBytes
835 value.delta = &toDelta
836 if diffInBytes != 0 {
837 value.itemBytes.Add(diffInBytes)
838 }
839 return diffInBytes
840}
841
842// getItemBytes atomically retrieves the rev cache items overall memory footprint
843func (value *revCacheValue) getItemBytes() int64 {

Calls 3

LockMethod · 0.45
UnlockMethod · 0.45
AddMethod · 0.45