mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-26 21:56:17 +00:00
feat: make frontend heartbeat extensible and lifecycle-safe (#8726)
* feat: make frontend heartbeat extensible and lifecycle-safe Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: isolate heartbeat extension response handlers Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: cancel in-flight heartbeat response handling Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test: cover heartbeat wire compatibility Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: clean up failed heartbeat startup Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: address frontend heartbeat review feedback Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> (cherry picked from commit 6ffa27bc8e78b5e11b2db3d2a898438446b298be)
This commit is contained in:
@@ -12,11 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use auth::{DefaultPermissionChecker, PermissionCheckerRef, UserProviderRef};
|
||||
use common_base::Plugins;
|
||||
use common_meta::cache::CacheRegistryBuilder;
|
||||
use frontend::error::{IllegalAuthConfigSnafu, Result};
|
||||
use frontend::frontend::FrontendOptions;
|
||||
use frontend::heartbeat::FrontendHeartbeatExtensions;
|
||||
use frontend::instance::Instance;
|
||||
use frontend::instance::builder::FrontendBuilder;
|
||||
use snafu::ResultExt;
|
||||
@@ -64,6 +67,20 @@ pub async fn setup_frontend_plugins_post_build(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Sets up heartbeat extensions after the frontend [`Instance`] is available.
|
||||
///
|
||||
/// Implementations may use the instance to construct extensions and register them in the
|
||||
/// [`FrontendHeartbeatExtensions`] stored in `plugins`. Registrations must be idempotent because
|
||||
/// plugin setup can be invoked more than once.
|
||||
pub async fn setup_frontend_heartbeat_extensions(
|
||||
plugins: &mut Plugins,
|
||||
_plugin_options: &[PluginOptions],
|
||||
_instance: &Arc<Instance>,
|
||||
) -> Result<()> {
|
||||
plugins.get_or_insert(FrontendHeartbeatExtensions::default);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn start_frontend_plugins(_instance: &Instance) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ pub use flownode::{
|
||||
setup_flownode_plugins_post_build, setup_flownode_plugins_pre_build, start_flownode_plugins,
|
||||
};
|
||||
pub use frontend::{
|
||||
setup_frontend_plugins_post_build, setup_frontend_plugins_pre_build, start_frontend_plugins,
|
||||
setup_frontend_heartbeat_extensions, setup_frontend_plugins_post_build,
|
||||
setup_frontend_plugins_pre_build, start_frontend_plugins,
|
||||
};
|
||||
pub use meta_srv::{
|
||||
setup_metasrv_plugins_post_build, setup_metasrv_plugins_pre_build, start_metasrv_plugins,
|
||||
|
||||
Reference in New Issue
Block a user