preload

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Link struct {
	Segment  datamodel.PathSegment
	LinkNode datamodel.Node
	Link     datamodel.Link
}

Link provides the link encountered during a preload pass, the node it was encountered on, and the segment of the path that led to the link.

type Loader

type Loader func(PreloadContext, Link)

Loader is a function that will be called with a link discovered in a preload pass of a traversal. A preload pass can be used to collect all links in each block prior to traversal of that block, allowing for parallel (background) loading of blocks in anticipation of eventual actual load during traversal.

type PreloadContext

type PreloadContext struct {
	// Ctx is the familiar golang Context pattern.
	// Use this for cancellation, or attaching additional info
	// (for example, perhaps to pass auth tokens through to the storage functions).
	Ctx context.Context

	// Path where the link was encountered.  May be zero.
	//
	// Functions in the traversal package will set this automatically.
	BasePath datamodel.Path

	// Parent of the LinkNode.  May be zero.
	//
	// Functions in the traversal package will set this automatically.
	ParentNode datamodel.Node
}

PreloadContext carries information about the current state of a traversal where a set of links that may be preloaded were encountered.

Jump to

Keyboard shortcuts

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