Skip to content

feat: managed virtual filesystem injection - #5

Merged
tanyyt merged 1 commit into
peroperofrom
feat/vfs
Dec 2, 2026
Merged

tanyyt merged 1 commit into
peroperofrom
feat/vfs

Conversation

@Gatongone

Copy link
Copy Markdown

Summary

Adds a public managed VFS injection API for platforms where SQLite cannot open a normal path (for example WeChat Mini Game's FileSystemManager).

  • SQLiteVfs.Register(name, ISQLiteVirtualFileSystem) / Unregister
  • ISQLiteVirtualFileSystem and random-access ISQLiteVirtualFile
  • SQLiteFileSystem default System.IO implementation
  • Native sqlite3_vfs bridge in C#, with [MonoPInvokeCallback] callbacks for IL2CPP
  • Routes the database file, journal and temporary files through the injected backend

Usage:

SQLiteVfs.Register("game", new MyVirtualFileSystem());
using var db = new SQLiteConnection(new SQLiteConnectionString(
    "game.sqlite",
    SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite,
    storeDateTimeAsTicks: true,
    vfsName: "game"));

Limitations documented: single connection, no WAL (journal_mode=DELETE), close connections before unregistering.

Verification

  • 55/55 Unity EditMode tests pass locally
  • WebGL player build succeeds
  • VFS registration/file callbacks work with the default SQLiteFileSystem and an in-memory backend

@perotoolsbot

perotoolsbot Bot commented Dec 2, 2026

Copy link
Copy Markdown

✅ Unity: 编译通过,单元测试通过。

平台 用例 通过 失败 跳过 耗时
EditMode 55 55 0 0 0.6s
PlayMode 0 0 0 0 0.0s

@perotoolsbot

perotoolsbot Bot commented Dec 2, 2026

Copy link
Copy Markdown

✅ .NET: 编译通过。

@perotoolsbot perotoolsbot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

构建与测试状态

✅ Unity: 编译通过,单元测试通过。

平台 用例 通过 失败 跳过 耗时
EditMode 55 55 0 0 0.6s
PlayMode 0 0 0 0 0.0s

✅ .NET: 编译通过。

Comment thread Tests/Editor/TestVirtualFileSystem.cs Resolved
@Gatongone

Copy link
Copy Markdown
Author

@perotoolsbot rebuild

Verification update:

  • Editor: 58/58 tests pass
  • WebGL IL2CPP player: VFS_SMOKE_OK vfs
  • Android IL2CPP x86_64 player: VFS_SMOKE_OK vfs
  • iOS/tvOS use the same managed bridge; their static SQLCipher libraries include sqlite3_vfs_register

@perotoolsbot

perotoolsbot Bot commented Dec 2, 2026

Copy link
Copy Markdown

🔧 重新构建与测试
仓库类型:Unity package com.prpr.gilzoide.sqlite-net in a C# project (SQLite.Generator.sln)

✅ Unity: 编译通过,单元测试通过。

平台 用例 通过 失败 跳过 耗时
EditMode 58 58 0 0 0.7s
PlayMode 0 0 0 0 0.0s

✅ .NET: 编译通过。

ReSharper:新提出 1 条行内意见。

完整报告:https://github.com/peroperogames/SQLite.net/actions/runs/46805041423/artifacts/15568142098

@Gatongone

Copy link
Copy Markdown
Author

@perotoolsbot rebuild

@perotoolsbot

perotoolsbot Bot commented Dec 2, 2026

Copy link
Copy Markdown

🔧 重新构建与测试
仓库类型:Unity package com.prpr.gilzoide.sqlite-net in a C# project (SQLite.Generator.sln)

✅ Unity: 编译通过,单元测试通过。

平台 用例 通过 失败 跳过 耗时
EditMode 58 58 0 0 0.6s
PlayMode 0 0 0 0 0.0s

✅ .NET: 编译通过。

完整报告:https://github.com/peroperogames/SQLite.net/actions/runs/46805714278/artifacts/15568449145

@Gatongone
Gatongone force-pushed the feat/vfs branch 2 times, most recently from d803e00 to 915844d Compare December 2, 2026 04:16
Add SQLiteVfs.Register/Unregister, ISQLiteVirtualFileSystem/ISQLiteVirtualFile and a System.IO-backed SQLiteFileSystem default. The managed sqlite3_vfs bridge handles the database, journal and temporary files, rejects a second open of the same database path with SQLITE_BUSY, reports callback errors through SQLiteVfs.LastError/xGetLastError, and reuses page buffers. Includes changeset documentation updates and 58 EditMode tests.
@Gatongone

Copy link
Copy Markdown
Author

@perotoolsbot settle

@Gatongone
Gatongone requested a review from tanyyt December 2, 2026 05:10

@perotoolsbot perotoolsbot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所有遗留问题已解决 ✅

@perotoolsbot

perotoolsbot Bot commented Dec 2, 2026

Copy link
Copy Markdown

未解决线程 0 → 0,已 approve ✅

@Gatongone

Copy link
Copy Markdown
Author

@perotoolsbot settle

@perotoolsbot perotoolsbot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

未解决线程 0 → 0,approve 未提交(该提交此前已批准过,或没有权限)。

@tanyyt
tanyyt merged commit c09eac1 into peropero Dec 2, 2026
@tanyyt
tanyyt deleted the feat/vfs branch December 2, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants