Documentation
¶
Overview ¶
Package file watches a file for changes and updates the in memory hardware data.
Index ¶
- type Watcher
- func (w *Watcher) FilterHardware(ctx context.Context, opts data.HardwareFilter) (*tinkerbell.Hardware, error)
- func (w *Watcher) ReadHardware(ctx context.Context, name, namespace string) (*tinkerbell.Hardware, error)
- func (w *Watcher) Start(ctx context.Context)
- func (w *Watcher) UpdateHardware(_ context.Context, _ *tinkerbell.Hardware, _ data.UpdateOptions) error
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 ¶
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 ¶
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.