ledgerbackend

package
v0.0.0-...-13e2633 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseBackend

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

DatabaseBackend implements a database data store.

func NewDatabaseBackend

func NewDatabaseBackend(dataSourceName string) (*DatabaseBackend, error)

func NewDatabaseBackendFromSession

func NewDatabaseBackendFromSession(session *db.Session) (*DatabaseBackend, error)

func (*DatabaseBackend) Close

func (dbb *DatabaseBackend) Close() error

Close disconnects an active database session.

func (*DatabaseBackend) GetLatestLedgerSequence

func (dbb *DatabaseBackend) GetLatestLedgerSequence() (uint32, error)

GetLatestLedgerSequence returns the most recent ledger sequence number present in the database.

func (*DatabaseBackend) GetLedger

func (dbb *DatabaseBackend) GetLedger(sequence uint32) (bool, LedgerCloseMeta, error)

GetLedger returns the LedgerCloseMeta for the given ledger sequence number. The first returned value is false when the ledger does not exist in the database.

type LedgerBackend

type LedgerBackend interface {
	GetLatestLedgerSequence() (sequence uint32, err error)
	// The first returned value is false when the ledger does not exist in a backend.
	GetLedger(sequence uint32) (bool, LedgerCloseMeta, error)
	Close() error
}

LedgerBackend represents the interface to a ledger data store.

type LedgerCloseMeta

type LedgerCloseMeta struct {
	LedgerHeader          xdr.LedgerHeaderHistoryEntry
	TransactionEnvelope   []xdr.TransactionEnvelope
	TransactionResult     []xdr.TransactionResultPair
	TransactionMeta       []xdr.TransactionMeta
	TransactionFeeChanges []xdr.LedgerEntryChanges
	UpgradesMeta          []xdr.LedgerEntryChanges
}

LedgerCloseMeta is the information needed to reconstruct the history of transactions in a given ledger.

type MockDatabaseBackend

type MockDatabaseBackend struct {
	mock.Mock
}

func (*MockDatabaseBackend) Close

func (m *MockDatabaseBackend) Close() error

func (*MockDatabaseBackend) GetLatestLedgerSequence

func (m *MockDatabaseBackend) GetLatestLedgerSequence() (uint32, error)

func (*MockDatabaseBackend) GetLedger

func (m *MockDatabaseBackend) GetLedger(sequence uint32) (bool, LedgerCloseMeta, error)

Jump to

Keyboard shortcuts

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