Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
diqiu50 committed Jan 3, 2025
1 parent aeffc3c commit c175ec7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions clients/filesystem-fuse/src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub(crate) const ROOT_DIR_FILE_ID: u64 = 1;
pub(crate) const ROOT_DIR_NAME: &str = "";
pub(crate) const ROOT_DIR_PATH: &str = "/";
pub(crate) const INITIAL_FILE_ID: u64 = 10000;

// File system meta file is indicated the fuse filesystem is active.
pub(crate) const FS_META_FILE_PATH: &str = "/.gvfs_meta";
pub(crate) const FS_META_FILE_NAME: &str = ".gvfs_meta";
pub(crate) const FS_META_FILE_ID: u64 = 10;
Expand Down
25 changes: 18 additions & 7 deletions clients/filesystem-fuse/src/s3_filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,24 @@ impl S3FileSystem {
let bucket = extract_bucket(&fileset.storage_location)?;
opendal_config.insert("bucket".to_string(), bucket);

let endpoint = catalog.properties.get("s3-endpoint");
if endpoint.is_none() {
return Err(OpenDalError.to_error("s3-endpoint is not found in catalog"));
}
let endpoint = endpoint.unwrap();
let region = extract_region(endpoint)?;
opendal_config.insert("region".to_string(), region);
let region = {
if let Some(region) = catalog.properties.get("region") {
Some(region.clone())
} else if let Some(endpoint) = catalog.properties.get("s3-endpoint") {
extract_region(endpoint).ok()
} else {
None
}
};
match region {
Some(region) => opendal_config.insert("region".to_string(), region),
None => {
return Err(InvalidConfig.to_error(format!(
"Cant not retrieve region in the Catalog {}",
catalog.name
)));
}
};

let builder = S3::from_map(opendal_config);

Expand Down

0 comments on commit c175ec7

Please sign in to comment.