Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedReadSeeker ¶
type BufferedReadSeeker struct {
// contains filtered or unexported fields
}
BufferedReadSeeker wraps bufio.Reader to expose Seek method from the provided io.ReadSeeker in NewBufferedReadSeeker.
func NewBufferedReadSeeker ¶
func NewBufferedReadSeeker(readSeeker io.ReadSeeker, size int) BufferedReadSeeker
NewBufferedReadSeeker creates a new instance of BufferedReadSeeker, out of io.ReadSeeker. Argument `size` is the size of the read buffer.
func (BufferedReadSeeker) Read ¶
func (b BufferedReadSeeker) Read(p []byte) (n int, err error)
Read reads to the byte slice from from buffered reader.
type Langos ¶
type Langos struct {
// contains filtered or unexported fields
}
Langos is a reader with a lookahead peekBuffer this is the most naive implementation of a lookahead peekBuffer it should issue a lookahead Read when a Read is called, hence the name - langos |--->====>>------------|
cur topmost
the first read is not a lookahead but the rest are so, it could be that a lookahead read might need to wait for a previous read to finish due to resource pooling
All Read and Seek method call must be synchronous.
func NewLangos ¶
NewLangos bakes a new yummy langos that peeks on provided reader when its Read method is called. Argument peekSize defines the length of peeks.
func (*Langos) Read ¶
Read copies the data to the provided byte slice starting from the current read position. The first read will wait for the underlaying Reader to return all the data and start a peek on the next data segment. All sequential reads will wait for peek to finish reading the data. If the current peek is not finished when Read is called, a second peek will be started to apprehend the following Read call.