Documentation ¶
Overview ¶
Package accel implements proxying for hardware accelerators.
Index ¶
- Constants
- func CreateDevtmpfsFile(ctx context.Context, dev *devtmpfs.Accessor, num uint32) error
- func DevAddrzeroNodeSlice(slice []*DevAddrnode)
- func DevAddrzeroValueSlice(slice []pinnedAccelMem)
- func Filters() seccomp.SyscallRules
- func Register(vfsObj *vfs.VirtualFilesystem, minor uint32) error
- type DevAddrGapIterator
- func (gap DevAddrGapIterator) End() uint64
- func (gap DevAddrGapIterator) IsEmpty() bool
- func (gap DevAddrGapIterator) NextGap() DevAddrGapIterator
- func (gap DevAddrGapIterator) NextLargeEnoughGap(minSize uint64) DevAddrGapIterator
- func (gap DevAddrGapIterator) NextSegment() DevAddrIterator
- func (gap DevAddrGapIterator) Ok() bool
- func (gap DevAddrGapIterator) PrevGap() DevAddrGapIterator
- func (gap DevAddrGapIterator) PrevLargeEnoughGap(minSize uint64) DevAddrGapIterator
- func (gap DevAddrGapIterator) PrevSegment() DevAddrIterator
- func (gap DevAddrGapIterator) Range() DevAddrRange
- func (gap DevAddrGapIterator) Start() uint64
- type DevAddrIterator
- func (seg DevAddrIterator) End() uint64
- func (seg DevAddrIterator) NextGap() DevAddrGapIterator
- func (seg DevAddrIterator) NextNonEmpty() (DevAddrIterator, DevAddrGapIterator)
- func (seg DevAddrIterator) NextSegment() DevAddrIterator
- func (seg DevAddrIterator) Ok() bool
- func (seg DevAddrIterator) PrevGap() DevAddrGapIterator
- func (seg DevAddrIterator) PrevNonEmpty() (DevAddrIterator, DevAddrGapIterator)
- func (seg DevAddrIterator) PrevSegment() DevAddrIterator
- func (seg DevAddrIterator) Range() DevAddrRange
- func (seg DevAddrIterator) SetEnd(end uint64)
- func (seg DevAddrIterator) SetEndUnchecked(end uint64)
- func (seg DevAddrIterator) SetRange(r DevAddrRange)
- func (seg DevAddrIterator) SetRangeUnchecked(r DevAddrRange)
- func (seg DevAddrIterator) SetStart(start uint64)
- func (seg DevAddrIterator) SetStartUnchecked(start uint64)
- func (seg DevAddrIterator) SetValue(val pinnedAccelMem)
- func (seg DevAddrIterator) Start() uint64
- func (seg DevAddrIterator) Value() pinnedAccelMem
- func (seg DevAddrIterator) ValuePtr() *pinnedAccelMem
- type DevAddrRange
- func (r DevAddrRange) CanSplitAt(x uint64) bool
- func (r DevAddrRange) Contains(x uint64) bool
- func (r DevAddrRange) Intersect(r2 DevAddrRange) DevAddrRange
- func (r DevAddrRange) IsSupersetOf(r2 DevAddrRange) bool
- func (r DevAddrRange) Length() uint64
- func (r DevAddrRange) Overlaps(r2 DevAddrRange) bool
- func (r *DevAddrRange) StateFields() []string
- func (r *DevAddrRange) StateLoad(stateSourceObject state.Source)
- func (r *DevAddrRange) StateSave(stateSinkObject state.Sink)
- func (r *DevAddrRange) StateTypeName() string
- func (r DevAddrRange) WellFormed() bool
- type DevAddrSegmentDataSlices
- type DevAddrSet
- func (s *DevAddrSet) Add(r DevAddrRange, val pinnedAccelMem) bool
- func (s *DevAddrSet) AddWithoutMerging(r DevAddrRange, val pinnedAccelMem) bool
- func (s *DevAddrSet) ApplyContiguous(r DevAddrRange, fn func(seg DevAddrIterator)) DevAddrGapIterator
- func (s *DevAddrSet) ExportSortedSlices() *DevAddrSegmentDataSlices
- func (s *DevAddrSet) Find(key uint64) (DevAddrIterator, DevAddrGapIterator)
- func (s *DevAddrSet) FindGap(key uint64) DevAddrGapIterator
- func (s *DevAddrSet) FindSegment(key uint64) DevAddrIterator
- func (s *DevAddrSet) FirstGap() DevAddrGapIterator
- func (s *DevAddrSet) FirstSegment() DevAddrIterator
- func (s *DevAddrSet) ImportSortedSlices(sds *DevAddrSegmentDataSlices) error
- func (s *DevAddrSet) Insert(gap DevAddrGapIterator, r DevAddrRange, val pinnedAccelMem) DevAddrIterator
- func (s *DevAddrSet) InsertWithoutMerging(gap DevAddrGapIterator, r DevAddrRange, val pinnedAccelMem) DevAddrIterator
- func (s *DevAddrSet) InsertWithoutMergingUnchecked(gap DevAddrGapIterator, r DevAddrRange, val pinnedAccelMem) DevAddrIterator
- func (s *DevAddrSet) IsEmpty() bool
- func (s *DevAddrSet) IsEmptyRange(r DevAddrRange) bool
- func (s *DevAddrSet) Isolate(seg DevAddrIterator, r DevAddrRange) DevAddrIterator
- func (s *DevAddrSet) LastGap() DevAddrGapIterator
- func (s *DevAddrSet) LastSegment() DevAddrIterator
- func (s *DevAddrSet) LowerBoundGap(min uint64) DevAddrGapIterator
- func (s *DevAddrSet) LowerBoundSegment(min uint64) DevAddrIterator
- func (s *DevAddrSet) Merge(first, second DevAddrIterator) DevAddrIterator
- func (s *DevAddrSet) MergeAdjacent(r DevAddrRange)
- func (s *DevAddrSet) MergeAll()
- func (s *DevAddrSet) MergeRange(r DevAddrRange)
- func (s *DevAddrSet) MergeUnchecked(first, second DevAddrIterator) DevAddrIterator
- func (s *DevAddrSet) Remove(seg DevAddrIterator) DevAddrGapIterator
- func (s *DevAddrSet) RemoveAll()
- func (s *DevAddrSet) RemoveRange(r DevAddrRange) DevAddrGapIterator
- func (s *DevAddrSet) Span() uint64
- func (s *DevAddrSet) SpanRange(r DevAddrRange) uint64
- func (s *DevAddrSet) Split(seg DevAddrIterator, split uint64) (DevAddrIterator, DevAddrIterator)
- func (s *DevAddrSet) SplitAt(split uint64) bool
- func (s *DevAddrSet) SplitUnchecked(seg DevAddrIterator, split uint64) (DevAddrIterator, DevAddrIterator)
- func (s *DevAddrSet) StateFields() []string
- func (s *DevAddrSet) StateLoad(stateSourceObject state.Source)
- func (s *DevAddrSet) StateSave(stateSinkObject state.Sink)
- func (s *DevAddrSet) StateTypeName() string
- func (s *DevAddrSet) String() string
- func (s *DevAddrSet) UpperBoundGap(max uint64) DevAddrGapIterator
- func (s *DevAddrSet) UpperBoundSegment(max uint64) DevAddrIterator
- type DevAddrdynamicGap
- type DevAddrnode
Constants ¶
const ( // minDegree is the minimum degree of an internal node in a Set B-tree. // // - Any non-root node has at least minDegree-1 segments. // // - Any non-root internal (non-leaf) node has at least minDegree children. // // - The root node may have fewer than minDegree-1 segments, but it may // only have 0 segments if the tree is empty. // // Our implementation requires minDegree >= 3. Higher values of minDegree // usually improve performance, but increase memory usage for small sets. DevAddrminDegree = 3 DevAddrmaxDegree = 2 * DevAddrminDegree )
const DevAddrtrackGaps = 0
trackGaps is an optional parameter.
If trackGaps is 1, the Set will track maximum gap size recursively, enabling the GapIterator.{Prev,Next}LargeEnoughGap functions. In this case, Key must be an unsigned integer.
trackGaps must be 0 or 1.
Variables ¶
This section is empty.
Functions ¶
func CreateDevtmpfsFile ¶
CreateDevtmpfsFile creates a /dev/accel[0-9]+ device file.
func DevAddrzeroNodeSlice ¶
func DevAddrzeroNodeSlice(slice []*DevAddrnode)
func DevAddrzeroValueSlice ¶
func DevAddrzeroValueSlice(slice []pinnedAccelMem)
func Filters ¶
func Filters() seccomp.SyscallRules
Filters returns seccomp-bpf filters for this package.
Types ¶
type DevAddrGapIterator ¶
type DevAddrGapIterator struct {
// contains filtered or unexported fields
}
A GapIterator is conceptually one of:
A pointer to a position between two segments, before the first segment, or after the last segment in a set, called a *gap*; or
A terminal iterator, which is a sentinel indicating that the end of iteration has been reached.
Note that the gap between two adjacent segments exists (iterators to it are non-terminal), but has a length of zero. GapIterator.IsEmpty returns true for such gaps. An empty set contains a single gap, spanning the entire range of the set's keys.
GapIterators are copyable values and are meaningfully equality-comparable. The zero value of GapIterator is a terminal iterator.
Unless otherwise specified, any mutation of a set invalidates all existing iterators into the set.
func (DevAddrGapIterator) End ¶
func (gap DevAddrGapIterator) End() uint64
End is equivalent to Range().End, but should be preferred if only the end of the range is needed.
func (DevAddrGapIterator) IsEmpty ¶
func (gap DevAddrGapIterator) IsEmpty() bool
IsEmpty returns true if the iterated gap is empty (that is, the "gap" is between two adjacent segments.)
func (DevAddrGapIterator) NextGap ¶
func (gap DevAddrGapIterator) NextGap() DevAddrGapIterator
NextGap returns the iterated gap's successor. If no such gap exists, NextGap returns a terminal iterator.
func (DevAddrGapIterator) NextLargeEnoughGap ¶
func (gap DevAddrGapIterator) NextLargeEnoughGap(minSize uint64) DevAddrGapIterator
NextLargeEnoughGap returns the iterated gap's first next gap with larger length than minSize. If not found, return a terminal gap iterator (does NOT include this gap itself).
Precondition: trackGaps must be 1.
func (DevAddrGapIterator) NextSegment ¶
func (gap DevAddrGapIterator) NextSegment() DevAddrIterator
NextSegment returns the segment immediately after the iterated gap. If no such segment exists, NextSegment returns a terminal iterator.
func (DevAddrGapIterator) Ok ¶
func (gap DevAddrGapIterator) Ok() bool
Ok returns true if the iterator is not terminal. All other methods are only valid for non-terminal iterators.
func (DevAddrGapIterator) PrevGap ¶
func (gap DevAddrGapIterator) PrevGap() DevAddrGapIterator
PrevGap returns the iterated gap's predecessor. If no such gap exists, PrevGap returns a terminal iterator.
func (DevAddrGapIterator) PrevLargeEnoughGap ¶
func (gap DevAddrGapIterator) PrevLargeEnoughGap(minSize uint64) DevAddrGapIterator
PrevLargeEnoughGap returns the iterated gap's first prev gap with larger or equal length than minSize. If not found, return a terminal gap iterator (does NOT include this gap itself).
Precondition: trackGaps must be 1.
func (DevAddrGapIterator) PrevSegment ¶
func (gap DevAddrGapIterator) PrevSegment() DevAddrIterator
PrevSegment returns the segment immediately before the iterated gap. If no such segment exists, PrevSegment returns a terminal iterator.
func (DevAddrGapIterator) Range ¶
func (gap DevAddrGapIterator) Range() DevAddrRange
Range returns the range spanned by the iterated gap.
func (DevAddrGapIterator) Start ¶
func (gap DevAddrGapIterator) Start() uint64
Start is equivalent to Range().Start, but should be preferred if only the start of the range is needed.
type DevAddrIterator ¶
type DevAddrIterator struct {
// contains filtered or unexported fields
}
A Iterator is conceptually one of:
A pointer to a segment in a set; or
A terminal iterator, which is a sentinel indicating that the end of iteration has been reached.
Iterators are copyable values and are meaningfully equality-comparable. The zero value of Iterator is a terminal iterator.
Unless otherwise specified, any mutation of a set invalidates all existing iterators into the set.
func DevAddrsegmentAfterPosition ¶
func DevAddrsegmentAfterPosition(n *DevAddrnode, i int) DevAddrIterator
segmentAfterPosition returns the successor segment of the position given by n.children[i], which may or may not contain a child. If no such segment exists, segmentAfterPosition returns a terminal iterator.
func DevAddrsegmentBeforePosition ¶
func DevAddrsegmentBeforePosition(n *DevAddrnode, i int) DevAddrIterator
segmentBeforePosition returns the predecessor segment of the position given by n.children[i], which may or may not contain a child. If no such segment exists, segmentBeforePosition returns a terminal iterator.
func (DevAddrIterator) End ¶
func (seg DevAddrIterator) End() uint64
End is equivalent to Range().End, but should be preferred if only the end of the range is needed.
func (DevAddrIterator) NextGap ¶
func (seg DevAddrIterator) NextGap() DevAddrGapIterator
NextGap returns the gap immediately after the iterated segment.
func (DevAddrIterator) NextNonEmpty ¶
func (seg DevAddrIterator) NextNonEmpty() (DevAddrIterator, DevAddrGapIterator)
NextNonEmpty returns the iterated segment's successor if it is adjacent, or the gap after the iterated segment otherwise. If seg.End() == Functions.MaxKey(), NextNonEmpty will return two terminal iterators. Otherwise, exactly one of the iterators returned by NextNonEmpty will be non-terminal.
func (DevAddrIterator) NextSegment ¶
func (seg DevAddrIterator) NextSegment() DevAddrIterator
NextSegment returns the iterated segment's successor. If there is no succeeding segment, NextSegment returns a terminal iterator.
func (DevAddrIterator) Ok ¶
func (seg DevAddrIterator) Ok() bool
Ok returns true if the iterator is not terminal. All other methods are only valid for non-terminal iterators.
func (DevAddrIterator) PrevGap ¶
func (seg DevAddrIterator) PrevGap() DevAddrGapIterator
PrevGap returns the gap immediately before the iterated segment.
func (DevAddrIterator) PrevNonEmpty ¶
func (seg DevAddrIterator) PrevNonEmpty() (DevAddrIterator, DevAddrGapIterator)
PrevNonEmpty returns the iterated segment's predecessor if it is adjacent, or the gap before the iterated segment otherwise. If seg.Start() == Functions.MinKey(), PrevNonEmpty will return two terminal iterators. Otherwise, exactly one of the iterators returned by PrevNonEmpty will be non-terminal.
func (DevAddrIterator) PrevSegment ¶
func (seg DevAddrIterator) PrevSegment() DevAddrIterator
PrevSegment returns the iterated segment's predecessor. If there is no preceding segment, PrevSegment returns a terminal iterator.
func (DevAddrIterator) Range ¶
func (seg DevAddrIterator) Range() DevAddrRange
Range returns the iterated segment's range key.
func (DevAddrIterator) SetEnd ¶
func (seg DevAddrIterator) SetEnd(end uint64)
SetEnd mutates the iterated segment's end. If the new end value would cause the iterated segment to overlap another segment, or would result in an invalid range, SetEnd panics. This operation does not invalidate any iterators.
func (DevAddrIterator) SetEndUnchecked ¶
func (seg DevAddrIterator) SetEndUnchecked(end uint64)
SetEndUnchecked mutates the iterated segment's end. This operation does not invalidate any iterators.
Preconditions: The new end must be valid:
- end > seg.Start().
- If seg.NextSegment().Ok(), then end <= seg.NextSegment().Start().
func (DevAddrIterator) SetRange ¶
func (seg DevAddrIterator) SetRange(r DevAddrRange)
SetRange mutates the iterated segment's range key. If the new range would cause the iterated segment to overlap another segment, or if the new range is invalid, SetRange panics. This operation does not invalidate any iterators.
func (DevAddrIterator) SetRangeUnchecked ¶
func (seg DevAddrIterator) SetRangeUnchecked(r DevAddrRange)
SetRangeUnchecked mutates the iterated segment's range key. This operation does not invalidate any iterators.
Preconditions: - r.Length() > 0. - The new range must not overlap an existing one:
- If seg.NextSegment().Ok(), then r.end <= seg.NextSegment().Start().
- If seg.PrevSegment().Ok(), then r.start >= seg.PrevSegment().End().
func (DevAddrIterator) SetStart ¶
func (seg DevAddrIterator) SetStart(start uint64)
SetStart mutates the iterated segment's start. If the new start value would cause the iterated segment to overlap another segment, or would result in an invalid range, SetStart panics. This operation does not invalidate any iterators.
func (DevAddrIterator) SetStartUnchecked ¶
func (seg DevAddrIterator) SetStartUnchecked(start uint64)
SetStartUnchecked mutates the iterated segment's start. This operation does not invalidate any iterators.
Preconditions: The new start must be valid:
- start < seg.End()
- If seg.PrevSegment().Ok(), then start >= seg.PrevSegment().End().
func (DevAddrIterator) SetValue ¶
func (seg DevAddrIterator) SetValue(val pinnedAccelMem)
SetValue mutates the iterated segment's value. This operation does not invalidate any iterators.
func (DevAddrIterator) Start ¶
func (seg DevAddrIterator) Start() uint64
Start is equivalent to Range().Start, but should be preferred if only the start of the range is needed.
func (DevAddrIterator) Value ¶
func (seg DevAddrIterator) Value() pinnedAccelMem
Value returns a copy of the iterated segment's value.
func (DevAddrIterator) ValuePtr ¶
func (seg DevAddrIterator) ValuePtr() *pinnedAccelMem
ValuePtr returns a pointer to the iterated segment's value. The pointer is invalidated if the iterator is invalidated. This operation does not invalidate any iterators.
type DevAddrRange ¶
type DevAddrRange struct { // Start is the inclusive start of the range. Start uint64 // End is the exclusive end of the range. End uint64 }
A Range represents a contiguous range of T.
+stateify savable
func (DevAddrRange) CanSplitAt ¶
func (r DevAddrRange) CanSplitAt(x uint64) bool
CanSplitAt returns true if it is legal to split a segment spanning the range r at x; that is, splitting at x would produce two ranges, both of which have non-zero length.
func (DevAddrRange) Contains ¶
func (r DevAddrRange) Contains(x uint64) bool
Contains returns true if r contains x.
func (DevAddrRange) Intersect ¶
func (r DevAddrRange) Intersect(r2 DevAddrRange) DevAddrRange
Intersect returns a range consisting of the intersection between r and r2. If r and r2 do not overlap, Intersect returns a range with unspecified bounds, but for which Length() == 0.
func (DevAddrRange) IsSupersetOf ¶
func (r DevAddrRange) IsSupersetOf(r2 DevAddrRange) bool
IsSupersetOf returns true if r is a superset of r2; that is, the range r2 is contained within r.
func (DevAddrRange) Length ¶
func (r DevAddrRange) Length() uint64
Length returns the length of the range.
func (DevAddrRange) Overlaps ¶
func (r DevAddrRange) Overlaps(r2 DevAddrRange) bool
Overlaps returns true if r and r2 overlap.
func (*DevAddrRange) StateFields ¶
func (r *DevAddrRange) StateFields() []string
func (*DevAddrRange) StateLoad ¶
func (r *DevAddrRange) StateLoad(stateSourceObject state.Source)
+checklocksignore
func (*DevAddrRange) StateSave ¶
func (r *DevAddrRange) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*DevAddrRange) StateTypeName ¶
func (r *DevAddrRange) StateTypeName() string
func (DevAddrRange) WellFormed ¶
func (r DevAddrRange) WellFormed() bool
WellFormed returns true if r.Start <= r.End. All other methods on a Range require that the Range is well-formed.
type DevAddrSegmentDataSlices ¶
SegmentDataSlices represents segments from a set as slices of start, end, and values. SegmentDataSlices is primarily used as an intermediate representation for save/restore and the layout here is optimized for that.
+stateify savable
func (*DevAddrSegmentDataSlices) StateFields ¶
func (d *DevAddrSegmentDataSlices) StateFields() []string
func (*DevAddrSegmentDataSlices) StateLoad ¶
func (d *DevAddrSegmentDataSlices) StateLoad(stateSourceObject state.Source)
+checklocksignore
func (*DevAddrSegmentDataSlices) StateSave ¶
func (d *DevAddrSegmentDataSlices) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*DevAddrSegmentDataSlices) StateTypeName ¶
func (d *DevAddrSegmentDataSlices) StateTypeName() string
type DevAddrSet ¶
type DevAddrSet struct {
// contains filtered or unexported fields
}
A Set is a mapping of segments with non-overlapping Range keys. The zero value for a Set is an empty set. Set values are not safely movable nor copyable. Set is thread-compatible.
+stateify savable
func (*DevAddrSet) Add ¶
func (s *DevAddrSet) Add(r DevAddrRange, val pinnedAccelMem) bool
Add inserts the given segment into the set and returns true. If the new segment can be merged with adjacent segments, Add will do so. If the new segment would overlap an existing segment, Add returns false. If Add succeeds, all existing iterators are invalidated.
func (*DevAddrSet) AddWithoutMerging ¶
func (s *DevAddrSet) AddWithoutMerging(r DevAddrRange, val pinnedAccelMem) bool
AddWithoutMerging inserts the given segment into the set and returns true. If it would overlap an existing segment, AddWithoutMerging does nothing and returns false. If AddWithoutMerging succeeds, all existing iterators are invalidated.
func (*DevAddrSet) ApplyContiguous ¶
func (s *DevAddrSet) ApplyContiguous(r DevAddrRange, fn func(seg DevAddrIterator)) DevAddrGapIterator
ApplyContiguous applies a function to a contiguous range of segments, splitting if necessary. The function is applied until the first gap is encountered, at which point the gap is returned. If the function is applied across the entire range, a terminal gap is returned. All existing iterators are invalidated.
N.B. The Iterator must not be invalidated by the function.
func (*DevAddrSet) ExportSortedSlices ¶
func (s *DevAddrSet) ExportSortedSlices() *DevAddrSegmentDataSlices
ExportSortedSlices returns a copy of all segments in the given set, in ascending key order.
func (*DevAddrSet) Find ¶
func (s *DevAddrSet) Find(key uint64) (DevAddrIterator, DevAddrGapIterator)
Find returns the segment or gap whose range contains the given key. If a segment is found, the returned Iterator is non-terminal and the returned GapIterator is terminal. Otherwise, the returned Iterator is terminal and the returned GapIterator is non-terminal.
func (*DevAddrSet) FindGap ¶
func (s *DevAddrSet) FindGap(key uint64) DevAddrGapIterator
FindGap returns the gap containing the given key. If no such gap exists (i.e. the set contains a segment containing that key), FindGap returns a terminal iterator.
func (*DevAddrSet) FindSegment ¶
func (s *DevAddrSet) FindSegment(key uint64) DevAddrIterator
FindSegment returns the segment whose range contains the given key. If no such segment exists, FindSegment returns a terminal iterator.
func (*DevAddrSet) FirstGap ¶
func (s *DevAddrSet) FirstGap() DevAddrGapIterator
FirstGap returns the first gap in the set.
func (*DevAddrSet) FirstSegment ¶
func (s *DevAddrSet) FirstSegment() DevAddrIterator
FirstSegment returns the first segment in the set. If the set is empty, FirstSegment returns a terminal iterator.
func (*DevAddrSet) ImportSortedSlices ¶
func (s *DevAddrSet) ImportSortedSlices(sds *DevAddrSegmentDataSlices) error
ImportSortedSlices initializes the given set from the given slice.
Preconditions:
- s must be empty.
- sds must represent a valid set (the segments in sds must have valid lengths that do not overlap).
- The segments in sds must be sorted in ascending key order.
func (*DevAddrSet) Insert ¶
func (s *DevAddrSet) Insert(gap DevAddrGapIterator, r DevAddrRange, val pinnedAccelMem) DevAddrIterator
Insert inserts the given segment into the given gap. If the new segment can be merged with adjacent segments, Insert will do so. Insert returns an iterator to the segment containing the inserted value (which may have been merged with other values). All existing iterators (including gap, but not including the returned iterator) are invalidated.
If the gap cannot accommodate the segment, or if r is invalid, Insert panics.
Insert is semantically equivalent to a InsertWithoutMerging followed by a Merge, but may be more efficient. Note that there is no unchecked variant of Insert since Insert must retrieve and inspect gap's predecessor and successor segments regardless.
func (*DevAddrSet) InsertWithoutMerging ¶
func (s *DevAddrSet) InsertWithoutMerging(gap DevAddrGapIterator, r DevAddrRange, val pinnedAccelMem) DevAddrIterator
InsertWithoutMerging inserts the given segment into the given gap and returns an iterator to the inserted segment. All existing iterators (including gap, but not including the returned iterator) are invalidated.
If the gap cannot accommodate the segment, or if r is invalid, InsertWithoutMerging panics.
func (*DevAddrSet) InsertWithoutMergingUnchecked ¶
func (s *DevAddrSet) InsertWithoutMergingUnchecked(gap DevAddrGapIterator, r DevAddrRange, val pinnedAccelMem) DevAddrIterator
InsertWithoutMergingUnchecked inserts the given segment into the given gap and returns an iterator to the inserted segment. All existing iterators (including gap, but not including the returned iterator) are invalidated.
Preconditions:
- r.Start >= gap.Start().
- r.End <= gap.End().
func (*DevAddrSet) IsEmpty ¶
func (s *DevAddrSet) IsEmpty() bool
IsEmpty returns true if the set contains no segments.
func (*DevAddrSet) IsEmptyRange ¶
func (s *DevAddrSet) IsEmptyRange(r DevAddrRange) bool
IsEmptyRange returns true iff no segments in the set overlap the given range. This is semantically equivalent to s.SpanRange(r) == 0, but may be more efficient.
func (*DevAddrSet) Isolate ¶
func (s *DevAddrSet) Isolate(seg DevAddrIterator, r DevAddrRange) DevAddrIterator
Isolate ensures that the given segment's range does not escape r by splitting at r.Start and r.End if necessary, and returns an updated iterator to the bounded segment. All existing iterators (including seg, but not including the returned iterators) are invalidated.
func (*DevAddrSet) LastGap ¶
func (s *DevAddrSet) LastGap() DevAddrGapIterator
LastGap returns the last gap in the set.
func (*DevAddrSet) LastSegment ¶
func (s *DevAddrSet) LastSegment() DevAddrIterator
LastSegment returns the last segment in the set. If the set is empty, LastSegment returns a terminal iterator.
func (*DevAddrSet) LowerBoundGap ¶
func (s *DevAddrSet) LowerBoundGap(min uint64) DevAddrGapIterator
LowerBoundGap returns the gap with the lowest range that is greater than or equal to min.
func (*DevAddrSet) LowerBoundSegment ¶
func (s *DevAddrSet) LowerBoundSegment(min uint64) DevAddrIterator
LowerBoundSegment returns the segment with the lowest range that contains a key greater than or equal to min. If no such segment exists, LowerBoundSegment returns a terminal iterator.
func (*DevAddrSet) Merge ¶
func (s *DevAddrSet) Merge(first, second DevAddrIterator) DevAddrIterator
Merge attempts to merge two neighboring segments. If successful, Merge returns an iterator to the merged segment, and all existing iterators are invalidated. Otherwise, Merge returns a terminal iterator.
If first is not the predecessor of second, Merge panics.
func (*DevAddrSet) MergeAdjacent ¶
func (s *DevAddrSet) MergeAdjacent(r DevAddrRange)
MergeAdjacent attempts to merge the segment containing r.Start with its predecessor, and the segment containing r.End-1 with its successor.
func (*DevAddrSet) MergeAll ¶
func (s *DevAddrSet) MergeAll()
MergeAll attempts to merge all adjacent segments in the set. All existing iterators are invalidated.
func (*DevAddrSet) MergeRange ¶
func (s *DevAddrSet) MergeRange(r DevAddrRange)
MergeRange attempts to merge all adjacent segments that contain a key in the specific range. All existing iterators are invalidated.
func (*DevAddrSet) MergeUnchecked ¶
func (s *DevAddrSet) MergeUnchecked(first, second DevAddrIterator) DevAddrIterator
MergeUnchecked attempts to merge two neighboring segments. If successful, MergeUnchecked returns an iterator to the merged segment, and all existing iterators are invalidated. Otherwise, MergeUnchecked returns a terminal iterator.
Precondition: first is the predecessor of second: first.NextSegment() == second, first == second.PrevSegment().
func (*DevAddrSet) Remove ¶
func (s *DevAddrSet) Remove(seg DevAddrIterator) DevAddrGapIterator
Remove removes the given segment and returns an iterator to the vacated gap. All existing iterators (including seg, but not including the returned iterator) are invalidated.
func (*DevAddrSet) RemoveAll ¶
func (s *DevAddrSet) RemoveAll()
RemoveAll removes all segments from the set. All existing iterators are invalidated.
func (*DevAddrSet) RemoveRange ¶
func (s *DevAddrSet) RemoveRange(r DevAddrRange) DevAddrGapIterator
RemoveRange removes all segments in the given range. An iterator to the newly formed gap is returned, and all existing iterators are invalidated.
func (*DevAddrSet) Span ¶
func (s *DevAddrSet) Span() uint64
Span returns the total size of all segments in the set.
func (*DevAddrSet) SpanRange ¶
func (s *DevAddrSet) SpanRange(r DevAddrRange) uint64
SpanRange returns the total size of the intersection of segments in the set with the given range.
func (*DevAddrSet) Split ¶
func (s *DevAddrSet) Split(seg DevAddrIterator, split uint64) (DevAddrIterator, DevAddrIterator)
Split 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.
If the segment cannot be split at split (because split is at the start or end of the segment's range, so splitting would produce a segment with zero length, or because split falls outside the segment's range altogether), Split panics.
func (*DevAddrSet) SplitAt ¶
func (s *DevAddrSet) SplitAt(split uint64) bool
SplitAt splits the segment straddling split, if one exists. SplitAt returns true if a segment was split and false otherwise. If SplitAt splits a segment, all existing iterators are invalidated.
func (*DevAddrSet) SplitUnchecked ¶
func (s *DevAddrSet) SplitUnchecked(seg DevAddrIterator, split uint64) (DevAddrIterator, DevAddrIterator)
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().
func (*DevAddrSet) StateFields ¶
func (s *DevAddrSet) StateFields() []string
func (*DevAddrSet) StateLoad ¶
func (s *DevAddrSet) StateLoad(stateSourceObject state.Source)
+checklocksignore
func (*DevAddrSet) StateSave ¶
func (s *DevAddrSet) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*DevAddrSet) StateTypeName ¶
func (s *DevAddrSet) StateTypeName() string
func (*DevAddrSet) String ¶
func (s *DevAddrSet) String() string
String stringifies a Set for debugging.
func (*DevAddrSet) UpperBoundGap ¶
func (s *DevAddrSet) UpperBoundGap(max uint64) DevAddrGapIterator
UpperBoundGap returns the gap with the highest range that is less than or equal to max.
func (*DevAddrSet) UpperBoundSegment ¶
func (s *DevAddrSet) UpperBoundSegment(max uint64) DevAddrIterator
UpperBoundSegment returns the segment with the highest range that contains a key less than or equal to max. If no such segment exists, UpperBoundSegment returns a terminal iterator.
type DevAddrdynamicGap ¶
type DevAddrdynamicGap [DevAddrtrackGaps]uint64
dynamicGap is a type that disappears if trackGaps is 0.
func (*DevAddrdynamicGap) Get ¶
func (d *DevAddrdynamicGap) Get() uint64
Get returns the value of the gap.
Precondition: trackGaps must be non-zero.
func (*DevAddrdynamicGap) Set ¶
func (d *DevAddrdynamicGap) Set(v uint64)
Set sets the value of the gap.
Precondition: trackGaps must be non-zero.
type DevAddrnode ¶
type DevAddrnode struct {
// contains filtered or unexported fields
}
+stateify savable
func (*DevAddrnode) StateFields ¶
func (n *DevAddrnode) StateFields() []string
func (*DevAddrnode) StateLoad ¶
func (n *DevAddrnode) StateLoad(stateSourceObject state.Source)
+checklocksignore
func (*DevAddrnode) StateSave ¶
func (n *DevAddrnode) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*DevAddrnode) StateTypeName ¶
func (n *DevAddrnode) StateTypeName() string
func (*DevAddrnode) String ¶
func (n *DevAddrnode) String() string
String stringifies a node (and all of its children) for debugging.