feat(primitive): add barrier and queue primitives#120
Merged
Conversation
Add distributed barrier and FIFO queue primitives following the same pattern as lock and election. Barrier provides synchronization: create holds a barrier that blocks other callers until released. Supports lease-based auto-release and watch-based blocking semantics (create_with_wait). Queue provides FIFO operations: enqueue adds items with sequential keys, dequeue pops the front item atomically. Peek reads without removing. Both primitives emit watch events on state changes and integrate with the Raft state machine, lease system, and gRPC API layer.
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.
Summary
Changes
create_with_waitblocking semanticsDesign
Barrier: Similar to lock — create holds a barrier that blocks other callers. Supports lease-based auto-release. Uses watch-based
create_with_waitfor blocking semantics (like election'scampaign_with_wait).Queue: Sequential keys (
_aether_queue/<name>/<seq>) with meta key tracking next sequence. Dequeue scans prefix for front item and deletes atomically. Peek reads without removing.Testing
cargo clippy -- -D warningspassescargo fmt -- --checkpassesRelated issues
Refs #91