Skip to content

Commit

Permalink
Add ndc_models_version to try_init_state
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljharvey committed Jul 18, 2024
1 parent 83a906e commit 75bee09
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
38 changes: 37 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ tracing = "0.1.40"
tracing-opentelemetry = "0.23.0"
tracing-subscriber = { version = "0.3", default-features = false, features = ["ansi", "env-filter", "fmt", "json"] }
url = "2.5.0"
versions = "6.3.0"

[dev-dependencies]
axum-test-helper = "0.3.0"
1 change: 1 addition & 0 deletions crates/sdk/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@ pub trait ConnectorSetup {
&self,
configuration: &<Self::Connector as Connector>::Configuration,
metrics: &mut prometheus::Registry,
ndc_models_versions: &Option<versions::SemVer>,
) -> Result<<Self::Connector as Connector>::State, InitializationError>;
}
1 change: 1 addition & 0 deletions crates/sdk/src/connector/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ impl ConnectorSetup for Example {
&self,
_configuration: &<Self as Connector>::Configuration,
_metrics: &mut prometheus::Registry,
_ndc_models_version: &Option<versions::SemVer>,
) -> Result<<Self as Connector>::State, InitializationError> {
Ok(())
}
Expand Down
8 changes: 6 additions & 2 deletions crates/sdk/src/default_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ pub async fn init_server_state<Setup: ConnectorSetup>(
) -> Result<ServerState<Setup::Connector>, Box<dyn Error + Send + Sync>> {
let mut metrics = Registry::new();
let configuration = setup.parse_configuration(config_directory).await?;
let state = setup.try_init_state(&configuration, &mut metrics).await?;
let state = setup
.try_init_state(&configuration, &mut metrics, &None)
.await?;
Ok(ServerState::new(configuration, state, metrics))
}

Expand Down Expand Up @@ -582,7 +584,9 @@ mod ndc_test_commands {
) -> Result<ConnectorAdapter<Setup::Connector>, Box<dyn Error + Send + Sync>> {
let mut metrics = Registry::new();
let configuration = setup.parse_configuration(configuration_path).await?;
let state = setup.try_init_state(&configuration, &mut metrics).await?;
let state = setup
.try_init_state(&configuration, &mut metrics, &None)
.await?;
Ok(ConnectorAdapter {
configuration,
state,
Expand Down

0 comments on commit 75bee09

Please sign in to comment.