Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions common/api/core-backend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4283,6 +4283,8 @@ export class IModelHost {
static get isValid(): boolean;
static get logTileLoadTimeThreshold(): number;
static get logTileSizeThreshold(): number;
// @beta
static get maxGeomStreamVTabBytes(): number;
static readonly onAfterStartup: BeEvent<() => void>;
static readonly onBeforeShutdown: BeEvent<() => void>;
static readonly onWorkspaceStartup: BeEvent<() => void>;
Expand Down Expand Up @@ -4336,6 +4338,8 @@ export class IModelHostConfiguration implements IModelHostOptions {
static defaultLogTileLoadTimeThreshold: number;
// (undocumented)
static defaultLogTileSizeThreshold: number;
// @beta
static defaultMaxGeomStreamVTabBytes: number;
// @internal (undocumented)
static defaultMaxTileCacheDbSize: number;
// (undocumented)
Expand Down Expand Up @@ -4391,6 +4395,8 @@ export interface IModelHostOptions {
// @internal
logTileSizeThreshold?: number;
// @beta
maxGeomStreamVTabBytes?: number;
// @beta
maxTileCacheDbSize?: number;
// @beta
profileName?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-backend",
"comment": "Add imodel_geom_stream virtual table for GeometryStream decomposition",
"type": "none"
}
],
"packageName": "@itwin/core-backend"
}
22 changes: 22 additions & 0 deletions core/backend/src/IModelHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ export interface IModelHostOptions {
*/
maxTileCacheDbSize?: number;

/** The process-wide maximum uncompressed GeometryStream size in bytes that the `dgn_geom_stream` virtual table will decompose.
* Blobs exceeding this limit are silently skipped (the vtab returns zero rows for them).
* Defaults to 50 MB. Minimum enforced by native layer: 4 KB.
* @beta
*/
Comment on lines +158 to +162
maxGeomStreamVTabBytes?: number;

/** Whether to restrict tile cache URLs by client IP address (if available).
* @beta
*/
Expand Down Expand Up @@ -249,6 +256,10 @@ export class IModelHostConfiguration implements IModelHostOptions {
public static defaultLogTileSizeThreshold = 20 * 1000000;
/** @internal */
public static defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;
/** Default maximum uncompressed GeometryStream size (50 MB) for the `imodel_geom_stream` virtual table.
* @beta
*/
public static defaultMaxGeomStreamVTabBytes = 50 * 1024 * 1024;
public appAssetsDir?: LocalDirName;
public cacheDir?: LocalDirName;

Expand Down Expand Up @@ -669,6 +680,7 @@ export class IModelHost {

this.configuration = otherOptions;
this.setupTileCache();
IModelNative.platform.setMaxGeomStreamVTabBytes(otherOptions.maxGeomStreamVTabBytes ?? IModelHostConfiguration.defaultMaxGeomStreamVTabBytes);

process.once("beforeExit", IModelHost.shutdown);
this.onAfterStartup.raiseEvent();
Expand Down Expand Up @@ -798,6 +810,16 @@ export class IModelHost {
return undefined !== IModelHost.configuration && (IModelHost.configuration.useSemanticRebase ? true : false);
}

/**
* The current process-wide maximum uncompressed GeometryStream size in bytes that the `dgn_geom_stream`
* virtual table will decompose. Blobs exceeding this limit are silently skipped.
* @see [[IModelHostOptions.maxGeomStreamVTabBytes]]
* @beta
*/
public static get maxGeomStreamVTabBytes(): number {
return IModelNative.platform.getMaxGeomStreamVTabBytes();
}

private static setupTileCache() {
assert(undefined !== IModelHost.configuration);
const config = IModelHost.configuration;
Expand Down
Loading
Loading