Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
32ade4f
First cut at a system for releasing locks that were acquired during a…
kring Feb 19, 2026
5f3bf6d
Fix logic error in recursive lock checking.
kring Feb 20, 2026
01aa71e
Add test for releaseLocksForReversedTxn.
kring Feb 20, 2026
13e3f23
Add another lock release test.
kring Feb 20, 2026
f61c84f
Simplify invalidation of Discovered locks when releasing Txn locks.
kring Feb 24, 2026
1cea987
Separate table to associate locks with Txns.
kring Feb 24, 2026
e9d2e92
Add test for reversing lock upgrades.
kring Feb 24, 2026
a639511
Add acquireLocksForReinstatedTxn (not tested yet).
kring Feb 24, 2026
8e54f95
Add a basic test for acquireLocksForReinstatedTxn.
kring Feb 24, 2026
5346686
Tweaks and tests.
kring Feb 26, 2026
8e63c89
Add doc to LockControl interface.
kring Feb 26, 2026
468ad70
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Feb 26, 2026
5f694bc
Don't update changeset when abandoning locks.
kring Feb 27, 2026
b7fd37b
Lock abandonment.
kring Feb 27, 2026
5d56e64
release -> abandon in appropriate places.
kring Feb 27, 2026
f26357e
LocalHub-friendly way of specifying "no changeset".
kring Feb 27, 2026
8e00875
Better attempt at hub-friendly non-changeset.
kring Feb 27, 2026
c85bbc0
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 1, 2026
ab9046b
Preserve NewElement origin when abandoning/reacquiring locks.
kring Mar 2, 2026
906aa77
Better terminology.
kring Mar 2, 2026
1592cb0
Extend LocalHub with new methods.
kring Mar 2, 2026
b050f31
Fix typos.
kring Mar 2, 2026
7b17bf0
Lint.
kring Mar 2, 2026
43b15b3
rush change
kring Mar 2, 2026
2568d41
Add check that releaseLocksForReversedTxn is used correctly.
kring Mar 2, 2026
ea3d5e7
Clarify order of releaseLocksForReversedTxn and acquireLocksForReinst…
kring Mar 2, 2026
414cb0a
extract-api
kring Mar 2, 2026
9d4ea34
Remove nonsense changes generated by extract-api?
kring Mar 2, 2026
701da9c
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 2, 2026
1765436
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 3, 2026
9a9204d
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 4, 2026
09650c3
releaseAfterAbandon -> abandon
kring Mar 4, 2026
95c27fa
Throw IModelError instead of Error when here are local changes.
kring Mar 4, 2026
17e2b0a
More release -> abandon.
kring Mar 4, 2026
7c1fbf6
A few more release -> abandon.
kring Mar 4, 2026
f4a00a8
Automatically release txn locks on reverse.
kring Mar 4, 2026
1ed9935
WIP acquire locks on reinstate.
kring Mar 5, 2026
e7fffe5
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 5, 2026
6d026b7
Run extract-api.
kring Mar 5, 2026
fbf7d5b
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 5, 2026
60c8dd3
Merge remote-tracking branch 'origin/kring/release-txn-locks' into kr…
kring Mar 5, 2026
d82f0a0
Add new "AndAbandonLocks" methods.
kring Mar 6, 2026
1cc6c01
Track txn lock abandonment.
kring Mar 9, 2026
d3d27e1
Improving TxnManager integration.
kring Mar 9, 2026
2ccd4e1
Much better logic for clearing txn lock records.
kring Mar 9, 2026
ba2885a
Doc improvements.
kring Mar 9, 2026
dba045c
More predictable lock abandon / reacquire behavior.
kring Mar 10, 2026
75bb497
Explicit distinction between current unsaved txn and committed ones.
kring Mar 11, 2026
acb8566
More tests.
kring Mar 11, 2026
0e9d9e3
Another test.
kring Mar 11, 2026
a1b8111
Some last tests.
kring Mar 11, 2026
55abee1
Run extract-api.
kring Mar 11, 2026
f4146f5
Lint
kring Mar 11, 2026
bd56842
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 11, 2026
4298484
Use ITwinError instead of IModelError for newly added exceptions.
kring Mar 12, 2026
8aaa341
Better way of inserting into txn_locks.
kring Mar 12, 2026
9b232f7
Improve consistency of exception.
kring Mar 12, 2026
b531df7
Don't cancel txns if lock abandonment fails.
kring Mar 12, 2026
55942e3
Remove empty ServerBasedLocksError interface.
kring Mar 12, 2026
bfd04da
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 12, 2026
7267b92
Rename new TxnManager methods to *Async.
kring Mar 13, 2026
e493ae4
Add args to async reverse and reinstate methods.
kring Mar 13, 2026
0ae1f4e
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 13, 2026
21ecae0
Improvements to lock abandonment.
kring Mar 16, 2026
9c75fa6
extract-api
kring Mar 16, 2026
787be4b
@bentley/imodeljs-native 5.8.14
imodeljs-admin Mar 16, 2026
1de3034
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 16, 2026
078996d
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 17, 2026
de8fb1f
Fix doc errors.
kring Mar 17, 2026
9cc4695
Don't try to link to internal type in doc.
kring Mar 17, 2026
3f6cd09
Avoid duplicate (txnId,elementId) rows in the txn_locks table.
kring Mar 17, 2026
9aaf813
Save changes after clearTxnLockRecords.
kring Mar 17, 2026
565e3e0
Fix incorrect error message.
kring Mar 17, 2026
f2ef5f2
Fix doc typo.
kring Mar 17, 2026
e8030ae
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 17, 2026
3a342c0
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 17, 2026
967674e
rush update
kring Mar 17, 2026
29c0379
Merge branch 'master' into kring/release-txn-locks
DanRod1999 Mar 18, 2026
fa0d4ef
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 19, 2026
046e61d
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 20, 2026
4a75062
Merge branch 'master' into kring/release-txn-locks
ben-polinsky Mar 20, 2026
a83a1d8
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 23, 2026
feeeecc
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 23, 2026
f108220
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 23, 2026
43aa055
Merge branch 'master' into kring/release-txn-locks
kring Mar 23, 2026
0cbd044
Merge branch 'master' into kring/release-txn-locks
kring Mar 24, 2026
b36db68
Merge branch 'master' into kring/release-txn-locks
kring Mar 24, 2026
771239d
Merge branch 'master' into kring/release-txn-locks
kring Mar 25, 2026
270a118
Merge branch 'master' into kring/release-txn-locks
kring Mar 26, 2026
d6188b0
Remove TODO.
kring Mar 26, 2026
4fb8d73
Clarify BackendHubAccess docs.
kring Mar 27, 2026
d83f876
Fix typo.
kring Mar 27, 2026
5f0b731
Add change description.
kring Mar 27, 2026
6fe7a42
Clarify comments.
kring Mar 27, 2026
6e2b722
Fix typo.
kring Mar 27, 2026
e6df7f5
Don't mention internal type in doc.
kring Mar 27, 2026
53837f1
Make new TxnManager APIs beta.
kring Mar 27, 2026
25f7f84
Mark new methods in LockControl and BackendHubAccess beta.
kring Mar 27, 2026
8b47b1a
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 27, 2026
b1b1709
Merge branch 'master' into kring/release-txn-locks
kring Mar 27, 2026
03d0c59
Merge branch 'master' into kring/release-txn-locks
kring Mar 30, 2026
3cebdeb
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Mar 31, 2026
93c467b
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Apr 1, 2026
66f5126
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Apr 2, 2026
d370efa
Bring lock abandonment to the frontend.
kring Apr 9, 2026
f8d5162
Merge remote-tracking branch 'origin/master' into kring/release-txn-l…
kring Apr 9, 2026
6dce957
Run extract-api.
kring Apr 9, 2026
50c2422
Lint.
kring Apr 9, 2026
bcb6e6a
Add frontend changes file.
kring Apr 9, 2026
14cffb3
Update new tests for EditTxn.
kring Apr 10, 2026
07f1cbf
Merge branch 'master' into kring/release-txn-locks
kring Apr 10, 2026
4a6413a
Merge branch 'master' into kring/release-txn-locks
kring Apr 10, 2026
f73ed10
Merge branch 'master' into kring/release-txn-locks
kring Apr 13, 2026
c2a3478
Merge branch 'master' into kring/release-txn-locks
kring Apr 13, 2026
e76d7ba
Merge branch 'master' into kring/release-txn-locks
kring Apr 14, 2026
94c6525
Use BriefcaseDb.findByKey instead of IModelDb.findByKey.
kring Apr 14, 2026
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
30 changes: 30 additions & 0 deletions common/api/core-backend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ import { Range2dProps } from '@itwin/core-geometry';
import { Range3d } from '@itwin/core-geometry';
import { Range3dProps } from '@itwin/core-geometry';
import { Rank } from '@itwin/core-common';
import { ReinstateTxnArgs } from '@itwin/core-common';
import { RelatedElement } from '@itwin/core-common';
import { RelatedElementProps } from '@itwin/core-common';
import { RelationshipClass } from '@itwin/ecschema-metadata';
Expand All @@ -231,6 +232,7 @@ import { RenderSchedule } from '@itwin/core-common';
import { RenderTimelineProps } from '@itwin/core-common';
import { RepositoryLinkProps } from '@itwin/core-common';
import { RequestNewBriefcaseProps } from '@itwin/core-common';
import { ReverseTxnArgs } from '@itwin/core-common';
import { RgbFactorProps } from '@itwin/core-common';
import { RpcActivity } from '@itwin/core-common';
import { RpcInterfaceEndpoints } from '@itwin/core-common';
Expand Down Expand Up @@ -442,6 +444,10 @@ export interface AzureBlobStorageCredentials {

// @public
export interface BackendHubAccess {
// @beta
abandonAllLocks?: (arg: BriefcaseIdArg) => Promise<void>;
// @beta
abandonLocks?: (arg: BriefcaseIdArg, locks: LockMap) => Promise<void>;
acquireLocks: (arg: BriefcaseDbArg, locks: LockMap) => Promise<void>;
acquireNewBriefcaseId: (arg: AcquireNewBriefcaseIdArg) => Promise<BriefcaseId>;
createNewIModel: (arg: CreateNewIModelProps) => Promise<GuidString>;
Expand Down Expand Up @@ -5062,13 +5068,25 @@ export interface LockControl {
readonly [_implementationProhibited]: unknown;
// @internal
[_releaseAllLocks]: () => Promise<void>;
// @beta
abandonAllLocks(): Promise<void>;
// @beta
abandonLocksForCurrentUnsavedTxn(): Promise<boolean>;
// @beta
abandonLocksForReversedTxn(txnId: Id64String): Promise<boolean>;
acquireLocks(arg: {
shared?: Id64Arg;
exclusive?: Id64Arg;
}): Promise<void>;
// @beta
acquireLocksForReinstatingTxn(txnId: Id64String): Promise<boolean>;
checkExclusiveLock(id: Id64String, type: string, operation: string): void;
checkSharedLock(id: Id64String, type: string, operation: string): void;
// @beta
clearTxnLockRecords(txnId: Id64String): void;
holdsExclusiveLock(id: Id64String): boolean;
// @beta
holdsNecessaryLocksForReinstatingTxn(txnId: Id64String): boolean;
holdsSharedLock(id: Id64String): boolean;
readonly isServerBased: boolean;
releaseAllLocks(): Promise<void>;
Expand Down Expand Up @@ -7359,6 +7377,8 @@ export class TxnManager {
appCustomConflictHandler?: (args: DbRebaseChangesetConflictArgs) => DbConflictResolution | undefined;
beginMultiTxnOperation(): DbResult;
cancelTo(txnId: TxnIdString): IModelStatus;
// @beta
cancelToTxnAsync(txnId: TxnIdString, args?: ReverseTxnArgs): Promise<void>;
deleteAllTxns(): void;
endMultiTxnOperation(): DbResult;
getChangeTrackingMemoryUsed(): number;
Expand Down Expand Up @@ -7447,12 +7467,22 @@ export class TxnManager {
// @internal (undocumented)
readonly rebaser: RebaseManager;
reinstateTxn(): IModelStatus;
// @beta
reinstateTxnAsync(args?: ReinstateTxnArgs): Promise<void>;
reportError(error: ValidationError): void;
restartSession(): void;
reverseAll(): IModelStatus;
// @beta
reverseAllTxnsAsync(args?: ReverseTxnArgs): Promise<void>;
reverseSingleTxn(): IModelStatus;
// @beta
reverseSingleTxnAsync(args?: ReverseTxnArgs): Promise<void>;
reverseTo(txnId: TxnIdString): IModelStatus;
// @beta
reverseToTxnAsync(txnId: TxnIdString, args?: ReverseTxnArgs): Promise<void>;
reverseTxns(numOperations: number): IModelStatus;
// @beta
reverseTxnsAsync(numOperations: number, args?: ReverseTxnArgs): Promise<void>;
// @internal
touchWatchFile(): void;
readonly validationErrors: ValidationError[];
Expand Down
32 changes: 32 additions & 0 deletions common/api/core-common.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5611,11 +5611,17 @@ export interface IpcAppFunctions {
// (undocumented)
reinstateTxn: (key: string) => Promise<IModelStatus>;
// (undocumented)
reinstateTxnAsync: (key: string, args?: ReinstateTxnArgs) => Promise<void>;
// (undocumented)
restartTxnSession: (key: string) => Promise<void>;
// (undocumented)
reverseAllTxn: (key: string) => Promise<IModelStatus>;
// (undocumented)
reverseAllTxnsAsync: (key: string, args?: ReverseTxnArgs) => Promise<void>;
// (undocumented)
reverseTxns: (key: string, numOperations: number) => Promise<IModelStatus>;
// (undocumented)
reverseTxnsAsync: (key: string, numOperations: number, args?: ReverseTxnArgs) => Promise<void>;
// @deprecated (undocumented)
saveChanges: (key: string, description?: string) => Promise<void>;
// (undocumented)
Expand Down Expand Up @@ -8042,6 +8048,11 @@ export class RealityModelDisplaySettings {
// @internal (undocumented)
export const REGISTRY: unique symbol;

// @beta
export interface ReinstateTxnArgs {
readonly retainLocks?: boolean;
}

// @public @preview
export class RelatedElement implements RelatedElementProps {
constructor(props: RelatedElementProps);
Expand Down Expand Up @@ -8641,6 +8652,11 @@ export class ResponseLike implements Response {
get url(): string;
}

// @beta
export interface ReverseTxnArgs {
readonly retainLocks?: boolean;
}

// @public
export class RgbColor {
constructor(r: number, g: number, b: number);
Expand Down Expand Up @@ -9536,6 +9552,22 @@ export interface SerializedRpcRequest extends SerializedRpcActivity {
protocolVersion?: number;
}

// @beta
export namespace ServerBasedLocksError {
const scope = "itwin-ServerBasedLocks";
export function isError(error: unknown, key?: Key): error is ITwinError;
export type Key =
/** The briefcase contains unsaved changes */
"has-unsaved-changes" |
/** A SQLite error occurred while reading or writing the "locks" database */
"lock-database-problem" |
/** The specified Txn ID is not known to the TxnManager */
"txn-id-not-found" |
/** Attempted to abandon locks for a Txn that has not yet been reversed */
"txn-not-reversed";
export function throwError(key: Key, message: string): never;
}

// @public (undocumented)
export class ServerError extends IModelError {
constructor(errorNumber: number, message: string);
Expand Down
10 changes: 10 additions & 0 deletions common/api/core-frontend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ import { RealityDataProvider } from '@itwin/core-common';
import { RealityDataSourceKey } from '@itwin/core-common';
import { RealityDataStatus } from '@itwin/core-bentley';
import { RealityModelDisplaySettings } from '@itwin/core-common';
import { ReinstateTxnArgs } from '@itwin/core-common';
import { RelatedElement } from '@itwin/core-common';
import { RelativePosition } from '@itwin/appui-abstract';
import { RemoveFunction } from '@itwin/core-common';
Expand All @@ -274,6 +275,7 @@ import { RenderTexture } from '@itwin/core-common';
import { RenderTextureParams } from '@itwin/core-common';
import { RenderTimelineProps } from '@itwin/core-common';
import { RenderType } from '@itwin/webgl-compatibility';
import { ReverseTxnArgs } from '@itwin/core-common';
import { RgbColor } from '@itwin/core-common';
import { RgbColorProps } from '@itwin/core-common';
import { RootSubjectProps } from '@itwin/core-common';
Expand Down Expand Up @@ -1892,10 +1894,18 @@ export class BriefcaseTxns extends BriefcaseNotificationHandler implements TxnNo
// @alpha
readonly onReverseLocalChangesEnd: BeEvent<(txns: TxnProps[]) => void>;
reinstateTxn(): Promise<IModelStatus>;
// @beta
reinstateTxnAsync(args?: ReinstateTxnArgs): Promise<void>;
restartTxnSession(): Promise<void>;
reverseAll(): Promise<IModelStatus>;
// @beta
reverseAllTxnsAsync(args?: ReverseTxnArgs): Promise<void>;
reverseSingleTxn(): Promise<IModelStatus>;
// @beta
reverseSingleTxnAsync(args?: ReverseTxnArgs): Promise<void>;
reverseTxns(numOperations: number): Promise<IModelStatus>;
// @beta
reverseTxnsAsync(numOperations: number, args?: ReverseTxnArgs): Promise<void>;
}

// @internal (undocumented)
Expand Down
3 changes: 3 additions & 0 deletions common/api/summary/core-common.exports.csv
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ beta;interface;RealityDataSourceProps
beta;interface;RealityModelDisplayProps
beta;class;RealityModelDisplaySettings
internal;const;REGISTRY
beta;interface;ReinstateTxnArgs
public;class;RelatedElement
preview;class;RelatedElement
public;interface;RelatedElementProps
Expand Down Expand Up @@ -775,6 +776,7 @@ public;interface;RepositoryLinkProps
preview;interface;RepositoryLinkProps
public;interface;RequestNewBriefcaseProps
internal;class;ResponseLike
beta;interface;ReverseTxnArgs
public;class;RgbColor
public;interface;RgbColorProps
public;type;RgbFactorProps
Expand Down Expand Up @@ -863,6 +865,7 @@ preview;enum;SectionType
public;interface;SerializedRpcActivity
internal;interface;SerializedRpcOperation
internal;interface;SerializedRpcRequest
beta;namespace;ServerBasedLocksError
public;class;ServerError
public;class;ServerTimeoutError
public;interface;SessionProps
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-backend",
"comment": "Added the ability to release locks associated with reversed Txns.",
"type": "none"
}
],
"packageName": "@itwin/core-backend"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-common",
"comment": "Added async versions of Txn reverse and reinstate operations, and added support for abandoning locks when reversing Txns.",
"type": "none"
}
],
"packageName": "@itwin/core-common"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-frontend",
"comment": "Added async versions of Txn reverse and reinstate operations, and added support for abandoning locks when reversing Txns.",
"type": "none"
}
],
"packageName": "@itwin/core-frontend"
}
2 changes: 1 addition & 1 deletion core/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@
"nyc": {
"extends": "./node_modules/@itwin/build-tools/.nycrc"
}
}
}
40 changes: 40 additions & 0 deletions core/backend/src/BackendHubAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,52 @@ export interface BackendHubAccess {
*/
acquireLocks: (arg: BriefcaseDbArg, locks: LockMap) => Promise<void>;

/**
* Abandons the specified locks when none of the associated elements have
* been or will be modified. Depending on the {@link LockState} specified for the lock,
* it may be returned to the {@link LockState.Shared} state or released entirely. It is only
* valid to call this method when none of the elements protected by the locks have been edited, or if all edits
* have been reversed or abandoned without pushing them.
*
* The locks are released on the IModelHub, but the changeset associated with the locks is not updated.
*
Comment thread
kring marked this conversation as resolved.
* It is an error to specify {@link LockState.Exclusive} for any element, to specify {@link LockState.Shared}
* for an element where the Exclusive lock is not currently held, or to include any element for which no lock
* is currently held.
*
* This method is optional, so not all IModelHubs will implement it. If this method is not implemented
* explicitly by an IModelHub, it will be implemented implicitly by calling
* {@link BackendHubAccess.acquireLocks} with the same locks and passing `changeset.id=""` and
* `changeset.index=0` in the first argument to indicate that the lock state should change without updating
* the changeset associated with the locks.
*
* @beta
*/
abandonLocks?: (arg: BriefcaseIdArg, locks: LockMap) => Promise<void>;

/** Get the list of all held locks for a briefcase. This can be very expensive and is currently used only for tests. */
queryAllLocks: (arg: BriefcaseDbArg) => Promise<LockProps[]>;

/** Release all currently held locks */
releaseAllLocks: (arg: BriefcaseDbArg) => Promise<void>;

/**
* Abandons all currently held locks when none of the associated elements have been or will be modified.
* It is only valid to call this method when none of the elements protected by the locks have been edited,
* or if all edits have been reversed or abandoned without pushing them.
*
* The locks are released on the IModelHub, but the changeset associated with the locks is not updated.
*
* This method is optional, so not all IModelHubs will implement it. If this method is not implemented
* explicitly by an IModelHub, it will be implemented implicitly by calling
* {@link BackendHubAccess.releaseAllLocks}, passing `changeset.id=""` and `changeset.index=0` in the
* first argument to indicate that the lock state should change without updating the changeset associated
* with the locks.
*
* @beta
*/
abandonAllLocks?: (arg: BriefcaseIdArg) => Promise<void>;

/** Get the iModelId of an iModel by name. Undefined if no iModel with that name exists. */
queryIModelByName: (arg: IModelNameArg) => Promise<GuidString | undefined>;

Expand Down
2 changes: 1 addition & 1 deletion core/backend/src/IModelDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3521,7 +3521,7 @@ export class BriefcaseDb extends IModelDb {

// attempt to release locks must happen after changes are undone successfully
Logger.logInfo(loggerCategory, "Releasing locks after discarding changes");
await this.locks.releaseAllLocks();
await this.locks.abandonAllLocks();
}

/**
Expand Down
26 changes: 21 additions & 5 deletions core/backend/src/IpcHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
BriefcaseConnectionProps,
ChangesetIndex, ChangesetIndexAndId, EditingScopeNotifications, getPullChangesIpcChannel, IModelConnectionProps, IModelError, IModelNotFoundResponse, IModelRpcProps,
ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketBackend, iTwinChannel,
OpenBriefcaseProps, OpenCheckpointArgs, PullChangesOptions, RemoveFunction, SnapshotOpenOptions, StandaloneOpenOptions, TileTreeContentIds, TxnNotifications,
OpenBriefcaseProps, OpenCheckpointArgs, PullChangesOptions, ReinstateTxnArgs, RemoveFunction, ReverseTxnArgs, SnapshotOpenOptions,
StandaloneOpenOptions, TileTreeContentIds, TxnNotifications,
} from "@itwin/core-common";
import { ProgressFunction, ProgressStatus } from "./CheckpointManager";
import { BriefcaseDb, IModelDb, SnapshotDb, StandaloneDb } from "./IModelDb";
Expand Down Expand Up @@ -342,16 +343,31 @@ class IpcAppHandler extends IpcHandler implements IpcAppFunctions {
}

public async reverseTxns(key: string, numOperations: number): Promise<IModelStatus> {
return IModelDb.findByKey(key)[_nativeDb].reverseTxns(numOperations);
return BriefcaseDb.findByKey(key).txns.reverseTxns(numOperations);
}

public async reverseTxnsAsync(key: string, numOperations: number, args?: ReverseTxnArgs): Promise<void> {
return BriefcaseDb.findByKey(key).txns.reverseTxnsAsync(numOperations, args);
}

public async reverseAllTxn(key: string): Promise<IModelStatus> {
return IModelDb.findByKey(key)[_nativeDb].reverseAll();
return BriefcaseDb.findByKey(key).txns.reverseAll();
}

public async reverseAllTxnsAsync(key: string, args?: ReverseTxnArgs): Promise<void> {
return BriefcaseDb.findByKey(key).txns.reverseAllTxnsAsync(args);
}

public async reinstateTxn(key: string): Promise<IModelStatus> {
return IModelDb.findByKey(key)[_nativeDb].reinstateTxn();
return BriefcaseDb.findByKey(key).txns.reinstateTxn();
}

public async reinstateTxnAsync(key: string, args?: ReinstateTxnArgs): Promise<void> {
return BriefcaseDb.findByKey(key).txns.reinstateTxnAsync(args);
}

public async restartTxnSession(key: string): Promise<void> {
return IModelDb.findByKey(key)[_nativeDb].restartTxnSession();
return IModelDb.findByKey(key).restartTxnSession();
}

public async queryConcurrency(pool: "io" | "cpu"): Promise<number> {
Expand Down
Loading
Loading