File tree Expand file tree Collapse file tree 17 files changed +30
-23
lines changed
Expand file tree Collapse file tree 17 files changed +30
-23
lines changed Original file line number Diff line number Diff line change @@ -638,7 +638,7 @@ std::vector<std::string> Azure::ls(
638638 return paths;
639639}
640640
641- std::vector<directory_entry> Azure::ls_with_sizes (const URI& uri) const {
641+ std::vector<directory_entry> Azure::ls_with_sizes (const URI& uri, bool ) const {
642642 return ls_with_sizes (uri, " /" );
643643}
644644
Original file line number Diff line number Diff line change @@ -459,7 +459,7 @@ class Azure : public FilesystemBase {
459459 * @return All entries that are contained in the prefix URI.
460460 */
461461 std::vector<tiledb::common::filesystem::directory_entry> ls_with_sizes (
462- const URI& uri) const override ;
462+ const URI& uri, bool get_sizes ) const override ;
463463
464464 /* *
465465 * Lists objects and object information that start with `uri`.
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ class FailingFS : public FilesystemBase {
8888 }
8989
9090 virtual std::vector<tiledb::common::filesystem::directory_entry>
91- ls_with_sizes (const URI&) const override {
91+ ls_with_sizes (const URI&, bool ) const override {
9292 throw get_exception ();
9393 }
9494
Original file line number Diff line number Diff line change @@ -147,10 +147,11 @@ class FilesystemBase {
147147 * Retrieves all the entries contained in the parent.
148148 *
149149 * @param parent The target directory to list.
150+ * @param get_sizes Flag to toggle retrieving file sizes.
150151 * @return All entries that are contained in the parent
151152 */
152153 virtual std::vector<tiledb::common::filesystem::directory_entry>
153- ls_with_sizes (const URI& parent) const = 0 ;
154+ ls_with_sizes (const URI& parent, bool get_sizes = true ) const = 0 ;
154155
155156 /* *
156157 * Lists objects and object information that start with `prefix`, invoking
Original file line number Diff line number Diff line change @@ -510,7 +510,7 @@ std::vector<directory_entry> GCS::ls_with_sizes(
510510 return entries;
511511}
512512
513- std::vector<directory_entry> GCS::ls_with_sizes (const URI& uri) const {
513+ std::vector<directory_entry> GCS::ls_with_sizes (const URI& uri, bool ) const {
514514 return ls_with_sizes (uri, " /" , -1 );
515515}
516516
Original file line number Diff line number Diff line change @@ -358,7 +358,7 @@ class GCS : public FilesystemBase {
358358 * @return A list of directory_entry objects.
359359 */
360360 std::vector<tiledb::common::filesystem::directory_entry> ls_with_sizes (
361- const URI& uri) const override ;
361+ const URI& uri, bool get_sizes ) const override ;
362362
363363 /* *
364364 * Copies the directory at 'old_uri' to `new_uri`.
Original file line number Diff line number Diff line change @@ -381,15 +381,15 @@ Status MemFilesystem::ls(
381381 const std::string& path, std::vector<std::string>* const paths) const {
382382 iassert (paths);
383383
384- for (auto & fs : ls_with_sizes (URI (path))) {
384+ for (auto & fs : ls_with_sizes (URI (path), true )) {
385385 paths->emplace_back (fs.path ().native ());
386386 }
387387
388388 return Status::Ok ();
389389}
390390
391391std::vector<directory_entry> MemFilesystem::ls_with_sizes (
392- const URI& path) const {
392+ const URI& path, bool ) const {
393393 auto abspath = path.to_path ();
394394 std::vector<std::string> tokens = tokenize (abspath);
395395
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ class MemFilesystem : public FilesystemBase {
159159 * @return A list of directory_entry objects
160160 */
161161 std::vector<tiledb::common::filesystem::directory_entry> ls_with_sizes (
162- const URI& path) const override ;
162+ const URI& path, bool get_sizes ) const override ;
163163
164164 /* *
165165 * Move a given filesystem path.
Original file line number Diff line number Diff line change @@ -361,7 +361,8 @@ void Posix::write(
361361 }
362362}
363363
364- std::vector<directory_entry> Posix::ls_with_sizes (const URI& uri) const {
364+ std::vector<directory_entry> Posix::ls_with_sizes (
365+ const URI& uri, bool get_sizes) const {
365366 std::string path = uri.to_path ();
366367 struct dirent * next_path = nullptr ;
367368 auto dir = PosixDIR::open (path);
@@ -379,7 +380,8 @@ std::vector<directory_entry> Posix::ls_with_sizes(const URI& uri) const {
379380 if (next_path->d_type == DT_DIR) {
380381 entries.emplace_back (abspath, 0 , true );
381382 } else {
382- entries.emplace_back (abspath, file_size (URI (abspath)), false );
383+ entries.emplace_back (
384+ abspath, get_sizes ? file_size (URI (abspath)) : 0 , false );
383385 }
384386 }
385387 return entries;
Original file line number Diff line number Diff line change @@ -228,7 +228,7 @@ class Posix : public LocalFilesystem {
228228 * @return A list of directory_entry objects
229229 */
230230 std::vector<tiledb::common::filesystem::directory_entry> ls_with_sizes (
231- const URI& uri) const override ;
231+ const URI& uri, bool get_sizes ) const override ;
232232
233233 /* *
234234 * Lists files one level deep under a given path.
You can’t perform that action at this time.
0 commit comments