This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy at the same URL with .md appended. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

FileWatchedValue Pennington.Infrastructure

A lazily-loaded value that reloads on next access when a file in its Scope changes. Implements IFileWatchAware so FileWatchDispatcher drives the reload — this type holds no IFileWatcher subscription of its own.

Properties

Scope FileWatchScope
The directory and pattern this value reloads for.
Value T
The current value, loaded on first access and reloaded after a change in Scope.
WatchScopes IReadOnlyList<FileWatchScope>
Directories needing an OS-level watcher. Empty (the default) for aggregators that ride notifications other watchers already produce.

Constructors

FileWatchedValue

#
public FileWatchedValue`1(FileWatchScope scope, Func<T> load)

Creates the holder; the value is not loaded until Value is first read.

Parameters

scope FileWatchScope
The directory and pattern whose changes trigger a reload.
load Func<T>
Factory that produces the value.

Methods

OnFileChanged

#
public FileWatchResponse OnFileChanged(FileChangeNotification change)

Called on the file-watcher thread for every watched change. Must be quick and thread-safe.

Parameters

change FileChangeNotification

Returns

FileWatchResponse

Pennington.Infrastructure.FileWatchedValue

namespace Pennington.Infrastructure;

/// A lazily-loaded value that reloads on next access when a file in its Scope changes. Implements IFileWatchAware so FileWatchDispatcher drives the reload — this type holds no IFileWatcher subscription of its own.
public class FileWatchedValue
{
    /// Creates the holder; the value is not loaded until Value is first read.
    
public FileWatchedValue`1(FileWatchScope scope, Func<T> load)
; /// Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
public FileWatchResponse OnFileChanged(FileChangeNotification change)
; /// The directory and pattern this value reloads for.
public FileWatchScope Scope { get; }
/// The current value, loaded on first access and reloaded after a change in Scope.
public T Value { get; }
/// Directories needing an OS-level watcher. Empty (the default) for aggregators that ride notifications other watchers already produce.
public IReadOnlyList<FileWatchScope> WatchScopes { get; }
}