Documentation
¶
Index ¶
- Variables
- func GetEntriesFromGenesis(end uint32, entryType xdr.LedgerEntryType, archiveURLs []string) ([]ingest.Change, error)
- func GetLedgerRange(startTime, endTime time.Time, isTest bool, isFuture bool) (int64, int64, error)
- func GetLedgers(start, end uint32, limit int64, isTest bool, isFuturenet bool) ([]historyarchive.Ledger, error)
- func GetOfferChanges(core *ledgerbackend.CaptiveStellarCore, env utils.EnvironmentDetails, ...) (*ingest.ChangeCompactor, error)
- func PrepareCaptiveCore(execPath string, tomlPath string, start, end uint32, ...) (*ledgerbackend.CaptiveStellarCore, error)
- func StreamChanges(core *ledgerbackend.CaptiveStellarCore, start, end, batchSize uint32, ...)
- func StreamOrderbooks(core *ledgerbackend.CaptiveStellarCore, start, end, batchSize uint32, ...)
- func UpdateOrderbook(start, end uint32, orderbook []ingest.Change, ...)
- type AllHistoryTransformInput
- type AssetTransformInput
- type ChangeBatch
- type LedgerChanges
- type LedgerTransformInput
- type OperationTransformInput
- type OrderbookBatch
- type OrderbookParser
- type TradeTransformInput
Constants ¶
This section is empty.
Variables ¶
var (
ExtractBatch = extractBatch
)
Functions ¶
func GetEntriesFromGenesis ¶
func GetEntriesFromGenesis(end uint32, entryType xdr.LedgerEntryType, archiveURLs []string) ([]ingest.Change, error)
GetEntriesFromGenesis returns a slice of ledger entries of the specified type for the ledgers starting from the genesis ledger and ending at end (inclusive)
func GetLedgerRange ¶
GetLedgerRange calculates the ledger range that spans the provided date range
func GetLedgers ¶
func GetLedgers(start, end uint32, limit int64, isTest bool, isFuturenet bool) ([]historyarchive.Ledger, error)
GetLedgers returns a slice of ledger close metas for the ledgers in the provided range (inclusive on both ends)
func GetOfferChanges ¶
func GetOfferChanges(core *ledgerbackend.CaptiveStellarCore, env utils.EnvironmentDetails, firstSeq, nextSeq uint32) (*ingest.ChangeCompactor, error)
GetOfferChanges gets the offer changes that ocurred between the firstSeq ledger and nextSeq ledger
func PrepareCaptiveCore ¶
func PrepareCaptiveCore(execPath string, tomlPath string, start, end uint32, env utils.EnvironmentDetails) (*ledgerbackend.CaptiveStellarCore, error)
PrepareCaptiveCore creates a new captive core instance and prepares it with the given range. The range is unbounded when end = 0, and is bounded and validated otherwise
func StreamChanges ¶
func StreamChanges(core *ledgerbackend.CaptiveStellarCore, start, end, batchSize uint32, changeChannel chan ChangeBatch, closeChan chan int, env utils.EnvironmentDetails, logger *utils.EtlLogger)
StreamChanges reads in ledgers, processes the changes, and send the changes to the channel matching their type Ledgers are processed in batches of size <batchSize>.
func StreamOrderbooks ¶
func StreamOrderbooks(core *ledgerbackend.CaptiveStellarCore, start, end, batchSize uint32, orderbookChannel chan OrderbookBatch, startOrderbook []ingest.Change, env utils.EnvironmentDetails, logger *utils.EtlLogger)
StreamOrderbooks exports all the batches of orderbooks between start and end to the orderbookChannel. If end is 0, then it exports in an unbounded fashion
func UpdateOrderbook ¶
func UpdateOrderbook(start, end uint32, orderbook []ingest.Change, core *ledgerbackend.CaptiveStellarCore, env utils.EnvironmentDetails, logger *utils.EtlLogger)
UpdateOrderbook updates an orderbook at ledger start to its state at ledger end
Types ¶
type AllHistoryTransformInput ¶
type AllHistoryTransformInput struct {
Operations []OperationTransformInput
Trades []TradeTransformInput
Ledgers []LedgerTransformInput
}
AllHistoryTransformInput is a representation of the input for the TransformOperation function
func GetAllHistory ¶
func GetAllHistory(start, end uint32, limit int64, env utils.EnvironmentDetails) (AllHistoryTransformInput, error)
GetAllHistory returns a slice of operations, trades, effects, transactions, diagnostic events for the ledgers in the provided range (inclusive on both ends)
type AssetTransformInput ¶
type AssetTransformInput struct {
Operation xdr.Operation
OperationIndex int32
TransactionIndex int32
LedgerSeqNum int32
}
func GetPaymentOperations ¶
func GetPaymentOperations(start, end uint32, limit int64, isTest bool, isFuture bool) ([]AssetTransformInput, error)
GetPaymentOperations returns a slice of payment operations that can include new assets from the ledgers in the provided range (inclusive on both ends)
type ChangeBatch ¶
type ChangeBatch struct {
Changes map[xdr.LedgerEntryType]LedgerChanges
BatchStart uint32
BatchEnd uint32
}
ChangeBatch represents the changes in a batch of ledgers represented by the range [BatchStart, BatchEnd)
type LedgerChanges ¶
type LedgerChanges struct {
Changes []ingest.Change
LedgerHeaders []xdr.LedgerHeaderHistoryEntry
}
type LedgerTransformInput ¶
type LedgerTransformInput struct {
Transaction ingest.LedgerTransaction
LedgerHistory xdr.LedgerHeaderHistoryEntry
LedgerCloseMeta xdr.LedgerCloseMeta
}
LedgerTransformInput is a representation of the input for the TransformTransaction function
func GetTransactions ¶
func GetTransactions(start, end uint32, limit int64, env utils.EnvironmentDetails) ([]LedgerTransformInput, error)
GetTransactions returns a slice of transactions for the ledgers in the provided range (inclusive on both ends)
type OperationTransformInput ¶
type OperationTransformInput struct {
Operation xdr.Operation
OperationIndex int32
Transaction ingest.LedgerTransaction
LedgerSeqNum int32
LedgerCloseMeta xdr.LedgerCloseMeta
}
OperationTransformInput is a representation of the input for the TransformOperation function
func GetOperations ¶
func GetOperations(start, end uint32, limit int64, env utils.EnvironmentDetails) ([]OperationTransformInput, error)
GetOperations returns a slice of operations for the ledgers in the provided range (inclusive on both ends)
type OrderbookBatch ¶
type OrderbookBatch struct {
BatchStart uint32
BatchEnd uint32
Orderbooks map[uint32][]ingest.Change
}
OrderbookBatch represents a batch of orderbooks
type OrderbookParser ¶
type OrderbookParser struct {
Events [][]byte
Markets [][]byte
SeenMarketHashes map[uint64]bool
Offers [][]byte
SeenOfferHashes map[uint64]bool
Accounts [][]byte
SeenAccountHashes map[uint64]bool
Logger *utils.EtlLogger
}
OrderbookParser handles parsing orderbooks
func NewOrderbookParser ¶
func NewOrderbookParser(logger *utils.EtlLogger) OrderbookParser
NewOrderbookParser creates a new orderbook parser and returns it
func ReceiveParsedOrderbooks ¶
func ReceiveParsedOrderbooks(orderbookChannel chan OrderbookBatch, logger *utils.EtlLogger) *OrderbookParser
ReceiveParsedOrderbooks reads a batch from the orderbookChannel, parses it using an orderbook parser, and returns the parser.
type TradeTransformInput ¶
type TradeTransformInput struct {
OperationIndex int32
Transaction ingest.LedgerTransaction
CloseTime time.Time
OperationHistoryID int64
}
TradeTransformInput is a representation of the input for the TransformTrade function
func GetTrades ¶
func GetTrades(start, end uint32, limit int64, env utils.EnvironmentDetails) ([]TradeTransformInput, error)
GetTrades returns a slice of trades for the ledgers in the provided range (inclusive on both ends)