Skip to content

Introduce LockService interface to BriefcaseConnection#9060

Merged
GytisCepk merged 5 commits into
masterfrom
gytis/frontend-api-for-locks
Mar 9, 2026
Merged

Introduce LockService interface to BriefcaseConnection#9060
GytisCepk merged 5 commits into
masterfrom
gytis/frontend-api-for-locks

Conversation

@GytisCepk

Copy link
Copy Markdown
Contributor

Motivation

Tools and other UI elements sometimes need to know whether element is locked and who owns the lock. Tools may query this information frequently and expect a quick response (e.g. on element hover tools want to show that element is not available due to element being locked by other user).

Some generic core level API is needed to make sure that solution is reachable from any package.

Solution

Have a locks cache available via BriefcaseConnection.

Cache would prefetch locks from iModelHub and regularly update them. Cache would be abstracted away via LockService interface and implementation would be provided by applications for now (later down the line, some generic default implementation could be available in core packages).

Benefits of having this available via BriefcaseConnection:

  • Easily accessible to tools and UI components, regardless of the package they're in
  • Easier to ensure that only one cache exists per iModel since multiple caches would create unnecessary network traffic.

Comment thread core/frontend/src/BriefcaseConnection.ts
@kring

kring commented Mar 5, 2026

Copy link
Copy Markdown
Member

This looks reasonable to me. Do you have an implementation of LockService somewhere already? It might be interesting to see it, if so. Maybe it would even be useful for testing if we had an implementation for LocalHub? The foreign locks would be simulated, of course.

@GytisCepk

Copy link
Copy Markdown
Contributor Author

Do you have an implementation of LockService somewhere already?

Partial one exists, but currently it's internal (you can find a link in linked issue).

Maybe it would even be useful for testing if we had an implementation for LocalHub?

At some point, maybe. Currently, no one is using this so there is nothing to test.

Also, interface is simple enough right now so writing a simple mock should not be difficult for anyone.

Comment thread core/frontend/src/BriefcaseConnection.ts
Comment thread core/frontend/src/BriefcaseConnection.ts
@GytisCepk GytisCepk enabled auto-merge (squash) March 9, 2026 11:01
@GytisCepk GytisCepk merged commit 97db09e into master Mar 9, 2026
15 checks passed
@GytisCepk GytisCepk deleted the gytis/frontend-api-for-locks branch March 9, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants