UNPKG

@mastra/core

Version:
53 lines (52 loc) 1.93 kB
const require_base = require("./base-B6soWsYg.cjs"); //#region src/storage/domains/base.ts /** * Base class for all storage domains. * Provides common interface for initialization and data clearing. */ var StorageDomain = class extends require_base.MastraBase { /** * Declares which of this domain's tables are eligible for age-based * retention, mapping a stable table key → physical table name, timestamp * anchor column, and whether that column is indexed. * * This is the single source of truth used by `prune()` implementations to * resolve policies to physical deletes. Domains that support retention * override this; the default is empty (nothing prunable). */ static retentionTables = {}; /** * Initialize the storage domain. * This should create any necessary tables/collections. * Default implementation is a no-op - override in adapters that need initialization. */ async init() {} /** * Delete rows older than each policy's `maxAge`, batched, bounded, and * cancellable so it is safe to run against very large tables. * * - `policies` maps this domain's stable table keys to their retention policy. * - `options` bound the work (`maxBatches`/`maxRows`), pace it (`pauseMs`), * and allow cooperative cancellation (`signal`). * * Returns one {@link PruneResult} per table touched. A result with * `done: false` means eligible rows remain — call `prune()` again to continue. * * `prune()` only deletes rows. On SQLite/LibSQL freed pages are reused by * future writes so the file stops growing. Handing disk back to the OS is left * to the underlying database and the operator to manage. * * Default implementation is a no-op (retention not supported). */ async prune(_policies, _options) { return []; } }; //#endregion Object.defineProperty(exports, "StorageDomain", { enumerable: true, get: function() { return StorageDomain; } }); //# sourceMappingURL=base-CfojwyC3.cjs.map