Stores a body etc. into a revCacheValue if there isn't one already.
(docRev DocumentRevision)
| 805 | |
| 806 | // Stores a body etc. into a revCacheValue if there isn't one already. |
| 807 | func (value *revCacheValue) store(docRev DocumentRevision) { |
| 808 | value.lock.Lock() |
| 809 | defer value.lock.Unlock() |
| 810 | if value.bodyBytes == nil { |
| 811 | value.revID = docRev.RevID |
| 812 | value.id = docRev.DocID |
| 813 | value.bodyBytes = docRev.BodyBytes |
| 814 | value.history = docRev.History |
| 815 | value.channels = docRev.Channels |
| 816 | value.expiry = docRev.Expiry |
| 817 | value.attachments = docRev.Attachments.ShallowCopy() // Don't store attachments the caller might later mutate |
| 818 | value.deleted = docRev.Deleted |
| 819 | value.err = nil |
| 820 | value.itemBytes.Store(docRev.MemoryBytes) |
| 821 | value.hlvHistory = docRev.HlvHistory |
| 822 | } |
| 823 | value.canEvict.Store(true) // now we have stored the doc revision in the cache, we can allow eviction |
| 824 | } |
| 825 | |
| 826 | func (value *revCacheValue) updateDelta(toDelta RevisionDelta) (diffInBytes int64) { |
| 827 | value.lock.Lock() |