Documentation ¶
Index ¶
- type FilterFunc
- type MatchesFunc
- type TreeV4
- func (t *TreeV4) Add(address patricia.IPv4Address, tag uint8, matchFunc MatchesFunc) (bool, int)
- func (t *TreeV4) Clone() *TreeV4
- func (t *TreeV4) CountTags() int
- func (t *TreeV4) Delete(address patricia.IPv4Address, matchFunc MatchesFunc, matchVal uint8) int
- func (t *TreeV4) DeleteWithBuffer(buf []uint8, address patricia.IPv4Address, matchFunc MatchesFunc, ...) int
- func (t *TreeV4) FindDeepestTag(address patricia.IPv4Address) (bool, uint8)
- func (t *TreeV4) FindDeepestTags(address patricia.IPv4Address) (bool, []uint8)
- func (t *TreeV4) FindDeepestTagsAppend(ret []uint8, address patricia.IPv4Address) (bool, []uint8)
- func (t *TreeV4) FindTags(address patricia.IPv4Address) []uint8
- func (t *TreeV4) FindTagsAppend(ret []uint8, address patricia.IPv4Address) []uint8
- func (t *TreeV4) FindTagsWithFilter(address patricia.IPv4Address, filterFunc FilterFunc) []uint8
- func (t *TreeV4) FindTagsWithFilterAppend(ret []uint8, address patricia.IPv4Address, filterFunc FilterFunc) []uint8
- func (t *TreeV4) Set(address patricia.IPv4Address, tag uint8) (bool, int)
- type TreeV6
- func (t *TreeV6) Add(address patricia.IPv6Address, tag uint8, matchFunc MatchesFunc) (bool, int)
- func (t *TreeV6) Clone() *TreeV6
- func (t *TreeV6) CountTags() int
- func (t *TreeV6) Delete(address patricia.IPv6Address, matchFunc MatchesFunc, matchVal uint8) int
- func (t *TreeV6) DeleteWithBuffer(buf []uint8, address patricia.IPv6Address, matchFunc MatchesFunc, ...) int
- func (t *TreeV6) FindDeepestTag(address patricia.IPv6Address) (bool, uint8)
- func (t *TreeV6) FindDeepestTags(address patricia.IPv6Address) (bool, []uint8)
- func (t *TreeV6) FindDeepestTagsAppend(ret []uint8, address patricia.IPv6Address) (bool, []uint8)
- func (t *TreeV6) FindTags(address patricia.IPv6Address) []uint8
- func (t *TreeV6) FindTagsAppend(ret []uint8, address patricia.IPv6Address) []uint8
- func (t *TreeV6) FindTagsWithFilter(address patricia.IPv6Address, filterFunc FilterFunc) []uint8
- func (t *TreeV6) FindTagsWithFilterAppend(ret []uint8, address patricia.IPv6Address, filterFunc FilterFunc) []uint8
- func (t *TreeV6) Set(address patricia.IPv6Address, tag uint8) (bool, int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilterFunc ¶
FilterFunc is called on each result to see if it belongs in the resulting set
type MatchesFunc ¶
MatchesFunc is called to check if tag data matches the input value
type TreeV4 ¶
type TreeV4 struct {
// contains filtered or unexported fields
}
TreeV4 is an IP Address patricia tree
func (*TreeV4) Add ¶
func (t *TreeV4) Add(address patricia.IPv4Address, tag uint8, matchFunc MatchesFunc) (bool, int)
Add adds a tag to the tree - if matchFunc is non-nil, it will be used to ensure uniqueness at this node - returns whether the tag count at this address was increased, and how many tags at this address
func (*TreeV4) Clone ¶
Clone creates an identical copy of the tree - Note: the items in the tree are not deep copied
func (*TreeV4) CountTags ¶
CountTags iterates through the tree, counting the number of tags - note: unused nodes will have TagCount==0
func (*TreeV4) Delete ¶
func (t *TreeV4) Delete(address patricia.IPv4Address, matchFunc MatchesFunc, matchVal uint8) int
Delete a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - use DeleteWithBuffer if you can reuse slices, to cut down on allocations
func (*TreeV4) DeleteWithBuffer ¶
func (t *TreeV4) DeleteWithBuffer(buf []uint8, address patricia.IPv4Address, matchFunc MatchesFunc, matchVal uint8) int
DeleteWithBuffer a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - uses input slice to reduce allocations
func (*TreeV4) FindDeepestTag ¶
func (t *TreeV4) FindDeepestTag(address patricia.IPv4Address) (bool, uint8)
FindDeepestTag finds a tag at the deepest level in the tree, representing the closest match. - if that target node has multiple tags, the first in the list is returned
func (*TreeV4) FindDeepestTags ¶
func (t *TreeV4) FindDeepestTags(address patricia.IPv4Address) (bool, []uint8)
FindDeepestTags finds all tags at the deepest level in the tree, representing the closest match - use FindDeepestTagsAppend if you can reuse slices, to cut down on allocations
func (*TreeV4) FindDeepestTagsAppend ¶
FindDeepestTagsAppend finds all tags at the deepest level in the tree, representing the closest match - appends results to the input slice
func (*TreeV4) FindTags ¶
func (t *TreeV4) FindTags(address patricia.IPv4Address) []uint8
FindTags finds all matching tags for given address - use FindTagsAppend if you can reuse slices, to cut down on allocations
func (*TreeV4) FindTagsAppend ¶
func (t *TreeV4) FindTagsAppend(ret []uint8, address patricia.IPv4Address) []uint8
FindTagsAppend finds all matching tags for given address and appends them to ret
func (*TreeV4) FindTagsWithFilter ¶
func (t *TreeV4) FindTagsWithFilter(address patricia.IPv4Address, filterFunc FilterFunc) []uint8
FindTagsWithFilter finds all matching tags that passes the filter function - use FindTagsWithFilterAppend if you can reuse slices, to cut down on allocations
func (*TreeV4) FindTagsWithFilterAppend ¶
func (t *TreeV4) FindTagsWithFilterAppend(ret []uint8, address patricia.IPv4Address, filterFunc FilterFunc) []uint8
FindTagsWithFilterAppend finds all matching tags that passes the filter function - results are appended to the input slice
type TreeV6 ¶
type TreeV6 struct {
// contains filtered or unexported fields
}
TreeV6 is an IP Address patricia tree
func (*TreeV6) Add ¶
func (t *TreeV6) Add(address patricia.IPv6Address, tag uint8, matchFunc MatchesFunc) (bool, int)
Add adds a tag to the tree - if matchFunc is non-nil, it will be used to ensure uniqueness at this node - returns whether the tag count at this address was increased, and how many tags at this address
func (*TreeV6) Clone ¶
Clone creates an identical copy of the tree - Note: the items in the tree are not deep copied
func (*TreeV6) CountTags ¶
CountTags iterates through the tree, counting the number of tags - note: unused nodes will have TagCount==0
func (*TreeV6) Delete ¶
func (t *TreeV6) Delete(address patricia.IPv6Address, matchFunc MatchesFunc, matchVal uint8) int
Delete a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - use DeleteWithBuffer if you can reuse slices, to cut down on allocations
func (*TreeV6) DeleteWithBuffer ¶
func (t *TreeV6) DeleteWithBuffer(buf []uint8, address patricia.IPv6Address, matchFunc MatchesFunc, matchVal uint8) int
DeleteWithBuffer a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - uses input slice to reduce allocations
func (*TreeV6) FindDeepestTag ¶
func (t *TreeV6) FindDeepestTag(address patricia.IPv6Address) (bool, uint8)
FindDeepestTag finds a tag at the deepest level in the tree, representing the closest match. - if that target node has multiple tags, the first in the list is returned
func (*TreeV6) FindDeepestTags ¶
func (t *TreeV6) FindDeepestTags(address patricia.IPv6Address) (bool, []uint8)
FindDeepestTags finds all tags at the deepest level in the tree, representing the closest match - use FindDeepestTagsAppend if you can reuse slices, to cut down on allocations
func (*TreeV6) FindDeepestTagsAppend ¶
FindDeepestTagsAppend finds all tags at the deepest level in the tree, representing the closest match - appends results to the input slice
func (*TreeV6) FindTags ¶
func (t *TreeV6) FindTags(address patricia.IPv6Address) []uint8
FindTags finds all matching tags for given address - use FindTagsAppend if you can reuse slices, to cut down on allocations
func (*TreeV6) FindTagsAppend ¶
func (t *TreeV6) FindTagsAppend(ret []uint8, address patricia.IPv6Address) []uint8
FindTagsAppend finds all matching tags for given address and appends them to ret
func (*TreeV6) FindTagsWithFilter ¶
func (t *TreeV6) FindTagsWithFilter(address patricia.IPv6Address, filterFunc FilterFunc) []uint8
FindTagsWithFilter finds all matching tags that passes the filter function - use FindTagsWithFilterAppend if you can reuse slices, to cut down on allocations
func (*TreeV6) FindTagsWithFilterAppend ¶
func (t *TreeV6) FindTagsWithFilterAppend(ret []uint8, address patricia.IPv6Address, filterFunc FilterFunc) []uint8
FindTagsWithFilterAppend finds all matching tags that passes the filter function - results are appended to the input slice