Documentation ¶
Index ¶
- Constants
- func GetObjectKeyFromSequenceNumber(config ExporterConfig, ledgerSeq uint32) (string, error)
- type App
- type Config
- type DataStore
- type ExportManager
- type ExporterConfig
- type GCSDataStore
- func (b GCSDataStore) Close() error
- func (b GCSDataStore) Exists(ctx context.Context, pth string) (bool, error)
- func (b GCSDataStore) GetFile(ctx context.Context, filePath string) (io.ReadCloser, error)
- func (b GCSDataStore) PutFile(ctx context.Context, filePath string, in io.WriterTo) error
- func (b GCSDataStore) PutFileIfNotExists(ctx context.Context, filePath string, in io.WriterTo) (bool, error)
- func (b GCSDataStore) Size(ctx context.Context, pth string) (int64, error)
- type LedgerMetaArchive
- func (f *LedgerMetaArchive) AddLedger(ledgerCloseMeta xdr.LedgerCloseMeta) error
- func (f *LedgerMetaArchive) GetEndLedgerSequence() uint32
- func (f *LedgerMetaArchive) GetLedgerCount() uint32
- func (f *LedgerMetaArchive) GetObjectKey() string
- func (f *LedgerMetaArchive) GetStartLedgerSequence() uint32
- type MockDataStore
- func (m *MockDataStore) Close() error
- func (m *MockDataStore) Exists(ctx context.Context, path string) (bool, error)
- func (m *MockDataStore) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (m *MockDataStore) PutFile(ctx context.Context, path string, in io.WriterTo) error
- func (m *MockDataStore) PutFileIfNotExists(ctx context.Context, path string, in io.WriterTo) (bool, error)
- func (m *MockDataStore) Size(ctx context.Context, path string) (int64, error)
- type StellarCoreConfig
- type UploadQueue
- type Uploader
- type XDRGzipDecoder
- type XDRGzipEncoder
Constants ¶
const Pubnet = "pubnet"
const Testnet = "testnet"
Variables ¶
This section is empty.
Functions ¶
func GetObjectKeyFromSequenceNumber ¶
func GetObjectKeyFromSequenceNumber(config ExporterConfig, ledgerSeq uint32) (string, error)
GetObjectKeyFromSequenceNumber generates the file name from the ledger sequence number based on configuration.
Types ¶
type Config ¶
type Config struct { AdminPort int `toml:"admin_port"` Network string `toml:"network"` DestinationURL string `toml:"destination_url"` ExporterConfig ExporterConfig `toml:"exporter_config"` StellarCoreConfig StellarCoreConfig `toml:"stellar_core_config"` //From command-line StartLedger uint32 `toml:"start"` EndLedger uint32 `toml:"end"` StartFromLastLedgers uint32 `toml:"from-last"` }
func (*Config) GenerateCaptiveCoreConfig ¶
func (config *Config) GenerateCaptiveCoreConfig() ledgerbackend.CaptiveCoreConfig
func (*Config) LoadConfig ¶
type DataStore ¶
type DataStore interface { GetFile(ctx context.Context, path string) (io.ReadCloser, error) PutFile(ctx context.Context, path string, in io.WriterTo) error PutFileIfNotExists(ctx context.Context, path string, in io.WriterTo) (bool, error) Exists(ctx context.Context, path string) (bool, error) Size(ctx context.Context, path string) (int64, error) Close() error }
DataStore defines an interface for interacting with data storage
type ExportManager ¶
type ExportManager struct {
// contains filtered or unexported fields
}
ExportManager manages the creation and handling of export objects.
func NewExportManager ¶
func NewExportManager(config ExporterConfig, backend ledgerbackend.LedgerBackend, queue UploadQueue, prometheusRegistry *prometheus.Registry) *ExportManager
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 ExporterConfig ¶
type GCSDataStore ¶
type GCSDataStore struct {
// contains filtered or unexported fields
}
GCSDataStore implements DataStore for GCS
func (GCSDataStore) Close ¶
func (b GCSDataStore) Close() error
Close closes the GCS client connection.
func (GCSDataStore) GetFile ¶
func (b GCSDataStore) GetFile(ctx context.Context, filePath string) (io.ReadCloser, error)
GetFile retrieves a file from the GCS bucket.
func (GCSDataStore) PutFileIfNotExists ¶
func (b GCSDataStore) PutFileIfNotExists(ctx context.Context, filePath string, in io.WriterTo) (bool, error)
PutFileIfNotExists uploads a file to GCS only if it doesn't already exist.
type LedgerMetaArchive ¶
type LedgerMetaArchive struct {
// contains filtered or unexported fields
}
LedgerMetaArchive represents a file with metadata and binary data.
func NewLedgerMetaArchive ¶
func NewLedgerMetaArchive(key string, startSeq uint32, endSeq uint32) *LedgerMetaArchive
NewLedgerMetaArchive creates a new LedgerMetaArchive instance.
func (*LedgerMetaArchive) AddLedger ¶
func (f *LedgerMetaArchive) AddLedger(ledgerCloseMeta xdr.LedgerCloseMeta) error
AddLedger adds a LedgerCloseMeta to the archive.
func (*LedgerMetaArchive) GetEndLedgerSequence ¶
func (f *LedgerMetaArchive) GetEndLedgerSequence() uint32
GetEndLedgerSequence returns the ending ledger sequence of the archive.
func (*LedgerMetaArchive) GetLedgerCount ¶
func (f *LedgerMetaArchive) GetLedgerCount() uint32
GetLedgerCount returns the number of ledgers currently in the archive.
func (*LedgerMetaArchive) GetObjectKey ¶
func (f *LedgerMetaArchive) GetObjectKey() string
GetObjectKey returns the object key of the archive.
func (*LedgerMetaArchive) GetStartLedgerSequence ¶
func (f *LedgerMetaArchive) GetStartLedgerSequence() uint32
GetStartLedgerSequence returns the starting ledger sequence of the archive.
type MockDataStore ¶
MockDataStore is a mock implementation for the Storage interface.
func (*MockDataStore) Close ¶
func (m *MockDataStore) Close() error
func (*MockDataStore) GetFile ¶
func (m *MockDataStore) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
func (*MockDataStore) PutFileIfNotExists ¶
type StellarCoreConfig ¶
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) Dequeue ¶
func (u UploadQueue) Dequeue(ctx context.Context) (*LedgerMetaArchive, bool, error)
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 *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, queue UploadQueue, prometheusRegistry *prometheus.Registry, ) Uploader
NewUploader constructs a new Uploader instance
type XDRGzipDecoder ¶
type XDRGzipDecoder struct {
XdrPayload interface{}
}
type XDRGzipEncoder ¶
type XDRGzipEncoder struct {
XdrPayload interface{}
}