Skip to content

Commit

Permalink
add bound to SourceProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
xxchan committed Dec 25, 2023
1 parent 3b01ed2 commit 30f499f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/connector/src/source/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub(crate) use crate::source::common::CommonSplitReader;
use crate::source::filesystem::opendal_source::OpendalS3Properties;
use crate::source::filesystem::{FsPageItem, GcsProperties, S3Properties};
use crate::source::monitor::EnumeratorMetrics;
use crate::with_options::WithOptions;
use crate::{
dispatch_source_prop, dispatch_split_impl, for_all_sources, impl_connector_properties,
impl_split, match_source_name_str,
Expand All @@ -61,7 +62,7 @@ pub trait TryFromHashmap: Sized {
fn try_from_hashmap(props: HashMap<String, String>) -> Result<Self>;
}

pub trait SourceProperties: TryFromHashmap + Clone {
pub trait SourceProperties: TryFromHashmap + Clone + WithOptions {
const SOURCE_NAME: &'static str;
type Split: SplitMetaData + TryFrom<SplitImpl, Error = anyhow::Error> + Into<SplitImpl>;
type SplitEnumerator: SplitEnumerator<Properties = Self, Split = Self::Split>;
Expand Down
3 changes: 3 additions & 0 deletions src/connector/src/with_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ use std::collections::HashMap;
/// Dummy trait for `WITH` options. Only for `#[derive(WithOptions)]`, should not be used manually.
///
/// This is used to ensure the `WITH` options types have reasonable structure.
///
/// TODO: add this bound for sink. There's a `SourceProperties` trait for sources, but no similar
/// things for sinks.
pub trait WithOptions {
#[doc(hidden)]
#[inline(always)]
Expand Down

0 comments on commit 30f499f

Please sign in to comment.