trie

package
v4.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Trie

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

Trie datastructure.

func NewTrie

func NewTrie() *Trie

NewTrie returns Trie.

func (*Trie) Add

func (t *Trie) Add(prefix []byte, id uint64)

Add adds the id in the trie for the given prefix path.

func (*Trie) AddMatch

func (t *Trie) AddMatch(m pb.Match, id uint64) error

AddMatch allows you to send in a prefix match, with "holes" in the prefix. The holes are specified via IgnoreBytes in a comma-separated list of indices starting from 0. A dash can be used to denote a range. Valid example is "3, 5-8, 10, 12-15". Length of IgnoreBytes does not need to match the length of the Prefix passed.

Consider a prefix = "aaaa". If the IgnoreBytes is set to "0, 2", then along with key "aaaa...", a key "baba..." would also match.

func (*Trie) Delete

func (t *Trie) Delete(prefix []byte, id uint64) error

Delete will delete the id if the id exist in the given index path.

func (*Trie) DeleteMatch

func (t *Trie) DeleteMatch(m pb.Match, id uint64) error

func (*Trie) Get

func (t *Trie) Get(key []byte) map[uint64]struct{}

Jump to

Keyboard shortcuts

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