ingester

package
v0.0.0-...-095633c Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOperationParticipants

func GetOperationParticipants(tx LedgerTransaction, op xdr.Operation, opIndex int) (set.Set[string], error)

GetOperationParticipants takes a LedgerTransaction, the Operation within the transaction, and the 0-based index of the operation within the transaction. It will return a set of all participants (accounts) in the operation. If there is any error, it will return nil and the error.

func GetTransactionParticipants

func GetTransactionParticipants(tx LedgerTransaction) (set.Set[string], error)

GetTransactionParticipants takes a LedgerTransaction and returns a set of all participants (accounts) in the transaction. If there is any error, it will return nil and the error.

func NewParallelIngester

func NewParallelIngester(
	archive metaarchive.MetaArchive,
	networkPassphrase string,
	workerCount uint,
) *parallelIngester

NewParallelIngester creates an ingester on the given `ledgerSource` using the given `networkPassphrase` that can download ledgers in parallel via `workerCount` workers via `PrepareRange()`.

Types

type Ingester

type Ingester interface {
	metaarchive.MetaArchive

	PrepareRange(ctx context.Context, r historyarchive.Range) error
	NewLedgerTransactionReader(
		ledgerCloseMeta xdr.SerializedLedgerCloseMeta,
	) (LedgerTransactionReader, error)
}

Ingester combines a source of unpacked ledger metadata and a way to create a ingestion reader interface on top of it.

func NewIngester

func NewIngester(config IngesterConfig) (Ingester, error)

type IngesterConfig

type IngesterConfig struct {
	SourceUrl         string
	NetworkPassphrase string

	CacheDir  string
	CacheSize int

	ParallelDownloads uint
}

type LedgerTransaction

type LedgerTransaction struct {
	*ingest.LedgerTransaction
}

For now, this mirrors the `ingest` library exactly, but it's replicated so that we can diverge in the future if necessary.

type LedgerTransactionReader

type LedgerTransactionReader interface {
	Read() (LedgerTransaction, error)
}

type MockIngester

type MockIngester struct {
	mock.Mock
}

func (*MockIngester) GetLatestLedgerSequence

func (m *MockIngester) GetLatestLedgerSequence(ctx context.Context) (uint32, error)

func (*MockIngester) GetLedger

func (m *MockIngester) GetLedger(ctx context.Context, sequence uint32) (xdr.SerializedLedgerCloseMeta, error)

func (*MockIngester) NewLedgerTransactionReader

func (m *MockIngester) NewLedgerTransactionReader(
	ledgerCloseMeta xdr.SerializedLedgerCloseMeta,
) (LedgerTransactionReader, error)

func (*MockIngester) PrepareRange

func (m *MockIngester) PrepareRange(ctx context.Context, r historyarchive.Range) error

type MockLedgerTransactionReader

type MockLedgerTransactionReader struct {
	mock.Mock
}

func (*MockLedgerTransactionReader) Read

Jump to

Keyboard shortcuts

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