refactor: decompose LockActor.create() and refresh() into focused pri…#1194
refactor: decompose LockActor.create() and refresh() into focused pri…#1194pallakartheekreddy wants to merge 1 commit intocloud-store-refactoringfrom
Conversation
…vate helpers Extracted three private helpers shared across create(), refresh(), retire(), and list(): - validateDeviceHeader(request): single-responsibility check for X-device-Id header, eliminating the repeated inline throw across all four operations - lockOkResponse(lockId, expiresAt): builds the standard lockKey/expiresAt/expiresIn response map, eliminating copy-paste between create and refresh success paths - readLockExternalProps(request, resourceId): sets identifier on request and fires readExternalProps, eliminating 4-line boilerplate repeated in create/refresh/retire Extracted two business-logic helpers from create(): - handleExistingLock(...): handles the three cases when a lock record already exists (same owner → extend, same user different device → self-lock error, other user → locked) - createNewLock(...): persists the new lock to Cassandra and calls updateContent create() shrinks from 52 to ~20 lines; refresh() from 48 to ~35 lines. All logic is preserved exactly — only organisation changed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
SonarCloud Analysis Results 🔍Quality Gate Results for Services:Please review the analysis results for each service. Ensure all quality gates are passing before merging. |



…vate helpers
Extracted three private helpers shared across create(), refresh(), retire(), and list():
Extracted two business-logic helpers from create():
create() shrinks from 52 to ~20 lines; refresh() from 48 to ~35 lines. All logic is preserved exactly — only organisation changed.