-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracting classes from component.hpp in to their own files
- Loading branch information
Showing
72 changed files
with
1,225 additions
and
910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <nano/store/account.hpp> | ||
|
||
std::optional<nano::account_info> nano::account_store::get (nano::transaction const & transaction, nano::account const & account) | ||
{ | ||
nano::account_info info; | ||
bool error = get (transaction, account, info); | ||
if (!error) | ||
{ | ||
return info; | ||
} | ||
else | ||
{ | ||
return std::nullopt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
|
||
#include <nano/lib/numbers.hpp> | ||
#include <nano/store/component.hpp> | ||
#include <nano/store/iterator.hpp> | ||
|
||
#include <functional> | ||
|
||
namespace nano | ||
{ | ||
class block_hash; | ||
class read_transaction; | ||
class transaction; | ||
class write_transaction; | ||
} | ||
namespace nano | ||
{ | ||
/** | ||
* Manages account storage and iteration | ||
*/ | ||
class account_store | ||
{ | ||
public: | ||
virtual void put (nano::write_transaction const &, nano::account const &, nano::account_info const &) = 0; | ||
virtual bool get (nano::transaction const &, nano::account const &, nano::account_info &) = 0; | ||
std::optional<nano::account_info> get (nano::transaction const &, nano::account const &); | ||
virtual void del (nano::write_transaction const &, nano::account const &) = 0; | ||
virtual bool exists (nano::transaction const &, nano::account const &) = 0; | ||
virtual size_t count (nano::transaction const &) = 0; | ||
virtual nano::store_iterator<nano::account, nano::account_info> begin (nano::transaction const &, nano::account const &) const = 0; | ||
virtual nano::store_iterator<nano::account, nano::account_info> begin (nano::transaction const &) const = 0; | ||
virtual nano::store_iterator<nano::account, nano::account_info> rbegin (nano::transaction const &) const = 0; | ||
virtual nano::store_iterator<nano::account, nano::account_info> end () const = 0; | ||
virtual void for_each_par (std::function<void (nano::read_transaction const &, nano::store_iterator<nano::account, nano::account_info>, nano::store_iterator<nano::account, nano::account_info>)> const &) const = 0; | ||
}; | ||
} // namespace nano::store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <nano/store/block.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#pragma once | ||
|
||
#include <nano/lib/blocks.hpp> | ||
#include <nano/lib/numbers.hpp> | ||
#include <nano/store/component.hpp> | ||
#include <nano/store/iterator.hpp> | ||
|
||
#include <functional> | ||
|
||
namespace nano | ||
{ | ||
class block_hash; | ||
class read_transaction; | ||
class transaction; | ||
class write_transaction; | ||
} | ||
namespace nano | ||
{ | ||
class block_w_sideband | ||
{ | ||
public: | ||
std::shared_ptr<nano::block> block; | ||
nano::block_sideband sideband; | ||
}; | ||
/** | ||
* Manages block storage and iteration | ||
*/ | ||
class block_store | ||
{ | ||
public: | ||
virtual void put (nano::write_transaction const &, nano::block_hash const &, nano::block const &) = 0; | ||
virtual void raw_put (nano::write_transaction const &, std::vector<uint8_t> const &, nano::block_hash const &) = 0; | ||
virtual nano::block_hash successor (nano::transaction const &, nano::block_hash const &) const = 0; | ||
virtual void successor_clear (nano::write_transaction const &, nano::block_hash const &) = 0; | ||
virtual std::shared_ptr<nano::block> get (nano::transaction const &, nano::block_hash const &) const = 0; | ||
virtual std::shared_ptr<nano::block> random (nano::transaction const &) = 0; | ||
virtual void del (nano::write_transaction const &, nano::block_hash const &) = 0; | ||
virtual bool exists (nano::transaction const &, nano::block_hash const &) = 0; | ||
virtual uint64_t count (nano::transaction const &) = 0; | ||
virtual nano::store_iterator<nano::block_hash, block_w_sideband> begin (nano::transaction const &, nano::block_hash const &) const = 0; | ||
virtual nano::store_iterator<nano::block_hash, block_w_sideband> begin (nano::transaction const &) const = 0; | ||
virtual nano::store_iterator<nano::block_hash, block_w_sideband> end () const = 0; | ||
virtual void for_each_par (std::function<void (nano::read_transaction const &, nano::store_iterator<nano::block_hash, block_w_sideband>, nano::store_iterator<nano::block_hash, block_w_sideband>)> const & action_a) const = 0; | ||
}; | ||
} // namespace nano::store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.