Class AppRegistry
- Namespace
- SharpConsoleUI.Registry
- Assembly
- SharpConsoleUI.dll
The main registry API. Holds an in-memory JsonNode tree and delegates persistence to an IRegistryStorage backend. Supports multiple flush modes: eager (every Set), manual (explicit Save()), lazy (timer-based), and auto-on-shutdown (via RegistryStateService).
Thread-safety: AppRegistry.OpenSection() and Save()/Load() are thread-safe via ReaderWriterLockSlim. Individual RegistrySection instances are NOT thread-safe — do not share a section instance across threads without external synchronization.
public class AppRegistry : IDisposable
- Inheritance
-
AppRegistry
- Implements
- Inherited Members
- Extension Methods
Constructors
AppRegistry(RegistryConfiguration)
Initializes a new AppRegistry with the given configuration. Storage must be provided; JsonFileStorage support will be added in a future task.
public AppRegistry(RegistryConfiguration config)
Parameters
configRegistryConfiguration
Methods
Dispose()
Stops the flush timer if active and releases the lock.
public void Dispose()
Load()
Loads from the storage backend. Replaces the in-memory tree entirely. Destructive: discards any unsaved writes. Call Save() first if needed.
public void Load()
OpenSection(string)
Opens a section at the given path. Creates intermediate nodes as needed. '/' is the separator. Leading/trailing slashes are trimmed. Empty path returns the root section. Uses a write lock because path creation mutates the tree.
public RegistrySection OpenSection(string path)
Parameters
pathstring
Returns
Save()
Saves the registry to the storage backend. Snapshots the in-memory tree under a read lock, then releases the lock before I/O. Concurrent Save() calls are serialized via an internal lock.
public void Save()