io

package
v0.0.0-...-e43266c Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 7 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 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.Archive, 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 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