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
5#include "ccf/ds/logger.h"
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;
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 else
35 {
36 LOG_FAIL_FMT("Unable to deserialise transaction at {}", seqno);
37 }
38
39 return nullptr;
40 }
41
42 std::vector<ccf::kv::ReadOnlyStorePtr> fetch_transactions(
43 const SeqNoCollection& seqnos) override
44 {
47 auto stores = historical_cache->get_stores_for(handle, seqnos);
48 if (!stores.empty())
49 {
50 historical_cache->drop_cached_states(handle);
51 }
52 return stores;
53 }
54 };
55}
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:42
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 logger.h:363
std::pair< RequestNamespace, RequestHandle > CompoundHandle
Definition historical_queries.h:36
Definition indexer_interface.h:14
ApplyResult
Definition kv_types.h:341
@ FAIL
Definition kv_types.h:350
std::shared_ptr< ReadOnlyStore > ReadOnlyStorePtr
Definition read_only_store.h:23
seqno
Definition signatures.h:54
uint64_t SeqNo
Definition tx_id.h:36