MCPcopy
hub / github.com/coocood/freecache / delEntryPtr

Method delEntryPtr

segment.go:391–401  ·  view source on GitHub ↗
(slotId uint8, slot []entryPtr, idx int)

Source from the content-addressed store, hash-verified

389}
390
391func (seg *segment) delEntryPtr(slotId uint8, slot []entryPtr, idx int) {
392 offset := slot[idx].offset
393 var entryHdrBuf [ENTRY_HDR_SIZE]byte
394 seg.rb.ReadAt(entryHdrBuf[:], offset)
395 entryHdr := (*entryHdr)(unsafe.Pointer(&entryHdrBuf[0]))
396 entryHdr.deleted = true
397 seg.rb.WriteAt(entryHdrBuf[:], offset)
398 copy(slot[idx:], slot[idx+1:])
399 seg.slotLens[slotId]--
400 atomic.AddInt64(&seg.entryCount, -1)
401}
402
403func entryPtrIdx(slot []entryPtr, hash16 uint16) (idx int) {
404 high := len(slot)

Callers 5

setMethod · 0.95
touchMethod · 0.95
locateMethod · 0.95
delMethod · 0.95
delEntryPtrByOffsetMethod · 0.95

Calls 2

ReadAtMethod · 0.80
WriteAtMethod · 0.80

Tested by

no test coverage detected