Implement persistent cache service #3903
Merged
chlins merged 3 commits intodragonflyoss:mainfrom Apr 2, 2025
BruceAko:main
Merged
Implement persistent cache service #3903chlins merged 3 commits intodragonflyoss:mainfrom BruceAko:main
chlins merged 3 commits intodragonflyoss:mainfrom
BruceAko:main
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3903 +/- ##
==========================================
- Coverage 35.03% 34.65% -0.39%
==========================================
Files 337 339 +2
Lines 39373 39959 +586
==========================================
+ Hits 13796 13847 +51
- Misses 24670 25201 +531
- Partials 907 911 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a persistent cache service with new Redis key functions, API endpoints, types, and corresponding service mocks to support persistent cache management.
- Updates Redis helper functions for key management, including a new extraction function
- Adds new API routes and handler for retrieving persistent caches
- Implements new types and service mocks for persistent cache functionality
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/redis/redis.go | Updates key formatting and adds a new extraction function |
| manager/types/persistent_cache.go | Introduces types for persistent cache tasks and peers |
| manager/types/job.go | Refactors comment to match updated scheduler cluster IDs |
| manager/service/service.go | Adds the GetPersistentCaches service method |
| manager/service/mocks/service_mock.go | Implements the mock for GetPersistentCaches |
| manager/router/router.go | Adds persistent cache GET route using JWT and RBAC middleware |
| manager/handlers/persistent_cache.go | Implements the handler for retrieving persistent caches |
| manager/handlers/job.go | Updates routing comment for job creation endpoint |
Signed-off-by: BruceAko <chongzhi@hust.edu.cn>
Signed-off-by: BruceAko <chongzhi@hust.edu.cn>
Signed-off-by: BruceAko <chongzhi@hust.edu.cn>
10 tasks
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.
Add persistent cache API in Dragonfly Manager.
Description
This PR adds new features to manage persistent cache in Dragonfly Manager:
Implementation of Redis-based persistent cache operations:
GetPersistentCachesmethod to list multiple persistent cache tasksGetPersistentCachemethod to retrieve a single persistent cache taskDestroyPersistentCachemethod to delete a persistent cache taskEnhanced data structures:
GetPersistentCacheResponsestructure with all necessary task information fieldsPersistentCachePeerstructure with detailed peer informationPersistentCachePeerHoststructure with comprehensive host informationPersistentCacheParamsfor API parameter handlingTechnical improvements:
Related Issue
#3892
Motivation and Context
Persistent cache is an important feature in Dragonfly that allows frequently accessed resources to be cached for extended periods. This PR provides the necessary APIs to manage these persistent caches through the Dragonfly Manager.
The implementation follows the existing patterns in Dragonfly, particularly referencing the scheduler/resource/persistentcache modules for data structure design. By providing these management APIs, users can now view detailed information about persistent cache tasks, including their associated peers and host information, as well as perform management operations.
These changes enable better visibility and control over persistent caches in Dragonfly deployments, which is particularly valuable for environments with high volumes of repeated downloads.
Types of changes
Checklist