Skip to content

v0.4.0

Choose a tag to compare

@trviph trviph released this 16 Jan 03:54
· 34 commits to main since this release
v0.4.0
4c2d127

Release v0.4.0

This release brings significant architectural changes, including a full implementation of the Redlock distributed locking algorithm and a unified interface for all lock types.

🚀 Key Features

  • Distributed Locking (Redlock): Full implementation of the Redlock algorithm with quorum-based consensus, clock drift validation, and fencing tokens.
  • Unified API: Introduced Locker interface implemented by both Lock (single-instance) and DistributedLock (multi-instance).
  • New Operations:
  • Enhanced Configuration: New functional options for both lock types, including cleanup timeouts and clock drift factors.

⚠️ Breaking Changes

Functional Options Refactor: Configuration methods have been renamed to follow the standard With* pattern (e.g., SetJitterDuration -> WithJitterDuration).

🛠 Fixes & Improvements

  • Retry Logic Refactor: Extracted common retryConfig struct with unified wait() logic for both Lock and DistributedLock.
  • Testing: Added comprehensive integration tests with multiple independent Redis instances, race condition tests, and improved test robustness.
  • Documentation:
    • Added usage examples for Extend, TryExtend, and watchdog pattern.
    • Comprehensive error handling section with all sentinel errors.
    • Clarified known limitations in Extend/TryExtend and AcquireOrExtend behavior.
    • Added table of contents to README.
  • Performance: Replaced math/rand with crypto/rand for secure token generation.

Full Changelog: v0.3.2...v0.4.0