Add class description to mostly of bootstrap classes (#3725)

This commit is contained in:
Thiago Silva 2022-02-09 09:35:32 -03:00 committed by GitHub
commit d67f7beb2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 0 deletions

View file

@ -63,6 +63,10 @@ public:
// clang-format on
constexpr static std::size_t cache_size_max = 10000;
};
/**
* Container for bootstrap sessions that are active. Owned by bootstrap_initiator.
*/
class bootstrap_attempts final
{
public:
@ -76,6 +80,10 @@ public:
std::map<uint64_t, std::shared_ptr<nano::bootstrap_attempt>> attempts;
};
/**
* Client side portion to initiate bootstrap sessions. Prevents multiple legacy-type bootstrap sessions from being started at the same time. Does permit
* lazy/wallet bootstrap sessions to overlap with legacy sessions.
*/
class bootstrap_initiator final
{
public:
@ -117,6 +125,10 @@ private:
};
std::unique_ptr<container_info_component> collect_container_info (bootstrap_initiator & bootstrap_initiator, std::string const & name);
/**
* Defines the numeric values for the bootstrap feature.
*/
class bootstrap_limits final
{
public:

View file

@ -11,6 +11,10 @@ class node;
class frontier_req_client;
class bulk_push_client;
/**
* Polymorphic base class for bootstrap sessions.
*/
class bootstrap_attempt : public std::enable_shared_from_this<bootstrap_attempt>
{
public:

View file

@ -25,6 +25,10 @@ public:
uint64_t bootstrap_id{ 0 };
};
class bootstrap_client;
/**
* Client side of a bulk_pull request. Created when the bootstrap_attempt wants to make a bulk_pull request to the remote side.
*/
class bulk_pull_client final : public std::enable_shared_from_this<nano::bulk_pull_client>
{
public:
@ -59,6 +63,12 @@ public:
};
class bootstrap_server;
class bulk_pull;
/**
* Server side of a bulk_pull request. Created when bootstrap_server receives a bulk_pull message and is exited after the contents
* have been sent. If the 'start' in the bulk_pull message is an account, send blocks for that account down to 'end'. If the 'start'
* is a block hash, send blocks for that chain down to 'end'. If end doesn't exist, send all accounts in the chain.
*/
class bulk_pull_server final : public std::enable_shared_from_this<nano::bulk_pull_server>
{
public:

View file

@ -8,6 +8,10 @@ namespace nano
{
class bootstrap_attempt;
class bootstrap_client;
/**
* Client side of a bulk_push request. Sends a sequence of blocks the other side did not report in their frontier_req response.
*/
class bulk_push_client final : public std::enable_shared_from_this<nano::bulk_push_client>
{
public:
@ -23,6 +27,10 @@ public:
std::pair<nano::block_hash, nano::block_hash> current_target;
};
class bootstrap_server;
/**
* Server side of a bulk_push request. Receives blocks and puts them in the block processor to be processed.
*/
class bulk_push_server final : public std::enable_shared_from_this<nano::bulk_push_server>
{
public:

View file

@ -18,6 +18,10 @@ class bootstrap_attempt;
class bootstrap_connections;
class frontier_req_client;
class pull_info;
/**
* Owns the client side of the bootstrap connection.
*/
class bootstrap_client final : public std::enable_shared_from_this<bootstrap_client>
{
public:
@ -42,6 +46,10 @@ private:
std::chrono::steady_clock::time_point start_time_m;
};
/**
* Container for bootstrap_client objects. Owned by bootstrap_initiator which pools open connections and makes them available
* for use by different bootstrap sessions.
*/
class bootstrap_connections final : public std::enable_shared_from_this<bootstrap_connections>
{
public:

View file

@ -9,6 +9,10 @@ namespace nano
{
class bootstrap_attempt;
class bootstrap_client;
/**
* Client side of a frontier request. Created to send and listen for frontier sequences from the server.
*/
class frontier_req_client final : public std::enable_shared_from_this<nano::frontier_req_client>
{
public:
@ -36,6 +40,10 @@ public:
};
class bootstrap_server;
class frontier_req;
/**
* Server side of a frontier request. Created when a bootstrap_server receives a frontier_req message and exited when end-of-list is reached.
*/
class frontier_req_server final : public std::enable_shared_from_this<nano::frontier_req_server>
{
public:

View file

@ -23,6 +23,11 @@ public:
nano::uint128_t balance{ 0 };
unsigned retry_limit{ 0 };
};
/**
* Lazy bootstrap session. Started with a block hash, this will "trace down" the blocks obtained to find a connection to the ledger.
* This attempts to quickly bootstrap a section of the ledger given a hash that's known to be confirmed.
*/
class bootstrap_attempt_lazy final : public bootstrap_attempt
{
public:
@ -60,6 +65,10 @@ public:
/** The maximum number of records to be read in while iterating over long lazy containers */
static uint64_t constexpr batch_read_size = 256;
};
/**
* Wallet bootstrap session. This session will trace down accounts within local wallets to try and bootstrap those blocks first.
*/
class bootstrap_attempt_wallet final : public bootstrap_attempt
{
public:

View file

@ -13,6 +13,9 @@ namespace nano
{
class node;
/**
* Legacy bootstrap session. This is made up of 3 phases: frontier requests, bootstrap pulls, bootstrap pushes.
*/
class bootstrap_attempt_legacy : public bootstrap_attempt
{
public:

View file

@ -9,6 +9,10 @@
namespace nano
{
class bootstrap_server;
/**
* Server side portion of bootstrap sessions. Listens for new socket connections and spawns bootstrap_server objects when connected.
*/
class bootstrap_listener final
{
public:
@ -32,6 +36,10 @@ public:
std::unique_ptr<container_info_component> collect_container_info (bootstrap_listener & bootstrap_listener, std::string const & name);
class message;
/**
* Owns the server side of a bootstrap connection. Responds to bootstrap messages sent over the socket.
*/
class bootstrap_server final : public std::enable_shared_from_this<nano::bootstrap_server>
{
public: