Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var EOF = io.EOF
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 ¶
func (msr *MemoryStateReader) Read() (xdr.LedgerEntryChange, error)
Read returns a new ledger entry change on each call, returning io.EOF when the stream ends.
type MockLedgerReadCloser ¶
func (*MockLedgerReadCloser) Close ¶
func (m *MockLedgerReadCloser) Close() error
func (*MockLedgerReadCloser) GetHeader ¶
func (m *MockLedgerReadCloser) GetHeader() (xdr.LedgerHeaderHistoryEntry, error)
func (*MockLedgerReadCloser) GetSequence ¶
func (m *MockLedgerReadCloser) GetSequence() uint32
func (*MockLedgerReadCloser) Read ¶
func (m *MockLedgerReadCloser) Read() (LedgerTransaction, error)
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