feat(lock): add dedicated Lock API module for resource locking#438
Open
kisielewski wants to merge 3 commits into
Open
feat(lock): add dedicated Lock API module for resource locking#438kisielewski wants to merge 3 commits into
kisielewski wants to merge 3 commits into
Conversation
Introduces a new lock module (endpoint/lock/) with lock, unlock, and checkReservedLock operations backed by direct server-side RPC calls. Replaces the KVDB-based LockSession/LockSetLogic in SearchApi, which required a read followed by a write — creating a TOCTOU window and doubling the number of bridge round-trips per lock acquisition.
Uriagat
approved these changes
May 26, 2026
Uriagat
requested changes
May 26, 2026
Member
There was a problem hiding this comment.
[build] In file included from /privmx-endpoint/endpoint/search/src/PrivmxFS.cpp:1:
[build] /privmx-endpoint/endpoint/search/include/privmx/endpoint/search/PrivmxFS.hpp:37:10: fatal error: privmx/endpoint/search/LockSession.hpp: No such file or directory
[build] 37 | #include "privmx/endpoint/search/LockSession.hpp"
Uriagat
approved these changes
May 26, 2026
djenczewski
approved these changes
Jun 3, 2026
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.
Important
Depends on: simplito/privmx-bridge#17 — add distributed resource lock API with hierarchical lock levels
Summary
endpoint/lock/module exposinglock,unlock, andcheckReservedLockoperations backed by direct server-side RPC calls(
lockLock,lockUnlock,lockCheckReservedLock).LockSession/LockSetLogicfrom the search module — theserelied on KVDB (read + write per acquisition), creating a TOCTOU window
and doubling bridge round-trips.
SearchApiImplandPrivmxFSto the new Lock API.Motivation
The old approach in SearchApi used KVDB as a locking primitive:
This meant two bridge round-trips per lock and a race window
between the read and the write. The dedicated Lock API collapses both
steps into a single atomic server call, eliminating the race and halving
the number of requests.