Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new endpoint for removing datasets or files from cache #104

Merged
merged 6 commits into from
Mar 12, 2024

Conversation

elmiomar
Copy link
Contributor

@elmiomar elmiomar commented Feb 2, 2024

This PR introduces a new removeFromCache() method in the CacheManagementController is designed to handle DELETE requests for removing either an entire dataset or specific files within a dataset from the cache. Here's a detailed breakdown of its functionality:

  • checks if the cache manager (PDRCacheManager in this context) is operational by calling _checkForManager()
  • extracts the dataset identifier (dsid) from the URL path variable
  • determines removal scope:
    • if no specific file path is provided or if the path refers to the dataset as a whole, the method removes the entire dataset from the cache
    • if a specific file path is provided, the method removes just the specified files within the dataset
  • retrieves Cache objects: depending on the removal scope in the previous step, it uses either selectDatasetObjects() or selectFileObjects() method from PDRCacheManager to retrieve a list of CacheObjects that represent the dataset or specific files within it
  • for each CacheObject retrieved in the previous step, it calls the uncache() method to remove the object from the cache. This removal leverages the inherited uncache() functionality from BasicCacheManager through PDRCacheManager.

@elmiomar
Copy link
Contributor Author

elmiomar commented Mar 7, 2024

Updates:

  • Enhanced the "remove objects from cache" endpoint logic to include the :cached selector for more accurate cache management.
  • Identified and fixed a bug in the "get from cache" endpoint where a ResourceNotFound exception failed to trigger for an empty files list; this was because empty list verification was done before the completion of the files selection process.
  • Added a unit test to cover a new scenario for the "remove from cache" endpoint.
  • Confirmed that existing unit tests remain successful following the the bug fix.

Other changes introduced in this PR include:

  • Removed the redundant RPARequestHandler interface and its associated implementation.
  • Renamed the IRPARequestHandler interface to RPARequestHandler for clarity.
  • Improved inline documentation.

Copy link
Collaborator

@RayPlante RayPlante left a comment

Choose a reason for hiding this comment

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

This was tested end-to-end after being combined with PRs #102, #103, #106, and associated updates to the front-end RPA apps on testdata. I fully tested the endpoint for deleting data from the cache--both as individual files or as a whole dataset.

@RayPlante RayPlante merged commit e125b00 into integration Mar 12, 2024
3 checks passed
@RayPlante RayPlante deleted the feature/uncaching-endpoint branch March 12, 2024 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants