Skip to main content

plugins/
datanode.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 datanode::config::DatanodeOptions;
17use datanode::datanode::{Datanode, DatanodeBuilder};
18use datanode::error::Result;
19
20use crate::options::PluginOptions;
21
22/// Sets up datanode plugins before the [`DatanodeBuilder`] is constructed.
23#[allow(unused_variables)]
24#[allow(unused_mut)]
25pub async fn setup_datanode_plugins_pre_build(
26    plugins: &mut Plugins,
27    plugin_options: &[PluginOptions],
28    dn_opts: &DatanodeOptions,
29) -> Result<()> {
30    Ok(())
31}
32
33/// Sets up datanode plugins after the [`DatanodeBuilder`] is constructed
34/// but before [`DatanodeBuilder::build()`].
35///
36/// Plugins can read context from the builder (e.g., kv_backend, options)
37/// and insert additional plugins. After this call, [`DatanodeBuilder::set_plugins()`]
38/// should be called to sync plugins into the builder.
39#[allow(unused_variables)]
40pub async fn setup_datanode_plugins_post_build(
41    plugins: &mut Plugins,
42    plugin_options: &[PluginOptions],
43    builder: &DatanodeBuilder,
44) -> Result<()> {
45    Ok(())
46}
47
48pub async fn start_datanode_plugins(_instance: &Datanode) -> Result<()> {
49    Ok(())
50}