dirdata

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLocked = errors.New("resource file held by another process")

ErrLocked reports a file still held exclusively by another process after the read retries. The scan is incomplete rather than failed: a caller must retry it instead of reconciling the partial result, which would unload the resources the file holds.

Functions

This section is empty.

Types

type DirData

type DirData struct {
	Entries []DirEntry
}

DirData holds pre-read YAML file contents from a set of directories. This allows multiple resource loaders to parse from the same file data without each independently opening and reading files from disk, which avoids file handle contention on Windows.

func ReadDirs

func ReadDirs(dirs []string) (*DirData, error)

ReadDirs reads all YAML files from the given directories into memory.

type DirDataLoader

type DirDataLoader[T meta.Resource] interface {
	LoadFromDirData(data *DirData) ([]T, error)
}

DirDataLoader can load resources from pre-read directory data, avoiding repeated file system reads when multiple resource types need to be loaded from the same directories.

type DirEntry

type DirEntry struct {
	Dir   string
	Files []FileEntry
}

DirEntry holds the YAML files from a single directory.

type FileEntry

type FileEntry struct {
	Name    string
	Content []byte
}

FileEntry holds the name and content of a single YAML file.

Jump to

Keyboard shortcuts

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