MCPcopy
hub / github.com/google/gvisor / RemoveRangeWith

Method RemoveRangeWith

pkg/segment/set.go:629–646  ·  view source on GitHub ↗

RemoveRangeWith removes all segments in the given range. An iterator to the newly formed gap is returned, and all existing iterators are invalidated. The function f is applied to each segment immediately before it is removed, in order of ascending keys. Segments that lie partially outside r are spl

(r Range, f func(seg Iterator))

Source from the content-addressed store, hash-verified

627//
628// N.B. f must not invalidate iterators into s.
629func (s *Set) RemoveRangeWith(r Range, f func(seg Iterator)) GapIterator {
630 seg, gap := s.Find(r.Start)
631 if seg.Ok() {
632 seg = s.Isolate(seg, r)
633 if f != nil {
634 f(seg)
635 }
636 gap = s.Remove(seg)
637 }
638 for seg = gap.NextSegment(); seg.Ok() && seg.Start() < r.End; seg = gap.NextSegment() {
639 seg = s.SplitAfter(seg, r.End)
640 if f != nil {
641 f(seg)
642 }
643 gap = s.Remove(seg)
644 }
645 return gap
646}
647
648// RemoveFullRangeWith is equivalent to RemoveRangeWith, except that if any key
649// in the given range does not correspond to a segment, RemoveFullRangeWith

Callers 9

RemoveRangeMethod · 0.95
gasketUnmapBufferIoctlFunction · 0.80
unpinRangeMethod · 0.80
writeCacheMethod · 0.80
cancelWasteLoadMethod · 0.80
removeVMAsLockedMethod · 0.80
DecRefMethod · 0.80
DropMethod · 0.80
KeepCleanMethod · 0.80

Calls 8

FindMethod · 0.95
IsolateMethod · 0.95
RemoveMethod · 0.95
SplitAfterMethod · 0.95
StartMethod · 0.65
fFunction · 0.50
OkMethod · 0.45
NextSegmentMethod · 0.45

Tested by

no test coverage detected