Skip to content

Commit

Permalink
incorperate comment
Browse files Browse the repository at this point in the history
  • Loading branch information
yamingk committed Feb 21, 2025
1 parent 5f53de6 commit ae7e64f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/include/homeblks/volume_mgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ namespace homeblocks {
ENUM(VolumeError, uint16_t, UNKNOWN = 1, INVALID_ARG, TIMEOUT, UNKNOWN_VOLUME, UNSUPPORTED_OP, CRC_MISMATCH,
NO_SPACE_LEFT, DRIVE_WRITE_ERROR);

class Volume;
using VolumePtr = std::shared_ptr< Volume >;

struct VolumeInfo {
VolumeInfo(volume_id_t _id, uint64_t _num_bytes) : id(_id), size_bytes(_num_bytes) {}

Expand All @@ -30,11 +27,12 @@ struct VolumeInfo {
auto operator==(VolumeInfo const& rhs) const { return id == rhs.id; }

std::string to_string() {
return fmt::format("VolumeInfo: id={} size_bytes={}, page_size={}, name={}", boost::uuids::to_string(id), size_bytes,
page_size, vol_name);
return fmt::format("VolumeInfo: id={} size_bytes={}, page_size={}, name={}", boost::uuids::to_string(id),
size_bytes, page_size, vol_name);
}
};

using VolumeInfoPtr = std::shared_ptr< VolumeInfo >;
struct VolumeStats {
volume_id_t id;

Expand All @@ -52,8 +50,8 @@ class VolumeManager : public Manager< VolumeError > {
virtual NullAsyncResult create_volume(VolumeInfo&& volume_info) = 0;

virtual NullAsyncResult remove_volume(const volume_id_t& id) = 0;
virtual VolumePtr lookup_volume(const volume_id_t& id) = 0;

virtual VolumeInfoPtr lookup_volume(const volume_id_t& id) = 0;

// TODO: read/write/unmap APIs

Expand Down
2 changes: 1 addition & 1 deletion src/lib/homeblks_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class HomeBlocksImpl : public HomeBlocks, public VolumeManager, public std::enab

NullAsyncResult remove_volume(const volume_id_t& id) final;

VolumePtr lookup_volume(const volume_id_t& id) final;
VolumeInfoPtr lookup_volume(const volume_id_t& id) final;

// see api comments in base class;
bool get_stats(volume_id_t id, VolumeStats& stats) const final;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/volume_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ VolumeManager::NullAsyncResult HomeBlocksImpl::create_volume(VolumeInfo&& vol_in

VolumeManager::NullAsyncResult HomeBlocksImpl::remove_volume(const volume_id_t& id) { return folly::Unit(); }

VolumePtr HomeBlocksImpl::lookup_volume(const volume_id_t& id) { return nullptr; }
VolumeInfoPtr HomeBlocksImpl::lookup_volume(const volume_id_t& id) { return nullptr; }

bool HomeBlocksImpl::get_stats(volume_id_t id, VolumeStats& stats) const { return true; }

Expand Down

0 comments on commit ae7e64f

Please sign in to comment.