MCPcopy
hub / github.com/kopia/kopia / AddOrUpdate

Method AddOrUpdate

internal/cache/persistent_lru_cache.go:253–264  ·  view source on GitHub ↗
(bm blob.Metadata)

Source from the content-addressed store, hash-verified

251}
252
253func (h *contentMetadataHeap) AddOrUpdate(bm blob.Metadata) {
254 if i, exists := h.index[bm.BlobID]; exists {
255 // only accept newer timestamps
256 if bm.Timestamp.After(h.data[i].Timestamp) {
257 h.totalDataBytes += bm.Length - h.data[i].Length
258 h.data[i] = bm
259 heap.Fix(h, i)
260 }
261 } else {
262 heap.Push(h, bm)
263 }
264}
265
266func (h *contentMetadataHeap) Pop() any {
267 old := h.data

Callers 2

getPartialCacheHitMethod · 0.80
PutMethod · 0.80

Calls 2

AfterMethod · 0.80
PushMethod · 0.45

Tested by

no test coverage detected