Skip to content

Commit

Permalink
Add optional support for write locks
Browse files Browse the repository at this point in the history
These write locks prevent accidental misuse of `Synchronizer`s by
establishing an advisory lock on the state file using the `flock`
system call. Correctly configured writers will check this lock to
prevent duplicate writers.

The new write locking feature is configured through a new builder
type, which provides an alternate way to configure `Synchronizer`
options. We can extend this pattern in the future.

Write locking functionality is gated behind the `write-lock` flag
and therefore has no performance impact when disabled. Benchmarks
show an ~1% increase in write latency when the feature is enabled
(the first write may experience additional latency as the lock is
acquired.)
  • Loading branch information
austinhartzheim committed Sep 12, 2024
1 parent 1756d86 commit 171227e
Show file tree
Hide file tree
Showing 6 changed files with 427 additions and 311 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Run cargo test
run: cargo test

- name: Test write-lock feature
run: cargo test --features write-lock

lints:
name: Lints
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit 171227e

Please sign in to comment.