Skip to content

Commit

Permalink
remove get_x_region
Browse files Browse the repository at this point in the history
add `make_region_configuration_map`
  • Loading branch information
paritosh-08 committed Oct 4, 2023
1 parent 3248df5 commit 1ee69d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
27 changes: 18 additions & 9 deletions rust-connector-sdk/src/connector.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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<String> {
vec![]
}

/// Return any write regions defined in the connector's configuration
fn get_write_regions(_config: &Self::Configuration) -> Vec<String> {
vec![]
/// Creates the region configuration map
fn make_region_configuration_map(
_raw_config: &Self::RawConfiguration,
) -> HashMap<String, RegionConfiguration<Self>> {
// Defaults to an empty map
HashMap::new()
}

fn make_empty_configuration() -> Self::RawConfiguration;
Expand Down Expand Up @@ -288,3 +286,14 @@ pub trait Connector {
request: models::QueryRequest,
) -> Result<models::QueryResponse, QueryError>;
}

pub enum ConnectorMode {
ReadOnly,
ReadWrite,
WriteOnly,
}

pub struct RegionConfiguration<C: Connector + ?Sized> {
pub config: <C as Connector>::Configuration,
pub mode: ConnectorMode,
}
8 changes: 0 additions & 8 deletions rust-connector-sdk/src/connector/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ impl Connector for Example {

fn make_empty_configuration() -> Self::RawConfiguration {}

fn get_read_regions(_config: &Self::Configuration) -> Vec<String> {
Vec::new()
}

fn get_write_regions(_config: &Self::Configuration) -> Vec<String> {
Vec::new()
}

async fn update_configuration(
_config: &Self::RawConfiguration,
) -> Result<Self::RawConfiguration, UpdateConfigurationError> {
Expand Down

0 comments on commit 1ee69d9

Please sign in to comment.