release: v0.6.0 — 完全移除 IndexedDB,自研 KVStore 事务存储引擎(多key原子写/快照日志恢复/CRC自愈)+ KVStoreEngine + 旧库迁移工具 + 10万级压力验证 + 崩溃注入e2e
CI / test (20.x) (push) Successful in 10m53s
CI / test (22.x) (push) Successful in 10m47s
CI / test (24.x) (push) Successful in 10m42s
CI / e2e (push) Successful in 10m27s
CI / test (18.x) (push) Successful in 11m1s

This commit is contained in:
thzxx
2026-08-10 13:56:04 +08:00
parent 2668bd47cf
commit 24b3ca1079
74 changed files with 8016 additions and 7688 deletions
+10 -4
View File
@@ -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);