MCPcopy
hub / github.com/grafana/tempo / tryEvictHead

Method tryEvictHead

modules/generator/processor/servicegraphs/store/store.go:71–87  ·  view source on GitHub ↗

tryEvictHead checks if the oldest item (head of list) can be evicted and will delete it if so. Returns true if the head was evicted. Must be called holding lock.

()

Source from the content-addressed store, hash-verified

69//
70// Must be called holding lock.
71func (s *store) tryEvictHead() bool {
72 head := s.l.Front()
73 if head == nil {
74 // list is empty
75 return false
76 }
77
78 headEdge := head.Value.(*Edge)
79 if !headEdge.isExpired() {
80 return false
81 }
82
83 s.onExpire(headEdge)
84 s.deleteEdge(head)
85
86 return true
87}
88
89// deleteEdge removes an edge from the map/list and returns it to the pool.
90// Must be called holding lock.

Callers 2

ExpireMethod · 0.95
TestStoreUpsertEdgeFunction · 0.80

Calls 3

deleteEdgeMethod · 0.95
isExpiredMethod · 0.80
onExpireMethod · 0.80

Tested by 1

TestStoreUpsertEdgeFunction · 0.64