Skip to content

Conversation

gaius-qi
Copy link
Member

@gaius-qi gaius-qi commented Apr 2, 2025

Description

This pull request includes significant changes to the API documentation in api/manager/docs.go and api/manager/swagger.json files. The primary focus is on renaming endpoints and updating related schema definitions to improve clarity and consistency.

API Endpoint Changes:

  • Renamed /api/v1/persistent-caches to /api/v1/persistent-cache-tasks and updated all related descriptions, tags, and summaries accordingly. [1] [2]
  • Changed the endpoint /api/v1/persistent-caches/{scheduler_cluster_id}/{task_id} to /api/v1/persistent-cache-tasks/{id} and updated the parameter types and locations. [1] [2]

Schema Definition Updates:

  • Updated references from GetPersistentCacheResponse to PersistentCacheTask in the response schema. [1] [2]
  • Removed the d7y_io_dragonfly_v2_manager_types.GetPersistentCacheResponse and PersistentCachePeer schema definitions. [1] [2]
  • Added new PersistentCacheTask and PersistentCachePeer schema definitions with updated properties.

These changes ensure that the API documentation is more intuitive and aligns with the updated endpoint structure.

Related Issue

close #3892

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi added the enhancement New feature or request label Apr 2, 2025
@gaius-qi gaius-qi added this to the v2.3.0 milestone Apr 2, 2025
@gaius-qi gaius-qi requested review from BruceAko and Copilot April 2, 2025 14:04
@gaius-qi gaius-qi self-assigned this Apr 2, 2025
@gaius-qi gaius-qi requested a review from a team as a code owner April 2, 2025 14:04
@gaius-qi gaius-qi requested review from yxxhero and fcgxz2003 April 2, 2025 14:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request redefines endpoints and schema definitions for persistent cache functionality to improve clarity and consistency. Key changes include:

  • Renaming endpoints from "/api/v1/persistent-caches" to "/api/v1/persistent-cache-tasks" and updating related routes, handlers, and mocks.
  • Updating schema definitions and types in the manager package to align with the new naming conventions.
  • Revising API documentation in swagger to reflect changes in endpoint paths and response models.

Reviewed Changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scheduler/resource/persistentcache/task_manager_mock.go Updates renamed mock function names to match persistent cache task methods.
scheduler/resource/persistentcache/task_manager.go Adjusts type conversion and inline comments for clarity.
scheduler/resource/persistentcache/peer_manager.go & host_manager.go Replaces []interface{} with []any for improved code consistency.
pkg/redis/redis.go Removes unused imports and outdated helper functions.
manager/types/persistent_cache_task.go Renames and updates schema definitions and types for persistent cache tasks.
manager/service/service.go & mocks/service_mock.go Renames service methods to align with the new endpoint semantics.
manager/router/router.go Modifies route paths and associated handler references for persistent cache tasks.
manager/handlers/persistent_cache_task.go Introduces new handlers for persistent cache tasks.
manager/handlers/persistent_cache.go & persistent_cache_test.go Removes obsolete handlers and tests for the previous persistent cache endpoints.
api/manager/docs.go Updates API documentation to reflect new endpoints and schema references.
Files not reviewed (2)
  • api/manager/swagger.json: Language not supported
  • api/manager/swagger.yaml: Language not supported
Comments suppressed due to low confidence (2)

scheduler/resource/persistentcache/task_manager_mock.go:103

  • [nitpick] The renaming between 'LoadCurrentReplicaCount' and 'LoadCurrentPersistentReplicaCount' in the mock functions can be confusing. Please double-check that the function names and comments are consistently updated to reflect the persistent cache task changes.
func (m *MockTaskManager) LoadCurrentReplicaCount(arg0 context.Context, arg1 string) (uint64, error) {

manager/handlers/persistent_cache_task.go:17

  • New persistent cache task handlers have been added without accompanying test cases. Consider adding test coverage to verify the behavior of these endpoints.
package handlers

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 1.36752% with 577 lines in your changes missing coverage. Please review.

Project coverage is 34.54%. Comparing base (2f49b73) to head (4b8e37b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
manager/service/persistent_cache_task.go 0.00% 498 Missing ⚠️
manager/handlers/persistent_cache_task.go 0.00% 47 Missing ⚠️
manager/service/mocks/service_mock.go 0.00% 14 Missing ⚠️
...uler/resource/persistentcache/task_manager_mock.go 0.00% 8 Missing ⚠️
manager/router/router.go 0.00% 5 Missing ⚠️
scheduler/resource/persistentcache/host_manager.go 0.00% 2 Missing ⚠️
scheduler/resource/persistentcache/peer_manager.go 0.00% 2 Missing ⚠️
scheduler/resource/persistentcache/task_manager.go 88.88% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3929      +/-   ##
==========================================
- Coverage   34.65%   34.54%   -0.11%     
==========================================
  Files         339      339              
  Lines       39959    39956       -3     
==========================================
- Hits        13847    13804      -43     
- Misses      25201    25247      +46     
+ Partials      911      905       -6     
Flag Coverage Δ
unittests 34.54% <1.36%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
api/manager/docs.go 0.00% <ø> (ø)
manager/service/service.go 0.00% <ø> (ø)
pkg/redis/redis.go 36.66% <ø> (+5.23%) ⬆️
scheduler/resource/persistentcache/task_manager.go 45.36% <88.88%> (+1.44%) ⬆️
scheduler/resource/persistentcache/host_manager.go 30.57% <0.00%> (ø)
scheduler/resource/persistentcache/peer_manager.go 40.66% <0.00%> (ø)
manager/router/router.go 0.00% <0.00%> (ø)
...uler/resource/persistentcache/task_manager_mock.go 25.86% <0.00%> (ø)
manager/service/mocks/service_mock.go 92.24% <0.00%> (-3.44%) ⬇️
manager/handlers/persistent_cache_task.go 0.00% <0.00%> (ø)
... and 1 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@fcgxz2003 fcgxz2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@BruceAko BruceAko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaius-qi gaius-qi merged commit 4e02af6 into main Apr 3, 2025
27 checks passed
@gaius-qi gaius-qi deleted the feature/persistent-cache-task branch April 3, 2025 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display persistent cache information of peers in the console
6 participants