adapters

package
v2.0.1 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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryArchiveAdapter

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

HistoryArchiveAdapter is an adapter for the historyarchive package to read from history archives

func (*HistoryArchiveAdapter) BucketListHash

func (haa *HistoryArchiveAdapter) BucketListHash(sequence uint32) (xdr.Hash, error)

BucketListHash returns the bucket list hash to compare with hash in the ledger header fetched from Stellar-Core.

func (*HistoryArchiveAdapter) GetLatestLedgerSequence

func (haa *HistoryArchiveAdapter) GetLatestLedgerSequence() (uint32, error)

GetLatestLedgerSequence returns the latest ledger sequence or an error

func (*HistoryArchiveAdapter) GetState

func (haa *HistoryArchiveAdapter) GetState(
	ctx context.Context, sequence uint32, maxStreamRetries int,
) (io.ChangeReader, error)

GetState returns a reader with the state of the ledger at the provided sequence number `maxStreamRetries` determines how many times the reader will retry when encountering errors while streaming xdr bucket entries from the history archive. Set `maxStreamRetries` to 0 if there should be no retry attempts

type HistoryArchiveAdapterInterface

type HistoryArchiveAdapterInterface interface {
	GetLatestLedgerSequence() (uint32, error)
	BucketListHash(sequence uint32) (xdr.Hash, error)
	GetState(
		ctx context.Context, sequence uint32, maxStreamRetries int,
	) (io.ChangeReader, error)
}

func MakeHistoryArchiveAdapter

func MakeHistoryArchiveAdapter(archive historyarchive.ArchiveInterface) HistoryArchiveAdapterInterface

MakeHistoryArchiveAdapter is a factory method to make a HistoryArchiveAdapter

type MockHistoryArchiveAdapter

type MockHistoryArchiveAdapter struct {
	mock.Mock
}

func (*MockHistoryArchiveAdapter) BucketListHash

func (m *MockHistoryArchiveAdapter) BucketListHash(sequence uint32) (xdr.Hash, error)

func (*MockHistoryArchiveAdapter) GetLatestLedgerSequence

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

func (*MockHistoryArchiveAdapter) GetState

func (m *MockHistoryArchiveAdapter) GetState(
	ctx context.Context, sequence uint32, maxStreamRetries int,
) (io.ChangeReader, error)

Jump to

Keyboard shortcuts

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