@gusto/baerly-storage 0.2.0 → 0.4.0
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/LICENSE +202 -0
- package/NOTICE +29 -0
- package/README.md +176 -70
- package/dist/API.md +213 -139
- package/dist/CHANGELOG.md +434 -0
- package/dist/RECIPES.md +125 -0
- package/dist/THIRD-PARTY-LICENSES.txt +238 -0
- package/dist/{app-config-C0Bbw_Z6.d.ts → app-config-DyiFK3_k.d.ts} +55 -11
- package/dist/app-config.d.ts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +301 -301
- package/dist/auth.js.map +1 -1
- package/dist/aws4fetch.esm-p7eEzLCs.js +1702 -0
- package/dist/aws4fetch.esm-p7eEzLCs.js.map +1 -0
- package/dist/baerly.js +35 -15
- package/dist/baerly.js.map +1 -1
- package/dist/baerly.spec.json +342 -0
- package/dist/bytes-BXdamO3L.js.map +1 -1
- package/dist/{client-DYZfoZb9.d.ts → client-Fe8CwB73.d.ts} +10 -10
- package/dist/client-react.d.ts +3 -3
- package/dist/client-react.js +4 -4
- package/dist/client-react.js.map +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.js +3 -3
- package/dist/client.js.map +1 -1
- package/dist/{cloudflare-CINJPKCW.js → cloudflare-DzKBrUlg.js} +178 -2
- package/dist/cloudflare-DzKBrUlg.js.map +1 -0
- package/dist/cloudflare.d.ts +49 -6
- package/dist/cloudflare.js +59 -26
- package/dist/cloudflare.js.map +1 -1
- package/dist/config-1tv0-Yzm.js +2693 -0
- package/dist/config-1tv0-Yzm.js.map +1 -0
- package/dist/constants-CfeMWQWk.js +222 -0
- package/dist/constants-CfeMWQWk.js.map +1 -0
- package/dist/context-DRZ3tZ5l.js.map +1 -1
- package/dist/{cost-CQt1YRkA.js → cost-DSMIVqzL.js} +43 -42
- package/dist/cost-DSMIVqzL.js.map +1 -0
- package/dist/current-json-C6nhPOm1.js +190 -0
- package/dist/current-json-C6nhPOm1.js.map +1 -0
- package/dist/{db-BM3y2JQw.d.ts → db-DsPkOVEH.d.ts} +26 -108
- package/dist/{deploy-CrAbfgCq.js → deploy-DonTr-CV.js} +12 -5
- package/dist/deploy-DonTr-CV.js.map +1 -0
- package/dist/dev-vite.d.ts +11 -7
- package/dist/dev-vite.js +7 -6
- package/dist/dev-vite.js.map +1 -1
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +1 -1
- package/dist/{doctor-Db-hzPmE.js → doctor-DSIyCDg_.js} +14 -136
- package/dist/doctor-DSIyCDg_.js.map +1 -0
- package/dist/{dump-BYA55NLP.js → dump-Bh5k26VQ.js} +10 -31
- package/dist/dump-Bh5k26VQ.js.map +1 -0
- package/dist/{errors-DOdL95kK.js → errors-Dfa3p78c.js} +25 -5
- package/dist/errors-Dfa3p78c.js.map +1 -0
- package/dist/{export-Bhbz90-z.js → export-DtF5tDIM.js} +11 -32
- package/dist/{export-Bhbz90-z.js.map → export-DtF5tDIM.js.map} +1 -1
- package/dist/{fsck-CPPZWt9p.js → fsck-D_djMO5D.js} +28 -39
- package/dist/fsck-D_djMO5D.js.map +1 -0
- package/dist/{http-Cw8p6y5b.js → http-DxM9MflO.js} +151 -79
- package/dist/http-DxM9MflO.js.map +1 -0
- package/dist/http.d.ts +42 -26
- package/dist/http.js +3 -2
- package/dist/{index-DwDTWPSU.d.ts → index-0rZcMBwy.d.ts} +10 -7
- package/dist/{index-C3JAH1Yo.d.ts → index-B6oexfOB.d.ts} +9 -9
- package/dist/{index-cUY-36AN.d.ts → index-BNRh23K9.d.ts} +21 -5
- package/dist/{index-DSvwEUeF.d.ts → index-BYk9oCNf.d.ts} +240 -202
- package/dist/index.d.ts +6 -6
- package/dist/index.js +5 -5
- package/dist/{indexes-DAu2AkTW.d.ts → indexes-Dn9hbGQG.d.ts} +2 -2
- package/dist/{inspect-Bdbzvi-_.js → inspect-6WZ-pC7-.js} +21 -36
- package/dist/inspect-6WZ-pC7-.js.map +1 -0
- package/dist/key-Di6yyxFu.js +35 -0
- package/dist/key-Di6yyxFu.js.map +1 -0
- package/dist/{snapshot-SS8USDUF.js → log-tail-D98U1JBo.js} +179 -84
- package/dist/log-tail-D98U1JBo.js.map +1 -0
- package/dist/{maintenance-ClzBC1Vv.js → maintenance-B4Dki6Ig.js} +438 -176
- package/dist/maintenance-B4Dki6Ig.js.map +1 -0
- package/dist/{maintenance-BRrThz8V.d.ts → maintenance-B_e0T99L.d.ts} +114 -26
- package/dist/{maintenance-BvOv6BMM.js → maintenance-C7coQp4c.js} +217 -94
- package/dist/maintenance-C7coQp4c.js.map +1 -0
- package/dist/maintenance.d.ts +3 -2
- package/dist/maintenance.js +3 -2
- package/dist/node.d.ts +176 -68
- package/dist/node.js +3 -2
- package/dist/{normalize-XWY25_sG.js → normalize-rjnZLwS4.js} +2 -2
- package/dist/normalize-rjnZLwS4.js.map +1 -0
- package/dist/{observability-CpOiEN0k.js → observability-wzs3-BL_.js} +279 -109
- package/dist/observability-wzs3-BL_.js.map +1 -0
- package/dist/observability.d.ts +3 -3
- package/dist/observability.js +1 -1
- package/dist/{plan-DOTl21vq.js → plan-a7PJHBCy.js} +7 -4
- package/dist/plan-a7PJHBCy.js.map +1 -0
- package/dist/{query-BmiQy328.js → query-rAtXNQQB.js} +1063 -1202
- package/dist/query-rAtXNQQB.js.map +1 -0
- package/dist/{rebuild-index-DC_nR6wP.js → rebuild-index-BVzQSZlm.js} +10 -32
- package/dist/rebuild-index-BVzQSZlm.js.map +1 -0
- package/dist/{request-BEF_OvMh.js → request-u0M51mhJ.js} +3 -3
- package/dist/{request-BEF_OvMh.js.map → request-u0M51mhJ.js.map} +1 -1
- package/dist/restore-R-4rbciV.js +778 -0
- package/dist/restore-R-4rbciV.js.map +1 -0
- package/dist/runtime-spec-qL3_lTTU.js +391 -0
- package/dist/runtime-spec-qL3_lTTU.js.map +1 -0
- package/dist/s3-http-B-z8th6O.d.ts +60 -0
- package/dist/s3.d.ts +47 -0
- package/dist/s3.js +45 -0
- package/dist/s3.js.map +1 -0
- package/dist/{shared-secret-BJdSwpgw.js → shared-secret-DgEicd3x.js} +13 -5
- package/dist/shared-secret-DgEicd3x.js.map +1 -0
- package/dist/src-BG20LZs7.js +2271 -0
- package/dist/src-BG20LZs7.js.map +1 -0
- package/dist/{src-zhEAmmF7.js → src-CYHFDrKz.js} +82 -99
- package/dist/src-CYHFDrKz.js.map +1 -0
- package/dist/{src-QQ7jDeL2.js → src-DYZ4H1aF.js} +44 -23
- package/dist/src-DYZ4H1aF.js.map +1 -0
- package/dist/subcommand-DoDA-K7d.js +197 -0
- package/dist/subcommand-DoDA-K7d.js.map +1 -0
- package/dist/time-DUqvFMHq.js +119 -0
- package/dist/time-DUqvFMHq.js.map +1 -0
- package/dist/{usage-CLjirdD-.js → usage-DBV1eQHC.js} +7 -22
- package/dist/usage-DBV1eQHC.js.map +1 -0
- package/dist/{validate-DCq_0DIn.js → validate-DtljsCh1.js} +51 -51
- package/dist/{validate-DCq_0DIn.js.map → validate-DtljsCh1.js.map} +1 -1
- package/dist/wire-izfGZDvr.js.map +1 -1
- package/package.json +77 -42
- package/dist/cloudflare-CINJPKCW.js.map +0 -1
- package/dist/config-DVfDGyw1.js +0 -278
- package/dist/config-DVfDGyw1.js.map +0 -1
- package/dist/cost-CQt1YRkA.js.map +0 -1
- package/dist/current-json-C-EyJqs0.js +0 -354
- package/dist/current-json-C-EyJqs0.js.map +0 -1
- package/dist/deploy-CrAbfgCq.js.map +0 -1
- package/dist/doctor-Db-hzPmE.js.map +0 -1
- package/dist/dump-BYA55NLP.js.map +0 -1
- package/dist/errors-DOdL95kK.js.map +0 -1
- package/dist/fsck-CPPZWt9p.js.map +0 -1
- package/dist/http-Cw8p6y5b.js.map +0 -1
- package/dist/inspect-Bdbzvi-_.js.map +0 -1
- package/dist/maintenance-BvOv6BMM.js.map +0 -1
- package/dist/maintenance-ClzBC1Vv.js.map +0 -1
- package/dist/normalize-XWY25_sG.js.map +0 -1
- package/dist/observability-CpOiEN0k.js.map +0 -1
- package/dist/plan-DOTl21vq.js.map +0 -1
- package/dist/query-BmiQy328.js.map +0 -1
- package/dist/rebuild-index-DC_nR6wP.js.map +0 -1
- package/dist/restore-C6IcmLeA.js +0 -771
- package/dist/restore-C6IcmLeA.js.map +0 -1
- package/dist/shared-secret-BJdSwpgw.js.map +0 -1
- package/dist/snapshot-SS8USDUF.js.map +0 -1
- package/dist/src-DU1sCMlr.js +0 -6236
- package/dist/src-DU1sCMlr.js.map +0 -1
- package/dist/src-QQ7jDeL2.js.map +0 -1
- package/dist/src-zhEAmmF7.js.map +0 -1
- package/dist/subcommand-DZcHcsYp.js +0 -5122
- package/dist/subcommand-DZcHcsYp.js.map +0 -1
- package/dist/usage-CLjirdD-.js.map +0 -1
- /package/dist/{chunk-EAsCxrDo.js → rolldown-runtime-EAsCxrDo.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as IndexDefinition } from "./app-config-
|
|
2
|
-
import {
|
|
1
|
+
import { d as IndexDefinition } from "./app-config-DyiFK3_k.js";
|
|
2
|
+
import { d as CurrentJson, p as Storage } from "./index-BYk9oCNf.js";
|
|
3
3
|
//#region packages/server/src/compactor.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Public configuration knobs for {@link compact}. All optional; the
|
|
@@ -54,6 +54,19 @@ interface InternalCompactOptions extends CompactOptions {
|
|
|
54
54
|
* row count balloons.
|
|
55
55
|
*/
|
|
56
56
|
readonly ceilingEntries?: number;
|
|
57
|
+
/**
|
|
58
|
+
* @internal A fresh tail LOWER BOUND the caller already observed (the
|
|
59
|
+
* write-tick runner threads the writer's in-memory `observedTail`,
|
|
60
|
+
* `seq + 1`). When present it raises the ceiling-probe FLOOR to
|
|
61
|
+
* `max(log_seq_start, tail_hint, knownTail)`, so on a stale-low stored
|
|
62
|
+
* `tail_hint` the forward probe walks only "commits since this writer's
|
|
63
|
+
* commit" instead of re-walking the whole gap from the stale hint
|
|
64
|
+
* (which could blow the CF subrequest budget — B4). The compactor still
|
|
65
|
+
* discovers the TRUE tail by probing UP from this floor (small gap).
|
|
66
|
+
* Absent on the scheduled path ⇒ probe from `max(log_seq_start,
|
|
67
|
+
* tail_hint)` as before.
|
|
68
|
+
*/
|
|
69
|
+
readonly knownTail?: number;
|
|
57
70
|
}
|
|
58
71
|
interface CompactResult {
|
|
59
72
|
/** `true` iff a new snapshot landed and `current.json` was advanced. */
|
|
@@ -274,7 +287,7 @@ interface RebuildIndexOptions {
|
|
|
274
287
|
* @throws BaerlyError code="InvalidResponse" — `current.json` missing.
|
|
275
288
|
* @throws BaerlyError code="Internal" — protocol-invariant
|
|
276
289
|
* violation (snapshot hash mismatch, missing log entry inside
|
|
277
|
-
* `[log_seq_start,
|
|
290
|
+
* `[log_seq_start, tail_hint)`).
|
|
278
291
|
*/
|
|
279
292
|
declare const rebuildIndex: (storage: Storage, currentJsonKey: string, def: IndexDefinition, opts?: RebuildIndexOptions) => Promise<RebuildIndexResult>;
|
|
280
293
|
//#endregion
|
|
@@ -337,34 +350,86 @@ interface MaintenanceResult {
|
|
|
337
350
|
* ```
|
|
338
351
|
*/
|
|
339
352
|
declare const runScheduledMaintenance: (args: MaintenanceArgs, options?: MaintenanceOptions) => Promise<MaintenanceResult>;
|
|
353
|
+
/** The six host-agnostic write-tick budgets (`maxFoldBytes`=`C`, `maxFoldRows`=`E`). Canonical shape; mirrors the protocol constants (typed there to avoid a cycle). */
|
|
354
|
+
interface MaintenanceProfile {
|
|
355
|
+
readonly gcInterval: number;
|
|
356
|
+
readonly gcMaxMarks: number;
|
|
357
|
+
readonly gcMaxSweeps: number;
|
|
358
|
+
readonly maxFoldEntriesPerPass: number;
|
|
359
|
+
readonly maxFoldBytes: number;
|
|
360
|
+
readonly maxFoldRows: number;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Tuning profile for the 50-subrequest Cloudflare free-tier budget,
|
|
364
|
+
* derived from {@link MAINTENANCE_PROFILE_CF_FREE} (one source of truth).
|
|
365
|
+
*
|
|
366
|
+
* Budget arithmetic (worst case):
|
|
367
|
+
* compact: 1 GET current + 1 GET snapshot (if any) + N GETs log
|
|
368
|
+
* + 1 PUT snapshot + 1 PUT current = 3 + N (N = maxEntriesPerRun).
|
|
369
|
+
* runGc: 1 GET current + 1 GET pending + 3 LISTs (one page each)
|
|
370
|
+
* + M GETs log (live tail for content hashes) + S DELETEs + 1 PUT
|
|
371
|
+
* pending = 6 + M + S.
|
|
372
|
+
*
|
|
373
|
+
* With N=20, M=20, S=10 the totals are: compact ≈ 23, gc ≈ 36 — over
|
|
374
|
+
* the 50 cap combined. The Cloudflare scheduled handler therefore
|
|
375
|
+
* alternates phases per tick (even minute → compact, odd minute →
|
|
376
|
+
* GC) by calling `compact()` / `runGc()` directly instead of
|
|
377
|
+
* `runScheduledMaintenance`; the `maintenance-budget.test.ts`
|
|
378
|
+
* worst-case test proves each phase in isolation sits under 50 ops
|
|
379
|
+
* with these bounds.
|
|
380
|
+
*/
|
|
340
381
|
declare const CLOUDFLARE_FREE_TIER: MaintenanceOptions;
|
|
341
382
|
/**
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
383
|
+
* Tuning profile for the 10,000-subrequest Cloudflare paid-tier budget,
|
|
384
|
+
* derived from {@link MAINTENANCE_PROFILE_CF_PAID} (one source of truth).
|
|
385
|
+
* Keeps the single-phase CPU-killable shape but affords Node-tier per-pass
|
|
386
|
+
* throughput (compact ≈ 3+200, gc ≈ 6+200+100 — far under the 10k cap).
|
|
387
|
+
*
|
|
388
|
+
* To honour `BAERLY_MAINTENANCE_PROFILE=cf-paid` on the cron path, pass this
|
|
389
|
+
* constant to `runScheduledMaintenance` inside your
|
|
390
|
+
* {@link WorkerScheduledHandler}; the worked recipe lives in the `scheduled`
|
|
391
|
+
* handler docstring of `baerlyWorker` (`@gusto/baerly-storage/cloudflare`).
|
|
392
|
+
*/
|
|
393
|
+
declare const CLOUDFLARE_PAID_TIER: MaintenanceOptions;
|
|
394
|
+
/**
|
|
395
|
+
* Floor-based GC-cadence boundary crossing. Every commit advances the
|
|
396
|
+
* writer-observed tail by one logical slot; `tail_hint` remains a
|
|
397
|
+
* lower bound and may be refreshed later by maintenance. The floor test
|
|
398
|
+
* trips on any interval boundary inside `(prevSeq, nextSeq]`, so it
|
|
399
|
+
* stays correct whether the observed/probed tail advances by one or
|
|
400
|
+
* catches up by a larger step.
|
|
346
401
|
*/
|
|
347
402
|
declare const crossesGcBoundary: (prevSeq: number, nextSeq: number, interval: number) => boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Derived live-tail byte size — the ratio TRIGGER input that replaces the
|
|
405
|
+
* formerly-stored exact byte count. `(observedTail − log_seq_start) ×
|
|
406
|
+
* mean_entry_bytes`. `observedTail` is a param so write-tick callers can
|
|
407
|
+
* pass the writer-observed tail and scheduled callers can pass a
|
|
408
|
+
* probe-discovered true tail. Cold-start (no mean yet) falls back to
|
|
409
|
+
* {@link MAINTENANCE_COLD_START_ENTRY_BYTES}, never 0 (see that constant).
|
|
410
|
+
* TRIGGER-only — structurally barred from `foldViable` (the exact-bytes CPU-kill
|
|
411
|
+
* ceiling).
|
|
412
|
+
*/
|
|
413
|
+
declare const estimateTailBytes: (current: CurrentJson, observedTail: number) => number;
|
|
348
414
|
/**
|
|
349
415
|
* The cheap DISPATCH gate the writer calls after a commit — zero
|
|
350
|
-
* storage ops; it reads the post-
|
|
416
|
+
* storage ops; it reads the post-commit {@link CurrentJson} already in
|
|
351
417
|
* scope. Ratio-OR-boundary, WITHOUT the entry floor (the floor is part
|
|
352
418
|
* of the fold-trigger Gate 1 checked inside {@link runBoundedMaintenance}).
|
|
353
|
-
* Returning `false` lets the writer skip the dispatch entirely.
|
|
419
|
+
* Returning `false` lets the writer skip the dispatch entirely. Ratio
|
|
420
|
+
* numerator is the DERIVED {@link estimateTailBytes};
|
|
421
|
+
* `observedTail` threads from the caller (the writer's in-memory observed
|
|
422
|
+
* tail `seq+1` under single-write commit). Both the boundary check and the
|
|
423
|
+
* ratio key off `observedTail`, since the stored `tail_hint` is now only a
|
|
424
|
+
* non-authoritative lower bound (compactor-advanced).
|
|
354
425
|
*/
|
|
355
|
-
declare const shouldFireMaintenance: (current: CurrentJson, prevSeq: number, gcInterval: number) => boolean;
|
|
426
|
+
declare const shouldFireMaintenance: (current: CurrentJson, prevSeq: number, gcInterval: number, observedTail: number) => boolean;
|
|
356
427
|
/** Per-tier caps for {@link runBoundedMaintenance}, threaded by the adapter. */
|
|
357
428
|
interface BoundedMaintenanceOptions {
|
|
358
|
-
/**
|
|
359
|
-
readonly
|
|
429
|
+
/** Host budgets, threaded by the adapter. Absent ⇒ {@link MAINTENANCE_PROFILE_CF_FREE} (CF-free-safe default; keeps a bare `Db.create()` maintaining). */
|
|
430
|
+
readonly profile?: MaintenanceProfile;
|
|
360
431
|
/** Gate-1 minimum live-tail length. Default {@link WRITE_TICK_MIN_ENTRIES_TO_COMPACT}. */
|
|
361
432
|
readonly minEntriesToCompact?: number;
|
|
362
|
-
/** GC marks per pass. Default {@link WRITE_TICK_GC_MAX_MARKS}. */
|
|
363
|
-
readonly gcMaxMarks?: number;
|
|
364
|
-
/** GC sweeps per pass. Default {@link WRITE_TICK_GC_MAX_SWEEPS}. */
|
|
365
|
-
readonly gcMaxSweeps?: number;
|
|
366
|
-
/** GC cadence (boundary-crossing). Default {@link WRITE_TICK_GC_INTERVAL}. */
|
|
367
|
-
readonly gcInterval?: number;
|
|
368
433
|
/**
|
|
369
434
|
* How many phases this tick may run. `"single"` (CF-free-safe
|
|
370
435
|
* default) runs at most one of fold / GC per tick; `"both"` lets a
|
|
@@ -393,6 +458,10 @@ interface BoundedMaintenanceOptions {
|
|
|
393
458
|
* composition of {@link compact} and {@link runGc} for one collection,
|
|
394
459
|
* sized to fit a CPU-killable Cloudflare free-tier isolate by default.
|
|
395
460
|
*
|
|
461
|
+
* INVARIANT: a {@link MaintenanceProfile} changes only maintenance rate +
|
|
462
|
+
* defer threshold — never data/API/query/wire/correctness; reads stay pure.
|
|
463
|
+
* See `maintenance-profile-equivalence.test.ts`.
|
|
464
|
+
*
|
|
396
465
|
* Never throws — the write-tick caller must never see a maintenance
|
|
397
466
|
* failure. Expected signals (CAS contention, an over-ceiling deferral)
|
|
398
467
|
* are swallowed quietly; unexpected throws bump
|
|
@@ -400,7 +469,8 @@ interface BoundedMaintenanceOptions {
|
|
|
400
469
|
* swallowed.
|
|
401
470
|
*
|
|
402
471
|
* Control flow (fold-priority with a stateless GC-starvation guard):
|
|
403
|
-
* 0. `disabled` →
|
|
472
|
+
* 0. `disabled` → skip fold/GC, but still allow the rate-limited
|
|
473
|
+
* tail_hint refresh that bounds read/write forward-probes.
|
|
404
474
|
* 1. Read `current.json` once.
|
|
405
475
|
* 2. Hard-GC starvation boundary (`"single"` only) → GC slice, skip fold.
|
|
406
476
|
* 3. Gate 1 (ratio AND entry floor) trips → fold if viable, else
|
|
@@ -410,9 +480,16 @@ interface BoundedMaintenanceOptions {
|
|
|
410
480
|
*/
|
|
411
481
|
declare const runBoundedMaintenance: (args: {
|
|
412
482
|
storage: Storage;
|
|
413
|
-
currentJsonKey: string; /** The
|
|
414
|
-
prevSeq: number;
|
|
415
|
-
|
|
483
|
+
currentJsonKey: string; /** The pre-commit observed tail — the GC cadence baseline. */
|
|
484
|
+
prevSeq: number;
|
|
485
|
+
/**
|
|
486
|
+
* Writer's in-memory observed tail (`seq + 1`). Given on the
|
|
487
|
+
* write-tick path so the runner's Gate-1 ratio + GC cadence key off
|
|
488
|
+
* the true tail without an O(gap) re-probe (the stored `tail_hint` is
|
|
489
|
+
* only a lower bound). Absent on a scheduled tick ⇒ the runner probes.
|
|
490
|
+
*/
|
|
491
|
+
observedTail?: number; /** `C` override (from `BAERLY_MAINTENANCE_MAX_FOLD_BYTES`). */
|
|
492
|
+
maxFoldBytes?: number; /** From `BAERLY_MAINTENANCE_DISABLE`: disable fold/GC phases, not tail_hint refresh. */
|
|
416
493
|
disabled?: boolean;
|
|
417
494
|
}, options?: BoundedMaintenanceOptions) => Promise<void>;
|
|
418
495
|
/**
|
|
@@ -427,7 +504,7 @@ declare const dispatchInlineAwaited: (task: () => Promise<void>) => void | Promi
|
|
|
427
504
|
* observability context (NOT `Db.create`). It rides the per-request ALS
|
|
428
505
|
* context because `dispatch = ctx.waitUntil` is inherently per-request,
|
|
429
506
|
* and routing it through `Db.create` would widen that surface past its
|
|
430
|
-
* locked four fields. The writer reads it at the post-
|
|
507
|
+
* locked four fields. The writer reads it at the post-commit dispatch
|
|
431
508
|
* point via `getCurrentContext()?.maintenance`.
|
|
432
509
|
*
|
|
433
510
|
* Absent ⇒ inline dispatch + CF-free-safe caps (the defaults inside
|
|
@@ -437,13 +514,24 @@ declare const dispatchInlineAwaited: (task: () => Promise<void>) => void | Promi
|
|
|
437
514
|
interface MaintenanceDispatch {
|
|
438
515
|
/** How to run the maintenance task. Default {@link dispatchInlineAwaited}. CF sets `ctx.waitUntil`. */
|
|
439
516
|
readonly dispatch?: (task: () => Promise<void>) => void | Promise<void>;
|
|
440
|
-
/** From `BAERLY_MAINTENANCE_DISABLE
|
|
517
|
+
/** From `BAERLY_MAINTENANCE_DISABLE`: disables fold/GC phases while preserving tail_hint refresh. */
|
|
441
518
|
readonly disabled?: boolean;
|
|
442
519
|
/** `C` override, from `BAERLY_MAINTENANCE_MAX_FOLD_BYTES`. */
|
|
443
520
|
readonly maxFoldBytes?: number;
|
|
444
521
|
/** Per-tier caps forwarded to {@link runBoundedMaintenance}. */
|
|
445
522
|
readonly options?: BoundedMaintenanceOptions;
|
|
446
523
|
}
|
|
524
|
+
/**
|
|
525
|
+
* Parse the two host-agnostic ops-plane env vars into the
|
|
526
|
+
* {@link MaintenanceDispatch} overrides. Shared by every host adapter so the
|
|
527
|
+
* cross-host contract has one source of truth: `maxFoldBytes` (`C`) is the
|
|
528
|
+
* finite `BAERLY_MAINTENANCE_MAX_FOLD_BYTES` or undefined; `disabled` is
|
|
529
|
+
* `BAERLY_MAINTENANCE_DISABLE` truthy (set, non-empty, not `"0"`/`"false"`).
|
|
530
|
+
*/
|
|
531
|
+
declare const parseMaintenanceEnv: (readEnv: (key: string) => string | undefined) => {
|
|
532
|
+
maxFoldBytes?: number;
|
|
533
|
+
disabled: boolean;
|
|
534
|
+
};
|
|
447
535
|
//#endregion
|
|
448
|
-
export {
|
|
449
|
-
//# sourceMappingURL=maintenance-
|
|
536
|
+
export { CompactOptions as C, runGc as S, compact as T, RebuildIndexOptions as _, MaintenanceArgs as a, RunGcOptions as b, MaintenanceProfile as c, dispatchInlineAwaited as d, estimateTailBytes as f, shouldFireMaintenance as g, runScheduledMaintenance as h, InternalMaintenanceOptions as i, MaintenanceResult as l, runBoundedMaintenance as m, CLOUDFLARE_FREE_TIER as n, MaintenanceDispatch as o, parseMaintenanceEnv as p, CLOUDFLARE_PAID_TIER as r, MaintenanceOptions as s, BoundedMaintenanceOptions as t, crossesGcBoundary as u, RebuildIndexResult as v, CompactResult as w, RunGcResult as x, rebuildIndex as y };
|
|
537
|
+
//# sourceMappingURL=maintenance-B_e0T99L.d.ts.map
|