Skip to content

Commit fc987ac

Browse files
committed
backend: disable list_files() due slowness (flat namespace)
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent cf7aa5f commit fc987ac

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/azure.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -648,12 +648,17 @@ impl super::Driver for AzureDriver {
648648
});
649649
received_file
650650
}
651-
fn list_files(&self, directory: String) -> Vec<String> {
652-
let mut ret = Vec::new();
653-
tokio::task::block_in_place(|| {
654-
let rt = tokio::runtime::Runtime::new().unwrap();
655-
ret = rt.block_on(azure_list_files(directory));
656-
});
657-
ret
651+
// Disabled: listing files on Azure Blob Storage is extremely slow due to
652+
// the flat namespace requiring enumeration of all blobs with prefix filtering.
653+
// For large containers this can take minutes and time out.
654+
// The HTTP handler (ax_list_files) returns 403 Forbidden for Azure backends.
655+
fn list_files(&self, _directory: String) -> Vec<String> {
656+
// let mut ret = Vec::new();
657+
// tokio::task::block_in_place(|| {
658+
// let rt = tokio::runtime::Runtime::new().unwrap();
659+
// ret = rt.block_on(azure_list_files(directory));
660+
// });
661+
// ret
662+
Vec::new()
658663
}
659664
}

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,11 @@ fn verify_auth_hdr(headers: &HeaderMap) -> Result<String, Option<String>> {
12221222

12231223
async fn ax_list_files() -> (StatusCode, String) {
12241224
let driver_name = get_driver_type();
1225+
// Listing files is disabled for Azure backend because it is too slow
1226+
// (flat blob namespace requires enumerating all blobs with prefix filtering).
1227+
if driver_name == "azure" {
1228+
return (StatusCode::FORBIDDEN, "Listing files is disabled for Azure storage backend".to_string());
1229+
}
12251230
let driver = init_driver(&driver_name);
12261231
let files = driver.list_files("/".to_string());
12271232
// generate nice list of files, with one file per line

0 commit comments

Comments
 (0)