MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / ls

Method ls

tiledb/sm/array/array_directory.cc:591–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

589}
590
591std::vector<URI> ArrayDirectory::ls(const URI& uri) const {
592 auto dir_entries = resources_.get().vfs().ls_with_sizes(uri);
593 auto& dirs = dir_names();
594 std::vector<URI> uris;
595 uris.reserve(dir_entries.size());
596
597 for (auto entry : dir_entries) {
598 auto entry_uri = URI(entry.path().native());
599
600 // Always list directories
601 if (entry.is_directory()) {
602 uris.emplace_back(entry_uri);
603 continue;
604 }
605
606 // Filter out empty files of the same name as the directory
607 if (entry_uri.remove_trailing_slash() == uri.remove_trailing_slash() &&
608 entry.file_size() == 0) {
609 continue;
610 }
611
612 // List non-known (user-added) directory names and non-empty files
613 auto iter = dirs.find(entry_uri.last_path_part());
614 if (iter == dirs.end() || entry.file_size() > 0) {
615 uris.emplace_back(entry_uri);
616 } else {
617 // Handle MinIO-based s3 implementation limitation. If an object exists
618 // with the same name as a directory, the objects under the directory are
619 // masked and cannot be listed. See
620 // https://github.com/minio/minio/issues/7335
621 throw ArrayDirectoryException(
622 "Cannot list given uri; File '" + entry_uri.to_string() +
623 "' may be masking a non-empty directory by the same name. Removing "
624 "that file might fix this.");
625 }
626 }
627
628 return uris;
629}
630
631std::vector<URI> ArrayDirectory::list_root_dir_uris() {
632 // List the array directory URIs

Callers

nothing calls this directly

Calls 14

vfsMethod · 0.80
pathMethod · 0.80
is_directoryMethod · 0.80
last_path_partMethod · 0.80
to_stringMethod · 0.80
URIClass · 0.50
ls_with_sizesMethod · 0.45
getMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
remove_trailing_slashMethod · 0.45

Tested by

no test coverage detected