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

Method SplitUnchecked

pkg/segment/set.go:862–870  ·  view source on GitHub ↗

SplitUnchecked splits the given segment at the given key and returns iterators to the two resulting segments. All existing iterators (including seg, but not including the returned iterators) are invalidated. Preconditions: seg.Start() < key < seg.End().

(seg Iterator, split Key)

Source from the content-addressed store, hash-verified

860//
861// Preconditions: seg.Start() < key < seg.End().
862func (s *Set) SplitUnchecked(seg Iterator, split Key) (Iterator, Iterator) {
863 val1, val2 := (Functions{}).Split(seg.Range(), seg.Value(), split)
864 end2 := seg.End()
865 seg.SetEndUnchecked(split)
866 seg.SetValue(val1)
867 seg2 := s.InsertWithoutMergingUnchecked(seg.NextGap(), Range{split, end2}, val2)
868 // seg may now be invalid due to the Insert.
869 return seg2.PrevSegment(), seg2
870}
871
872// SplitBefore ensures that the given segment's start is at least start by
873// splitting at start if necessary, and returns an updated iterator to the

Callers 5

SplitMethod · 0.95
SplitBeforeMethod · 0.95
SplitAfterMethod · 0.95
IsolateMethod · 0.95
lockMethod · 0.80

Calls 9

SetEndUncheckedMethod · 0.80
SplitMethod · 0.65
ValueMethod · 0.65
RangeMethod · 0.45
EndMethod · 0.45
SetValueMethod · 0.45
NextGapMethod · 0.45
PrevSegmentMethod · 0.45

Tested by

no test coverage detected