ledgerexporter

package
v0.0.0-...-79f44c6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Pubnet = "pubnet"
View Source
const Testnet = "testnet"

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp(flags Flags) *App

func (*App) Run

func (a *App) Run()

type Config

type Config struct {
	AdminPort int `toml:"admin_port"`

	Network           string                      `toml:"network"`
	DataStoreConfig   datastore.DataStoreConfig   `toml:"datastore_config"`
	LedgerBatchConfig datastore.LedgerBatchConfig `toml:"exporter_config"`
	StellarCoreConfig StellarCoreConfig           `toml:"stellar_core_config"`

	StartLedger uint32
	EndLedger   uint32
	Resume      bool
}

func NewConfig

func NewConfig(ctx context.Context, flags Flags) (*Config, error)

This will generate the config based on commandline flags and toml

ctx - the caller context flags - command line flags

return - *Config or an error if any range validation failed.

func (*Config) GenerateCaptiveCoreConfig

func (config *Config) GenerateCaptiveCoreConfig() (ledgerbackend.CaptiveCoreConfig, error)

func (*Config) ValidateAndSetLedgerRange

func (config *Config) ValidateAndSetLedgerRange(ctx context.Context, archive historyarchive.ArchiveInterface) error

Validates requested ledger range, and will automatically adjust it to be ledgers-per-file boundary aligned

type DataAlreadyExportedError

type DataAlreadyExportedError struct {
	Start uint32
	End   uint32
}

func NewDataAlreadyExportedError

func NewDataAlreadyExportedError(Start uint32, End uint32) *DataAlreadyExportedError

func (DataAlreadyExportedError) Error

func (m DataAlreadyExportedError) Error() string

type ExportManager

type ExportManager struct {
	// contains filtered or unexported fields
}

func NewExportManager

func NewExportManager(config datastore.LedgerBatchConfig, backend ledgerbackend.LedgerBackend, queue UploadQueue, prometheusRegistry *prometheus.Registry) (*ExportManager, error)

NewExportManager creates a new ExportManager with the provided configuration.

func (*ExportManager) AddLedgerCloseMeta

func (e *ExportManager) AddLedgerCloseMeta(ctx context.Context, ledgerCloseMeta xdr.LedgerCloseMeta) error

AddLedgerCloseMeta adds ledger metadata to the current export object

func (*ExportManager) Run

func (e *ExportManager) Run(ctx context.Context, startLedger, endLedger uint32) error

Run iterates over the specified range of ledgers, retrieves ledger data from the backend, and processes the corresponding ledger close metadata. The process continues until the ending ledger number is reached or a cancellation signal is received.

type Flags

type Flags struct {
	StartLedger    uint32
	EndLedger      uint32
	ConfigFilePath string
	Resume         bool
	AdminPort      uint
}

type InvalidDataStoreError

type InvalidDataStoreError struct {
	LedgerSequence uint32
	LedgersPerFile uint32
}

func NewInvalidDataStoreError

func NewInvalidDataStoreError(LedgerSequence uint32, LedgersPerFile uint32) *InvalidDataStoreError

func (InvalidDataStoreError) Error

func (m InvalidDataStoreError) Error() string

type StellarCoreConfig

type StellarCoreConfig struct {
	NetworkPassphrase     string   `toml:"network_passphrase"`
	HistoryArchiveUrls    []string `toml:"history_archive_urls"`
	StellarCoreBinaryPath string   `toml:"stellar_core_binary_path"`
	CaptiveCoreTomlPath   string   `toml:"captive_core_toml_path"`
}

type UploadQueue

type UploadQueue struct {
	// contains filtered or unexported fields
}

UploadQueue is a queue of LedgerMetaArchive objects which are scheduled for upload

func NewUploadQueue

func NewUploadQueue(size int, prometheusRegistry *prometheus.Registry) UploadQueue

NewUploadQueue constructs a new UploadQueue

func (UploadQueue) Close

func (u UploadQueue) Close()

Close will close the queue.

func (UploadQueue) Dequeue

Dequeue will pop a task off the queue. Dequeue may block if the queue is empty.

func (UploadQueue) Enqueue

func (u UploadQueue) Enqueue(ctx context.Context, archive *datastore.LedgerMetaArchive) error

Enqueue will add an upload task to the queue. Enqueue may block if the queue is full.

type Uploader

type Uploader struct {
	// contains filtered or unexported fields
}

Uploader is responsible for uploading data to a storage destination.

func NewUploader

func NewUploader(
	destination datastore.DataStore,
	queue UploadQueue,
	prometheusRegistry *prometheus.Registry,
) Uploader

NewUploader constructs a new Uploader instance

func (Uploader) Run

func (u Uploader) Run(ctx context.Context) error

Run starts the uploader, continuously listening for LedgerMetaArchive objects to upload.

func (Uploader) Upload

func (u Uploader) Upload(ctx context.Context, metaArchive *datastore.LedgerMetaArchive) error

Upload uploads the serialized binary data of ledger TxMeta to the specified destination.

Jump to

Keyboard shortcuts

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