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

feat(plugin): Add Key-Value Storage Support for Plugins #1265

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

sosyz
Copy link
Member

@sosyz sosyz commented Feb 25, 2025

This pull request introduces a new key-value storage system for plugins. The most important changes include adding a new entity for plugin key-value storage, creating a migration for the new table, updating the plugin service to use the new storage, and implementing the key-value storage functionality.

Key-Value Storage System for Plugins

Implementation of Key-Value Storage Functionality

  • plugin/kv_storage.go: Implemented the KVOperator struct and methods for handling key-value storage operations, including setting, getting, and deleting values, as well as transaction management.

  • plugin/plugin.go: Updated the plugin registration to handle key-value storage plugins and defined the Data struct to avoid circular dependencies. [1] [2]

Testing

I've created a test plugin to validate this functionality

Would it be helpful to include test code files in the repository? Have any suggestions on how to better demonstrate and test this feature.

This enhancement provides plugins with persistent storage capabilities, enabling more complex plugin functionality and state management.

Related Issue

Closes #1208

Looking forward to feedback!

@sosyz sosyz requested a review from LinkinStars February 25, 2025 12:26
@LinkinStars LinkinStars self-assigned this Feb 26, 2025
}
}

func (kv *KVOperator) GetByGroup(ctx context.Context, group string, page, pageSize int) (map[string]string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Wrap these query conditions in an object so that subsequent extensions do not affect the previous developer. I think it's possible to add a query later.

@LinkinStars
Copy link
Member

I've created a test plugin to validate this functionality

Would it be helpful to include test code files in the repository? Have any suggestions on how to better demonstrate and test this feature.

@sosyz I think you wrote a great test case and like you said, it should be added to this repository(maybeplugin_test dir). To facilitate subsequent testing. I've tested the others, and the function itself should be fine. Great.

@sosyz
Copy link
Member Author

sosyz commented Mar 13, 2025

Some update: I've added high concurrency tests and discovered issues that I'm currently working to resolve.

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