Renaming
This commit is contained in:
parent
84fef77255
commit
0a4252d47a
2 changed files with 15 additions and 41 deletions
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
nano::bootstrap_ascending::database_scan::database_scan (nano::ledger & ledger_a) :
|
nano::bootstrap_ascending::database_scan::database_scan (nano::ledger & ledger_a) :
|
||||||
ledger{ ledger_a },
|
ledger{ ledger_a },
|
||||||
accounts_iterator{ ledger },
|
account_scanner{ ledger },
|
||||||
pending_iterator{ ledger }
|
pending_scanner{ ledger }
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,8 +43,8 @@ void nano::bootstrap_ascending::database_scan::fill ()
|
||||||
{
|
{
|
||||||
auto transaction = ledger.store.tx_begin_read ();
|
auto transaction = ledger.store.tx_begin_read ();
|
||||||
|
|
||||||
auto set1 = accounts_iterator.next_batch (transaction, batch_size);
|
auto set1 = account_scanner.next_batch (transaction, batch_size);
|
||||||
auto set2 = pending_iterator.next_batch (transaction, batch_size);
|
auto set2 = pending_scanner.next_batch (transaction, batch_size);
|
||||||
|
|
||||||
queue.insert (queue.end (), set1.begin (), set1.end ());
|
queue.insert (queue.end (), set1.begin (), set1.end ());
|
||||||
queue.insert (queue.end (), set2.begin (), set2.end ());
|
queue.insert (queue.end (), set2.begin (), set2.end ());
|
||||||
|
|
@ -52,14 +52,14 @@ void nano::bootstrap_ascending::database_scan::fill ()
|
||||||
|
|
||||||
bool nano::bootstrap_ascending::database_scan::warmed_up () const
|
bool nano::bootstrap_ascending::database_scan::warmed_up () const
|
||||||
{
|
{
|
||||||
return accounts_iterator.warmed_up () && pending_iterator.warmed_up ();
|
return account_scanner.completed > 0 && pending_scanner.completed > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<nano::container_info_component> nano::bootstrap_ascending::database_scan::collect_container_info (std::string const & name) const
|
std::unique_ptr<nano::container_info_component> nano::bootstrap_ascending::database_scan::collect_container_info (std::string const & name) const
|
||||||
{
|
{
|
||||||
auto composite = std::make_unique<container_info_composite> (name);
|
auto composite = std::make_unique<container_info_composite> (name);
|
||||||
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "accounts_iterator", accounts_iterator.completed, 0 }));
|
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "account_scan", account_scanner.completed, 0 }));
|
||||||
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "pending_iterator", pending_iterator.completed, 0 }));
|
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "pending_scan", pending_scanner.completed, 0 }));
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,12 +67,7 @@ std::unique_ptr<nano::container_info_component> nano::bootstrap_ascending::datab
|
||||||
* account_database_iterator
|
* account_database_iterator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nano::bootstrap_ascending::account_database_iterator::account_database_iterator (nano::ledger & ledger_a) :
|
std::deque<nano::account> nano::bootstrap_ascending::account_database_scanner::next_batch (nano::store::transaction & transaction, size_t batch_size)
|
||||||
ledger{ ledger_a }
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
std::deque<nano::account> nano::bootstrap_ascending::account_database_iterator::next_batch (nano::store::transaction & transaction, size_t batch_size)
|
|
||||||
{
|
{
|
||||||
std::deque<nano::account> result;
|
std::deque<nano::account> result;
|
||||||
|
|
||||||
|
|
@ -96,21 +91,11 @@ std::deque<nano::account> nano::bootstrap_ascending::account_database_iterator::
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nano::bootstrap_ascending::account_database_iterator::warmed_up () const
|
|
||||||
{
|
|
||||||
return completed > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pending_database_iterator
|
* pending_database_iterator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nano::bootstrap_ascending::pending_database_iterator::pending_database_iterator (nano::ledger & ledger_a) :
|
std::deque<nano::account> nano::bootstrap_ascending::pending_database_scanner::next_batch (nano::store::transaction & transaction, size_t batch_size)
|
||||||
ledger{ ledger_a }
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
std::deque<nano::account> nano::bootstrap_ascending::pending_database_iterator::next_batch (nano::store::transaction & transaction, size_t batch_size)
|
|
||||||
{
|
{
|
||||||
std::deque<nano::account> result;
|
std::deque<nano::account> result;
|
||||||
|
|
||||||
|
|
@ -160,8 +145,3 @@ std::deque<nano::account> nano::bootstrap_ascending::pending_database_iterator::
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nano::bootstrap_ascending::pending_database_iterator::warmed_up () const
|
|
||||||
{
|
|
||||||
return completed > 0;
|
|
||||||
}
|
|
||||||
|
|
@ -8,28 +8,22 @@
|
||||||
|
|
||||||
namespace nano::bootstrap_ascending
|
namespace nano::bootstrap_ascending
|
||||||
{
|
{
|
||||||
// TODO: Rename to *_scanner
|
struct account_database_scanner
|
||||||
struct account_database_iterator
|
|
||||||
{
|
{
|
||||||
explicit account_database_iterator (nano::ledger &);
|
nano::ledger & ledger;
|
||||||
|
|
||||||
std::deque<nano::account> next_batch (nano::store::transaction &, size_t batch_size);
|
std::deque<nano::account> next_batch (nano::store::transaction &, size_t batch_size);
|
||||||
bool warmed_up () const;
|
|
||||||
|
|
||||||
nano::ledger & ledger;
|
|
||||||
nano::account next{ 0 };
|
nano::account next{ 0 };
|
||||||
size_t completed{ 0 };
|
size_t completed{ 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Rename to *_scanner
|
struct pending_database_scanner
|
||||||
struct pending_database_iterator
|
|
||||||
{
|
{
|
||||||
explicit pending_database_iterator (nano::ledger &);
|
nano::ledger & ledger;
|
||||||
|
|
||||||
std::deque<nano::account> next_batch (nano::store::transaction &, size_t batch_size);
|
std::deque<nano::account> next_batch (nano::store::transaction &, size_t batch_size);
|
||||||
bool warmed_up () const;
|
|
||||||
|
|
||||||
nano::ledger & ledger;
|
|
||||||
nano::pending_key next{ 0, 0 };
|
nano::pending_key next{ 0, 0 };
|
||||||
size_t completed{ 0 };
|
size_t completed{ 0 };
|
||||||
};
|
};
|
||||||
|
|
@ -53,8 +47,8 @@ private:
|
||||||
void fill ();
|
void fill ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
account_database_iterator accounts_iterator;
|
account_database_scanner account_scanner;
|
||||||
pending_database_iterator pending_iterator;
|
pending_database_scanner pending_scanner;
|
||||||
|
|
||||||
std::deque<nano::account> queue;
|
std::deque<nano::account> queue;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue