[WIP] - Aquire locks during onElement and onModel api's - #284
Draft
DanRod1999 wants to merge 140 commits into
Draft
[WIP] - Aquire locks during onElement and onModel api's#284DanRod1999 wants to merge 140 commits into
DanRod1999 wants to merge 140 commits into
Conversation
iTwin/itwinjs-core#7512 makes the internal APIs `IModelDb.nativeDb` and `IModelHost.platform` inaccessible outside of the core-backend package. --------- Co-authored-by: nick.tessier <22119573+nick4598@users.noreply.github.com> Co-authored-by: Daniel Rodriguez <DanRod1999@users.noreply.github.com> Co-authored-by: Arun George <11051042+aruniverse@users.noreply.github.com> Co-authored-by: Arun George <aruniverse@users.noreply.github.com>
Fixed failing `transforms code values with non standard space characters` test. Original fix can be found [here](https://github.com/iTwin/itwinjs-core/pull/5088/changes#diff-34e307a38caa78b6a83b0dd63f56946e9d8b715eb19c0900147e21b66b901795).
Resolves this [issue](iTwin/itwinjs-core#9176) on the transformer side Co-authored-by: Daniel Rodriguez <DanRod1999@users.noreply.github.com>
# Conflicts: # package.json # pnpm-lock.yaml
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
If option is enabled, we should also acquire schema lock in |
Contributor
Author
If the schema lock is needed that means we would be locking the entire imodel anyway right? Does that change anything? It slightly defeats the purpose of only locking what you need, but I guess in cases where they need to processSchema() there's no way to avoid it anyway |
Resolves [issue](#272) ## APIs Changed to Async ### IModelExporter | Method | Before | After | |--------|--------|-------| | `shouldExportElement(element)` | `boolean` | `Promise<boolean>` | ### IModelExportHandler | Method | Before | After | |--------|--------|-------| | `onDeleteElement(_elementId)` | `void` | `Promise<void>` | | `onDeleteRelationship(_relInstanceId)` | `void` | `Promise<void>` | | `onExportCodeSpec(_codeSpec, _isUpdate)` | `void` | `Promise<void>` | | `onExportFont(_font, _isUpdate)` | `void` | `Promise<void>` | | `onExportModel(_model, _isUpdate)` | `void` | `Promise<void>` | | `onSkipElement(_elementId)` | `void` | `Promise<void>` | | `shouldExportCodeSpec(_codeSpec)` | `boolean` | `Promise<boolean>` | | `shouldExportElement(_element)` | `boolean` | `Promise<boolean>` | | `shouldExportElementAspect(_aspect)` | `boolean` | `Promise<boolean>` | | `shouldExportRelationship(_relationship)` | `boolean` | `Promise<boolean>` | | `shouldExportSchema(_schemaKey)` | `boolean` | `Promise<boolean>` | ### IModelImporter | Method | Before | After | |--------|--------|-------| | `deleteElement(elementId)` | `void` | `Promise<void>` | | `deleteRelationship(relationshipProps)` | `void` | `Promise<void>` | | `importElement(elementProps)` | `Id64String` | `Promise<Id64String>` | | `importElementMultiAspects(...)` | `Id64String[]` | `Promise<Id64String[]>` | | `importElementUniqueAspect(aspectProps)` | `Id64String` | `Promise<Id64String>` | | `importModel(modelProps)` | `void` | `Promise<void>` | | `importRelationship(relationshipProps)` | `Id64String` | `Promise<Id64String>` | | `onDeleteElement(elementId)` | `void` | `Promise<void>` | | `onDeleteElementAspect(targetElementAspect)` | `void` | `Promise<void>` | | `onDeleteRelationship(relationshipProps)` | `void` | `Promise<void>` | | `onInsertElement(elementProps)` | `Id64String` | `Promise<Id64String>` | | `onInsertElementAspect(aspectProps)` | `Id64String` | `Promise<Id64String>` | | `onInsertModel(modelProps)` | `Id64String` | `Promise<Id64String>` | | `onInsertRelationship(relationshipProps)` | `Id64String` | `Promise<Id64String>` | | `onProgress()` | `void` | `Promise<void>` | | `onUpdateElement(elementProps)` | `void` | `Promise<void>` | | `onUpdateElementAspect(aspectProps)` | `void` | `Promise<void>` | | `onUpdateModel(modelProps)` | `void` | `Promise<void>` | | `onUpdateRelationship(relationshipProps)` | `void` | `Promise<void>` | ### IModelTransformer | Method | Before | After | |--------|--------|-------| | `onDeleteElement(sourceElementId)` | `void` | `Promise<void>` | | `onExportCodeSpec(sourceCodeSpec)` | `void` | `Promise<void>` | | `onExportFont(font, _isUpdate)` | `void` | `Promise<void>` | | `onExportModel(sourceModel)` | `void` | `Promise<void>` | | `shouldDetectDeletes()` | `boolean` | `Promise<boolean>` | | `shouldExportCodeSpec(_sourceCodeSpec)` | `boolean` | `Promise<boolean>` | | `shouldExportElement(_sourceElement)` | `boolean` | `Promise<boolean>` | | `shouldExportElementAspect(aspect)` | `boolean` | `Promise<boolean>` | | `shouldExportRelationship(_sourceRelationship)` | `boolean` | `Promise<boolean>` | | `shouldExportSchema(schemaKey)` | `boolean` | `Promise<boolean>` | --------- Co-authored-by: Daniel Rodriguez <DanRod1999@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trying to resolve: #263
Make
onElement...()andonModel...()apis async. Add transformer option to acquire locks when these functions are called. If the transformation fails abandon changes and release locks acquired during transformation process, but only do so if the option flag for acquiring locks is set.