Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultBufferSize = 1 << 20
DefaultBufferSize is the steady-state chunk size and the clip target.
Variables ¶
This section is empty.
Functions ¶
func ClipBatch ¶
ClipBatch estimates rows per Decode that keep a batch's aliased values near the buffer size, for a page whose value region exceeds it. Row count is a conservative proxy for value count; skewed sizes may overshoot. Returns nvals (no clip) when the whole region already fits one buffer.
Types ¶
type Decoder ¶
type Decoder interface {
SetSource(nvals int, src ValueBuffer)
}
Decoder is a decoder that can read from a ValueBuffer via SetSource.
type ValueBuffer ¶
type ValueBuffer interface {
// Fill returns >= need contiguous bytes from the cursor, valid until the next Recycle;
// io.ErrUnexpectedEOF if fewer remain (incl. a need past the value region).
Fill(need int) ([]byte, error)
// Advance marks the first n bytes from the cursor as consumed.
Advance(n int)
// Skip discards the next n bytes without buffering them, for the discard/seek path.
Skip(n int) error
// Recycle reclaims everything handed out since the last Recycle; the caller must be
// done with the previous batch's aliases. A decoder calls it when entering Decode.
Recycle()
io.Closer
}
ValueBuffer is the byte source a streaming decoder reads; bytes from Fill stay valid until the next Recycle, so a decoder can alias them instead of copying.
func NewStreamBuffer ¶
func NewStreamBuffer(mem memory.Allocator, r io.Reader, valueBytes int, onClose func() error) ValueBuffer
NewStreamBuffer returns a ValueBuffer over r, bounded to valueBytes (the value region).
Click to show internal directories.
Click to hide internal directories.