@camstack/server 1.2.868 → 1.2.869
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.
- package/CHANGELOG.md +8 -0
- package/dist/api/trpc/generated-cap-routers.js +64 -0
- package/package.json +19 -9
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +4 -4
- package/system/dist/builtins/composer/composer.addon.mjs +4 -4
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/drain-ratchet.d.ts +8 -0
- package/system/dist/builtins/storage-orchestrator/storage-drain-event-monitor.d.ts +63 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +14 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +152 -2
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +152 -2
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-CZAoDA8f.js → capture-engine-Bwhwpy3T.js} +1 -1
- package/system/dist/{capture-engine-BLvsM_9n.mjs → capture-engine-hLbiQm2r.mjs} +1 -1
- package/system/dist/{composition-sources-C-JTlA-Z.mjs → composition-sources-CXd5ydxk.mjs} +1 -1
- package/system/dist/{composition-sources-cHTw-yaK.js → composition-sources-DqGVEx12.js} +1 -1
- package/system/dist/{constants-z053G1cz.mjs → constants-BxOTlPMv.mjs} +1 -1
- package/system/dist/{constants-Ja04pgXN.js → constants-hVovxKZz.js} +1 -1
- package/system/dist/{device-ca-CBH-uKco.js → device-ca-1vqFIP_t.js} +1 -1
- package/system/dist/{device-ca-CenGkhrx.mjs → device-ca-B-yM5jiy.mjs} +1 -1
- package/system/dist/{dist-DxpO7T7_.mjs → dist-D1LOSOS0.mjs} +360 -13
- package/system/dist/{dist-4s3KGwmo.js → dist-uTbt3Yxy.js} +360 -13
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-DBlEsrOj.mjs → hub-identity-Dx3Jbhnp.mjs} +1 -1
- package/system/dist/{hub-identity-L6pLf8b7.js → hub-identity-TBo0Xrxk.js} +1 -1
- package/system/dist/{hub-mdns-ciao-Kd4Vk9zo.mjs → hub-mdns-ciao-Br5Vlcf0.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-UkoNqaH4.js → hub-mdns-ciao-C0xzb8jM.js} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +8 -8
- package/system/dist/{legacy-integration-rows-door-BZknuVEL.mjs → legacy-integration-rows-door-CqsM5HcW.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-7TugpMtZ.js → legacy-integration-rows-door-c8pHSqwA.js} +1 -1
- package/system/dist/{rename-composition-block-C0sgZZyJ.mjs → rename-composition-block-Bbu4W1mg.mjs} +1 -1
- package/system/dist/{rename-composition-block-B_E0FaEf.js → rename-composition-block-DNgRnLHV.js} +1 -1
- package/system/dist/{restore-archive-QZmJfXLn.js → restore-archive-D48JPP0d.js} +1 -1
- package/system/dist/{restore-archive-CyGsqv6W.mjs → restore-archive-DcS4GDfw.mjs} +1 -1
- package/system/dist/{wal-maintenance-CJaRdr0b.mjs → wal-maintenance-BoxO0tlN.mjs} +0 -0
- package/system/dist/{wal-maintenance-DvcEWip3.js → wal-maintenance-D3s8jnax.js} +0 -0
- package/system/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Il as errMsg, Is as BaseAddon, Nc as createEvent, Pa as reducePoints, Rl as EventCategory, Ua as resolveBucketMs, Xi as metricsProviderCapability, Zt as ROOT_BUCKET_KEY, _n as UNATTRIBUTED_BUCKET_KEY, ti as foldSnapshotByFunction } from "../../dist-
|
|
1
|
+
import { Il as errMsg, Is as BaseAddon, Nc as createEvent, Pa as reducePoints, Rl as EventCategory, Ua as resolveBucketMs, Xi as metricsProviderCapability, Zt as ROOT_BUCKET_KEY, _n as UNATTRIBUTED_BUCKET_KEY, ti as foldSnapshotByFunction } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import * as fs$1 from "node:fs";
|
|
3
3
|
import { constants, readFileSync } from "node:fs";
|
|
4
4
|
import { access, readFile, readdir } from "node:fs/promises";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
const require_coral_accelerators = require("../../coral-accelerators-BSVsBVzt.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { Bc as emitReadiness, Il as errMsg, Is as BaseAddon, Lr as enumerateInferenceDevices, Rl as EventCategory, _a as platformProbeCapability, lo as scoreRuntimes, ua as parseAcceleratorFactsJson } from "../../dist-
|
|
2
|
+
import { Bc as emitReadiness, Il as errMsg, Is as BaseAddon, Lr as enumerateInferenceDevices, Rl as EventCategory, _a as platformProbeCapability, lo as scoreRuntimes, ua as parseAcceleratorFactsJson } from "../../dist-D1LOSOS0.mjs";
|
|
3
3
|
import { n as detectCoralAccelerator, r as nodeCoralFs } from "../../coral-accelerators-DBlgWB8k.mjs";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
//#region src/builtins/record-entries/entries-service.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cl as secretViewsOf, Is as BaseAddon, Ma as recordEntriesCapability, gc as UnknownRecordKindError, qs as InvalidRecordError } from "../../dist-
|
|
1
|
+
import { Cl as secretViewsOf, Is as BaseAddon, Ma as recordEntriesCapability, gc as UnknownRecordKindError, qs as InvalidRecordError } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/builtins/record-entries/entries-service.ts
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
9
9
|
/**
|
package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Is as BaseAddon, Rl as EventCategory } from "../../dist-
|
|
1
|
+
import { Is as BaseAddon, Rl as EventCategory } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
|
|
4
4
|
/**
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
const require_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fl as DeviceType, Fn as batteryCapability, Il as errMsg, Is as BaseAddon, Ji as memoizePinnedFfmpeg, Nl as DeviceFeature, Oo as streamQualityLabel, Pn as bareAddonId, Rl as EventCategory, ll as nodePin, wr as deriveBatteryPresence, y as BatteryStatusSchema, yo as snapshotCapability } from "../../dist-
|
|
1
|
+
import { Fl as DeviceType, Fn as batteryCapability, Il as errMsg, Is as BaseAddon, Ji as memoizePinnedFfmpeg, Nl as DeviceFeature, Oo as streamQualityLabel, Pn as bareAddonId, Rl as EventCategory, ll as nodePin, wr as deriveBatteryPresence, y as BatteryStatusSchema, yo as snapshotCapability } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $r as filesystemBrowseCapability, Eo as storageProviderCapability, Is as BaseAddon } from "../../dist-
|
|
1
|
+
import { $r as filesystemBrowseCapability, Eo as storageProviderCapability, Is as BaseAddon } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import * as fs$1 from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
6
|
const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
|
|
7
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
7
|
+
const require_wal_maintenance = require("../../wal-maintenance-D3s8jnax.js");
|
|
8
8
|
const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
|
|
9
9
|
//#region src/builtins/sqlite-storage/config-store.ts
|
|
10
10
|
var ConfigStore = class {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
|
|
2
|
-
import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-
|
|
2
|
+
import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-BoxO0tlN.mjs";
|
|
3
3
|
import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
|
|
4
4
|
//#region src/builtins/sqlite-storage/config-store.ts
|
|
5
5
|
var ConfigStore = class {
|
|
@@ -3,12 +3,12 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
|
|
8
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
8
|
+
const require_wal_maintenance = require("../../wal-maintenance-D3s8jnax.js");
|
|
9
9
|
const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
|
|
10
10
|
const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
|
|
11
|
-
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-
|
|
11
|
+
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-c8pHSqwA.js");
|
|
12
12
|
let zod = require("zod");
|
|
13
13
|
let node_crypto = require("node:crypto");
|
|
14
14
|
let node_fs = require("node:fs");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $a as resolveRunnerId, F as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, Hs as DeclarationRefusedError, I as DATABASE_SNAPSHOT_SUFFIX, Ic as defineCustomActions, Il as errMsg$1, Is as BaseAddon, Js as NoCallerError, L as DATABASE_SNAPSHOT_TIMEOUT_MS, Lt as MigrationMetaSchema, Mt as MIGRATION_API_V1_METHODS, Na as recordsCapability, Pc as customAction, Pn as bareAddonId, R as DATA_STORE_DATABASES, Rl as EventCategory, So as storageAdminCapability, Yn as catalogueIssues, Zi as migrationsCapability, dl as normalizeSecretOwner, ec as RECORD_SWEEP_INTERVAL_MS, gc as UnknownRecordKindError, kc as collectSecretMarkerRefs, la as orderMigrations, mc as TransactRefusedError, qo as vectorStoreCapability, qs as InvalidRecordError, rc as RUNTIME_DEFAULTS, sc as RecordKindDeclarationSchema, vr as dataStoreProviderCapability, yr as databaseSnapshotCapability } from "../../dist-
|
|
1
|
+
import { $a as resolveRunnerId, F as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, Hs as DeclarationRefusedError, I as DATABASE_SNAPSHOT_SUFFIX, Ic as defineCustomActions, Il as errMsg$1, Is as BaseAddon, Js as NoCallerError, L as DATABASE_SNAPSHOT_TIMEOUT_MS, Lt as MigrationMetaSchema, Mt as MIGRATION_API_V1_METHODS, Na as recordsCapability, Pc as customAction, Pn as bareAddonId, R as DATA_STORE_DATABASES, Rl as EventCategory, So as storageAdminCapability, Yn as catalogueIssues, Zi as migrationsCapability, dl as normalizeSecretOwner, ec as RECORD_SWEEP_INTERVAL_MS, gc as UnknownRecordKindError, kc as collectSecretMarkerRefs, la as orderMigrations, mc as TransactRefusedError, qo as vectorStoreCapability, qs as InvalidRecordError, rc as RUNTIME_DEFAULTS, sc as RecordKindDeclarationSchema, vr as dataStoreProviderCapability, yr as databaseSnapshotCapability } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-u6xQA6r7.mjs";
|
|
3
|
-
import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-
|
|
3
|
+
import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-BoxO0tlN.mjs";
|
|
4
4
|
import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
|
|
5
5
|
import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
|
|
6
|
-
import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-
|
|
6
|
+
import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-CqsM5HcW.mjs";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
@@ -90,6 +90,14 @@ export interface DrainProgress {
|
|
|
90
90
|
* believe the screen.
|
|
91
91
|
*/
|
|
92
92
|
readonly estimatedEmptyAtMs: number | null;
|
|
93
|
+
/**
|
|
94
|
+
* The observed cede rate, bytes per millisecond, or `null` on the same
|
|
95
|
+
* condition as {@link estimatedEmptyAtMs} — no growth measured yet. #538's
|
|
96
|
+
* progress event reports this rather than re-deriving it from the other two
|
|
97
|
+
* fields, so a reader never has to reconstruct a rate the ratchet already
|
|
98
|
+
* computed.
|
|
99
|
+
*/
|
|
100
|
+
readonly rateBytesPerMs: number | null;
|
|
93
101
|
}
|
|
94
102
|
/** The state a drain starts from. No deletion happens on this sweep. */
|
|
95
103
|
export declare function beginDrain(observation: DrainObservation): DrainState;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StorageDrainEventMonitor — the operator-facing cadence for a drain's
|
|
3
|
+
* progress (#538).
|
|
4
|
+
*
|
|
5
|
+
* A `drain` location (D385) and the pruning eviction that paces it (D386) ran
|
|
6
|
+
* with no signal at all: an operator who put a disk into drain had to poll
|
|
7
|
+
* `storage.listDrainProgress` by hand to learn it was still moving. This
|
|
8
|
+
* decides WHEN a system event fires, not what it says — the sweep already
|
|
9
|
+
* computed the figures (`drainProgressOf`); this only throttles them to the
|
|
10
|
+
* cadence an operator can read without being paged every sweep.
|
|
11
|
+
*
|
|
12
|
+
* Two rules, no operator knob:
|
|
13
|
+
*
|
|
14
|
+
* - PROGRESS fires once immediately (drain start, or this process's first
|
|
15
|
+
* sweep after a restart) and then at most once per `cadenceMs` — the named
|
|
16
|
+
* constant {@link DRAIN_PROGRESS_EVENT_INTERVAL_MS}, 15 minutes.
|
|
17
|
+
* - COMPLETE fires exactly once, the first sweep that reports the location
|
|
18
|
+
* drained — never again for the same location until it drains again.
|
|
19
|
+
*
|
|
20
|
+
* A sweep whose occupancy read failed is NOT skipped: the sample's bytes/
|
|
21
|
+
* rate/ETA are `null` (D393 — never folded to 0) and the cadence still
|
|
22
|
+
* applies, so the operator sees "still draining, figures unknown" rather than
|
|
23
|
+
* silence that reads as "the drain stopped reporting".
|
|
24
|
+
*
|
|
25
|
+
* Pure except for the injected clock — same shape as
|
|
26
|
+
* `StorageLocationBandMonitor`, stateful across `observe()` calls, one
|
|
27
|
+
* transition per sweep.
|
|
28
|
+
*/
|
|
29
|
+
/** No operator-facing rate knob (#538): the cadence is this one constant. */
|
|
30
|
+
export declare const DRAIN_PROGRESS_EVENT_INTERVAL_MS: number;
|
|
31
|
+
export interface StorageDrainEventSample {
|
|
32
|
+
readonly locationId: string;
|
|
33
|
+
readonly locationName: string;
|
|
34
|
+
readonly nodeId?: string;
|
|
35
|
+
/** `null` when this sweep's occupancy read failed — never folded to 0 (D393). */
|
|
36
|
+
readonly bytesRemaining: number | null;
|
|
37
|
+
readonly rateBytesPerMs: number | null;
|
|
38
|
+
readonly estimatedEmptyAtMs: number | null;
|
|
39
|
+
readonly drained: boolean;
|
|
40
|
+
}
|
|
41
|
+
export type StorageDrainEventKind = "progress" | "complete";
|
|
42
|
+
export interface StorageDrainEvent {
|
|
43
|
+
readonly kind: StorageDrainEventKind;
|
|
44
|
+
readonly locationId: string;
|
|
45
|
+
readonly locationName: string;
|
|
46
|
+
readonly nodeId?: string;
|
|
47
|
+
readonly bytesRemaining: number | null;
|
|
48
|
+
readonly rateBytesPerMs: number | null;
|
|
49
|
+
readonly estimatedEmptyAtMs: number | null;
|
|
50
|
+
}
|
|
51
|
+
export declare class StorageDrainEventMonitor {
|
|
52
|
+
private readonly cadenceMs;
|
|
53
|
+
private readonly now;
|
|
54
|
+
private readonly state;
|
|
55
|
+
constructor(cadenceMs?: number, now?: () => number);
|
|
56
|
+
/**
|
|
57
|
+
* Observe one sweep of draining locations. A location missing from `samples`
|
|
58
|
+
* (switched back to `readonly`/`active`, or deleted) drops its schedule
|
|
59
|
+
* silently: a later re-drain starts a fresh "begin" event rather than
|
|
60
|
+
* resuming the old cadence clock.
|
|
61
|
+
*/
|
|
62
|
+
observe(samples: readonly StorageDrainEventSample[]): readonly StorageDrainEvent[];
|
|
63
|
+
}
|
|
@@ -9,6 +9,8 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
9
9
|
private service;
|
|
10
10
|
private pressureManager;
|
|
11
11
|
private readonly locationBandMonitor;
|
|
12
|
+
/** Drain progress/completion cadence (#538) — a named constant, no operator knob. */
|
|
13
|
+
private readonly drainEventMonitor;
|
|
12
14
|
/**
|
|
13
15
|
* How much of each location CamStack itself holds (D388).
|
|
14
16
|
*
|
|
@@ -154,6 +156,18 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
154
156
|
/** Drain progress for every draining location, as of the last sweep. */
|
|
155
157
|
private drainProgress;
|
|
156
158
|
/**
|
|
159
|
+
* Regular system events for drain and pruning progress (#538) — a progress
|
|
160
|
+
* ping on the named cadence (plus on drain start), and the completion
|
|
161
|
+
* event once a location empties.
|
|
162
|
+
*
|
|
163
|
+
* The sample set is the drain PLAN (`resolveDrainPlan`, which locations the
|
|
164
|
+
* operator put into `drain`), not the progress snapshot: a sweep whose
|
|
165
|
+
* occupancy read failed for a location is still draining and must still be
|
|
166
|
+
* sampled, with `null` figures (D393 — never folded to 0), so the cadence
|
|
167
|
+
* clock keeps ticking instead of restarting as if the drain had just begun.
|
|
168
|
+
*/
|
|
169
|
+
private emitDrainEvents;
|
|
170
|
+
/**
|
|
157
171
|
* What the provider's own schema declared secret, or `undefined` when this
|
|
158
172
|
* node has never heard from that provider. The distinction is the whole
|
|
159
173
|
* point — see `secretKeysForConfig`, which fails CLOSED on `undefined`.
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-uTbt3Yxy.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -4082,7 +4082,8 @@ function drainProgressOf(state, usedBytes, nowMs) {
|
|
|
4082
4082
|
startBytes: state.startBytes,
|
|
4083
4083
|
bytesRemaining,
|
|
4084
4084
|
drained: bytesRemaining <= 0,
|
|
4085
|
-
estimatedEmptyAtMs: rateBytesPerMs === null || bytesRemaining <= 0 ? null : nowMs + Math.ceil(bytesRemaining / rateBytesPerMs)
|
|
4085
|
+
estimatedEmptyAtMs: rateBytesPerMs === null || bytesRemaining <= 0 ? null : nowMs + Math.ceil(bytesRemaining / rateBytesPerMs),
|
|
4086
|
+
rateBytesPerMs
|
|
4086
4087
|
};
|
|
4087
4088
|
}
|
|
4088
4089
|
//#endregion
|
|
@@ -4461,6 +4462,91 @@ var StorageLocationBandMonitor = class {
|
|
|
4461
4462
|
}
|
|
4462
4463
|
};
|
|
4463
4464
|
//#endregion
|
|
4465
|
+
//#region src/builtins/storage-orchestrator/storage-drain-event-monitor.ts
|
|
4466
|
+
/**
|
|
4467
|
+
* StorageDrainEventMonitor — the operator-facing cadence for a drain's
|
|
4468
|
+
* progress (#538).
|
|
4469
|
+
*
|
|
4470
|
+
* A `drain` location (D385) and the pruning eviction that paces it (D386) ran
|
|
4471
|
+
* with no signal at all: an operator who put a disk into drain had to poll
|
|
4472
|
+
* `storage.listDrainProgress` by hand to learn it was still moving. This
|
|
4473
|
+
* decides WHEN a system event fires, not what it says — the sweep already
|
|
4474
|
+
* computed the figures (`drainProgressOf`); this only throttles them to the
|
|
4475
|
+
* cadence an operator can read without being paged every sweep.
|
|
4476
|
+
*
|
|
4477
|
+
* Two rules, no operator knob:
|
|
4478
|
+
*
|
|
4479
|
+
* - PROGRESS fires once immediately (drain start, or this process's first
|
|
4480
|
+
* sweep after a restart) and then at most once per `cadenceMs` — the named
|
|
4481
|
+
* constant {@link DRAIN_PROGRESS_EVENT_INTERVAL_MS}, 15 minutes.
|
|
4482
|
+
* - COMPLETE fires exactly once, the first sweep that reports the location
|
|
4483
|
+
* drained — never again for the same location until it drains again.
|
|
4484
|
+
*
|
|
4485
|
+
* A sweep whose occupancy read failed is NOT skipped: the sample's bytes/
|
|
4486
|
+
* rate/ETA are `null` (D393 — never folded to 0) and the cadence still
|
|
4487
|
+
* applies, so the operator sees "still draining, figures unknown" rather than
|
|
4488
|
+
* silence that reads as "the drain stopped reporting".
|
|
4489
|
+
*
|
|
4490
|
+
* Pure except for the injected clock — same shape as
|
|
4491
|
+
* `StorageLocationBandMonitor`, stateful across `observe()` calls, one
|
|
4492
|
+
* transition per sweep.
|
|
4493
|
+
*/
|
|
4494
|
+
/** No operator-facing rate knob (#538): the cadence is this one constant. */
|
|
4495
|
+
var DRAIN_PROGRESS_EVENT_INTERVAL_MS = 15 * 6e4;
|
|
4496
|
+
function toEvent(kind, sample) {
|
|
4497
|
+
return {
|
|
4498
|
+
kind,
|
|
4499
|
+
locationId: sample.locationId,
|
|
4500
|
+
locationName: sample.locationName,
|
|
4501
|
+
...sample.nodeId !== void 0 ? { nodeId: sample.nodeId } : {},
|
|
4502
|
+
bytesRemaining: sample.bytesRemaining,
|
|
4503
|
+
rateBytesPerMs: sample.rateBytesPerMs,
|
|
4504
|
+
estimatedEmptyAtMs: sample.estimatedEmptyAtMs
|
|
4505
|
+
};
|
|
4506
|
+
}
|
|
4507
|
+
var StorageDrainEventMonitor = class {
|
|
4508
|
+
cadenceMs;
|
|
4509
|
+
now;
|
|
4510
|
+
state = /* @__PURE__ */ new Map();
|
|
4511
|
+
constructor(cadenceMs = DRAIN_PROGRESS_EVENT_INTERVAL_MS, now = Date.now) {
|
|
4512
|
+
this.cadenceMs = cadenceMs;
|
|
4513
|
+
this.now = now;
|
|
4514
|
+
}
|
|
4515
|
+
/**
|
|
4516
|
+
* Observe one sweep of draining locations. A location missing from `samples`
|
|
4517
|
+
* (switched back to `readonly`/`active`, or deleted) drops its schedule
|
|
4518
|
+
* silently: a later re-drain starts a fresh "begin" event rather than
|
|
4519
|
+
* resuming the old cadence clock.
|
|
4520
|
+
*/
|
|
4521
|
+
observe(samples) {
|
|
4522
|
+
const nowMs = this.now();
|
|
4523
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4524
|
+
const out = [];
|
|
4525
|
+
for (const sample of samples) {
|
|
4526
|
+
seen.add(sample.locationId);
|
|
4527
|
+
const previous = this.state.get(sample.locationId);
|
|
4528
|
+
if (sample.drained) {
|
|
4529
|
+
if (previous?.completedEmitted !== true) {
|
|
4530
|
+
this.state.set(sample.locationId, {
|
|
4531
|
+
lastEmittedAtMs: nowMs,
|
|
4532
|
+
completedEmitted: true
|
|
4533
|
+
});
|
|
4534
|
+
out.push(toEvent("complete", sample));
|
|
4535
|
+
}
|
|
4536
|
+
continue;
|
|
4537
|
+
}
|
|
4538
|
+
if (!(previous === void 0 || nowMs - previous.lastEmittedAtMs >= this.cadenceMs)) continue;
|
|
4539
|
+
this.state.set(sample.locationId, {
|
|
4540
|
+
lastEmittedAtMs: nowMs,
|
|
4541
|
+
completedEmitted: false
|
|
4542
|
+
});
|
|
4543
|
+
out.push(toEvent("progress", sample));
|
|
4544
|
+
}
|
|
4545
|
+
for (const id of this.state.keys()) if (!seen.has(id)) this.state.delete(id);
|
|
4546
|
+
return out;
|
|
4547
|
+
}
|
|
4548
|
+
};
|
|
4549
|
+
//#endregion
|
|
4464
4550
|
//#region src/builtins/storage-orchestrator/location-history-recorder.ts
|
|
4465
4551
|
var LOCATION_HISTORY_NAMES = {
|
|
4466
4552
|
usedPercent: "location-used-percent",
|
|
@@ -4612,6 +4698,8 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
4612
4698
|
service = null;
|
|
4613
4699
|
pressureManager = null;
|
|
4614
4700
|
locationBandMonitor = new StorageLocationBandMonitor();
|
|
4701
|
+
/** Drain progress/completion cadence (#538) — a named constant, no operator knob. */
|
|
4702
|
+
drainEventMonitor = new StorageDrainEventMonitor();
|
|
4615
4703
|
/**
|
|
4616
4704
|
* How much of each location CamStack itself holds (D388).
|
|
4617
4705
|
*
|
|
@@ -5185,6 +5273,7 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5185
5273
|
try {
|
|
5186
5274
|
await this.pressureManager.sweep();
|
|
5187
5275
|
await this.emitLocationBandEvents();
|
|
5276
|
+
this.emitDrainEvents();
|
|
5188
5277
|
} catch (err) {
|
|
5189
5278
|
this.ctxIfReady?.logger.warn("storage pressure sweep failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
5190
5279
|
} finally {
|
|
@@ -5355,6 +5444,67 @@ var StorageOrchestratorAddon = class extends require_dist.BaseAddon {
|
|
|
5355
5444
|
return this.pressureManager?.drainProgressSnapshot() ?? [];
|
|
5356
5445
|
}
|
|
5357
5446
|
/**
|
|
5447
|
+
* Regular system events for drain and pruning progress (#538) — a progress
|
|
5448
|
+
* ping on the named cadence (plus on drain start), and the completion
|
|
5449
|
+
* event once a location empties.
|
|
5450
|
+
*
|
|
5451
|
+
* The sample set is the drain PLAN (`resolveDrainPlan`, which locations the
|
|
5452
|
+
* operator put into `drain`), not the progress snapshot: a sweep whose
|
|
5453
|
+
* occupancy read failed for a location is still draining and must still be
|
|
5454
|
+
* sampled, with `null` figures (D393 — never folded to 0), so the cadence
|
|
5455
|
+
* clock keeps ticking instead of restarting as if the drain had just begun.
|
|
5456
|
+
*/
|
|
5457
|
+
emitDrainEvents() {
|
|
5458
|
+
const svc = this.service;
|
|
5459
|
+
const ctx = this.ctxIfReady;
|
|
5460
|
+
if (!svc || !ctx) return;
|
|
5461
|
+
const plan = this.resolveDrainPlan();
|
|
5462
|
+
if (plan.length === 0) return;
|
|
5463
|
+
const byId = new Map(svc.listLocations().map((loc) => [loc.id, loc]));
|
|
5464
|
+
const progressById = new Map(this.drainProgress().map((p) => [p.locationId, p]));
|
|
5465
|
+
const samples = plan.map((entry) => {
|
|
5466
|
+
const loc = byId.get(entry.locationId);
|
|
5467
|
+
const progress = progressById.get(entry.locationId);
|
|
5468
|
+
if (progress === void 0) ctx.logger.debug("storage drain: no progress figures from this sweep — reporting unknown rather than 0", { meta: { locationId: entry.locationId } });
|
|
5469
|
+
return {
|
|
5470
|
+
locationId: entry.locationId,
|
|
5471
|
+
locationName: loc?.displayName ?? entry.locationId,
|
|
5472
|
+
...loc?.nodeId !== void 0 ? { nodeId: loc.nodeId } : {},
|
|
5473
|
+
bytesRemaining: progress?.bytesRemaining ?? null,
|
|
5474
|
+
rateBytesPerMs: progress?.rateBytesPerMs ?? null,
|
|
5475
|
+
estimatedEmptyAtMs: progress?.estimatedEmptyAtMs ?? null,
|
|
5476
|
+
drained: progress?.drained ?? false
|
|
5477
|
+
};
|
|
5478
|
+
});
|
|
5479
|
+
for (const event of this.drainEventMonitor.observe(samples)) {
|
|
5480
|
+
const category = event.kind === "complete" ? require_dist.EventCategory.StorageDrainComplete : require_dist.EventCategory.StorageDrainProgress;
|
|
5481
|
+
ctx.logger.info("storage drain: event", { meta: {
|
|
5482
|
+
locationId: event.locationId,
|
|
5483
|
+
kind: event.kind,
|
|
5484
|
+
bytesRemaining: event.bytesRemaining,
|
|
5485
|
+
rateBytesPerMs: event.rateBytesPerMs,
|
|
5486
|
+
estimatedEmptyAtMs: event.estimatedEmptyAtMs
|
|
5487
|
+
} });
|
|
5488
|
+
ctx.eventBus.emit({
|
|
5489
|
+
id: (0, node_crypto.randomUUID)(),
|
|
5490
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
5491
|
+
source: {
|
|
5492
|
+
type: "addon",
|
|
5493
|
+
id: this.ctx.id
|
|
5494
|
+
},
|
|
5495
|
+
category,
|
|
5496
|
+
data: {
|
|
5497
|
+
locationId: event.locationId,
|
|
5498
|
+
locationName: event.locationName,
|
|
5499
|
+
...event.nodeId !== void 0 ? { nodeId: event.nodeId } : {},
|
|
5500
|
+
bytesRemaining: event.bytesRemaining,
|
|
5501
|
+
rateBytesPerMs: event.rateBytesPerMs,
|
|
5502
|
+
estimatedEmptyAtMs: event.estimatedEmptyAtMs
|
|
5503
|
+
}
|
|
5504
|
+
});
|
|
5505
|
+
}
|
|
5506
|
+
}
|
|
5507
|
+
/**
|
|
5358
5508
|
* What the provider's own schema declared secret, or `undefined` when this
|
|
5359
5509
|
* node has never heard from that provider. The distinction is the whole
|
|
5360
5510
|
* point — see `secretKeysForConfig`, which fails CLOSED on `undefined`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $i as modeMayWrite, Co as storageCapability, Dc as collectSecretConfigKeys, Ec as buildSecretRef, Ei as isLocationEnabled, El as toSecretFieldView, Fc as defineAddonMigrations, Gi as mayWriteToLocation, Ic as defineCustomActions, Is as BaseAddon, Ja as resolveLocationMode, Pc as customAction, Qi as modeForSwitch, Rc as defineRecordKinds, Rl as EventCategory, Ur as evictionPolicyOfLocation, Wi as mayReadLocation, Xo as withLocationMode, dn as StorageCleanupJobSchema, do as settingsStoreCapability, fi as integrationInstancesCapability, fn as StorageLocationModeSchema, gl as recordSecretRef, ii as gbToBytes, jo as switchStateOfMode, ml as parseSecretRef, mn as StorageMigrationJobSchema, nl as isSecretFieldView, ol as makeSecretMarker, pn as StorageLocationTypeSchema, rl as isSecretMarker, rn as STORAGE_LOCATION_MODES, tc as REDACTED_SECRET, tl as isSecretClear, ul as normalizeNodeId, vl as resolveSecretMarkers, wo as storageMigrationCapability } from "../../dist-
|
|
1
|
+
import { $i as modeMayWrite, Co as storageCapability, Dc as collectSecretConfigKeys, Ec as buildSecretRef, Ei as isLocationEnabled, El as toSecretFieldView, Fc as defineAddonMigrations, Gi as mayWriteToLocation, Ic as defineCustomActions, Is as BaseAddon, Ja as resolveLocationMode, Pc as customAction, Qi as modeForSwitch, Rc as defineRecordKinds, Rl as EventCategory, Ur as evictionPolicyOfLocation, Wi as mayReadLocation, Xo as withLocationMode, dn as StorageCleanupJobSchema, do as settingsStoreCapability, fi as integrationInstancesCapability, fn as StorageLocationModeSchema, gl as recordSecretRef, ii as gbToBytes, jo as switchStateOfMode, ml as parseSecretRef, mn as StorageMigrationJobSchema, nl as isSecretFieldView, ol as makeSecretMarker, pn as StorageLocationTypeSchema, rl as isSecretMarker, rn as STORAGE_LOCATION_MODES, tc as REDACTED_SECRET, tl as isSecretClear, ul as normalizeNodeId, vl as resolveSecretMarkers, wo as storageMigrationCapability } from "../../dist-D1LOSOS0.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -4077,7 +4077,8 @@ function drainProgressOf(state, usedBytes, nowMs) {
|
|
|
4077
4077
|
startBytes: state.startBytes,
|
|
4078
4078
|
bytesRemaining,
|
|
4079
4079
|
drained: bytesRemaining <= 0,
|
|
4080
|
-
estimatedEmptyAtMs: rateBytesPerMs === null || bytesRemaining <= 0 ? null : nowMs + Math.ceil(bytesRemaining / rateBytesPerMs)
|
|
4080
|
+
estimatedEmptyAtMs: rateBytesPerMs === null || bytesRemaining <= 0 ? null : nowMs + Math.ceil(bytesRemaining / rateBytesPerMs),
|
|
4081
|
+
rateBytesPerMs
|
|
4081
4082
|
};
|
|
4082
4083
|
}
|
|
4083
4084
|
//#endregion
|
|
@@ -4456,6 +4457,91 @@ var StorageLocationBandMonitor = class {
|
|
|
4456
4457
|
}
|
|
4457
4458
|
};
|
|
4458
4459
|
//#endregion
|
|
4460
|
+
//#region src/builtins/storage-orchestrator/storage-drain-event-monitor.ts
|
|
4461
|
+
/**
|
|
4462
|
+
* StorageDrainEventMonitor — the operator-facing cadence for a drain's
|
|
4463
|
+
* progress (#538).
|
|
4464
|
+
*
|
|
4465
|
+
* A `drain` location (D385) and the pruning eviction that paces it (D386) ran
|
|
4466
|
+
* with no signal at all: an operator who put a disk into drain had to poll
|
|
4467
|
+
* `storage.listDrainProgress` by hand to learn it was still moving. This
|
|
4468
|
+
* decides WHEN a system event fires, not what it says — the sweep already
|
|
4469
|
+
* computed the figures (`drainProgressOf`); this only throttles them to the
|
|
4470
|
+
* cadence an operator can read without being paged every sweep.
|
|
4471
|
+
*
|
|
4472
|
+
* Two rules, no operator knob:
|
|
4473
|
+
*
|
|
4474
|
+
* - PROGRESS fires once immediately (drain start, or this process's first
|
|
4475
|
+
* sweep after a restart) and then at most once per `cadenceMs` — the named
|
|
4476
|
+
* constant {@link DRAIN_PROGRESS_EVENT_INTERVAL_MS}, 15 minutes.
|
|
4477
|
+
* - COMPLETE fires exactly once, the first sweep that reports the location
|
|
4478
|
+
* drained — never again for the same location until it drains again.
|
|
4479
|
+
*
|
|
4480
|
+
* A sweep whose occupancy read failed is NOT skipped: the sample's bytes/
|
|
4481
|
+
* rate/ETA are `null` (D393 — never folded to 0) and the cadence still
|
|
4482
|
+
* applies, so the operator sees "still draining, figures unknown" rather than
|
|
4483
|
+
* silence that reads as "the drain stopped reporting".
|
|
4484
|
+
*
|
|
4485
|
+
* Pure except for the injected clock — same shape as
|
|
4486
|
+
* `StorageLocationBandMonitor`, stateful across `observe()` calls, one
|
|
4487
|
+
* transition per sweep.
|
|
4488
|
+
*/
|
|
4489
|
+
/** No operator-facing rate knob (#538): the cadence is this one constant. */
|
|
4490
|
+
var DRAIN_PROGRESS_EVENT_INTERVAL_MS = 15 * 6e4;
|
|
4491
|
+
function toEvent(kind, sample) {
|
|
4492
|
+
return {
|
|
4493
|
+
kind,
|
|
4494
|
+
locationId: sample.locationId,
|
|
4495
|
+
locationName: sample.locationName,
|
|
4496
|
+
...sample.nodeId !== void 0 ? { nodeId: sample.nodeId } : {},
|
|
4497
|
+
bytesRemaining: sample.bytesRemaining,
|
|
4498
|
+
rateBytesPerMs: sample.rateBytesPerMs,
|
|
4499
|
+
estimatedEmptyAtMs: sample.estimatedEmptyAtMs
|
|
4500
|
+
};
|
|
4501
|
+
}
|
|
4502
|
+
var StorageDrainEventMonitor = class {
|
|
4503
|
+
cadenceMs;
|
|
4504
|
+
now;
|
|
4505
|
+
state = /* @__PURE__ */ new Map();
|
|
4506
|
+
constructor(cadenceMs = DRAIN_PROGRESS_EVENT_INTERVAL_MS, now = Date.now) {
|
|
4507
|
+
this.cadenceMs = cadenceMs;
|
|
4508
|
+
this.now = now;
|
|
4509
|
+
}
|
|
4510
|
+
/**
|
|
4511
|
+
* Observe one sweep of draining locations. A location missing from `samples`
|
|
4512
|
+
* (switched back to `readonly`/`active`, or deleted) drops its schedule
|
|
4513
|
+
* silently: a later re-drain starts a fresh "begin" event rather than
|
|
4514
|
+
* resuming the old cadence clock.
|
|
4515
|
+
*/
|
|
4516
|
+
observe(samples) {
|
|
4517
|
+
const nowMs = this.now();
|
|
4518
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4519
|
+
const out = [];
|
|
4520
|
+
for (const sample of samples) {
|
|
4521
|
+
seen.add(sample.locationId);
|
|
4522
|
+
const previous = this.state.get(sample.locationId);
|
|
4523
|
+
if (sample.drained) {
|
|
4524
|
+
if (previous?.completedEmitted !== true) {
|
|
4525
|
+
this.state.set(sample.locationId, {
|
|
4526
|
+
lastEmittedAtMs: nowMs,
|
|
4527
|
+
completedEmitted: true
|
|
4528
|
+
});
|
|
4529
|
+
out.push(toEvent("complete", sample));
|
|
4530
|
+
}
|
|
4531
|
+
continue;
|
|
4532
|
+
}
|
|
4533
|
+
if (!(previous === void 0 || nowMs - previous.lastEmittedAtMs >= this.cadenceMs)) continue;
|
|
4534
|
+
this.state.set(sample.locationId, {
|
|
4535
|
+
lastEmittedAtMs: nowMs,
|
|
4536
|
+
completedEmitted: false
|
|
4537
|
+
});
|
|
4538
|
+
out.push(toEvent("progress", sample));
|
|
4539
|
+
}
|
|
4540
|
+
for (const id of this.state.keys()) if (!seen.has(id)) this.state.delete(id);
|
|
4541
|
+
return out;
|
|
4542
|
+
}
|
|
4543
|
+
};
|
|
4544
|
+
//#endregion
|
|
4459
4545
|
//#region src/builtins/storage-orchestrator/location-history-recorder.ts
|
|
4460
4546
|
var LOCATION_HISTORY_NAMES = {
|
|
4461
4547
|
usedPercent: "location-used-percent",
|
|
@@ -4607,6 +4693,8 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
4607
4693
|
service = null;
|
|
4608
4694
|
pressureManager = null;
|
|
4609
4695
|
locationBandMonitor = new StorageLocationBandMonitor();
|
|
4696
|
+
/** Drain progress/completion cadence (#538) — a named constant, no operator knob. */
|
|
4697
|
+
drainEventMonitor = new StorageDrainEventMonitor();
|
|
4610
4698
|
/**
|
|
4611
4699
|
* How much of each location CamStack itself holds (D388).
|
|
4612
4700
|
*
|
|
@@ -5180,6 +5268,7 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
5180
5268
|
try {
|
|
5181
5269
|
await this.pressureManager.sweep();
|
|
5182
5270
|
await this.emitLocationBandEvents();
|
|
5271
|
+
this.emitDrainEvents();
|
|
5183
5272
|
} catch (err) {
|
|
5184
5273
|
this.ctxIfReady?.logger.warn("storage pressure sweep failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
5185
5274
|
} finally {
|
|
@@ -5350,6 +5439,67 @@ var StorageOrchestratorAddon = class extends BaseAddon {
|
|
|
5350
5439
|
return this.pressureManager?.drainProgressSnapshot() ?? [];
|
|
5351
5440
|
}
|
|
5352
5441
|
/**
|
|
5442
|
+
* Regular system events for drain and pruning progress (#538) — a progress
|
|
5443
|
+
* ping on the named cadence (plus on drain start), and the completion
|
|
5444
|
+
* event once a location empties.
|
|
5445
|
+
*
|
|
5446
|
+
* The sample set is the drain PLAN (`resolveDrainPlan`, which locations the
|
|
5447
|
+
* operator put into `drain`), not the progress snapshot: a sweep whose
|
|
5448
|
+
* occupancy read failed for a location is still draining and must still be
|
|
5449
|
+
* sampled, with `null` figures (D393 — never folded to 0), so the cadence
|
|
5450
|
+
* clock keeps ticking instead of restarting as if the drain had just begun.
|
|
5451
|
+
*/
|
|
5452
|
+
emitDrainEvents() {
|
|
5453
|
+
const svc = this.service;
|
|
5454
|
+
const ctx = this.ctxIfReady;
|
|
5455
|
+
if (!svc || !ctx) return;
|
|
5456
|
+
const plan = this.resolveDrainPlan();
|
|
5457
|
+
if (plan.length === 0) return;
|
|
5458
|
+
const byId = new Map(svc.listLocations().map((loc) => [loc.id, loc]));
|
|
5459
|
+
const progressById = new Map(this.drainProgress().map((p) => [p.locationId, p]));
|
|
5460
|
+
const samples = plan.map((entry) => {
|
|
5461
|
+
const loc = byId.get(entry.locationId);
|
|
5462
|
+
const progress = progressById.get(entry.locationId);
|
|
5463
|
+
if (progress === void 0) ctx.logger.debug("storage drain: no progress figures from this sweep — reporting unknown rather than 0", { meta: { locationId: entry.locationId } });
|
|
5464
|
+
return {
|
|
5465
|
+
locationId: entry.locationId,
|
|
5466
|
+
locationName: loc?.displayName ?? entry.locationId,
|
|
5467
|
+
...loc?.nodeId !== void 0 ? { nodeId: loc.nodeId } : {},
|
|
5468
|
+
bytesRemaining: progress?.bytesRemaining ?? null,
|
|
5469
|
+
rateBytesPerMs: progress?.rateBytesPerMs ?? null,
|
|
5470
|
+
estimatedEmptyAtMs: progress?.estimatedEmptyAtMs ?? null,
|
|
5471
|
+
drained: progress?.drained ?? false
|
|
5472
|
+
};
|
|
5473
|
+
});
|
|
5474
|
+
for (const event of this.drainEventMonitor.observe(samples)) {
|
|
5475
|
+
const category = event.kind === "complete" ? EventCategory.StorageDrainComplete : EventCategory.StorageDrainProgress;
|
|
5476
|
+
ctx.logger.info("storage drain: event", { meta: {
|
|
5477
|
+
locationId: event.locationId,
|
|
5478
|
+
kind: event.kind,
|
|
5479
|
+
bytesRemaining: event.bytesRemaining,
|
|
5480
|
+
rateBytesPerMs: event.rateBytesPerMs,
|
|
5481
|
+
estimatedEmptyAtMs: event.estimatedEmptyAtMs
|
|
5482
|
+
} });
|
|
5483
|
+
ctx.eventBus.emit({
|
|
5484
|
+
id: randomUUID(),
|
|
5485
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
5486
|
+
source: {
|
|
5487
|
+
type: "addon",
|
|
5488
|
+
id: this.ctx.id
|
|
5489
|
+
},
|
|
5490
|
+
category,
|
|
5491
|
+
data: {
|
|
5492
|
+
locationId: event.locationId,
|
|
5493
|
+
locationName: event.locationName,
|
|
5494
|
+
...event.nodeId !== void 0 ? { nodeId: event.nodeId } : {},
|
|
5495
|
+
bytesRemaining: event.bytesRemaining,
|
|
5496
|
+
rateBytesPerMs: event.rateBytesPerMs,
|
|
5497
|
+
estimatedEmptyAtMs: event.estimatedEmptyAtMs
|
|
5498
|
+
}
|
|
5499
|
+
});
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5502
|
+
/**
|
|
5353
5503
|
* What the provider's own schema declared secret, or `undefined` when this
|
|
5354
5504
|
* node has never heard from that provider. The distinction is the whole
|
|
5355
5505
|
* point — see `secretKeysForConfig`, which fails CLOSED on `undefined`.
|