22#ifdef ENABLE_HISTORICAL_VERBOSE_LOGGING
23# define HISTORICAL_LOG(...) LOG_INFO_FMT(__VA_ARGS__)
25# define HISTORICAL_LOG(...)
44 template <
typename ParseContext>
45 constexpr auto parse(ParseContext& ctx)
50 template <
typename FormatContext>
66 static constexpr auto slow_fetch_threshold = std::chrono::milliseconds(1000);
67 static constexpr size_t soft_to_raw_ratio{5};
69 static std::optional<ccf::PrimarySignature> get_signature(
72 auto tx = sig_store->create_read_only_tx();
74 return signatures->get();
77 static std::optional<ccf::CoseSignature> get_cose_signature(
80 auto tx = sig_store->create_read_only_tx();
82 return signatures->get();
85 static std::optional<std::vector<uint8_t>> get_tree(
88 auto tx = sig_store->create_read_only_tx();
124 "Source ledger secrets are empty");
133 "Historical ledger secrets are not older than main ledger secrets");
154 if (
store !=
nullptr)
156 auto e =
store->get_encryptor();
157 return e->get_commit_nonce(
162 throw std::logic_error(
"Store pointer not set");
229 return it->second.lock();
247 bool should_include_receipts,
248 SeqNo earliest_ledger_secret_seqno)
250 std::vector<SeqNo> removed{}, added{};
252 bool any_diff =
false;
261 bool any_too_early =
false;
265 auto new_it = new_seqnos.
begin();
266 while (new_it != new_seqnos.
end())
268 if (prev_it !=
my_stores.end() && *new_it == prev_it->first)
275 else if (prev_it !=
my_stores.end() && *new_it > prev_it->first)
279 removed.push_back(prev_it->first);
289 if (*new_it < earliest_ledger_secret_seqno || any_too_early)
293 added.push_back(*new_it);
294 prev_it =
my_stores.insert_or_assign(prev_it, *new_it,
nullptr);
295 any_too_early =
true;
301 all_it ==
all_stores.end() ? nullptr : all_it->second.lock();
302 if (details ==
nullptr)
305 details = std::make_shared<StoreDetails>();
306 all_stores.insert_or_assign(all_it, *new_it, details);
308 added.push_back(*new_it);
309 prev_it =
my_stores.insert_or_assign(prev_it, *new_it, details);
327 return {removed, added};
335 if (should_include_receipts)
342 for (
auto seqno : new_seqnos)
347 return {removed, added};
353 "Looking at {}, and populating receipts from it", new_seqno);
355 if (new_details !=
nullptr && new_details->store !=
nullptr)
357 if (new_details->is_signature)
361 fill_receipts_from_signature(new_details);
378 auto next_seqno = new_seqno + 1;
383 all_it ==
all_stores.end() ? nullptr : all_it->second.lock();
384 if (details ==
nullptr)
387 "Looking for new supporting signature at {}", next_seqno);
388 details = std::make_shared<StoreDetails>();
389 all_stores.insert_or_assign(all_it, next_seqno, details);
392 if (details->store ==
nullptr)
398 "Assigning {} as potential signature for {}",
404 else if (details->is_signature)
406 const auto filled_this =
407 fill_receipts_from_signature(details, new_seqno);
412 throw std::logic_error(fmt::format(
413 "Unexpected: Found a signature at {}, and contiguous range "
414 "of transactions from {}, yet signature does not cover "
434 bool fill_receipts_from_signature(
435 const std::shared_ptr<StoreDetails>& sig_details,
436 std::optional<ccf::SeqNo> should_fill = std::nullopt)
440 const auto sig = get_signature(sig_details->store);
441 const auto cose_sig = get_cose_signature(sig_details->store);
446 auto sig_lower_bound_it =
447 my_stores.lower_bound(sig_details->transaction_id.seqno);
449 if (sig_lower_bound_it !=
my_stores.begin())
452 auto search_rit = std::reverse_iterator(sig_lower_bound_it);
455 auto seqno = search_rit->first;
456 if (tree.in_range(
seqno))
458 auto details = search_rit->second;
459 if (details !=
nullptr && details->store !=
nullptr)
461 auto proof = tree.get_proof(
seqno);
462 details->transaction_id = {sig->view,
seqno};
463 details->receipt = std::make_shared<TxReceiptImpl>(
470 details->entry_digest,
471 details->get_commit_evidence(),
472 details->claims_digest);
474 "Assigned a receipt for {} after given signature at {}",
476 sig_details->transaction_id.to_str());
478 if (should_fill.has_value() &&
seqno == *should_fill)
495 return !should_fill.has_value();
515 std::map<CompoundHandle, std::list<CompoundHandle>::iterator>
lru_lookup;
542 it->second.insert(handle);
548 for (
const auto& [seq, _] :
requests.at(handle).my_stores)
559 it->second.erase(handle);
560 if (it->second.empty())
574 for (
const auto& [seq, _] :
requests.at(handle).my_stores)
602 "LRU shrink to {} requested but cache is already empty", threshold);
608 "Cache size shrinking (reached {} / {}). Dropping {}",
635 assert(!stored_size || stored_size == new_size);
639 stored_size = new_size;
652 ::consensus::ledger_get_range,
662 auto [earliest_ledger_secret_seqno, earliest_ledger_secret] =
665 earliest_ledger_secret !=
nullptr,
666 "Can't fetch without knowing earliest");
668 const auto too_early =
seqno < earliest_ledger_secret_seqno;
670 auto previous_secret_stored_version =
671 earliest_ledger_secret->previous_secret_stored_version;
672 const auto is_next_secret =
673 previous_secret_stored_version.value_or(0) ==
seqno;
675 if (too_early || is_next_secret)
678 if (!previous_secret_stored_version.has_value())
680 throw std::logic_error(fmt::format(
681 "Earliest known ledger secret at {} has no earlier secret stored "
683 earliest_ledger_secret_seqno,
687 const auto seqno_to_fetch = previous_secret_stored_version.value();
689 "Requesting historical entry at {} but first known ledger "
690 "secret is applicable from {}",
692 earliest_ledger_secret_seqno);
695 auto details = it ==
all_stores.end() ? nullptr : it->second.lock();
696 if (details ==
nullptr)
698 LOG_TRACE_FMT(
"Requesting older secret at {} now", seqno_to_fetch);
699 details = std::make_shared<StoreDetails>();
700 all_stores.insert_or_assign(it, seqno_to_fetch, details);
708 return seqno_to_fetch;
722 bool has_commit_evidence)
727 details->has_commit_evidence = has_commit_evidence;
729 details->entry_digest = entry_digest;
730 if (!claims_digest.empty())
731 details->claims_digest = std::move(claims_digest);
734 details->store ==
nullptr,
735 "Cache already has store for seqno {}",
737 details->store = store;
739 details->is_signature = is_signature;
747 const auto sig = get_signature(details->store);
748 const auto cose_sig = get_cose_signature(details->store);
749 assert(sig.has_value());
750 details->transaction_id = {sig->view, sig->seqno};
751 details->receipt = std::make_shared<TxReceiptImpl>(
752 sig->sig, cose_sig, sig->root.h,
nullptr, sig->node, sig->cert);
756 while (request_it !=
requests.end())
758 auto& [handle, request] = *request_it;
763 request.awaiting_ledger_secrets.has_value() &&
764 request.awaiting_ledger_secrets.value() ==
seqno)
767 "{} is a ledger secret seqno this request was waiting for",
seqno);
769 request.awaiting_ledger_secrets =
771 if (!request.awaiting_ledger_secrets.has_value())
776 auto my_stores_it = request.my_stores.begin();
777 while (my_stores_it != request.my_stores.end())
779 auto [store_seqno, _] = *my_stores_it;
782 it ==
all_stores.end() ? nullptr : it->second.lock();
784 if (store_details ==
nullptr)
786 store_details = std::make_shared<StoreDetails>();
787 all_stores.insert_or_assign(it, store_seqno, store_details);
790 my_stores_it->second = store_details;
800 if (request.include_receipts)
802 const bool seqno_in_this_request =
803 (request.my_stores.find(
seqno) != request.my_stores.end() ||
804 request.supporting_signatures.find(
seqno) !=
805 request.supporting_signatures.end());
806 if (seqno_in_this_request)
808 request.populate_receipts(
seqno);
820 auto tx = store->create_read_only_tx();
821 auto encrypted_past_ledger_secret_handle =
823 ccf::Tables::ENCRYPTED_PAST_LEDGER_SECRET);
824 if (!encrypted_past_ledger_secret_handle)
829 auto encrypted_past_ledger_secret =
830 encrypted_past_ledger_secret_handle->get();
831 if (!encrypted_past_ledger_secret.has_value())
837 auto previous_ledger_secret =
838 encrypted_past_ledger_secret->previous_ledger_secret;
839 if (!previous_ledger_secret.has_value())
844 encrypted_past_ledger_secret->next_version.has_value() &&
845 encrypted_past_ledger_secret->next_version.value() == 1,
846 "Write to ledger secrets table at {} should contain a next_version "
848 store->current_version());
852 auto recovered_ledger_secret = std::make_shared<LedgerSecret>(
854 encrypting_secret, std::move(previous_ledger_secret->encrypted_data)),
855 previous_ledger_secret->previous_secret_stored_version);
859 previous_ledger_secret->version, std::move(recovered_ledger_secret));
872 if (end_seqno < start_seqno)
874 throw std::logic_error(fmt::format(
875 "Invalid range for historical query: end {} is before start {}",
888 bool include_receipts)
892 throw std::logic_error(
893 "Invalid range for historical query: Cannot request empty range");
898 const auto ms_until_expiry =
899 std::chrono::duration_cast<std::chrono::milliseconds>(
900 seconds_until_expiry);
918 "Adjusting handle {} to cover {} seqnos starting at {} "
919 "(include_receipts={})",
927 for (
auto seq : removed)
931 for (
auto seq : added)
945 std::vector<StatePtr> trusted_states;
947 for (
auto seqno : seqnos)
951 target_details !=
nullptr &&
957 StatePtr state = std::make_shared<State>(
958 target_details->store,
959 target_details->receipt,
960 target_details->transaction_id);
961 trusted_states.push_back(state);
971 return trusted_states;
979 while (request_it !=
requests.end())
981 if (request_it->second.get_store_details(
seqno) !=
nullptr)
984 request_it =
requests.erase(request_it);
994 const std::vector<StatePtr>& states)
996 std::vector<ccf::kv::ReadOnlyStorePtr> stores;
997 for (
size_t i = 0; i < states.size(); i++)
999 stores.push_back(states[i]->store);
1007 const std::shared_ptr<ccf::LedgerSecrets>& secrets,
1065 seconds_until_expiry,
1087 seconds_until_expiry,
1122 throw std::runtime_error(
"Cannot request empty range");
1153 const auto erased_count =
requests.erase(handle);
1154 return erased_count > 0;
1166 auto details = it ==
all_stores.end() ? nullptr : it->second.lock();
1176 bool has_commit_evidence;
1183 has_commit_evidence);
1193 const auto tx_id = store->current_txid();
1194 if (tx_id.version !=
seqno)
1197 "Corrupt ledger entry received - claims to be {} but is actually "
1213 if (actual_view != tx_id.term)
1216 "Ledger entry comes from fork - contains {}.{} but this service "
1226 const auto is_signature =
1234 secret->previous_secret_stored_version.has_value() &&
1235 secret->previous_secret_stored_version.value() ==
seqno)
1238 "Handling past ledger secret. Current earliest is valid from {}, now "
1239 "processing secret stored at {}",
1247 "Processing historical store at {} ({})",
1249 (
size_t)deserialise_result);
1257 std::move(claims_digest),
1258 has_commit_evidence);
1268 from_seqno, to_seqno, data.data(), data.size());
1274 const uint8_t* data,
1277 LOG_TRACE_FMT(
"handle_ledger_entries({}, {})", from_seqno, to_seqno);
1279 auto seqno = from_seqno;
1280 bool all_accepted =
true;
1284 serialized::peek<ccf::kv::SerialisedEntryHeader>(data, size);
1285 const auto whole_size =
1286 header.size + ccf::kv::serialised_entry_header_size;
1293 if (
seqno != to_seqno + 1)
1296 "Claimed ledger entries: [{}, {}), actual [{}, {}]",
1303 return all_accepted;
1315 LOG_TRACE_FMT(
"handle_no_entry_range({}, {})", from_seqno, to_seqno);
1335 const uint8_t* data,
1339 bool& has_commit_evidence)
1348 if (seqno < source_ledger_secrets->get_first().first)
1363 bool public_only =
false;
1364 for (
const auto& [_, request] :
requests)
1366 const auto& als = request.awaiting_ledger_secrets;
1367 if (als.has_value() && als.value() ==
seqno)
1374 auto exec = store->deserialize({data, data + size}, public_only);
1375 if (exec ==
nullptr)
1382 claims_digest = std::move(exec->consume_claims_digest());
1384 auto commit_evidence_digest =
1385 std::move(exec->consume_commit_evidence_digest());
1386 has_commit_evidence = commit_evidence_digest.has_value();
1388 catch (
const std::exception& e)
1391 "Exception while attempting to deserialise entry {}: {}",
1400 void tick(
const std::chrono::milliseconds& elapsed_ms)
1408 auto& request = it->second;
1409 if (elapsed_ms >= request.time_to_expiry)
1412 "Dropping expired historical query with handle {}", it->first);
1418 request.time_to_expiry -= elapsed_ms;
1428 std::optional<std::pair<ccf::SeqNo, ccf::SeqNo>> range_to_request =
1432 auto details = it->second.lock();
1433 if (details ==
nullptr)
1441 details->time_until_fetch -= elapsed_ms;
1442 if (details->time_until_fetch.count() <= 0)
1444 details->time_until_fetch = slow_fetch_threshold;
1446 const auto seqno = it->first;
1448 range_to_request.has_value() &&
1449 range_to_request->second + 1 ==
seqno)
1451 range_to_request->second =
seqno;
1455 if (range_to_request.has_value())
1459 range_to_request->first, range_to_request->second);
1463 range_to_request = std::make_pair(
seqno,
seqno);
1472 if (range_to_request.has_value())
1476 range_to_request->first, range_to_request->second);
1491 template <
typename... Ts>
1534 seconds_until_expiry);
1556 seconds_until_expiry);
#define CCF_ASSERT_FMT(expr,...)
Definition ccf_assert.h:10
#define CCF_ASSERT(expr, msg)
Definition ccf_assert.h:14
Definition claims_digest.h:10
Definition ledger_secrets.h:24
Definition sha256_hash.h:16
Definition contiguous_set.h:18
ConstIterator end() const
Definition contiguous_set.h:495
bool empty() const
Definition contiguous_set.h:320
ConstIterator begin() const
Definition contiguous_set.h:490
size_t size() const
Definition contiguous_set.h:312
Definition historical_queries_interface.h:67
Definition historical_queries.h:95
std::map< CompoundHandle, std::list< CompoundHandle >::iterator > lru_lookup
Definition historical_queries.h:515
void update_store_raw_size(SeqNo seq, size_t new_size)
Definition historical_queries.h:632
void process_deserialised_store(const StoreDetailsPtr &details, const ccf::kv::StorePtr &store, const ccf::crypto::Sha256Hash &entry_digest, ccf::SeqNo seqno, bool is_signature, ccf::ClaimsDigest &&claims_digest, bool has_commit_evidence)
Definition historical_queries.h:715
std::vector< StatePtr > get_states_for(const CompoundHandle &handle, const SeqNoCollection &seqnos)
Definition historical_queries.h:1127
std::map< CompoundHandle, Request > requests
Definition historical_queries.h:503
std::list< CompoundHandle > lru_requests
Definition historical_queries.h:514
std::vector< ccf::kv::ReadOnlyStorePtr > states_to_stores(const std::vector< StatePtr > &states)
Definition historical_queries.h:993
ExpiryDuration default_expiry_duration
Definition historical_queries.h:510
bool track_deletes_on_missing_keys_v
Definition historical_queries.h:105
ccf::kv::Store & source_store
Definition historical_queries.h:97
std::map< ccf::SeqNo, WeakStoreDetailsPtr > AllRequestedStores
Definition historical_queries.h:186
ringbuffer::WriterPtr to_host
Definition historical_queries.h:99
void add_request_refs(CompoundHandle handle)
Definition historical_queries.h:546
std::vector< StatePtr > get_state_range(const CompoundHandle &handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1078
std::unordered_map< SeqNo, std::set< CompoundHandle > > store_to_requests
Definition historical_queries.h:519
std::vector< StatePtr > get_state_range(const CompoundHandle &handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno)
Definition historical_queries.h:1091
AllRequestedStores all_stores
Definition historical_queries.h:508
void set_soft_cache_limit(CacheSize cache_limit)
Definition historical_queries.h:1138
void remove_request_ref(SeqNo seq, CompoundHandle handle)
Definition historical_queries.h:554
CacheSize estimated_store_cache_size
Definition historical_queries.h:525
StatePtr get_state_at(const CompoundHandle &handle, ccf::SeqNo seqno, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1037
bool drop_cached_states(const CompoundHandle &handle)
Definition historical_queries.h:1149
void handle_no_entry(ccf::SeqNo seqno)
Definition historical_queries.h:1306
void remove_request_refs(CompoundHandle handle)
Definition historical_queries.h:572
void track_deletes_on_missing_keys(bool track)
Definition historical_queries.h:1144
std::vector< StatePtr > get_states_for(const CompoundHandle &handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1115
std::vector< ccf::kv::ReadOnlyStorePtr > get_stores_for(const CompoundHandle &handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1100
std::map< ccf::SeqNo, StoreDetailsPtr > RequestedStores
Definition historical_queries.h:183
void handle_no_entry_range(ccf::SeqNo from_seqno, ccf::SeqNo to_seqno)
Definition historical_queries.h:1311
bool handle_encrypted_past_ledger_secret(const ccf::kv::StorePtr &store, LedgerSecretPtr encrypting_secret)
Definition historical_queries.h:816
ccf::kv::ReadOnlyStorePtr get_store_at(const CompoundHandle &handle, ccf::SeqNo seqno)
Definition historical_queries.h:1031
StatePtr get_state_at(const CompoundHandle &handle, ccf::SeqNo seqno)
Definition historical_queries.h:1051
std::shared_ptr< ccf::NodeEncryptor > historical_encryptor
Definition historical_queries.h:102
CacheSize soft_store_cache_limit
Definition historical_queries.h:522
void add_request_ref(SeqNo seq, CompoundHandle handle)
Definition historical_queries.h:527
void fetch_entries_range(ccf::SeqNo from, ccf::SeqNo to)
Definition historical_queries.h:647
std::vector< uint8_t > LedgerEntry
Definition historical_queries.h:113
bool handle_ledger_entry(ccf::SeqNo seqno, const uint8_t *data, size_t size)
Definition historical_queries.h:1162
void fetch_entry_at(ccf::SeqNo seqno)
Definition historical_queries.h:642
ccf::kv::ReadOnlyStorePtr get_store_at(const CompoundHandle &handle, ccf::SeqNo seqno, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1017
StoreDetailsPtr next_secret_fetch_handle
Definition historical_queries.h:203
void update_earliest_known_ledger_secret()
Definition historical_queries.h:115
ccf::pal::Mutex requests_lock
Definition historical_queries.h:500
std::shared_ptr< StoreDetails > StoreDetailsPtr
Definition historical_queries.h:182
bool handle_ledger_entry(ccf::SeqNo seqno, const std::vector< uint8_t > &data)
Definition historical_queries.h:1157
void tick(const std::chrono::milliseconds &elapsed_ms)
Definition historical_queries.h:1400
VersionedSecret earliest_secret_
Definition historical_queries.h:202
std::optional< ccf::SeqNo > fetch_supporting_secret_if_needed(ccf::SeqNo seqno)
Definition historical_queries.h:659
std::unordered_map< ccf::SeqNo, size_t > raw_store_sizes
Definition historical_queries.h:520
std::shared_ptr< ccf::LedgerSecrets > source_ledger_secrets
Definition historical_queries.h:98
ccf::kv::StorePtr deserialise_ledger_entry(ccf::SeqNo seqno, const uint8_t *data, size_t size, ccf::kv::ApplyResult &result, ccf::ClaimsDigest &claims_digest, bool &has_commit_evidence)
Definition historical_queries.h:1333
std::shared_ptr< ccf::LedgerSecrets > historical_ledger_secrets
Definition historical_queries.h:101
std::vector< ccf::kv::ReadOnlyStorePtr > get_stores_for(const CompoundHandle &handle, const SeqNoCollection &seqnos)
Definition historical_queries.h:1109
StateCacheImpl(ccf::kv::Store &store, const std::shared_ptr< ccf::LedgerSecrets > &secrets, const ringbuffer::WriterPtr &host_writer)
Definition historical_queries.h:1005
std::vector< StatePtr > get_states_internal(const CompoundHandle &handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry, bool include_receipts)
Definition historical_queries.h:884
void delete_all_interested_requests(ccf::SeqNo seqno)
Definition historical_queries.h:976
void lru_shrink_to_fit(size_t threshold)
Definition historical_queries.h:595
bool handle_ledger_entries(ccf::SeqNo from_seqno, ccf::SeqNo to_seqno, const uint8_t *data, size_t size)
Definition historical_queries.h:1271
CacheSize soft_store_cache_limit_raw
Definition historical_queries.h:523
void set_default_expiry_duration(ExpiryDuration duration)
Definition historical_queries.h:1133
bool handle_ledger_entries(ccf::SeqNo from_seqno, ccf::SeqNo to_seqno, const LedgerEntry &data)
Definition historical_queries.h:1264
std::vector< ccf::kv::ReadOnlyStorePtr > get_store_range(const CompoundHandle &handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno)
Definition historical_queries.h:1069
std::weak_ptr< StoreDetails > WeakStoreDetailsPtr
Definition historical_queries.h:185
SeqNoCollection collection_from_single_range(ccf::SeqNo start_seqno, ccf::SeqNo end_seqno)
Definition historical_queries.h:869
std::vector< ccf::kv::ReadOnlyStorePtr > get_store_range(const CompoundHandle &handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1056
void lru_promote(CompoundHandle handle)
Definition historical_queries.h:580
StoreStage
Definition historical_queries.h:108
void lru_evict(CompoundHandle handle)
Definition historical_queries.h:621
Definition historical_queries.h:1483
StatePtr get_state_at(RequestHandle handle, ccf::SeqNo seqno, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1510
std::vector< StatePtr > get_state_range(RequestHandle handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1546
std::vector< StatePtr > get_states_for(RequestHandle handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1584
CompoundHandle make_compound_handle(RequestHandle rh)
Definition historical_queries.h:1485
std::vector< ccf::kv::ReadOnlyStorePtr > get_store_range(RequestHandle handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno) override
Definition historical_queries.h:1537
ccf::kv::ReadOnlyStorePtr get_store_at(RequestHandle handle, ccf::SeqNo seqno) override
Definition historical_queries.h:1504
std::vector< ccf::kv::ReadOnlyStorePtr > get_stores_for(RequestHandle handle, const SeqNoCollection &seqnos) override
Definition historical_queries.h:1577
std::vector< ccf::kv::ReadOnlyStorePtr > get_stores_for(RequestHandle handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1568
StatePtr get_state_at(RequestHandle handle, ccf::SeqNo seqno) override
Definition historical_queries.h:1519
void set_soft_cache_limit(CacheSize cache_limit) override
Definition historical_queries.h:1605
std::vector< StatePtr > get_state_range(RequestHandle handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno) override
Definition historical_queries.h:1559
ccf::kv::ReadOnlyStorePtr get_store_at(RequestHandle handle, ccf::SeqNo seqno, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1495
void set_default_expiry_duration(ExpiryDuration duration) override
Definition historical_queries.h:1600
bool drop_cached_states(RequestHandle handle) override
Definition historical_queries.h:1615
std::vector< StatePtr > get_states_for(RequestHandle handle, const SeqNoCollection &seqnos) override
Definition historical_queries.h:1593
void track_deletes_on_missing_keys(bool track) override
Definition historical_queries.h:1610
std::vector< ccf::kv::ReadOnlyStorePtr > get_store_range(RequestHandle handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1524
StateCache(Ts &&... ts)
Definition historical_queries.h:1492
ReadOnlyTx create_read_only_tx() override
Definition store.h:1275
EncryptorPtr get_encryptor() override
Definition store.h:226
std::shared_ptr< Consensus > get_consensus() override
Definition store.h:188
Definition encryptor.h:15
#define HISTORICAL_LOG(...)
Definition historical_queries.h:25
#define LOG_TRACE_FMT
Definition logger.h:356
#define LOG_DEBUG_FMT
Definition logger.h:357
#define LOG_FAIL_FMT
Definition logger.h:363
std::vector< uint8_t > HashBytes
Definition hash_bytes.h:10
Definition historical_queries_adapter.h:18
std::chrono::seconds ExpiryDuration
Definition historical_queries_interface.h:50
std::shared_ptr< State > StatePtr
Definition historical_queries_interface.h:41
RequestNamespace
Definition historical_queries.h:31
std::pair< RequestNamespace, RequestHandle > CompoundHandle
Definition historical_queries.h:36
size_t RequestHandle
Definition historical_queries_interface.h:48
size_t CacheSize
Definition historical_queries_interface.h:52
ApplyResult
Definition kv_types.h:341
@ PASS_SIGNATURE
Definition kv_types.h:343
@ FAIL
Definition kv_types.h:350
std::shared_ptr< ReadOnlyStore > ReadOnlyStorePtr
Definition read_only_store.h:23
std::shared_ptr< ccf::kv::Store > StorePtr
Definition store.h:1340
std::mutex Mutex
Definition locking.h:12
Definition app_interface.h:14
LedgerSecretsMap::value_type VersionedLedgerSecret
Definition ledger_secrets.h:21
std::shared_ptr< TxReceiptImpl > TxReceiptImplPtr
Definition receipt.h:136
std::shared_ptr< LedgerSecret > LedgerSecretPtr
Definition ledger_secret.h:75
seqno
Definition signatures.h:54
uint64_t SeqNo
Definition tx_id.h:36
std::vector< uint8_t > decrypt_previous_ledger_secret_raw(const LedgerSecretPtr &ledger_secret, const std::vector< uint8_t > &encrypted_previous_secret_raw)
Definition ledger_secret.h:83
Definition consensus_types.h:23
uint64_t Index
Definition ledger_enclave_types.h:11
@ HistoricalQuery
Definition ledger_enclave_types.h:16
std::shared_ptr< AbstractWriter > WriterPtr
Definition ring_buffer_types.h:150
#define RINGBUFFER_WRITE_MESSAGE(MSG,...)
Definition ring_buffer_types.h:255
SeqNo seqno
Definition tx_id.h:46
View view
Definition tx_id.h:45
Definition historical_queries.h:206
bool include_receipts
Definition historical_queries.h:212
StoreDetailsPtr get_store_details(ccf::SeqNo seqno) const
Definition historical_queries.h:224
Request(AllRequestedStores &all_stores_)
Definition historical_queries.h:222
void populate_receipts(ccf::SeqNo new_seqno)
Definition historical_queries.h:350
std::pair< std::vector< SeqNo >, std::vector< SeqNo > > adjust_ranges(const SeqNoCollection &new_seqnos, bool should_include_receipts, SeqNo earliest_ledger_secret_seqno)
Definition historical_queries.h:245
std::optional< ccf::SeqNo > awaiting_ledger_secrets
Definition historical_queries.h:220
AllRequestedStores & all_stores
Definition historical_queries.h:207
std::chrono::milliseconds time_to_expiry
Definition historical_queries.h:210
RequestedStores supporting_signatures
Definition historical_queries.h:217
ccf::SeqNo first_requested_seqno() const
Definition historical_queries.h:235
RequestedStores my_stores
Definition historical_queries.h:209
Definition historical_queries.h:141
std::chrono::milliseconds time_until_fetch
Definition historical_queries.h:142
std::optional< std::string > get_commit_evidence()
Definition historical_queries.h:166
bool has_commit_evidence
Definition historical_queries.h:150
ccf::kv::StorePtr store
Definition historical_queries.h:146
ccf::ClaimsDigest claims_digest
Definition historical_queries.h:145
ccf::crypto::Sha256Hash entry_digest
Definition historical_queries.h:144
ccf::TxID transaction_id
Definition historical_queries.h:149
ccf::crypto::HashBytes get_commit_nonce()
Definition historical_queries.h:152
TxReceiptImplPtr receipt
Definition historical_queries.h:148
StoreStage current_stage
Definition historical_queries.h:143
bool is_signature
Definition historical_queries.h:147
Definition historical_queries.h:189
ccf::LedgerSecretPtr secret
Definition historical_queries.h:191
ccf::SeqNo valid_from
Definition historical_queries.h:190
VersionedSecret(const ccf::VersionedLedgerSecret &vls)
Definition historical_queries.h:196
VersionedSecret()=default