sosyz opened a new pull request, #1265:
URL: https://github.com/apache/answer/pull/1265

   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`](diffhunk://#diff-e090fec2ea91edc066c99cb29c3924f4c2dd3cdfdca1d837eb6bc4fc392effb1R1-R32):
 Added a new `PluginKVStorage` entity to represent the key-value storage for 
plugins.
   
   * 
[`internal/migrations/init_data.go`](diffhunk://#diff-bdb95a0a0a7810cc004818076508e55a43570122b01225b0fe16553129ccd634R77):
 Included the `PluginKVStorage` entity in the initial data setup.
   
   * 
[`internal/migrations/migrations.go`](diffhunk://#diff-70a6663d7610d0c0ea546d5f8464ff8eacf238af79d65443da1a5dcacc52e1beR103):
 Added a new migration to create the `plugin_kv_storage` table.
   
   * 
[`internal/migrations/v25.go`](diffhunk://#diff-b37a969511bc055d298539051cc1031c36a6be751fcba441d4fb7efe742ba5a2R1-R31):
 Implemented the `addPluginKVStorage` function to handle the migration for the 
new table.
   
   * 
[`internal/service/plugin_common/plugin_common_service.go`](diffhunk://#diff-cb460c7cd16c53f9845ae3b87cb840d4316eaa1fb7bab1bb25f791d3ca19acf7R138-R142):
 Updated the `PluginCommonService` to initialize the key-value storage database 
connection.
   
   ### Implementation of Key-Value Storage Functionality
   
   * 
[`plugin/kv_storage.go`](diffhunk://#diff-3c8291830a8b1c4935eaf1f9833026615611bb8b620ae8b90d23eb0ee761fc3eR1-R344):
 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`](diffhunk://#diff-f42d64c75c9ca7a08c149ea609687764f2abcd3a79ae4e77110c6ae44ba36e9fR26-R40):
 Updated the plugin registration to handle key-value storage plugins and 
defined the `Data` struct to avoid circular dependencies. 
[[1]](diffhunk://#diff-f42d64c75c9ca7a08c149ea609687764f2abcd3a79ae4e77110c6ae44ba36e9fR26-R40)
 
[[2]](diffhunk://#diff-f42d64c75c9ca7a08c149ea609687764f2abcd3a79ae4e77110c6ae44ba36e9fR125-R128)
   
   
   ### Testing
   I've created a [test 
plugin](https://github.com/sosyz/answer/blob/test/kv_stroage_plugin/ui/src/plugins/test/test.go)
 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!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to