Skip to content

Commit 035e2a7

Browse files
committed
Move boolean variant to LocalFilesystem base class.
1 parent a1e1284 commit 035e2a7

File tree

18 files changed

+47
-54
lines changed

18 files changed

+47
-54
lines changed

tiledb/sm/filesystem/azure.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ std::vector<std::string> Azure::ls(
638638
return paths;
639639
}
640640

641-
std::vector<directory_entry> Azure::ls_with_sizes(const URI& uri, bool) const {
642-
return ls_with_sizes(uri, std::string("/"));
641+
std::vector<directory_entry> Azure::ls_with_sizes(const URI& uri) const {
642+
return ls_with_sizes(uri, "/");
643643
}
644644

645645
std::vector<directory_entry> Azure::ls_with_sizes(

tiledb/sm/filesystem/azure.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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, bool get_sizes) const override;
462+
const URI& uri) const override;
463463

464464
/**
465465
* Lists objects and object information that start with `uri`.

tiledb/sm/filesystem/failing_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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&, bool) const override {
91+
ls_with_sizes(const URI&) const override {
9292
throw get_exception();
9393
}
9494

tiledb/sm/filesystem/filesystem_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class FilesystemBase {
151151
* @return All entries that are contained in the parent
152152
*/
153153
virtual std::vector<tiledb::common::filesystem::directory_entry>
154-
ls_with_sizes(const URI& parent, bool get_sizes = true) const = 0;
154+
ls_with_sizes(const URI& parent) const = 0;
155155

156156
/**
157157
* Lists objects and object information that start with `prefix`, invoking

tiledb/sm/filesystem/gcs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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, bool) const {
513+
std::vector<directory_entry> GCS::ls_with_sizes(const URI& uri) const {
514514
return ls_with_sizes(uri, "/", -1);
515515
}
516516

tiledb/sm/filesystem/gcs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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, bool get_sizes) const override;
361+
const URI& uri) const override;
362362

363363
/**
364364
* Copies the directory at 'old_uri' to `new_uri`.

tiledb/sm/filesystem/local.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,20 @@ LsObjects LocalFilesystem::ls_filtered_v2(
124124
return qualifyingPaths;
125125
}
126126

127+
Status LocalFilesystem::ls(
128+
const std::string& path, std::vector<std::string>* paths) const {
129+
for (auto& fs : ls_with_sizes(URI(path), false)) {
130+
paths->emplace_back(fs.path().native());
131+
}
132+
133+
return Status::Ok();
134+
}
135+
136+
std::vector<filesystem::directory_entry> LocalFilesystem::ls_with_sizes(
137+
const URI& uri) const {
138+
return ls_with_sizes(uri, true);
139+
}
140+
127141
void LocalFilesystem::copy_file(const URI& old_uri, const URI& new_uri) {
128142
std::filesystem::copy_file(
129143
old_uri.to_path(),

tiledb/sm/filesystem/local.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@ class LocalFilesystem : public FilesystemBase {
5353
ResultFilterV2 result_filter,
5454
bool recursive) const override;
5555

56+
/**
57+
* Lists files one level deep under a given path.
58+
*
59+
* @param path The parent path to list sub-paths.
60+
* @param paths Pointer to a vector of strings to store the retrieved paths.
61+
* @return Status
62+
*/
63+
Status ls(const std::string& path, std::vector<std::string>* paths) const;
64+
65+
std::vector<tiledb::common::filesystem::directory_entry> ls_with_sizes(
66+
const URI& uri) const override;
67+
68+
virtual std::vector<tiledb::common::filesystem::directory_entry>
69+
ls_with_sizes(const URI& uri, bool get_sizes) const = 0;
70+
5671
void copy_file(const URI& old_uri, const URI& new_uri) override;
5772

5873
void copy_dir(const URI& old_uri, const URI& new_uri) override;

tiledb/sm/filesystem/mem_filesystem.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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), true)) {
384+
for (auto& fs : ls_with_sizes(URI(path))) {
385385
paths->emplace_back(fs.path().native());
386386
}
387387

388388
return Status::Ok();
389389
}
390390

391391
std::vector<directory_entry> MemFilesystem::ls_with_sizes(
392-
const URI& path, bool) const {
392+
const URI& path) const {
393393
auto abspath = path.to_path();
394394
std::vector<std::string> tokens = tokenize(abspath);
395395

tiledb/sm/filesystem/mem_filesystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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, bool get_sizes) const override;
162+
const URI& path) const override;
163163

164164
/**
165165
* Move a given filesystem path.

0 commit comments

Comments
 (0)