Repository navigation
v0.4.0
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:
- Extend / TryExtend: Atomic lock extension.
- AcquireOrExtend: Idempotent acquisition or extension.
- TryAcquire: Fail-fast acquisition without retries.
- 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
retryConfigstruct with unifiedwait()logic for bothLockandDistributedLock. - 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/TryExtendandAcquireOrExtendbehavior. - Added table of contents to README.
- Added usage examples for
- Performance: Replaced
math/randwithcrypto/randfor secure token generation.
Full Changelog: v0.3.2...v0.4.0