Refactor to api + core + remote module architecture#39
Merged
Conversation
Restructure library modules to separate shared API types from implementation, enabling both embedded and remote backends to share a unified DownloadTask interface. Module changes: - library:core → library:embedded (renamed) - library:service → deleted (merged into embedded as EmbeddedKDownService) - library:client → library:remote (renamed) - library:api → expanded with shared types and DownloadTask interface Key design changes: - DownloadTask is now an interface in api; DownloadTaskImpl is internal in embedded; RemoteDownloadTask implements it via HTTP in remote - KDownService rewritten to use DownloadTask directly (no wire DTOs) - Wire models (TaskResponse, CreateDownloadRequest) moved to remote as internal serialization types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Test Results492 tests +255 491 ✅ +254 6s ⏱️ -1s For more details on these failures, see this check. Results for commit 3f40c58. ± Comparison against base commit 1d030ed. This pull request removes 99 and adds 354 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
- KDownService interface → KDown interface (in library:api) - EmbeddedKDownService → EmbeddedKDown (in library:embedded) - RemoteKDownService → RemoteKDown (in library:remote) - Use import alias in EmbeddedKDown to disambiguate from com.linroid.kdown.KDown engine class Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
events() is an SSE/server concern, not a consumer API concern. Consumers observe tasks and task.state StateFlows directly. - Remove events() from KDown interface - Delete TaskEvent, ProgressResponse, ErrorResponse from api/model - Remove events() implementation from EmbeddedKDown and RemoteKDown - Delete TaskMapper from embedded (only used for event synthesis) - Remove toTaskEvent from WireMapper in remote Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- connectionState is a remote-specific concern, moved to RemoteKDown - getStatus()/ServerStatus removed (consumers derive counts from tasks) - backendLabel kept on KDown interface - ConnectionState moved from api to remote module - Delete empty api/model/ directory (ServerStatus was last file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
…ackage - Rename api module interface `KDown` → `KDownApi` to resolve naming conflict - Rename core module class `CoreKDown` → `KDown` (the natural name for the impl) - Flatten all api types into `com.linroid.kdown.api` (remove task/, segment/, error/, file/ subpackages) - Update all imports across core, remote, ktor, kermit, sqlite, server, examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Split the monolithic library module into three focused modules with clear separation of concerns:
KDownApiinterfaceKDownApiKDownApifor controlling a remote daemonThis enables the UI layer to work identically regardless of whether downloads run in-process or on a remote server.
Changes
New: library:api
com.linroid.kdown.apipackage:KDownApi,KDownVersion,DownloadTask,DownloadRequest,DownloadState,DownloadProgress,DownloadPriority,DownloadSchedule,DownloadCondition,SpeedLimit,Segment,KDownError,PathSerializerKDownApiinterface defines the contract both backends implementNew: library:core (extracted from the original monolithic module)
KDown(implementsKDownApi)com.linroid.kdown.coreNew: library:remote
RemoteKDownimplementsKDownApivia HTTP calls to the daemon serverRemoteDownloadTaskwith reactive state via SSEWireMapperfor JSON serializationNaming
KDownApi= the interface (api module)KDown= the core in-process implementation (core module)RemoteKDown= the remote client implementation (remote module)Other modules updated
library:ktor,library:kermit,library:sqlite— import updatesserver/— usesKDownApiin route signatures,KDownfor constructionexamples/— updated imports and constructor callsModule dependency graph
Test plan
🤖 Generated with Claude Code