zfs

package
v0.0.0-...-d46e842 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoChildren  = errors.New("no child nodes")
	ErrInvalidPath = errors.New("invalid path")
	ErrNotFound    = errors.New("name not found")
	ErrNilNode     = errors.New("node cannot be nil")
	ErrSameDir     = errors.New("parent and child cannot be the same")
)

Functions

This section is empty.

Types

type Node

type Node[T comparable] struct {
	Value           *T
	Children        map[string]*Node[T]
	ChildrenByInode map[uint64]*Node[T]
}

Node is the tree node

func NewNode

func NewNode[T comparable](v *T, hasChildren bool) *Node[T]

func (*Node[T]) HasChildren

func (node *Node[T]) HasChildren() bool

type Tree

type Tree[T comparable] struct {
	Root *Node[T]
}

func NewTree

func NewTree[T comparable]() Tree[T]

func (*Tree[T]) Add

func (tree *Tree[T]) Add(pathName string, parentNode, childNode *Node[T], pInode, cInode uint64, children bool) error

func (*Tree[T]) Get

func (tree *Tree[T]) Get(pathName string) (*Node[T], error)

func (*Tree[T]) GetByInode

func (tree *Tree[T]) GetByInode(ino uint64) (*Node[T], error)

func (*Tree[T]) ListByInode

func (tree *Tree[T]) ListByInode(inode uint64) ([]*T, error)

TODO implement this method for a Node[T] to make searches from the given position and faster.

func (*Tree[T]) ListByName

func (tree *Tree[T]) ListByName(pathName string) ([]*T, error)

Jump to

Keyboard shortcuts

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