在 iTwin.js 中,briefcase?和?checkpoint?都是 IModel 的不同連接類型,但它們的用途和特性不同:
Briefcase
- 用途:用于本地編輯和同步。通常是用戶從 iModelHub 檢出(Check-out)后在本地生成的可寫副本。
- 特性:
- 支持本地修改和增量同步(Push/Pull)。
- 可以合并、提交更改集(ChangeSet)。
- 適合需要離線編輯、協作的場景。
- 典型場景:設計人員本地編輯 BIM 數據,然后同步到云端。
示例:
itwinjs-core\example-code\app\src\backend\test\RobotWorldRpc.test.ts
const roWrite = RobotWorldWriteRpcInterface.getClient();const roRead = RobotWorldReadRpcInterface.getClient();const iModel = await BriefcaseConnection.openFile({ fileName: `${KnownTestLocations.outputDir}/` + `RobotWorldRpc.bim` });assert.isTrue(iModel !== undefined);const iToken = iModel.getRpcProps();let modelId!: Id64String;for (const modelStr of await iModel.queryEntityIds({ from: "bis:element", where: "CodeValue='test'" }))modelId = Id64.fromString(modelStr);// Initial placement: Robot1 is not touching any barrier (or other robot)//// |// |<---barrier1------->// | ^// | |// | barrier2// | |// |R1 V// +-- -- -- -- -- -- --const robot1Id = await roWrite.insertRobot(iToken, modelId, "r1", Point3d.create(0, 0, 0).toJSON());const barrier1Id = await roWrite.insertBarrier(iToken, modelId, Point3d.create(0, 5, 0).toJSON(), Angle.createDegrees(0).toJSON(), 5);const barrier2Id = await roWrite.insertBarrier(iToken, modelId, Point3d.create(5, 0, 0).toJSON(), Angle.createDegrees(90).toJSON(), 5);await iModel.saveChanges();
Checkpoint
- 用途:只讀快照。通常用于查看、審閱,不支持本地編輯。
- 特性:
- 只讀,不支持本地修改。
- 通常是某個更改集(ChangeSet)在云端生成的快照。
- 適合只讀瀏覽、審查、對比等場景。
- 典型場景:項目成員只需要查看某一時刻的模型數據,無需編輯。
示例:
imodel = await CheckpointConnection.openRemote(iTwinId, iModelId);
standalone db
(獨立數據庫)指的是本地單機使用的數據庫文件,它不依賴于云端服務或協作平臺。
常見特征如下:
- 通常是一個本地的?
.bim
?或?.db
?文件。 - 只支持單用戶訪問和操作,不支持多人協作或同步。
- 適合離線、個人測試、數據導入導出等場景。
- 與 iModelHub 的 briefcase(可同步的本地副本)不同,standalone db 不能推送或拉取更改集。
簡而言之:
standalone db 就是“獨立本地數據庫”,只在本地使用,不支持云端協作和同步。