Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a new v2 plugin system for C/C++ users, enabling integration of custom cache algorithms through hook functions. Key changes include updated API documentation in plugin.h, the implementation of a new plugin cache in plugin_cache.c (with corresponding updates to evictionAlgo.h and logging), and demonstration/example changes for a hook-based LRU plugin.
Reviewed Changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| libCacheSim/include/libCacheSim/plugin.h | Added detailed doxygen documentation for both v1 and v2 plugin APIs |
| libCacheSim/include/libCacheSim/logging.h | Marked an unused variable to suppress warnings |
| libCacheSim/include/libCacheSim/evictionAlgo.h | Declared the new pluginCache_init function for custom cache plugins |
| libCacheSim/cache/eviction/plugin_cache.c | Implemented the plugin cache, including hook loading and parameter parsing |
| libCacheSim/cache/CMakeLists.txt | Added the plugin cache source to the build |
| example/plugin_v2/* | Introduced test and example files for a hook-based LRU cache plugin |
Comments suppressed due to low confidence (2)
libCacheSim/cache/eviction/plugin_cache.c:107
- Assigning the pluginCache_init function to the cache's cache_init pointer may lead to confusion as it reuses the same name for both the API function and its function pointer. Consider renaming one of them to better differentiate the initialization routine from the function pointer used for cache reinitialization.
cache->cache_init = pluginCache_init;
libCacheSim/cache/eviction/plugin_cache.c:386
- [nitpick] The error message for unsupported parameters could be clearer. Consider rephrasing it (e.g., "Unsupported parameter: %s for cache %s") to improve developer understanding.
ERROR("%s does not have parameter %s\n", cache->cache_name, key);
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2647053 to
a061a4b
Compare
haochengxia
reviewed
Jun 25, 2025
haochengxia
approved these changes
Jun 25, 2025
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.
This is the new plugin system for C/C++ users.
The v2 plugin cache API allows implementing a cache plugin by providing four core hook functions. This design enables easy integration on top of an user's existing cache implementations without requiring a full libCacheSim-based implementation.