Skip to content

Commit

Permalink
[FOLD] Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelportilla committed Jul 24, 2019
1 parent 5e4215e commit 439afc8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
9 changes: 3 additions & 6 deletions src/ripple/core/impl/Stoppable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ Stoppable::~Stoppable ()

void Stoppable::setParent (Stoppable& parent)
{
if (hasParent_ ||
parent.isStopping() ||
std::addressof(m_root) != std::addressof(parent.m_root))
{
LogicError("Invalid parent");
}
assert(!hasParent_);
assert(!parent.isStopping());
assert(std::addressof(m_root) == std::addressof(parent.m_root));

parent.m_children.push_front(&m_child);
hasParent_ = true;
Expand Down
27 changes: 16 additions & 11 deletions src/ripple/nodestore/impl/DatabaseShardImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,25 @@ DatabaseShardImp::init()
else
boost::filesystem::create_directories(dir_);

if (!get_if_exists<std::uint64_t>(section, "max_size_gb", maxDiskSpace_))
return fail("'max_size_gb' missing");

if (maxDiskSpace_ < minDiskSpace_)
{
return fail("'max_size_gb' must be at least " +
std::to_string(minDiskSpace_));
}
std::uint64_t i;
if (!get_if_exists<std::uint64_t>(section, "max_size_gb", i))
return fail("'max_size_gb' missing");

// Minimum disk space required (in gigabytes)
static constexpr auto minDiskSpace = 10;
if (i < minDiskSpace)
{
return fail("'max_size_gb' must be at least " +
std::to_string(minDiskSpace));
}

if ((maxDiskSpace_ << 30) < maxDiskSpace_)
return fail("'max_size_gb' overflow");
if ((i << 30) < i)
return fail("'max_size_gb' overflow");

// Convert to bytes
maxDiskSpace_ <<= 30;
// Convert to bytes
maxDiskSpace_ = i << 30;
}

if (section.exists("ledgers_per_shard"))
{
Expand Down
3 changes: 0 additions & 3 deletions src/ripple/nodestore/impl/DatabaseShardImp.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ class DatabaseShardImp : public DatabaseShard
// File name used to mark shards being imported from node store
static constexpr auto importMarker_ = "import";

// Minimum disk space required
static constexpr auto minDiskSpace_ = 10;

std::shared_ptr<NodeObject>
fetchFrom(uint256 const& hash, std::uint32_t seq) override;

Expand Down

1 comment on commit 439afc8

@mellery451
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.