Replies: 2 comments 8 replies
-
Is the idea of this that a product that needs historical ledger state could get that from CDP? I'm interested in this concept because of: |
Beta Was this translation helpful? Give feedback.
-
We have the CheckpointChangeReader in the ingestion library which is essentially an iterator that lets you enumerate through all ledger entries that exist at a specific checkpoint ledger. The CheckpointChangeReader is used by horizon and stellar-rpc to bootstrap their respective databases when ingesting from scratch. I think this should be sufficient for those who want to get all ledger entries that exist at a given point in time. The one limitation of CheckpointChangeReader is that you can only use it on ledger sequences which are checkpoint ledgers. However, we could enhance the CheckpointChangeReader implementation to allow it to work on any ledger using the following algorithm: Given input ledger If Otherwise, we can obtain all ledgers in the range Now we can enumerate through the ledger entries which are live at This workflow will allow us to enumerate through all ledger entries which exist at any ledger sequence regardless if it's a checkpoint ledger or not. The additional memory required to to store the compacted changes from ledgers I think this would be a better API then the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What problem does your idea address?
current state of LedgerEntry's on network per LedgerSequence is not included in the current CDP export model. At present it provides just the LedgerCloseMeta for each LedgerSequence, which provides meta information only related to ledger entries that changed as a result of transactions within one ledger sequence.
The absence of ledger entry state for network at a given ledger sequence from the CDP exported model that consumers receive means downstream ingesting applications which need ledger entry states must solve how to acquire or derive this in addition to using CDP.
If ledger entry states were included as optional data from CDP consumer sdk, it would streamline downstream ingesting applications which need ledger entry states to avoid complexity of custom derivation or external dependency on RPC, encouraging wider adoption of CDP for more use cases.
What would you like to see?
Currently CDP consumer sdk is comprised of ApplyLedgerMetadata function for consumers to receive pre-computed LedgerCloseMeta's from a datastore.
The idea here is to expand the consumer sdk with new functions to perform on-the-fly ledger state derivation internally using combination of checkpoint buckets from HA servers and pre-computed LedgerCloseMeta's from CDP datastores and publish the ledger entry states to a local RocksDB:
RocksDB schema
CDP sdk changes
The sequence for getting ledger entries at close of a specific ledger sequence:
DeriveLedgerState
on a thread, it blocks until ledger entries are finished for requestedledgerSequence
:ledgerStateDbPath
to emptyledgerStateDbPath
ledgerStateDbPath
The sequence for unbounded, continuously updated ledger entries from a network, aka 'current state':
DeriveLedgerStateUnbounded
on a thread, it blocks forever:ledgerStateDbPath
to emptyledgerStateDbPath
VerifedState
. If it detects too far back, it (re)locksVerifedState
DeriveLedgerStateUnbounded
can stop and return error if severe error, and/or unable to verify state.VerifyState.WaitForVerified
first, when it's unlocked, client can proceed to read entries fromledgerStateDbPath
What alternatives are there?
if downstream CDP consumers need access to ledger entry states for any given ledger sequence, there are two current day options:
Beta Was this translation helpful? Give feedback.
All reactions