io

package
v0.0.0-...-821bc58 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EOF = io.EOF
View Source
var ErrClosedPipe = io.ErrClosedPipe

Functions

This section is empty.

Types

type ArchiveLedgerReader

type ArchiveLedgerReader interface {
	GetSequence() uint32
	Read() (bool, xdr.Transaction, xdr.TransactionResult, error)
}

ArchiveLedgerReader placeholder

type DBLedgerReadCloser

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

DBLedgerReadCloser is a database-backed implementation of the io.LedgerReadCloser interface.

func MakeLedgerReadCloser

func MakeLedgerReadCloser(sequence uint32, backend ledgerbackend.LedgerBackend) *DBLedgerReadCloser

MakeLedgerReadCloser is a factory method for LedgerReadCloser.

func (*DBLedgerReadCloser) Close

func (dblrc *DBLedgerReadCloser) Close() error

Close moves the read pointer so that subsequent calls to Read() will return EOF.

func (*DBLedgerReadCloser) GetHeader

func (dblrc *DBLedgerReadCloser) GetHeader() (xdr.LedgerHeaderHistoryEntry, error)

GetHeader returns the XDR Header data associated with the stored ledger.

func (*DBLedgerReadCloser) GetSequence

func (dblrc *DBLedgerReadCloser) GetSequence() uint32

GetSequence returns the sequence number of the ledger data stored by this object.

func (*DBLedgerReadCloser) Read

func (dblrc *DBLedgerReadCloser) Read() (LedgerTransaction, error)

Read returns the next transaction in the ledger, ordered by tx number, each time it is called. When there are no more transactions to return, an EOF error is returned.

type LedgerReadCloser

type LedgerReadCloser interface {
	GetSequence() uint32
	GetHeader() (xdr.LedgerHeaderHistoryEntry, error)
	// Read should return the next transaction. If there are no more
	// transactions it should return `EOF` error.
	Read() (LedgerTransaction, error)
	// Close should be called when reading is finished. This is especially
	// helpful when there are still some entries available so the reader can stop
	// streaming them.
	Close() error
}

LedgerReadCloser provides convenient, streaming access to the transactions within a ledger.

type LedgerTransaction

type LedgerTransaction struct {
	Index      uint32
	Envelope   xdr.TransactionEnvelope
	Result     xdr.TransactionResultPair
	Meta       xdr.TransactionMeta
	FeeChanges xdr.LedgerEntryChanges
}

LedgerTransaction represents the data for a single transaction within a ledger.

type MemoryStateReader

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

MemoryStateReader is an in-memory streaming implementation that reads ledger entries from buckets for a given HistoryArchiveState. MemoryStateReader hides internal structure of buckets from the user so entries returned by `Read()` are exactly the ledger entries present at the given ledger.

func MakeMemoryStateReader

func MakeMemoryStateReader(archive historyarchive.ArchiveInterface, sequence uint32, bufferSize uint16) (*MemoryStateReader, error)

MakeMemoryStateReader is a factory method for MemoryStateReader

func (*MemoryStateReader) Close

func (msr *MemoryStateReader) Close() error

Close should be called when reading is finished.

func (*MemoryStateReader) GetSequence

func (msr *MemoryStateReader) GetSequence() uint32

GetSequence impl.

func (*MemoryStateReader) Read

Read returns a new ledger entry change on each call, returning io.EOF when the stream ends.

type MockLedgerReadCloser

type MockLedgerReadCloser struct {
	mock.Mock
}

func (*MockLedgerReadCloser) Close

func (m *MockLedgerReadCloser) Close() error

func (*MockLedgerReadCloser) GetHeader

func (*MockLedgerReadCloser) GetSequence

func (m *MockLedgerReadCloser) GetSequence() uint32

func (*MockLedgerReadCloser) Read

type StateReadCloser

type StateReadCloser interface {
	GetSequence() uint32
	// Read should return next ledger entry. If there are no more
	// entries it should return `EOF` error.
	Read() (xdr.LedgerEntryChange, error)
	// Close should be called when reading is finished. This is especially
	// helpful when there are still some entries available so reader can stop
	// streaming them.
	Close() error
}

StateReadCloser interface placeholder

type StateWriteCloser

type StateWriteCloser interface {
	// Write is used to pass ledger entry change to the next processor. It can return
	// `ErrClosedPipe` when the pipe between processors has been closed meaning
	// that next processor does not need more data. In such situation the current
	// processor can terminate as sending more entries to a `StateWriteCloser`
	// does not make sense (will not be read).
	Write(xdr.LedgerEntryChange) error
	// Close should be called when there are no more entries
	// to write.
	Close() error
}

StateWriteCloser interface placeholder

Jump to

Keyboard shortcuts

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