traverse

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

New creates a default traverser, starting from objects/queries of class.

Functions

func IsPartialError

func IsPartialError(err error) bool

Types

type Errors

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

Errors is a goroutine-safe collection of unique errors.

func NewErrors

func NewErrors(log logr.Logger) *Errors

func (*Errors) Err

func (e *Errors) Err() error

Err returns the resulting error which may be a PartialError. Must not be called concurrently.

func (*Errors) Log

func (e *Errors) Log(err error, msg string, kv ...any) bool

Log the first instance of err, don't log duplicates

type PartialError

type PartialError struct{ Err error }

PartialError indicates some errors were encountered but there are still some results.

func (*PartialError) Error

func (e *PartialError) Error() string

type Start

type Start struct {
	Class   korrel8r.Class    // Start class.
	Objects []korrel8r.Object // Start objects, must be of Start class.
	Queries []korrel8r.Query  // Queries for start objects, must be of Start class.
}

Start point information for graph traversal.

type Traverser

type Traverser interface {
	// Goals traverses all paths from start objects to all goal classes.
	Goals(ctx context.Context, start Start, goals []korrel8r.Class) (*graph.Graph, error)
	// Neighbours traverses to all neighbours of the start objects, traversing links up to the given depth.
	Neighbours(ctx context.Context, start Start, depth int) (*graph.Graph, error)
}

Traverser traverses a graph, filling in [Node.Result], [Node.Queries] and [Line.Queries]. A korrel8r.Constraint can be set on the context if needed.

func NewAsync

func NewAsync(e *engine.Engine, g *graph.Graph) Traverser

NewSync returns an asynchronous Traverser that can do multiple store queries concurrently.

Jump to

Keyboard shortcuts

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