Path: redb-tsak/src/redb.Tsak.Contracts/StorageModels.cs Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Contracts/StorageModels.cs ---- namespace redb.Tsak.Contracts; /// /// One redb instance the node can reach: the host's own storage, or an instance a context declares in its /// Redb section. What the engine behind it can report differs, and the dashboard hides what it cannot /// answer instead of printing empty columns — hence the capability flags rather than "the value came back null". /// public sealed record RedbInstanceInfo { /// Instance name; empty for the host's own storage. public string Name { get; init; } = ""; /// Context that declares the instance; null for the host's own storage. public string? ContextName { get; init; } /// Provider as configured: postgres, mssql or sqlite. public string Provider { get; init; } = ""; /// Whether the instance runs the Pro tier. public bool UsePro { get; init; } /// /// Whether the context named this instance as its active one. A non-active instance is registered but /// never connected on start, so asking it for statistics is what opens its connection. /// public bool IsActive { get; init; } /// /// Short fingerprint of provider and connection string: instances that share it address the same database. /// Identity alone declares the same three databases in five contexts, which listed one row each is fifteen /// rows of the same three things — the dashboard groups by this instead of guessing from the name, which /// two contexts may well reuse for different databases. The connection string itself never leaves the node. /// public string Fingerprint { get; init; } = ""; /// Whether the engine has schemas at all (SQLite does not). public bool SupportsSchemas { get; init; } /// Whether the engine counts index usage (SQLite does not). public bool SupportsUsageCounters { get; init; } /// Whether the engine records when statistics were last refreshed (SQLite does not). public bool SupportsAnalyzeTimestamps { get; init; } } /// Everything one instance reports in a single read: the counter window, its tables and its indexes. public sealed record RedbStorageStats { /// Instance the numbers came from; empty for the host's own storage. public string Instance { get; init; } = ""; /// Context of that instance; null for the host's own storage. public string? ContextName { get; init; } /// /// Since when the usage counters have been counting: a statistics reset, or the server start. Null when /// the engine does not say — and then a zero counter means nothing at all. /// public DateTimeOffset? CountersSince { get; init; } /// Whether this node is a replica, so the counters describe reads served here and nowhere else. public bool? IsReplica { get; init; } /// Tables of the database, redb's own and everyone else's. public IReadOnlyList Tables { get; init; } = []; /// Indexes of those tables. public IReadOnlyList Indexes { get; init; } = []; } /// One table as the database catalogs report it. Null means the engine does not say. public sealed record RedbTableInfo { /// Schema of the table; null on an engine without schemas. public string? Schema { get; init; } /// Table name. public string Table { get; init; } = ""; /// Whether the table belongs to redb itself rather than to the application. public bool IsRedbOwned { get; init; } /// Row estimate. public long? EstimatedRows { get; init; } /// Size of the data, without the indexes. public long? DataSizeBytes { get; init; } /// Size of every index of this table together. public long? IndexesSizeBytes { get; init; } /// Dead rows awaiting vacuum (PostgreSQL). public long? DeadRows { get; init; } /// When statistics were last refreshed by hand. public DateTimeOffset? LastAnalyze { get; init; } /// When the engine last refreshed them on its own. public DateTimeOffset? LastAutoAnalyze { get; init; } /// When the table was last vacuumed (PostgreSQL). public DateTimeOffset? LastVacuum { get; init; } /// Whether statistics exist at all; the only answer SQLite can give about them. public bool? HasStatistics { get; init; } } /// One index as the database catalogs report it. Null means the engine does not say. public sealed record RedbIndexInfo { /// Schema of the table; null on an engine without schemas. public string? Schema { get; init; } /// Table the index belongs to. public string Table { get; init; } = ""; /// Index name. public string Name { get; init; } = ""; /// Whether the index is unique. public bool? IsUnique { get; init; } /// Key columns, in index order. public IReadOnlyList Columns { get; init; } = []; /// Columns carried but not keyed on (SQL Server), which is what makes an index covering. public IReadOnlyList IncludedColumns { get; init; } = []; /// Whether the index backs the primary key. public bool IsPrimaryKey { get; init; } /// Whether the index enforces a uniqueness constraint. public bool IsUniqueConstraint { get; init; } /// Whether the index is clustered (SQL Server). public bool? IsClustered { get; init; } /// Whether a foreign key relies on the index. public bool BacksForeignKey { get; init; } /// Whether the index belongs to a table of redb itself. public bool IsRedbOwned { get; init; } /// /// Whether removing the index would break the engine or a constraint. Such an index is shown and never /// offered for removal: some of them read zero because they hold a key, not because nobody uses them. /// public bool IsSystemCritical { get; init; } /// Why the index is critical: RedbMetadata, RedbSecurity, RedbData, PrimaryKey, Unique, ForeignKey or None. public string CriticalReason { get; init; } = "None"; /// On-disk size. public long? SizeBytes { get; init; } /// Row estimate of the index. public long? EstimatedRows { get; init; } /// Point lookups; on PostgreSQL the engine's single combined scan counter. public long? Seeks { get; init; } /// Range and full scans, where the engine splits the counter. public long? Scans { get; init; } /// Maintenance writes into the index (SQL Server). public long? Updates { get; init; } /// When the index last served a read. public DateTimeOffset? LastUsed { get; init; } } /// Result of refreshing planner statistics. public sealed record RedbAnalyzeResult { /// Instance that was analyzed; empty for the host's own storage. public string Instance { get; init; } = ""; /// Table that was analyzed; null when the whole database was. public string? Table { get; init; } /// Schema of that table. public string? Schema { get; init; } /// How long the refresh took. public long ElapsedMs { get; init; } }