| 824 | } |
| 825 | |
| 826 | func (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 |
| 843 | func (value *revCacheValue) getItemBytes() int64 { |