Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions examples/basic_example_proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ publish = false

[dependencies]
databricks-zerobus-ingest-sdk = { path = "../../sdk" }
tonic-build = "0.13.1"
prost = "0.13.3"
prost-build = "0.12"
prost-reflect = "0.14.2"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1.16"
tonic = { version = "0.12.3", features = ["tls"] }
tracing = "0.1.41"
prost = "0.14.1"
prost-reflect = "0.16.2"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
chrono = "0.4"
17 changes: 9 additions & 8 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@ documentation = "https://docs.rs/databricks-zerobus-ingest-sdk"

[dependencies]
async-trait = "0.1"
prost = "0.13.3"
prost-types = "0.13.3"
prost = "0.14.1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gotocoding-DB expressed a concern regarding this how we use an older version in Universe and thus this would make it harder to import the SDK into Universe. We'd need to bump up the Universe version which is a bit of a hassle.

prost-types = "0.14.1"
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false }
serde_json = "1.0"
thiserror = "1.0"
tokio = { version = "1.42.0", features = ["macros", "rt-multi-thread", "fs"] }
thiserror = "2.0.17"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "fs"] }
tokio-retry = "0.3"
tokio-stream = "0.1.16"
tonic = { version = "0.12.3", features = ["tls", "tls-native-roots", "transport"] }
tokio-stream = "0.1"
tonic = { version = "0.14.2", features = ["tls-aws-lc", "transport", "tls-native-roots"] }
tonic-prost = "0.14.2"
tracing = "0.1.41"

[build-dependencies]
tonic-build = "0.12.3"
protoc-bin-vendored = "3.0.0"
tonic-prost-build = "0.14.2"
protoc-bin-vendored = "3"

[features]
testing = []
2 changes: 1 addition & 1 deletion sdk/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
std::env::set_var("PROTOC", protoc_bin_vendored::protoc_bin_path().unwrap());
tonic_build::compile_protos("zerobus_service.proto")
tonic_prost_build::compile_protos("zerobus_service.proto")
.unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e));
}
17 changes: 7 additions & 10 deletions sdk/src/default_token_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ impl DefaultTokenFactory {
"type": "unity_catalog_privileges",
"privileges": ["USE SCHEMA"],
"object_type": "SCHEMA",
"object_full_path": format!("{}.{}", catalog, schema)
"object_full_path": format!("{catalog}.{schema}")
},
{
"type": "unity_catalog_privileges",
"privileges": ["SELECT", "MODIFY"],
"object_type": "TABLE",
"object_full_path": format!("{}.{}.{}", catalog, schema, table)
"object_full_path": format!("{catalog}.{schema}.{table}")
}
]);

Expand All @@ -66,24 +66,21 @@ impl DefaultTokenFactory {
("scope", "all-apis".to_string()),
(
"resource",
format!(
"api://databricks/workspaces/{}/zerobusDirectWriteApi",
workspace_id
)
.to_string(),
format!("api://databricks/workspaces/{workspace_id}/zerobusDirectWriteApi")
.to_string(),
),
("authorization_details", authorization_details.to_string()),
];

let token_endpoint = format!("{}/oidc/v1/token", uc_endpoint);
let token_endpoint = format!("{uc_endpoint}/oidc/v1/token");
let resp = client
.post(&token_endpoint)
.basic_auth(databricks_client_id, Some(databricks_client_secret))
.form(&params)
.send()
.await
.map_err(|e| {
ZerobusError::InvalidUCTokenError(format!("Request failed with error: {}", e))
ZerobusError::InvalidUCTokenError(format!("Request failed with error: {e}"))
})?;

if !resp.status().is_success() {
Expand All @@ -100,7 +97,7 @@ impl DefaultTokenFactory {
}

let body: serde_json::Value = resp.json().await.map_err(|e| {
ZerobusError::InvalidUCTokenError(format!("Parse failed with error: {}", e))
ZerobusError::InvalidUCTokenError(format!("Parse failed with error: {e}"))
})?;

let token = body["access_token"]
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/headers_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl HeadersProvider for OAuthHeadersProvider {
)
.await?;
let mut headers = HashMap::new();
headers.insert("authorization", format!("Bearer {}", token));
headers.insert("authorization", format!("Bearer {token}"));
headers.insert("x-databricks-zerobus-table-name", self.table_name.clone());
Ok(headers)
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/landing_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ mod tests {
assert!(all_items.contains(&"item1".to_string()));
assert!(all_items.contains(&"item2".to_string()));

assert!(lz.len() == 0);
assert_eq!(lz.len(), 0);
}

#[tokio::test]
Expand All @@ -280,7 +280,7 @@ mod tests {
_ = tokio::time::sleep(Duration::from_millis(50)) => {
// This is expected, the task is still blocked.
}
};
}

// Remove one item to free up space.
let _observed = lz.observe().await;
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/stream_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct StreamConfigurationOptions {
/// Maximum number of records that can be sending or pending acknowledgement at any given time.
///
/// This limit controls memory usage and backpressure. When this limit is reached,
/// `ingest_record()` calls will block until acknowledgments free up space.
/// `ingest_record()` calls will block until acknowledgements free up space.
///
/// Default: 1,000,000
pub max_inflight_records: usize,
Expand Down
15 changes: 8 additions & 7 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ path = "src/rust_tests.rs"

[dependencies]
async-trait = "0.1"
prost = "0.13.3"
prost-reflect = "0.14"
prost-types = "0.13.3"
tokio = { version = "1.42.0", features = ["macros", "rt-multi-thread", "sync", "time"] }
prost = "0.14.1"
prost-reflect = "0.16.2"
prost-types = "0.14.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync", "time"] }
tokio-stream = { version = "0.1.16", features = ["net"] }
tonic = { version = "0.12.3", features = ["transport"] }
tonic = { version = "0.14.2", features = ["transport"] }
tonic-prost = "0.14.2"
tracing = "0.1.41"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
databricks-zerobus-ingest-sdk = { path = "../sdk", features = ["testing"] }

[build-dependencies]
tonic-build = "0.12.3"
protoc-bin-vendored = "3.0.0"
tonic-prost-build = "0.14.2"
protoc-bin-vendored = "3"
9 changes: 4 additions & 5 deletions tests/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
fn main() -> Result<(), std::io::Error> {
std::env::set_var("PROTOC", protoc_bin_vendored::protoc_bin_path().unwrap());
tonic_prost_build::configure()
.build_server(true)
.build_client(false)
.compile_protos(&["../sdk/zerobus_service.proto"], &["../sdk"])?;

Ok(())
.compile_protos(&["../sdk/zerobus_service.proto"], &["../sdk"])
}
4 changes: 1 addition & 3 deletions tools/generate_files/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
urlencoding = "2"
tonic-build = "0.12.3"
tonic-prost-build = "0.14.2"
tempfile = "3.21.0"
prost = "0.12"
tonic = "0.12"

[build-dependencies]
protoc-bin-vendored = "3"
2 changes: 1 addition & 1 deletion tools/generate_files/src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ pub fn generate_rust_and_descriptor(
.context("bad filename")?;
let desc_file = output_dir.join(format!("{}.descriptor", file_name));

tonic_build::configure()
tonic_prost_build::configure()
.out_dir(output_dir)
.file_descriptor_set_path(&desc_file)
.compile_protos(
Expand Down
Loading