expingest

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

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

View Source
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 Config

type Config struct {
	CoreSession  *db.Session
	HcNetCoreURL string

	HistorySession    *db.Session
	HistoryArchiveURL string
	TempSet           io.TempSet

	OrderBookGraph *orderbook.OrderBookGraph
}

type LoggingLedgerReporter

type LoggingLedgerReporter struct {
	Log *ilog.Entry
	// contains filtered or unexported fields
}

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 NewSystem

func NewSystem(config Config) (*System, error)

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.

func (*System) Shutdown

func (s *System) Shutdown()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL