Skip to content

Commit

Permalink
Use hook for creating sharded table to make it clean
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Aug 31, 2023
1 parent b815d03 commit bbcce33
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Lib/QueryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Exception;
use Manticoresearch\Buddy\Base\Exception\SQLQueryCommandNotSupported;
use Manticoresearch\Buddy\Base\Network\EventHandler;
use Manticoresearch\Buddy\Base\Sharding\Thread as ShardingThread;
use Manticoresearch\Buddy\Core\ManticoreSearch\Client as HTTPClient;
use Manticoresearch\Buddy\Core\ManticoreSearch\Settings as ManticoreSettings;
use Manticoresearch\Buddy\Core\ManticoreSearch\Settings;
Expand Down Expand Up @@ -199,6 +200,7 @@ public static function detectPluginPrefixFromRequest(Request $request): string {
*/
protected static function getHooks(): array {
return [
// Happens when we installed the external plugin
[
'manticoresoftware/buddy-plugin-plugin',
'installed',
Expand All @@ -207,6 +209,7 @@ function () {
EventHandler::setShouldExit(true);
},
],
// Happens when we remove the plugin
[
'manticoresoftware/buddy-plugin-plugin',
'deleted',
Expand All @@ -215,6 +218,14 @@ function () {
EventHandler::setShouldExit(true);
},
],
// Happens when we run create table with shards in options
[
'manticoresoftware/buddy-plugin-create-table',
'shard',
function (array $args) {
ShardingThread::instance()->execute('shard', $args);
},
],
];
}
}

0 comments on commit bbcce33

Please sign in to comment.