API Reference > imodeljs-backend > iModels > ConcurrencyControl ConcurrencyControl Namespace Beta Enumeration Name Description ConcurrencyControl.OnConflict How to handle a conflict. Class Name Description ConcurrencyControl.CodesManager Code manager. ConcurrencyControl.ConflictResolutionPolicy The options for how conflicts are to be handled during change-merging in an OptimisticConcurrencyControlPolicy. ConcurrencyControl.LocksManager Locks manager ConcurrencyControl.OptimisticPolicy Specifies an optimistic concurrency policy. ConcurrencyControl.PessimisticPolicy Specifies the pessimistic concurrency policy. ConcurrencyControl.Request A request for locks and/or code reservations. Interface Name Description ConcurrencyControl.ElementAndOpcode ConcurrencyControl.ModelAndOpcode ConcurrencyControl.RelationshipAndOpcode Defined in core/backend/src/ConcurrencyControl.ts Line 719 ConcurrencyControl Class Beta ConcurrencyControl enables an app to coordinate local changes with changes that are being made by others to an iModel. Methods Name Description constructor(_iModel: BriefcaseDb): ConcurrencyControl abandonRequest(): void Abandon any pending requests for locks or codes. abandonResources(requestContext: AuthorizedClientRequestContext): Promise<void> Abandons any locks that are held, any Codes that are reserved, and any pending requests. Beta areAvailable(requestContext: AuthorizedClientRequestContext, req?: ConcurrencyControl.Request): Promise<boolean> Check to see if all of the requested resources could be acquired from iModelHub. areLocksAvailable(requestContext: AuthorizedClientRequestContext, req?: ConcurrencyControl.Request): Promise<boolean> Check to see if this briefcase could acquire (or already has acquired) the specified locks at that specified levels. buildConcurrencyControlRequestForDb(): void Schedule the shared Db lock. endBulkMode(rqctx: AuthorizedClientRequestContext): Promise<void> Call this when in bulk mode and before calling BriefcaseDb.saveChanges. Beta onElementWrite(elementClass: undefined, element: ElementProps, opcode: DbOpcode): void onElementWritten(_elementClass: undefined, id: string, opcode: DbOpcode): void onModelWrite(modelClass: undefined, model: ModelProps, opcode: DbOpcode): void onModelWritten(_modelClass: undefined, id: string, opcode: DbOpcode): void request(requestContext: AuthorizedClientRequestContext, req?: ConcurrencyControl.Request): Promise<void> Try to acquire locks and/or reserve codes from iModelHub. requestResources(ctx: AuthorizedClientRequestContext, elements: ConcurrencyControl.ElementAndOpcode[], models?: ConcurrencyControl.ModelAndOpcode[], relationships?: ConcurrencyControl.RelationshipAndOpcode[]): Promise<void> Request the locks and/or Codes that will be required to carry out the intended write operations. requestResourcesForDelete(ctx: AuthorizedClientRequestContext, elements: ElementProps[], models?: ModelProps[], relationships?: RelationshipProps[]): Promise<void> Request the locks and/or Codes that will be required to delete the specified elements and/or models. Beta requestResourcesForInsert(ctx: AuthorizedClientRequestContext, elements: ElementProps[], models?: ModelProps[], relationships?: RelationshipProps[]): Promise<void> Request the locks and/or Codes that will be required to insert the specified elements and/or models. Beta requestResourcesForUpdate(ctx: AuthorizedClientRequestContext, elements: ElementProps[], models?: ModelProps[], relationships?: RelationshipProps[]): Promise<void> Request the locks and/or Codes that will be required to update the specified elements and/or models. Beta setPolicy(policy: ConcurrencyControl.PessimisticPolicy | ConcurrencyControl.OptimisticPolicy): void Set the concurrency control policy. startBulkMode(): void Start "bulk update mode". Beta syncCache(requestContext: AuthorizedClientRequestContext): Promise<void> You must call this if you use classes other than ConcurrencyControl to manage locks and codes. Beta Properties Name Type Description codes Accessor ReadOnly ConcurrencyControl.CodesManager API to reserve Codes and to query the status of Codes hasPendingRequests Accessor ReadOnly boolean Are there pending, unprocessed requests for locks or codes? isBulkMode Accessor ReadOnly boolean Query if changes are being monitored in "bulk update mode". locks Accessor ReadOnly ConcurrencyControl.LocksManager API to acquire locks preemptively and to query the status of locks Defined in core/backend/src/ConcurrencyControl.ts Line 32 Last Updated: 11 June, 2024