Rename Database class to DatabaseService
This commit is contained in:
parent
a15abb8a33
commit
833ea5227a
@ -2,12 +2,12 @@
|
||||
* Database service managing IndexedDB operations via Web Worker
|
||||
* Pure Data Store Layer
|
||||
*/
|
||||
export class Database {
|
||||
export class DatabaseService {
|
||||
// ============================================
|
||||
// PRIVATE PROPERTIES
|
||||
// ============================================
|
||||
|
||||
private static instance: Database;
|
||||
private static instance: DatabaseService;
|
||||
private indexedDBWorker: Worker | null = null;
|
||||
private messageIdCounter: number = 0;
|
||||
private pendingMessages: Map<
|
||||
@ -23,12 +23,12 @@ export class Database {
|
||||
this.initIndexedDBWorker();
|
||||
}
|
||||
|
||||
public static async getInstance(): Promise<Database> {
|
||||
if (!Database.instance) {
|
||||
Database.instance = new Database();
|
||||
await Database.instance.waitForWorkerReady();
|
||||
public static async getInstance(): Promise<DatabaseService> {
|
||||
if (!DatabaseService.instance) {
|
||||
DatabaseService.instance = new DatabaseService();
|
||||
await DatabaseService.instance.waitForWorkerReady();
|
||||
}
|
||||
return Database.instance;
|
||||
return DatabaseService.instance;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
@ -57,7 +57,7 @@ export class Database {
|
||||
};
|
||||
|
||||
this.indexedDBWorker.onerror = (error) => {
|
||||
console.error("[Database] IndexedDB Worker error:", error);
|
||||
console.error("[DatabaseService] IndexedDB Worker error:", error);
|
||||
};
|
||||
}
|
||||
|
||||
@ -288,4 +288,4 @@ export class Database {
|
||||
}
|
||||
}
|
||||
|
||||
export default Database;
|
||||
export default DatabaseService;
|
||||
|
||||
@ -13,7 +13,7 @@ import { BackUp } from "../types/index";
|
||||
import { APP_CONFIG } from "../config/constants";
|
||||
import { NetworkService } from "./network.service";
|
||||
import type { CoreBackend } from "../workers/core.worker";
|
||||
import Database from "./database.service";
|
||||
import DatabaseService from "./database.service";
|
||||
import WasmService from "./wasm.service";
|
||||
|
||||
export default class Services {
|
||||
@ -55,7 +55,7 @@ export default class Services {
|
||||
console.log("[Services] 🚀 Démarrage Proxy...");
|
||||
|
||||
// 1. Initialiser les Services dans le Main Thread (Hub)
|
||||
const db = await Database.getInstance();
|
||||
const db = await DatabaseService.getInstance();
|
||||
const wasmService = await WasmService.getInstance();
|
||||
|
||||
// 2. Passer les Services au Core Worker via Comlink proxy (BEFORE init)
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
SecretsStore,
|
||||
UserDiff,
|
||||
} from "../../pkg/sdk_client";
|
||||
import Database from "../services/database.service";
|
||||
import DatabaseService from "../services/database.service";
|
||||
import { storeData, retrieveData } from "../services/storage.service";
|
||||
import { BackUp } from "../types/index";
|
||||
import { APP_CONFIG } from "../config/constants";
|
||||
@ -145,7 +145,7 @@ export class CoreBackend {
|
||||
// Initialize domain services with WASM and Database proxies
|
||||
this.cryptoService = new CryptoService(this.wasmService);
|
||||
this.walletService = new WalletService(this.wasmService, this.db);
|
||||
// @ts-ignore - ProcessService accepts DatabaseServiceProxy via Comlink but TypeScript sees Database type
|
||||
// @ts-ignore - ProcessService accepts DatabaseServiceProxy via Comlink but TypeScript sees DatabaseService type
|
||||
this.processService = new ProcessService(this.db);
|
||||
|
||||
this.notifications = this.getNotifications();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user