Skip to content

Commit

Permalink
Added a FileSystem::get_partitions() method
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed May 31, 2024
1 parent 90a7a0c commit 9fcc475
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/fsmod/FileSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ namespace simgrid::fsmod {
[[nodiscard]] std::shared_ptr<Partition> partition_by_name(const std::string& name) const;
[[nodiscard]] std::shared_ptr<Partition> partition_by_name_or_null(const std::string& name) const;

[[nodiscard]] std::vector<std::shared_ptr<Partition>> get_partitions() const;

private:


private:
[[nodiscard]] std::pair<std::shared_ptr<Partition>, std::string> find_path_at_mount_point(const std::string &full_path) const;

std::map<std::string, std::shared_ptr<Partition>, std::less<>> partitions_;
Expand Down
10 changes: 10 additions & 0 deletions src/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ namespace simgrid::fsmod {
return nullptr;
}

std::vector<std::shared_ptr<Partition>> FileSystem::get_partitions() const {
std::vector<std::shared_ptr<Partition>> to_return;
to_return.reserve(this->partitions_.size());
for (auto const &p : this->partitions_) {
to_return.push_back(p.second);
}
return to_return;
}


/**
* @brief Create a new file on the file system in zero time
* @param full_path: the absolute path to the file
Expand Down

0 comments on commit 9fcc475

Please sign in to comment.