PostgresRegistry
Namespace: Ankus.PgConfig
Assembly: Ankus.PgConfig.dll
Persists explicitly registered PostgreSQL installations in the Ankus home directory.
public sealed class PostgresRegistryUses the specified home, then ANKUS_HOME, then the current user’s ~/.ankus directory. Relative home paths are resolved against the caller’s current directory.
Inheritance: object
Constructors
Section titled “Constructors”PostgresRegistry(string?)
Section titled “PostgresRegistry(string?)”Persists explicitly registered PostgreSQL installations in the Ankus home directory.
public PostgresRegistry(string? homeDirectory = null)Parameters:
homeDirectory — string
An optional Ankus home directory.
Uses the specified home, then ANKUS_HOME, then the current user’s ~/.ankus directory. Relative home paths are resolved against the caller’s current directory.
Properties
Section titled “Properties”ConfigurationPath
Section titled “ConfigurationPath”Gets the persisted configuration path.
public string ConfigurationPath { get; }Value: string
HomeDirectory
Section titled “HomeDirectory”Gets the directory that contains configuration and managed installations.
public string HomeDirectory { get; }Value: string
Methods
Section titled “Methods”GetAsync(int, CancellationToken)
Section titled “GetAsync(int, CancellationToken)”Loads an explicitly registered installation, rejecting missing or mismatched registrations.
public Task<PostgresInstallation> GetAsync(int major, CancellationToken cancellationToken = default)Parameters:
major — int
The PostgreSQL major version.
cancellationToken — CancellationToken
Cancels installation queries.
Returns: Task<PostgresInstallation>
The registered installation.
GetPath(int)
Section titled “GetPath(int)”Gets a registered pg_config path, resolving relative entries against the Ankus home.
public string? GetPath(int major)Parameters:
major — int
The PostgreSQL major version.
Returns: string
The registered path, or null if this version has not been registered.
GetPort(int)
Section titled “GetPort(int)”Gets the configured development port base plus the selected major, defaulting to 28800 plus the major.
public int GetPort(int major)Parameters:
major — int
A supported PostgreSQL major, from 13 through 19.
Returns: int
The development TCP port.
GetTestPort(int)
Section titled “GetTestPort(int)”Gets the configured test port base plus the selected major, defaulting to 32200 plus the major. Test fixtures use this port only when explicitly selected; their default ports remain automatic.
public int GetTestPort(int major)Parameters:
major — int
A supported PostgreSQL major, from 13 through 19.
Returns: int
The TCP port to request for a test fixture.
RegisterAsync(IReadOnlyDictionary<int, string>, PostgresPortOptions, CancellationToken)
Section titled “RegisterAsync(IReadOnlyDictionary<int, string>, PostgresPortOptions, CancellationToken)”Atomically registers validated installations and selected port bases, preserving unspecified settings.
public Task<IReadOnlyList<PostgresInstallation>> RegisterAsync(IReadOnlyDictionary<int, string> paths, PostgresPortOptions ports, CancellationToken cancellationToken = default)Parameters:
paths — IReadOnlyDictionary<int, string>
PostgreSQL majors and their pg_config executable paths.
ports — PostgresPortOptions
Port bases to update; null properties preserve their existing values.
cancellationToken — CancellationToken
Cancels validation or writing before the commit.
Returns: Task<IReadOnlyList<PostgresInstallation>>
The validated registrations.
RegisterAsync(IReadOnlyDictionary<int, string>, CancellationToken)
Section titled “RegisterAsync(IReadOnlyDictionary<int, string>, CancellationToken)”Validates all requested installations before atomically updating the registry, preserving other settings.
public Task<IReadOnlyList<PostgresInstallation>> RegisterAsync(IReadOnlyDictionary<int, string> paths, CancellationToken cancellationToken = default)Parameters:
paths — IReadOnlyDictionary<int, string>
PostgreSQL majors and their pg_config executable paths.
cancellationToken — CancellationToken
Cancels validation or writing before the commit.
Returns: Task<IReadOnlyList<PostgresInstallation>>
The validated registrations.