stellar-core
stellar-core copied to clipboard
WIP Add LedgerStateCache
Adds LedgerStateCache to store all Soroban entries:
- Populates (
LedgerStateCache::addEntry) the cache inPopulateLedgerCacheWork(executed inLedgerManagerImpl::loadLastKnownLedger). - Updates the cache (
LedgerStateCache:::addEntries) each ledger fromLedgerManagerImpl::transferLedgerEntriesToBucketList. - Reads the cache (
LedgerStateCache::readEntry) inLedgerTxnRoot::Impl:::getNewestVersion.
Notes:
-
LedgerStateCachelives in an optional shared pointer and is created at startup, originally in theLedgerManagerImpl -
LedgerTxnRoottakes anstd::optional<LedgerStateCache>in its constructor, andPopulateLedgerCacheWorkaccess it withLedgerManager::getLedgerStateCache. -
addEntryandaddEntriesare private and only accessible fromfriendclassesLedgerManagerImplandPopulateLedgerCacheWork -
addEntryandaddEntriesacquire a unique lock on the cache - Currently, the
LedgerStateCacheonly supports contract entries. To access them in the index, I've addedBucket / Index::getContractEntryRange. - The
LedgerStateCacheis enabled viaConfig::IN_MEMORY_SOROBAN_STATE_FOR_TESTING(defaulttrue).
Description
Resolves https://github.com/stellar/stellar-core/issues/4556
Checklist
- [ ] Reviewed the contributing document
- [ ] Rebased on top of master (no merge commits)
- [ ] Ran
clang-formatv8.0.0 (viamake formator the Visual Studio extension) - [ ] Compiles
- [ ] Ran all tests
- [ ] If change impacts performance, include supporting evidence per the performance document