release: v0.6.0 — 完全移除 IndexedDB,自研 KVStore 事务存储引擎(多key原子写/快照日志恢复/CRC自愈)+ KVStoreEngine + 旧库迁移工具 + 10万级压力验证 + 崩溃注入e2e
This commit is contained in:
+10
-4
@@ -12,8 +12,7 @@ import type { IStorageEngine } from '../engine/interface';
|
||||
import type { QueryPlan, TableSchema, DiskEngine } from '../constants';
|
||||
import { DatabaseError } from '../constants';
|
||||
import { MemoryEngine } from '../engine/memory';
|
||||
import { IndexedDBEngine } from '../engine/indexeddb';
|
||||
import { OPFSEngine } from '../engine/opfs';
|
||||
import { KVStoreEngine } from '../engine/kvstore_engine';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// HybridEngine
|
||||
@@ -28,10 +27,11 @@ export class HybridEngine implements IStorageEngine {
|
||||
private dbName = '';
|
||||
private version = 1;
|
||||
|
||||
constructor(diskEngine: DiskEngine = 'indexeddb') {
|
||||
constructor(diskEngine: DiskEngine = 'opfs') {
|
||||
this.memoryEngine = new MemoryEngine();
|
||||
this.diskEngineType = diskEngine;
|
||||
this.diskEngine = diskEngine === 'opfs' ? new OPFSEngine() : new IndexedDBEngine();
|
||||
// v0.6.0: 磁盘层统一为自研 KVStoreEngine
|
||||
this.diskEngine = new KVStoreEngine();
|
||||
}
|
||||
|
||||
// ---- 生命周期 ----
|
||||
@@ -57,6 +57,12 @@ export class HybridEngine implements IStorageEngine {
|
||||
await this.memoryEngine.close();
|
||||
await this.memoryEngine.open(this.dbName, this.version);
|
||||
|
||||
// v0.6.0: KVStoreEngine 读内存 → 先重载磁盘最新数据
|
||||
const disk = this.diskEngine as IStorageEngine & { reload?: () => Promise<void> };
|
||||
if (typeof disk.reload === 'function') {
|
||||
await disk.reload();
|
||||
}
|
||||
|
||||
const tableNames = await this.diskEngine.getTableNames();
|
||||
for (const tableName of tableNames) {
|
||||
const schema = await this.diskEngine.getTableSchema(tableName);
|
||||
|
||||
Reference in New Issue
Block a user