Skip to content

add plugin_v2#230

Merged
haochengxia merged 4 commits intodevelopfrom
1a1a11a/plugin_v2
Jun 25, 2025
Merged

add plugin_v2#230
haochengxia merged 4 commits intodevelopfrom
1a1a11a/plugin_v2

Conversation

@1a1a11a
Copy link
Copy Markdown
Owner

@1a1a11a 1a1a11a commented Jun 25, 2025

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.

@1a1a11a 1a1a11a requested a review from Copilot June 25, 2025 15:48
@1a1a11a 1a1a11a self-assigned this Jun 25, 2025
@1a1a11a 1a1a11a requested a review from haochengxia as a code owner June 25, 2025 15:48
Copy link
Copy Markdown
Contributor

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 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);

Comment thread libCacheSim/cache/eviction/plugin_cache.c
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@1a1a11a 1a1a11a force-pushed the 1a1a11a/plugin_v2 branch from 2647053 to a061a4b Compare June 25, 2025 15:53
Comment thread example/plugin_v2/CMakeLists.txt
@haochengxia haochengxia merged commit 9406e05 into develop Jun 25, 2025
9 checks passed
@haochengxia haochengxia deleted the 1a1a11a/plugin_v2 branch July 18, 2025 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants