domaintree64

package
v0.0.0-...-66ceba8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package domaintree64 implements radix tree data structure for domain names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

Node is a radix tree for domain names.

func (*Node) Delete

func (n *Node) Delete(d domain.Name) (*Node, bool)

Delete removes current domain only. It returns new tree and flag if deletion indeed occurs.

func (*Node) DeleteSubdomains

func (n *Node) DeleteSubdomains(d domain.Name) (*Node, bool)

DeleteSubdomains removes current domain and all its subdomains if any. It returns new tree and flag if deletion indeed occurs.

func (*Node) Enumerate

func (n *Node) Enumerate() chan Pair

Enumerate returns key-value pairs in given tree. It lists domains in the same order for the same tree.

func (*Node) Get

func (n *Node) Get(d domain.Name) (uint64, bool)

Get gets value for domain which is equal to domain in the tree or is a subdomain of existing domain.

func (*Node) InplaceInsert

func (n *Node) InplaceInsert(d domain.Name, v uint64)

InplaceInsert puts or replaces value using given domain as a key. The method inserts data directly to current tree so make sure you have exclusive access to it.

func (*Node) Insert

func (n *Node) Insert(d domain.Name, v uint64) *Node

Insert puts value using given domain as a key. The method returns new tree (old one remains unaffected).

type Pair

type Pair struct {
	Key   string
	Value uint64
}

Pair represents a key-value pair returned by Enumerate method.

Jump to

Keyboard shortcuts

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