export declare const DATABASE_FILE = "fantastic.db"; /** خطأ قفلٍ يفهمه المالك: عمليةٌ ما زالت تفتح القاعدة بعد إيقاف الخدمات. */ export declare class DatabaseLockedError extends Error { readonly file: string; constructor(file: string); } export interface DatabaseSnapshot { /** ‎/pre-update-.db‎ — والملفّان المرافقان بجانبها بنفس اللاحقة. */ path: string; dataDir: string; } export declare function snapshotPathFor(runDir: string, from: string): string; /** * AR: ينسخ القاعدة. ‎null‎ حين لا قاعدة (جهازٌ لم تُنشأ قاعدته بعد) — لا شيء يُحمى. **يرمي** إن تعذّر * النسخ (قرصٌ ممتلئ): تحديثٌ بلا طريق عودةٍ للبيانات لا يمضي. * EN: Copies the database. `null` when there is none (an appliance whose database was never created) — * nothing to protect. **Throws** if the copy fails (a full disk): an update with no way back for * the data does not proceed. */ export declare function snapshotDatabase(dataDir: string, runDir: string, from: string): DatabaseSnapshot | null; /** * AR: يعيد القاعدة كما كانت. **يُنادى والخدمات موقوفة.** ويحذف ‎-wal‎/‎-shm‎ اللذين كتبتهما النواة * الجديدة إن لم يكن لهما مقابلٌ في النسخة: ‎-wal‎ غريبٌ بجانب قاعدةٍ قديمة يُطبَّق عليها عند الفتح. * EN: Puts the database back as it was. **Called with the services stopped.** And it deletes a `-wal` / * `-shm` written by the new core when the copy has none: a foreign `-wal` beside an old database is * replayed onto it at open. */ export declare function restoreDatabase(snapshot: DatabaseSnapshot): void; /** يحذف النسخة بعد تحديثٍ نجح. لا يرمي. */ export declare function discardSnapshot(snapshot: DatabaseSnapshot): void; /** * AR: **نسخة ما قبل التحديث تبقى بعد نجاحه** (2026-10-14). كانت تُحذف فور النجاح، وأخطر الأعطال لا تظهر وقتها: * هجرةٌ غيّرت بياناتٍ خطأً دون أن تفشل، أو نواةٌ جديدة تكتب ما لا يصحّ — تُكتشف بعد ساعات، وحينها لا شيء * يُرجَع إليه غير نسخة الخامسة فجرًا، ونافذة التحديث في الرابعة، أي يومٌ من بيانات العميل. * * **سبعة أيام، وثلاث نسخٍ على الأكثر**: أكثر من تحديثٍ في اليوم لا يملأ القرص بنسخٍ لقاعدةٍ واحدة. والرجوع * بها قرارُ دعمٍ يدويّ، لا شيءٌ يجري وحده. * EN: **The pre-update copy stays after a success** (2026-10-14). It used to be deleted at once, and the worst * faults do not show then: a migration that changed data wrongly without failing, or a new core writing what it * should not — found hours later, when nothing remains to go back to but the 5 a.m. backup, with the update * window at 4: a day of the customer's data. * * **Seven days, and three copies at most**: more than one update a day does not fill the disk with copies of one * database. Going back with it is a manual support decision, not something that runs by itself. */ export declare const SNAPSHOT_KEEP_DAYS = 7; export declare const SNAPSHOT_KEEP_COUNT = 3; /** يحذف نسخ ما قبل التحديث الأقدم من الحدّ أو الزائدة عن العدد. **لا يرمي** — بقاء نسخةٍ لا يكسر شيئًا. */ export declare function pruneSnapshots(runDir: string, now?: Date): string[]; /** نسخةٌ باقية من تحديثٍ انقطع، إن وُجدت لهذه النسخة. */ export declare function findSnapshot(runDir: string, dataDir: string, from: string): DatabaseSnapshot | null; //# sourceMappingURL=db-snapshot.d.ts.map