Skip to content

Commit a2661e4

Browse files
authored
Support Alibaba Cloud OSS with ObjectStore (#567)
1 parent 20891ae commit a2661e4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ballista/core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ hashbrown = "0.13"
5858
itertools = "0.10"
5959
libloading = "0.7.3"
6060
log = "0.4"
61-
object_store = "0.5.0"
61+
object_store = "0.5.2"
6262
once_cell = "1.9.0"
6363

6464
parking_lot = "0.12"

ballista/core/src/utils.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,24 @@ impl ObjectStoreProvider for FeatureBasedObjectStoreProvider {
9999

100100
#[cfg(feature = "s3")]
101101
{
102-
if url.to_string().starts_with("s3://") {
102+
if url.as_str().starts_with("s3://") {
103103
if let Some(bucket_name) = url.host_str() {
104104
let store = AmazonS3Builder::from_env()
105105
.with_bucket_name(bucket_name)
106106
.build()?;
107107
return Ok(Arc::new(store));
108108
}
109+
// Support Alibaba Cloud OSS
110+
// Use S3 compatibility mode to access Alibaba Cloud OSS
111+
// The `AWS_ENDPOINT` should have bucket name included
112+
} else if url.as_str().starts_with("oss://") {
113+
if let Some(bucket_name) = url.host_str() {
114+
let store = AmazonS3Builder::from_env()
115+
.with_virtual_hosted_style_request(true)
116+
.with_bucket_name(bucket_name)
117+
.build()?;
118+
return Ok(Arc::new(store));
119+
}
109120
}
110121
}
111122

0 commit comments

Comments
 (0)