Documentation ¶
Overview ¶
Package expingest contains the new ingestion system for aurora. It currently runs completely independent of the old one, that means that the new system can be ledgers behind/ahead the old system.
Index ¶
Constants ¶
const ( // CurrentVersion reflects the latest version of the ingestion // algorithm. This value is stored in KV store and is used to decide // if there's a need to reprocess the ledger state or reingest data. // // Version history: // - 1: Initial version // - 2: We added the orderbook, offers processors and distributed // ingestion. CurrentVersion = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggingLedgerReporter ¶
LoggingLedgerReporter logs the progress of a session running its ledger pipelines
func (*LoggingLedgerReporter) OnEndLedger ¶
func (lr *LoggingLedgerReporter) OnEndLedger(err error, shutdown bool)
OnEndLedger logs that the session has finished processing the ledger
func (*LoggingLedgerReporter) OnLedgerTransaction ¶
func (lr *LoggingLedgerReporter) OnLedgerTransaction()
OnLedgerTransaction records that the session has processed a transaction from the ledger
func (*LoggingLedgerReporter) OnNewLedger ¶
func (lr *LoggingLedgerReporter) OnNewLedger(sequence uint32)
OnNewLedger logs that the session has started reading a new ledger
type LoggingStateReporter ¶
type LoggingStateReporter struct { Log *ilog.Entry Interval int // contains filtered or unexported fields }
LoggingStateReporter logs the progress of a session running its state pipelines
func (*LoggingStateReporter) OnEndState ¶
func (lr *LoggingStateReporter) OnEndState(err error, shutdown bool)
OnEndState logs that the session has finished processing the history archive snapshot
func (*LoggingStateReporter) OnStartState ¶
func (lr *LoggingStateReporter) OnStartState(sequence uint32)
OnStartState logs that the session has started reading from the history archive snapshot
func (*LoggingStateReporter) OnStateEntry ¶
func (lr *LoggingStateReporter) OnStateEntry()
OnStateEntry logs that the session has processed an entry from the history archive snapshot
type System ¶
type System struct {
// contains filtered or unexported fields
}
func (*System) Run ¶
func (s *System) Run()
Run starts ingestion system. Ingestion system supports distributed ingestion that means that Aurora ingestion can be running on multiple machines and only one, random node will lead the ingestion.
It needs to support cartesian product of the following run scenarios cases: - Init from empty state (1a) and resuming from existing state (1b). - Ingestion system version has been upgraded (2a) or not (2b). - Current node is leading ingestion (3a) or not (3b).
We always clear state when ingestion system is upgraded so 2a and 2b are included in 1a.
We ensure that only one instance is a leader because in each round instances try to acquire a lock on `LastLedgerExpIngest value in key value store and only one instance will be able to acquire it. This happens in both initial processing and ledger processing. So this solves 3a and 3b in both 1a and 1b.
Finally, 1a and 1b are tricky because we need to keep the latest version of order book graph in memory of each Aurora instance. To solve this: * For state init:
- If instance is a leader, we update the order book graph by running state pipeline normally.
- If instance is NOT a leader, we build a graph from offers present in a database. We completely omit state pipeline in this case.
* For resuming:
- If instances is a leader, it runs full ledger pipeline, including updating a database.
- If instances is a NOT leader, it runs ledger pipeline without updating a a database so order book graph is updated but database is not overwritten.