file

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package file watches a file for changes and updates the in memory hardware data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {

	// FilePath is the path to the file to watch.
	FilePath string

	// Log is the logger to be used in the File backend.
	Log logr.Logger
	// contains filtered or unexported fields
}

Watcher represents the backend for watching a file for changes and updating the in memory DHCP data.

func NewWatcher

func NewWatcher(l logr.Logger, f string) (*Watcher, error)

NewWatcher creates a new file watcher.

func (*Watcher) FilterHardware added in v0.23.0

func (w *Watcher) FilterHardware(ctx context.Context, opts data.HardwareFilter) (*tinkerbell.Hardware, error)

FilterHardware looks up a single Hardware object from the in-memory data using selector-based filtering. Exactly one result is expected; zero results returns a not-found error and multiple results returns a multiple-found error.

func (*Watcher) ReadHardware added in v0.23.0

func (w *Watcher) ReadHardware(ctx context.Context, name, namespace string) (*tinkerbell.Hardware, error)

ReadHardware looks up a Hardware object by name from the in-memory data.

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context)

Start starts watching a file for changes and updates the in memory data (w.data) on changes. Start is a blocking method. Use a context cancellation to exit.

func (*Watcher) UpdateHardware added in v0.23.0

func (w *Watcher) UpdateHardware(_ context.Context, _ *tinkerbell.Hardware, _ data.UpdateOptions) error

UpdateHardware is not supported by the file backend as it is read-only.

Jump to

Keyboard shortcuts

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