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<std::vector<uint8_t>> get_tree(
80 auto tx = sig_store->create_read_only_tx();
116 "Source ledger secrets are empty");
125 "Historical ledger secrets are not older than main ledger secrets");
146 if (
store !=
nullptr)
148 auto e =
store->get_encryptor();
149 return e->get_commit_nonce(
154 throw std::logic_error(
"Store pointer not set");
221 return it->second.lock();
239 bool should_include_receipts,
240 SeqNo earliest_ledger_secret_seqno)
242 std::vector<SeqNo> removed{}, added{};
244 bool any_diff =
false;
253 bool any_too_early =
false;
257 auto new_it = new_seqnos.
begin();
258 while (new_it != new_seqnos.
end())
260 if (prev_it !=
my_stores.end() && *new_it == prev_it->first)
267 else if (prev_it !=
my_stores.end() && *new_it > prev_it->first)
271 removed.push_back(prev_it->first);
281 if (*new_it < earliest_ledger_secret_seqno || any_too_early)
285 added.push_back(*new_it);
286 prev_it =
my_stores.insert_or_assign(prev_it, *new_it,
nullptr);
287 any_too_early =
true;
293 all_it ==
all_stores.end() ? nullptr : all_it->second.lock();
294 if (details ==
nullptr)
297 details = std::make_shared<StoreDetails>();
298 all_stores.insert_or_assign(all_it, *new_it, details);
300 added.push_back(*new_it);
301 prev_it =
my_stores.insert_or_assign(prev_it, *new_it, details);
319 return {removed, added};
327 if (should_include_receipts)
334 for (
auto seqno : new_seqnos)
339 return {removed, added};
345 "Looking at {}, and populating receipts from it", new_seqno);
347 if (new_details !=
nullptr && new_details->store !=
nullptr)
349 if (new_details->is_signature)
353 fill_receipts_from_signature(new_details);
370 auto next_seqno = new_seqno + 1;
375 all_it ==
all_stores.end() ? nullptr : all_it->second.lock();
376 if (details ==
nullptr)
379 "Looking for new supporting signature at {}", next_seqno);
380 details = std::make_shared<StoreDetails>();
381 all_stores.insert_or_assign(all_it, next_seqno, details);
384 if (details->store ==
nullptr)
390 "Assigning {} as potential signature for {}",
396 else if (details->is_signature)
398 const auto filled_this =
399 fill_receipts_from_signature(details, new_seqno);
404 throw std::logic_error(fmt::format(
405 "Unexpected: Found a signature at {}, and contiguous range "
406 "of transactions from {}, yet signature does not cover "
426 bool fill_receipts_from_signature(
427 const std::shared_ptr<StoreDetails>& sig_details,
428 std::optional<ccf::SeqNo> should_fill = std::nullopt)
432 const auto sig = get_signature(sig_details->store);
437 auto sig_lower_bound_it =
438 my_stores.lower_bound(sig_details->transaction_id.seqno);
440 if (sig_lower_bound_it !=
my_stores.begin())
443 auto search_rit = std::reverse_iterator(sig_lower_bound_it);
446 auto seqno = search_rit->first;
447 if (tree.in_range(
seqno))
449 auto details = search_rit->second;
450 if (details !=
nullptr && details->store !=
nullptr)
452 auto proof = tree.get_proof(
seqno);
453 details->transaction_id = {sig->view,
seqno};
454 details->receipt = std::make_shared<TxReceiptImpl>(
460 details->entry_digest,
461 details->get_commit_evidence(),
462 details->claims_digest);
464 "Assigned a receipt for {} after given signature at {}",
466 sig_details->transaction_id.to_str());
468 if (should_fill.has_value() &&
seqno == *should_fill)
485 return !should_fill.has_value();
505 std::map<CompoundHandle, std::list<CompoundHandle>::iterator>
lru_lookup;
532 it->second.insert(handle);
538 for (
const auto& [seq, _] :
requests.at(handle).my_stores)
549 it->second.erase(handle);
550 if (it->second.empty())
564 for (
const auto& [seq, _] :
requests.at(handle).my_stores)
592 "LRU shrink to {} requested but cache is already empty", threshold);
598 "Cache size shrinking (reached {} / {}). Dropping {}",
625 assert(!stored_size || stored_size == new_size);
629 stored_size = new_size;
642 ::consensus::ledger_get_range,
652 auto [earliest_ledger_secret_seqno, earliest_ledger_secret] =
655 earliest_ledger_secret !=
nullptr,
656 "Can't fetch without knowing earliest");
658 const auto too_early =
seqno < earliest_ledger_secret_seqno;
660 auto previous_secret_stored_version =
661 earliest_ledger_secret->previous_secret_stored_version;
662 const auto is_next_secret =
663 previous_secret_stored_version.value_or(0) ==
seqno;
665 if (too_early || is_next_secret)
668 if (!previous_secret_stored_version.has_value())
670 throw std::logic_error(fmt::format(
671 "Earliest known ledger secret at {} has no earlier secret stored "
673 earliest_ledger_secret_seqno,
677 const auto seqno_to_fetch = previous_secret_stored_version.value();
679 "Requesting historical entry at {} but first known ledger "
680 "secret is applicable from {}",
682 earliest_ledger_secret_seqno);
685 auto details = it ==
all_stores.end() ? nullptr : it->second.lock();
686 if (details ==
nullptr)
688 LOG_TRACE_FMT(
"Requesting older secret at {} now", seqno_to_fetch);
689 details = std::make_shared<StoreDetails>();
690 all_stores.insert_or_assign(it, seqno_to_fetch, details);
698 return seqno_to_fetch;
712 bool has_commit_evidence)
717 details->has_commit_evidence = has_commit_evidence;
719 details->entry_digest = entry_digest;
720 if (!claims_digest.empty())
721 details->claims_digest = std::move(claims_digest);
724 details->store ==
nullptr,
725 "Cache already has store for seqno {}",
727 details->store = store;
729 details->is_signature = is_signature;
737 const auto sig = get_signature(details->store);
738 assert(sig.has_value());
739 details->transaction_id = {sig->view, sig->seqno};
740 details->receipt = std::make_shared<TxReceiptImpl>(
741 sig->sig, sig->root.h,
nullptr, sig->node, sig->cert);
745 while (request_it !=
requests.end())
747 auto& [handle, request] = *request_it;
752 request.awaiting_ledger_secrets.has_value() &&
753 request.awaiting_ledger_secrets.value() ==
seqno)
756 "{} is a ledger secret seqno this request was waiting for",
seqno);
758 request.awaiting_ledger_secrets =
760 if (!request.awaiting_ledger_secrets.has_value())
765 auto my_stores_it = request.my_stores.begin();
766 while (my_stores_it != request.my_stores.end())
768 auto [store_seqno, _] = *my_stores_it;
771 it ==
all_stores.end() ? nullptr : it->second.lock();
773 if (store_details ==
nullptr)
775 store_details = std::make_shared<StoreDetails>();
776 all_stores.insert_or_assign(it, store_seqno, store_details);
779 my_stores_it->second = store_details;
789 if (request.include_receipts)
791 const bool seqno_in_this_request =
792 (request.my_stores.find(
seqno) != request.my_stores.end() ||
793 request.supporting_signatures.find(
seqno) !=
794 request.supporting_signatures.end());
795 if (seqno_in_this_request)
797 request.populate_receipts(
seqno);
809 auto tx = store->create_read_only_tx();
810 auto encrypted_past_ledger_secret_handle =
812 ccf::Tables::ENCRYPTED_PAST_LEDGER_SECRET);
813 if (!encrypted_past_ledger_secret_handle)
818 auto encrypted_past_ledger_secret =
819 encrypted_past_ledger_secret_handle->get();
820 if (!encrypted_past_ledger_secret.has_value())
826 auto previous_ledger_secret =
827 encrypted_past_ledger_secret->previous_ledger_secret;
828 if (!previous_ledger_secret.has_value())
833 encrypted_past_ledger_secret->next_version.has_value() &&
834 encrypted_past_ledger_secret->next_version.value() == 1,
835 "Write to ledger secrets table at {} should contain a next_version "
837 store->current_version());
841 auto recovered_ledger_secret = std::make_shared<LedgerSecret>(
843 encrypting_secret, std::move(previous_ledger_secret->encrypted_data)),
844 previous_ledger_secret->previous_secret_stored_version);
848 previous_ledger_secret->version, std::move(recovered_ledger_secret));
861 if (end_seqno < start_seqno)
863 throw std::logic_error(fmt::format(
864 "Invalid range for historical query: end {} is before start {}",
877 bool include_receipts)
881 throw std::logic_error(
882 "Invalid range for historical query: Cannot request empty range");
887 const auto ms_until_expiry =
888 std::chrono::duration_cast<std::chrono::milliseconds>(
889 seconds_until_expiry);
907 "Adjusting handle {} to cover {} seqnos starting at {} "
908 "(include_receipts={})",
916 for (
auto seq : removed)
920 for (
auto seq : added)
934 std::vector<StatePtr> trusted_states;
936 for (
auto seqno : seqnos)
940 target_details !=
nullptr &&
946 StatePtr state = std::make_shared<State>(
947 target_details->store,
948 target_details->receipt,
949 target_details->transaction_id);
950 trusted_states.push_back(state);
960 return trusted_states;
968 while (request_it !=
requests.end())
970 if (request_it->second.get_store_details(
seqno) !=
nullptr)
973 request_it =
requests.erase(request_it);
983 const std::vector<StatePtr>& states)
985 std::vector<ccf::kv::ReadOnlyStorePtr> stores;
986 for (
size_t i = 0; i < states.size(); i++)
988 stores.push_back(states[i]->store);
996 const std::shared_ptr<ccf::LedgerSecrets>& secrets,
1054 seconds_until_expiry,
1076 seconds_until_expiry,
1111 throw std::runtime_error(
"Cannot request empty range");
1142 const auto erased_count =
requests.erase(handle);
1143 return erased_count > 0;
1155 auto details = it ==
all_stores.end() ? nullptr : it->second.lock();
1165 bool has_commit_evidence;
1172 has_commit_evidence);
1182 const auto tx_id = store->current_txid();
1183 if (tx_id.version !=
seqno)
1186 "Corrupt ledger entry received - claims to be {} but is actually "
1202 if (actual_view != tx_id.term)
1205 "Ledger entry comes from fork - contains {}.{} but this service "
1215 const auto is_signature =
1223 secret->previous_secret_stored_version.has_value() &&
1224 secret->previous_secret_stored_version.value() ==
seqno)
1227 "Handling past ledger secret. Current earliest is valid from {}, now "
1228 "processing secret stored at {}",
1236 "Processing historical store at {} ({})",
1238 (
size_t)deserialise_result);
1246 std::move(claims_digest),
1247 has_commit_evidence);
1257 from_seqno, to_seqno, data.data(), data.size());
1263 const uint8_t* data,
1266 LOG_TRACE_FMT(
"handle_ledger_entries({}, {})", from_seqno, to_seqno);
1268 auto seqno = from_seqno;
1269 bool all_accepted =
true;
1273 serialized::peek<ccf::kv::SerialisedEntryHeader>(data, size);
1274 const auto whole_size =
1275 header.size + ccf::kv::serialised_entry_header_size;
1282 if (
seqno != to_seqno + 1)
1285 "Claimed ledger entries: [{}, {}), actual [{}, {}]",
1292 return all_accepted;
1304 LOG_TRACE_FMT(
"handle_no_entry_range({}, {})", from_seqno, to_seqno);
1324 const uint8_t* data,
1328 bool& has_commit_evidence)
1337 if (seqno < source_ledger_secrets->get_first().first)
1352 bool public_only =
false;
1353 for (
const auto& [_, request] :
requests)
1355 const auto& als = request.awaiting_ledger_secrets;
1356 if (als.has_value() && als.value() ==
seqno)
1363 auto exec = store->deserialize({data, data + size}, public_only);
1364 if (exec ==
nullptr)
1371 claims_digest = std::move(exec->consume_claims_digest());
1373 auto commit_evidence_digest =
1374 std::move(exec->consume_commit_evidence_digest());
1375 has_commit_evidence = commit_evidence_digest.has_value();
1377 catch (
const std::exception& e)
1380 "Exception while attempting to deserialise entry {}: {}",
1389 void tick(
const std::chrono::milliseconds& elapsed_ms)
1397 auto& request = it->second;
1398 if (elapsed_ms >= request.time_to_expiry)
1401 "Dropping expired historical query with handle {}", it->first);
1407 request.time_to_expiry -= elapsed_ms;
1417 std::optional<std::pair<ccf::SeqNo, ccf::SeqNo>> range_to_request =
1421 auto details = it->second.lock();
1422 if (details ==
nullptr)
1430 details->time_until_fetch -= elapsed_ms;
1431 if (details->time_until_fetch.count() <= 0)
1433 details->time_until_fetch = slow_fetch_threshold;
1435 const auto seqno = it->first;
1437 range_to_request.has_value() &&
1438 range_to_request->second + 1 ==
seqno)
1440 range_to_request->second =
seqno;
1444 if (range_to_request.has_value())
1448 range_to_request->first, range_to_request->second);
1452 range_to_request = std::make_pair(
seqno,
seqno);
1461 if (range_to_request.has_value())
1465 range_to_request->first, range_to_request->second);
1480 template <
typename... Ts>
1523 seconds_until_expiry);
1545 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:23
Definition sha256_hash.h:16
Definition contiguous_set.h:17
ConstIterator end() const
Definition contiguous_set.h:494
bool empty() const
Definition contiguous_set.h:319
ConstIterator begin() const
Definition contiguous_set.h:489
size_t size() const
Definition contiguous_set.h:311
Definition historical_queries_interface.h:67
Definition historical_queries.h:87
std::map< CompoundHandle, std::list< CompoundHandle >::iterator > lru_lookup
Definition historical_queries.h:505
void update_store_raw_size(SeqNo seq, size_t new_size)
Definition historical_queries.h:622
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:705
std::vector< StatePtr > get_states_for(const CompoundHandle &handle, const SeqNoCollection &seqnos)
Definition historical_queries.h:1116
std::map< CompoundHandle, Request > requests
Definition historical_queries.h:493
std::list< CompoundHandle > lru_requests
Definition historical_queries.h:504
std::vector< ccf::kv::ReadOnlyStorePtr > states_to_stores(const std::vector< StatePtr > &states)
Definition historical_queries.h:982
ExpiryDuration default_expiry_duration
Definition historical_queries.h:500
bool track_deletes_on_missing_keys_v
Definition historical_queries.h:97
ccf::kv::Store & source_store
Definition historical_queries.h:89
std::map< ccf::SeqNo, WeakStoreDetailsPtr > AllRequestedStores
Definition historical_queries.h:178
ringbuffer::WriterPtr to_host
Definition historical_queries.h:91
void add_request_refs(CompoundHandle handle)
Definition historical_queries.h:536
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:1067
std::unordered_map< SeqNo, std::set< CompoundHandle > > store_to_requests
Definition historical_queries.h:509
std::vector< StatePtr > get_state_range(const CompoundHandle &handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno)
Definition historical_queries.h:1080
AllRequestedStores all_stores
Definition historical_queries.h:498
void set_soft_cache_limit(CacheSize cache_limit)
Definition historical_queries.h:1127
void remove_request_ref(SeqNo seq, CompoundHandle handle)
Definition historical_queries.h:544
CacheSize estimated_store_cache_size
Definition historical_queries.h:515
StatePtr get_state_at(const CompoundHandle &handle, ccf::SeqNo seqno, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1026
bool drop_cached_states(const CompoundHandle &handle)
Definition historical_queries.h:1138
void handle_no_entry(ccf::SeqNo seqno)
Definition historical_queries.h:1295
void remove_request_refs(CompoundHandle handle)
Definition historical_queries.h:562
void track_deletes_on_missing_keys(bool track)
Definition historical_queries.h:1133
std::vector< StatePtr > get_states_for(const CompoundHandle &handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1104
std::vector< ccf::kv::ReadOnlyStorePtr > get_stores_for(const CompoundHandle &handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1089
std::map< ccf::SeqNo, StoreDetailsPtr > RequestedStores
Definition historical_queries.h:175
void handle_no_entry_range(ccf::SeqNo from_seqno, ccf::SeqNo to_seqno)
Definition historical_queries.h:1300
bool handle_encrypted_past_ledger_secret(const ccf::kv::StorePtr &store, LedgerSecretPtr encrypting_secret)
Definition historical_queries.h:805
ccf::kv::ReadOnlyStorePtr get_store_at(const CompoundHandle &handle, ccf::SeqNo seqno)
Definition historical_queries.h:1020
StatePtr get_state_at(const CompoundHandle &handle, ccf::SeqNo seqno)
Definition historical_queries.h:1040
std::shared_ptr< ccf::NodeEncryptor > historical_encryptor
Definition historical_queries.h:94
CacheSize soft_store_cache_limit
Definition historical_queries.h:512
void add_request_ref(SeqNo seq, CompoundHandle handle)
Definition historical_queries.h:517
void fetch_entries_range(ccf::SeqNo from, ccf::SeqNo to)
Definition historical_queries.h:637
std::vector< uint8_t > LedgerEntry
Definition historical_queries.h:105
bool handle_ledger_entry(ccf::SeqNo seqno, const uint8_t *data, size_t size)
Definition historical_queries.h:1151
void fetch_entry_at(ccf::SeqNo seqno)
Definition historical_queries.h:632
ccf::kv::ReadOnlyStorePtr get_store_at(const CompoundHandle &handle, ccf::SeqNo seqno, ExpiryDuration seconds_until_expiry)
Definition historical_queries.h:1006
StoreDetailsPtr next_secret_fetch_handle
Definition historical_queries.h:195
void update_earliest_known_ledger_secret()
Definition historical_queries.h:107
ccf::pal::Mutex requests_lock
Definition historical_queries.h:490
std::shared_ptr< StoreDetails > StoreDetailsPtr
Definition historical_queries.h:174
bool handle_ledger_entry(ccf::SeqNo seqno, const std::vector< uint8_t > &data)
Definition historical_queries.h:1146
void tick(const std::chrono::milliseconds &elapsed_ms)
Definition historical_queries.h:1389
VersionedSecret earliest_secret_
Definition historical_queries.h:194
std::optional< ccf::SeqNo > fetch_supporting_secret_if_needed(ccf::SeqNo seqno)
Definition historical_queries.h:649
std::unordered_map< ccf::SeqNo, size_t > raw_store_sizes
Definition historical_queries.h:510
std::shared_ptr< ccf::LedgerSecrets > source_ledger_secrets
Definition historical_queries.h:90
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:1322
std::shared_ptr< ccf::LedgerSecrets > historical_ledger_secrets
Definition historical_queries.h:93
std::vector< ccf::kv::ReadOnlyStorePtr > get_stores_for(const CompoundHandle &handle, const SeqNoCollection &seqnos)
Definition historical_queries.h:1098
StateCacheImpl(ccf::kv::Store &store, const std::shared_ptr< ccf::LedgerSecrets > &secrets, const ringbuffer::WriterPtr &host_writer)
Definition historical_queries.h:994
std::vector< StatePtr > get_states_internal(const CompoundHandle &handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry, bool include_receipts)
Definition historical_queries.h:873
void delete_all_interested_requests(ccf::SeqNo seqno)
Definition historical_queries.h:965
void lru_shrink_to_fit(size_t threshold)
Definition historical_queries.h:585
bool handle_ledger_entries(ccf::SeqNo from_seqno, ccf::SeqNo to_seqno, const uint8_t *data, size_t size)
Definition historical_queries.h:1260
CacheSize soft_store_cache_limit_raw
Definition historical_queries.h:513
void set_default_expiry_duration(ExpiryDuration duration)
Definition historical_queries.h:1122
bool handle_ledger_entries(ccf::SeqNo from_seqno, ccf::SeqNo to_seqno, const LedgerEntry &data)
Definition historical_queries.h:1253
std::vector< ccf::kv::ReadOnlyStorePtr > get_store_range(const CompoundHandle &handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno)
Definition historical_queries.h:1058
std::weak_ptr< StoreDetails > WeakStoreDetailsPtr
Definition historical_queries.h:177
SeqNoCollection collection_from_single_range(ccf::SeqNo start_seqno, ccf::SeqNo end_seqno)
Definition historical_queries.h:858
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:1045
void lru_promote(CompoundHandle handle)
Definition historical_queries.h:570
StoreStage
Definition historical_queries.h:100
void lru_evict(CompoundHandle handle)
Definition historical_queries.h:611
Definition historical_queries.h:1472
StatePtr get_state_at(RequestHandle handle, ccf::SeqNo seqno, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1499
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:1535
std::vector< StatePtr > get_states_for(RequestHandle handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1573
CompoundHandle make_compound_handle(RequestHandle rh)
Definition historical_queries.h:1474
std::vector< ccf::kv::ReadOnlyStorePtr > get_store_range(RequestHandle handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno) override
Definition historical_queries.h:1526
ccf::kv::ReadOnlyStorePtr get_store_at(RequestHandle handle, ccf::SeqNo seqno) override
Definition historical_queries.h:1493
std::vector< ccf::kv::ReadOnlyStorePtr > get_stores_for(RequestHandle handle, const SeqNoCollection &seqnos) override
Definition historical_queries.h:1566
std::vector< ccf::kv::ReadOnlyStorePtr > get_stores_for(RequestHandle handle, const SeqNoCollection &seqnos, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1557
StatePtr get_state_at(RequestHandle handle, ccf::SeqNo seqno) override
Definition historical_queries.h:1508
void set_soft_cache_limit(CacheSize cache_limit) override
Definition historical_queries.h:1594
std::vector< StatePtr > get_state_range(RequestHandle handle, ccf::SeqNo start_seqno, ccf::SeqNo end_seqno) override
Definition historical_queries.h:1548
ccf::kv::ReadOnlyStorePtr get_store_at(RequestHandle handle, ccf::SeqNo seqno, ExpiryDuration seconds_until_expiry) override
Definition historical_queries.h:1484
void set_default_expiry_duration(ExpiryDuration duration) override
Definition historical_queries.h:1589
bool drop_cached_states(RequestHandle handle) override
Definition historical_queries.h:1604
std::vector< StatePtr > get_states_for(RequestHandle handle, const SeqNoCollection &seqnos) override
Definition historical_queries.h:1582
void track_deletes_on_missing_keys(bool track) override
Definition historical_queries.h:1599
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:1513
StateCache(Ts &&... ts)
Definition historical_queries.h:1481
ReadOnlyTx create_read_only_tx() override
Definition store.h:1231
EncryptorPtr get_encryptor() override
Definition store.h:212
std::shared_ptr< Consensus > get_consensus() override
Definition store.h:184
Definition encryptor.h:15
#define HISTORICAL_LOG(...)
Definition historical_queries.h:25
#define LOG_TRACE_FMT
Definition logger.h:378
#define LOG_DEBUG_FMT
Definition logger.h:380
#define LOG_FAIL_FMT
Definition logger.h:396
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:339
@ PASS_SIGNATURE
Definition kv_types.h:341
@ FAIL
Definition kv_types.h:348
std::shared_ptr< ReadOnlyStore > ReadOnlyStorePtr
Definition read_only_store.h:23
std::shared_ptr< ccf::kv::Store > StorePtr
Definition store.h:1296
std::mutex Mutex
Definition locking.h:17
Definition app_interface.h:15
ServiceValue< PrimarySignature > Signatures
Definition signatures.h:58
ccf::kv::RawCopySerialisedValue< std::vector< uint8_t > > SerialisedMerkleTree
Definition signatures.h:62
LedgerSecretsMap::value_type VersionedLedgerSecret
Definition ledger_secrets.h:20
ServiceValue< EncryptedLedgerSecretInfo > EncryptedLedgerSecretsInfo
Definition shares.h:118
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:198
bool include_receipts
Definition historical_queries.h:204
StoreDetailsPtr get_store_details(ccf::SeqNo seqno) const
Definition historical_queries.h:216
Request(AllRequestedStores &all_stores_)
Definition historical_queries.h:214
void populate_receipts(ccf::SeqNo new_seqno)
Definition historical_queries.h:342
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:237
std::optional< ccf::SeqNo > awaiting_ledger_secrets
Definition historical_queries.h:212
AllRequestedStores & all_stores
Definition historical_queries.h:199
std::chrono::milliseconds time_to_expiry
Definition historical_queries.h:202
RequestedStores supporting_signatures
Definition historical_queries.h:209
ccf::SeqNo first_requested_seqno() const
Definition historical_queries.h:227
RequestedStores my_stores
Definition historical_queries.h:201
Definition historical_queries.h:133
std::chrono::milliseconds time_until_fetch
Definition historical_queries.h:134
std::optional< std::string > get_commit_evidence()
Definition historical_queries.h:158
bool has_commit_evidence
Definition historical_queries.h:142
ccf::kv::StorePtr store
Definition historical_queries.h:138
ccf::ClaimsDigest claims_digest
Definition historical_queries.h:137
ccf::crypto::Sha256Hash entry_digest
Definition historical_queries.h:136
ccf::TxID transaction_id
Definition historical_queries.h:141
ccf::crypto::HashBytes get_commit_nonce()
Definition historical_queries.h:144
TxReceiptImplPtr receipt
Definition historical_queries.h:140
StoreStage current_stage
Definition historical_queries.h:135
bool is_signature
Definition historical_queries.h:139
Definition historical_queries.h:181
ccf::LedgerSecretPtr secret
Definition historical_queries.h:183
ccf::SeqNo valid_from
Definition historical_queries.h:182
VersionedSecret(const ccf::VersionedLedgerSecret &vls)
Definition historical_queries.h:188
VersionedSecret()=default