Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove trie_factory_ codec_
Signed-off-by: turuslan <[email protected]>
  • Loading branch information
turuslan committed Jul 29, 2022
commit b47d00dbc505525888443f6257cd236abeca4832
11 changes: 2 additions & 9 deletions core/storage/changes_trie/impl/storage_changes_tracker_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,12 @@ OUTCOME_CPP_DEFINE_CATEGORY(kagome::storage::changes_trie,
namespace kagome::storage::changes_trie {

StorageChangesTrackerImpl::StorageChangesTrackerImpl(
std::shared_ptr<storage::trie::PolkadotTrieFactory> trie_factory,
std::shared_ptr<storage::trie::Codec> codec,
primitives::events::StorageSubscriptionEnginePtr
storage_subscription_engine,
primitives::events::ChainSubscriptionEnginePtr chain_subscription_engine)
: trie_factory_(std::move(trie_factory)),
codec_(std::move(codec)),
storage_subscription_engine_(std::move(storage_subscription_engine)),
: storage_subscription_engine_(std::move(storage_subscription_engine)),
chain_subscription_engine_(std::move(chain_subscription_engine)),
logger_{log::createLogger("Storage Changes Tracker", "changes_trie")} {
BOOST_ASSERT(trie_factory_ != nullptr);
BOOST_ASSERT(codec_ != nullptr);
}
logger_{log::createLogger("Storage Changes Tracker", "changes_trie")} {}

outcome::result<void> StorageChangesTrackerImpl::onBlockExecutionStart(
primitives::BlockHash new_parent_hash,
Expand Down
19 changes: 4 additions & 15 deletions core/storage/changes_trie/impl/storage_changes_tracker_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,16 @@
#include "log/logger.hpp"
#include "primitives/event_types.hpp"

namespace kagome::storage::trie {
class Codec;
class PolkadotTrieFactory;
} // namespace kagome::storage::trie

namespace kagome::storage::changes_trie {

class StorageChangesTrackerImpl : public ChangesTracker {
public:
enum class Error { INVALID_PARENT_HASH };

StorageChangesTrackerImpl(
std::shared_ptr<storage::trie::PolkadotTrieFactory> trie_factory,
std::shared_ptr<storage::trie::Codec> codec,
primitives::events::StorageSubscriptionEnginePtr
storage_subscription_engine,
primitives::events::ChainSubscriptionEnginePtr
chain_subscription_engine);
StorageChangesTrackerImpl(primitives::events::StorageSubscriptionEnginePtr
storage_subscription_engine,
primitives::events::ChainSubscriptionEnginePtr
chain_subscription_engine);

/**
* Functor that returns the current extrinsic index, which is supposed to
Expand All @@ -44,9 +36,6 @@ namespace kagome::storage::changes_trie {
const common::BufferView &key) override;

private:
std::shared_ptr<storage::trie::PolkadotTrieFactory> trie_factory_;
std::shared_ptr<storage::trie::Codec> codec_;

std::set<common::Buffer, std::less<>>
new_entries_; // entries that do not yet exist in
// the underlying storage
Expand Down
4 changes: 1 addition & 3 deletions test/core/storage/changes_trie/changes_tracker_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ TEST(ChangesTrieTest, IntegrationWithOverlay) {
std::make_shared<StorageSubscriptionEngine>();
auto chain_subscription_engine = std::make_shared<ChainSubscriptionEngine>();
std::shared_ptr<ChangesTracker> changes_tracker =
std::make_shared<StorageChangesTrackerImpl>(factory,
codec,
storage_subscription_engine,
std::make_shared<StorageChangesTrackerImpl>(storage_subscription_engine,
chain_subscription_engine);
EXPECT_OUTCOME_TRUE_1(
changes_tracker->onBlockExecutionStart("aaa"_hash256, 42));
Expand Down