@camstack/system 1.2.127 → 1.2.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -116,3 +116,29 @@ export declare const SQLITE_PAGE_CACHE_CEILING_KIB = -262144;
116
116
  export declare function sqliteMmapSizeFor(fileSizeBytes: number): number;
117
117
  /** The `cache_size` to apply for a database of this size, in KiB (negative). */
118
118
  export declare function sqlitePageCacheKibFor(fileSizeBytes: number): number;
119
+ /** Page counters read straight off the connection, in the units SQLite reports. */
120
+ export interface SqlitePageCounters {
121
+ readonly pageCount: number;
122
+ readonly freelistCount: number;
123
+ readonly pageSizeBytes: number;
124
+ }
125
+ /** How much of the file holds rows, and how much is free pages awaiting reuse. */
126
+ export interface SqliteOccupancy {
127
+ readonly liveMb: number;
128
+ readonly freeMb: number;
129
+ readonly freePct: number;
130
+ }
131
+ /**
132
+ * Split a database file into live bytes and free bytes.
133
+ *
134
+ * A file that stopped growing is not the same as a file that is full. SQLite
135
+ * reuses freed pages but never returns them to the filesystem without a
136
+ * `VACUUM`, so a database sitting at its high-water mark looks — from `stat`,
137
+ * from `df`, from any measurement outside the connection — exactly like one
138
+ * genuinely packed with rows. The two call for opposite actions: the first is
139
+ * reclaimed by a VACUUM, the second means retention is not keeping up.
140
+ *
141
+ * `dbSizeMb` on the boot line could not tell them apart. This can, and it costs
142
+ * three header reads on a connection that is already open.
143
+ */
144
+ export declare function sqliteOccupancy(counters: SqlitePageCounters): SqliteOccupancy;
@@ -218,6 +218,12 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
218
218
  * unreadable `stat`, and both callers treat it as "unknown" and fall back to
219
219
  * the floor — never to a smaller setting than the one already argued for.
220
220
  */
221
+ /**
222
+ * One numeric PRAGMA off the open connection. A pragma that does not answer
223
+ * with a number yields 0, which `sqliteOccupancy` reads as "unknown" and
224
+ * reports as an empty file rather than inventing a ratio.
225
+ */
226
+ private readPragmaNumber;
221
227
  private measureDbSizeBytes;
222
228
  private getDb;
223
229
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.127",
3
+ "version": "1.2.128",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",