uint64_tree

package
v0.0.0-...-a746c6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2018 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package template is the base of code generation for type-specific trees

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterFunc

type FilterFunc func(payload uint64) bool

FilterFunc is called on each result to see if it belongs in the resulting set

type MatchesFunc

type MatchesFunc func(payload uint64, val uint64) bool

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 NewTreeV4

func NewTreeV4() *TreeV4

NewTreeV4 returns a new Tree

func (*TreeV4) Add

func (t *TreeV4) Add(address patricia.IPv4Address, tag uint64, matchFunc MatchesFunc) (bool, int, error)

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

func (t *TreeV4) Clone() *TreeV4

Clone creates an identical copy of the tree - Note: the items in the tree are not deep copied

func (*TreeV4) Delete

func (t *TreeV4) Delete(address patricia.IPv4Address, matchFunc MatchesFunc, matchVal uint64) (int, error)

Delete a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed

func (*TreeV4) FindDeepestTag

func (t *TreeV4) FindDeepestTag(address patricia.IPv4Address) (bool, uint64, error)

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) FindTags

func (t *TreeV4) FindTags(address patricia.IPv4Address) ([]uint64, error)

FindTags finds all matching tags that passes the filter function

func (*TreeV4) FindTagsWithFilter

func (t *TreeV4) FindTagsWithFilter(address patricia.IPv4Address, filterFunc FilterFunc) ([]uint64, error)

FindTagsWithFilter finds all matching tags that passes the filter function

func (*TreeV4) Set

func (t *TreeV4) Set(address patricia.IPv4Address, tag uint64) (bool, int, error)

Set the single value for a node - overwrites what's there Returns whether the tag count at this address was increased, and how many tags at this address

type TreeV6

type TreeV6 struct {
	// contains filtered or unexported fields
}

TreeV6 is an IP Address patricia tree

func NewTreeV6

func NewTreeV6() *TreeV6

NewTreeV6 returns a new Tree

func (*TreeV6) Add

func (t *TreeV6) Add(address patricia.IPv6Address, tag uint64, matchFunc MatchesFunc) (bool, int, error)

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

func (t *TreeV6) Clone() *TreeV6

Clone creates an identical copy of the tree - Note: the items in the tree are not deep copied

func (*TreeV6) Delete

func (t *TreeV6) Delete(address patricia.IPv6Address, matchFunc MatchesFunc, matchVal uint64) (int, error)

Delete a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed

func (*TreeV6) FindDeepestTag

func (t *TreeV6) FindDeepestTag(address patricia.IPv6Address) (bool, uint64, error)

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) FindTags

func (t *TreeV6) FindTags(address patricia.IPv6Address) ([]uint64, error)

FindTags finds all matching tags that passes the filter function

func (*TreeV6) FindTagsWithFilter

func (t *TreeV6) FindTagsWithFilter(address patricia.IPv6Address, filterFunc FilterFunc) ([]uint64, error)

FindTagsWithFilter finds all matching tags that passes the filter function

func (*TreeV6) Set

func (t *TreeV6) Set(address patricia.IPv6Address, tag uint64) (bool, int, error)

Set the single value for a node - overwrites what's there Returns whether the tag count at this address was increased, and how many tags at this address

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL