ConcurrencyControl Class

Beta  

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: IModelDb): ConcurrencyControl    
abandonRequest(): void Abandon any pending requests for locks or codes.  
areAvailable(requestContext: AuthorizedClientRequestContext, req?: ConcurrencyControl.Request): Promise<boolean> Check to see if all of the requested resources could be acquired from iModelHub.  
areCodesAvailable(requestContext: AuthorizedClientRequestContext, req?: ConcurrencyControl.Request): Promise<boolean> Check to see that this briefcase could reserve (or has already reserved) all of the specified Codes.  
areCodesAvailable2(requestContext: AuthorizedClientRequestContext, codes: CodeProps[]): Promise<boolean> Check to see if all of the specified codes are available. Beta  
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.  
getHeldElementLock(elementId: Id64String): LockLevel    
getHeldLock(type: LockType, objectId: Id64String): LockLevel    
getHeldModelLock(modelId: Id64String): LockLevel    
lockCodeSpecs(requestContext: AuthorizedClientRequestContext): Promise<Lock[]> Obtain the CodeSpec lock.  
lockSchema(requestContext: AuthorizedClientRequestContext): Promise<Lock[]> Obtain the schema lock.  
onClose(_requestContext: AuthorizedClientRequestContext): Promise<void>    
onElementWrite(elementClass: undefined, element: ElementProps, opcode: DbOpcode): void    
onElementWritten(_elementClass: undefined, id: Id64String, opcode: DbOpcode): void    
onModelWrite(modelClass: undefined, model: ModelProps, opcode: DbOpcode): void    
onModelWritten(_modelClass: undefined, id: Id64String, opcode: DbOpcode): void    
onOpened(requestContext: AuthorizedClientRequestContext): Promise<void>    
onPushChanges(_requestContext: AuthorizedClientRequestContext): Promise<void>    
onPushedChanges(requestContext: AuthorizedClientRequestContext): Promise<void>    
openOrCreateCache(requestContext: AuthorizedClientRequestContext): Promise<void>    
queryCodeStates(requestContext: AuthorizedClientRequestContext, specId: Id64String, scopeId: string, value?: string): Promise<HubCode[]>    
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.  
reserveCodes(requestContext: AuthorizedClientRequestContext, codes: CodeProps[]): Promise<HubCode[]> Reserve the specified codes.  
setPolicy(policy: ConcurrencyControl.PessimisticPolicy | ConcurrencyControl.OptimisticPolicy): void Set the concurrency control policy.  
syncCache(requestContext: AuthorizedClientRequestContext): Promise<void>    

Properties

Name Type Description
codes Accessor ReadOnly ConcurrencyControl.Codes API to reserve Codes and query the status of Codes  
hasPendingRequests Accessor ReadOnly boolean Are there pending, unprocessed requests for locks or codes?  

Defined in

Last Updated: 13 June, 2024