MCPcopy Create free account
hub / github.com/imroc/req / seen

Method seen

internal/bisect/bisect.go:764–773  ·  view source on GitHub ↗

seen records that h has now been seen and reports whether it was seen before. When seen returns false, the caller is expected to print a report for h.

(h uint64)

Source from the content-addressed store, hash-verified

762// seen records that h has now been seen and reports whether it was seen before.
763// When seen returns false, the caller is expected to print a report for h.
764func (d *dedup) seen(h uint64) bool {
765 d.mu.Lock()
766 if d.m == nil {
767 d.m = make(map[uint64]bool)
768 }
769 seen := d.m[h]
770 d.m[h] = true
771 d.mu.Unlock()
772 return seen
773}
774
775// seenLossy is a variant of seen that avoids a lock by using a cache of recently seen hashes.
776// Each cache entry is N-way set-associative: h can appear in any of the slots.

Callers 1

stackMethod · 0.95

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected