Skip to content

Commit 8af0d99

Browse files
committed
move information schema table factories trait to standalone
1 parent 857c3e7 commit 8af0d99

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

src/cmd/src/extension/standalone.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ use flow::FrontendClient;
2525
#[cfg(feature = "enterprise")]
2626
use operator::statement::TriggerQuerierRef;
2727

28-
use crate::extension::common::{InformationSchemaTableFactories, TableFactoryContext};
29-
28+
/// The extension point for standalone instance.
3029
#[derive(Default)]
3130
pub struct Extension {
3231
#[cfg(feature = "enterprise")]
@@ -35,7 +34,7 @@ pub struct Extension {
3534
pub trigger_querier: Option<TriggerQuerierRef>,
3635
}
3736

38-
/// Factory trait to create Extension instances.
37+
/// Factory trait to create Extension instance.
3938
pub trait ExtensionFactory: InformationSchemaTableFactories + Send + Sync {
4039
fn create(
4140
&self,
@@ -49,6 +48,28 @@ pub struct ExtensionContext {
4948
pub frontend_client: Arc<FrontendClient>,
5049
}
5150

51+
/// Provides additional information schema table factories beyond the built-in
52+
/// ones.
53+
///
54+
/// These are typically provided by enterprise or optional modules, such as:
55+
/// - `information_schema.triggers`
56+
/// - `information_schema.alerts`
57+
#[async_trait::async_trait]
58+
pub trait InformationSchemaTableFactories: Send + Sync {
59+
async fn create_factories(
60+
&self,
61+
ctx: TableFactoryContext,
62+
) -> Result<HashMap<String, InformationSchemaTableFactoryRef>, BoxedError>;
63+
}
64+
65+
pub type InformationSchemaTableFactoriesRef = Arc<dyn InformationSchemaTableFactories>;
66+
67+
/// Context for information schema table factory providers.
68+
pub struct TableFactoryContext {
69+
pub fe_client: Arc<FrontendClient>,
70+
}
71+
72+
/// Default no-op implementation of ExtensionFactory.
5273
pub struct DefaultExtensionFactory;
5374

5475
#[async_trait::async_trait]

src/cmd/src/standalone.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ use standalone::options::StandaloneOptions;
6666
use tracing_appender::non_blocking::WorkerGuard;
6767

6868
use crate::error::{OtherSnafu, Result, StartFlownodeSnafu};
69-
use crate::extension::common::TableFactoryContext;
70-
use crate::extension::standalone::{ExtensionContext, ExtensionFactory};
69+
use crate::extension::standalone::{ExtensionContext, ExtensionFactory, TableFactoryContext};
7170
use crate::options::{GlobalOptions, GreptimeOptions};
7271
use crate::{App, create_resource_limit_metrics, error, log_versions, maybe_activate_heap_profile};
7372

src/meta-srv/src/metasrv/builder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ impl MetasrvBuilder {
418418
} else {
419419
ddl_manager
420420
};
421+
#[cfg(not(feature = "enterprise"))]
422+
let _ = extension;
421423

422424
let ddl_manager = Arc::new(ddl_manager);
423425

0 commit comments

Comments
 (0)