CCF
Loading...
Searching...
No Matches
historical_transaction_fetcher.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
8
9namespace ccf::indexing
10{
12 {
13 private:
14 std::shared_ptr<ccf::historical::StateCacheImpl> historical_cache;
15
16 public:
18 const std::shared_ptr<ccf::historical::StateCacheImpl>& sc) :
19 historical_cache(sc)
20 {}
21
23 ccf::SeqNo seqno, const uint8_t* data, size_t size) override
24 {
26 ccf::ClaimsDigest claims_digest;
27 bool has_commit_evidence = false;
28 auto store = historical_cache->deserialise_ledger_entry(
29 seqno, data, size, result, claims_digest, has_commit_evidence);
30 if (store != nullptr && result != ccf::kv::ApplyResult::FAIL)
31 {
32 return store;
33 }
34
35 LOG_FAIL_FMT("Unable to deserialise transaction at {}", seqno);
36 return nullptr;
37 }
38
39 std::vector<ccf::kv::ReadOnlyStorePtr> fetch_transactions(
40 const SeqNoCollection& seqnos) override
41 {
44 auto stores = historical_cache->get_stores_for(handle, seqnos);
45 if (!stores.empty())
46 {
47 historical_cache->drop_cached_states(handle);
48 }
49 return stores;
50 }
51 };
52}
Definition claims_digest.h:10
Definition contiguous_set.h:18
Definition historical_transaction_fetcher.h:12
ccf::kv::ReadOnlyStorePtr deserialise_transaction(ccf::SeqNo seqno, const uint8_t *data, size_t size) override
Definition historical_transaction_fetcher.h:22
std::vector< ccf::kv::ReadOnlyStorePtr > fetch_transactions(const SeqNoCollection &seqnos) override
Definition historical_transaction_fetcher.h:39
HistoricalTransactionFetcher(const std::shared_ptr< ccf::historical::StateCacheImpl > &sc)
Definition historical_transaction_fetcher.h:17
Definition transaction_fetcher_interface.h:11
#define LOG_FAIL_FMT
Definition internal_logger.h:16
std::pair< RequestNamespace, RequestHandle > CompoundHandle
Definition historical_queries.h:36
Definition indexer_interface.h:14
std::shared_ptr< ReadOnlyStore > ReadOnlyStorePtr
Definition read_only_store.h:23
ApplyResult
Definition kv_types.h:302
@ FAIL
Definition kv_types.h:311
seqno
Definition signatures.h:54
uint64_t SeqNo
Definition tx_id.h:36