Skip to main content

plugins/
meta_srv.rs

1// Copyright 2023 Greptime Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use common_base::Plugins;
16use meta_srv::bootstrap::MetasrvInstance;
17use meta_srv::error::Result;
18use meta_srv::metasrv::MetasrvOptions;
19use meta_srv::metasrv::builder::MetasrvBuilder;
20
21use crate::options::PluginOptions;
22
23/// Sets up metasrv plugins before the [`MetasrvBuilder`] is constructed.
24///
25/// Plugins registered here are available during builder construction
26/// (e.g., `SelectorFactoryRef`).
27#[allow(unused_variables)]
28pub async fn setup_metasrv_plugins_pre_build(
29    plugins: &mut Plugins,
30    plugin_options: &[PluginOptions],
31    _metasrv_opts: &MetasrvOptions,
32) -> Result<()> {
33    Ok(())
34}
35
36/// Sets up metasrv plugins after the [`MetasrvBuilder`] is constructed
37/// but before [`MetasrvBuilder::build()`].
38///
39/// Plugins can read context from the builder (e.g., kv_backend, options)
40/// and insert additional plugins. After this call, [`MetasrvBuilder::plugins()`]
41/// should be called to set plugins on the builder.
42#[allow(unused_variables)]
43pub async fn setup_metasrv_plugins_post_build(
44    plugins: &mut Plugins,
45    plugin_options: &[PluginOptions],
46    builder: &MetasrvBuilder,
47) -> Result<()> {
48    Ok(())
49}
50
51pub async fn start_metasrv_plugins(_instance: &MetasrvInstance) -> Result<()> {
52    Ok(())
53}