-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: dev
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
func (kv *KVOperator) GetByGroup(ctx context.Context, group string, page, pageSize int) (map[string]string, error) { |
There was a problem hiding this comment.
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.
@sosyz I think you wrote a great test case and like you said, it should be added to this repository(maybe |
Some update: I've added high concurrency tests and discovered issues that I'm currently working to resolve. |
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
internal/entity/plugin_kv_storage_entity.go
: Added a newPluginKVStorage
entity to represent the key-value storage for plugins.internal/migrations/init_data.go
: Included thePluginKVStorage
entity in the initial data setup.internal/migrations/migrations.go
: Added a new migration to create theplugin_kv_storage
table.internal/migrations/v25.go
: Implemented theaddPluginKVStorage
function to handle the migration for the new table.internal/service/plugin_common/plugin_common_service.go
: Updated thePluginCommonService
to initialize the key-value storage database connection.Implementation of Key-Value Storage Functionality
plugin/kv_storage.go
: Implemented theKVOperator
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 theData
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!