diff --git a/rust-connector-sdk/src/connector.rs b/rust-connector-sdk/src/connector.rs index 904e653a..92619cab 100644 --- a/rust-connector-sdk/src/connector.rs +++ b/rust-connector-sdk/src/connector.rs @@ -1,7 +1,7 @@ use async_trait::async_trait; use ndc_client::models; use serde::Serialize; -use std::error::Error; +use std::{collections::HashMap, error::Error}; use thiserror::Error; pub mod example; @@ -189,14 +189,12 @@ pub trait Connector { /// The type of unserializable state type State; - /// Return any read regions defined in the connector's configuration - fn get_read_regions(_config: &Self::Configuration) -> Vec { - vec![] - } - - /// Return any write regions defined in the connector's configuration - fn get_write_regions(_config: &Self::Configuration) -> Vec { - vec![] + /// Creates the region configuration map + fn make_region_configuration_map( + _raw_config: &Self::RawConfiguration, + ) -> HashMap> { + // Defaults to an empty map + HashMap::new() } fn make_empty_configuration() -> Self::RawConfiguration; @@ -288,3 +286,14 @@ pub trait Connector { request: models::QueryRequest, ) -> Result; } + +pub enum ConnectorMode { + ReadOnly, + ReadWrite, + WriteOnly, +} + +pub struct RegionConfiguration { + pub config: ::Configuration, + pub mode: ConnectorMode, +} diff --git a/rust-connector-sdk/src/connector/example.rs b/rust-connector-sdk/src/connector/example.rs index af031378..9140f559 100644 --- a/rust-connector-sdk/src/connector/example.rs +++ b/rust-connector-sdk/src/connector/example.rs @@ -17,14 +17,6 @@ impl Connector for Example { fn make_empty_configuration() -> Self::RawConfiguration {} - fn get_read_regions(_config: &Self::Configuration) -> Vec { - Vec::new() - } - - fn get_write_regions(_config: &Self::Configuration) -> Vec { - Vec::new() - } - async fn update_configuration( _config: &Self::RawConfiguration, ) -> Result {