Documentation
¶
Index ¶
- Constants
- func EnsureExtension(f Format, path string) string
- func Extension(f Format) string
- func LevelRange(f Format) (int, int, int)
- func NewStreamWriter(dst io.Writer, format Format, level *int, concurrency int) (io.WriteCloser, error)
- func OpenOutput(path string, bufferSize int, format Format, level *int, forceOverwrite bool, ...) (io.WriteCloser, string, error)
- func ValidateLevel(f Format, level *int) (int, error)
- type EstimateResult
- type Format
Constants ¶
const DefaultBufferSize = 1024 * 1024
DefaultBufferSize is the default I/O write buffer size (1 MB) when -b is not specified.
const FormatZstdExt = ".zst"
Variables ¶
This section is empty.
Functions ¶
func EnsureExtension ¶
EnsureExtension appends the canonical compression extension to path if missing.
func LevelRange ¶
LevelRange returns the valid (min, max, default) compression levels for a Format.
func NewStreamWriter ¶
func NewStreamWriter(dst io.Writer, format Format, level *int, concurrency int) (io.WriteCloser, error)
NewStreamWriter wraps dst in a streaming compressor for the given Format, level, and concurrency. Uses parallel block compression (pgzip) for gzip and concurrent zstd encoding when concurrency > 1.
func OpenOutput ¶
func OpenOutput(path string, bufferSize int, format Format, level *int, forceOverwrite bool, concurrency ...int) (io.WriteCloser, string, error)
OpenOutput opens stdout (when path == "") or a target file with buffered I/O and optional streaming compression. Optional concurrency specifies the encoder thread count for parallel codecs (gzip via pgzip, zstd).
Types ¶
type EstimateResult ¶
type EstimateResult struct {
Bytes *big.Int // Predicted or exact compressed byte count
Ratio float64 // Compressed / Uncompressed ratio in (0, 1+]
Exact bool // True when the entire dataset fit inside the in-memory probe
}
EstimateResult holds the predicted (or exact) compressed output size and empirical compression ratio.
func EstimateSize ¶
func EstimateSize( ctx context.Context, engine *gomap.Engine, plan *gomap.Plan, stats gomap.StatsResult, delimiter string, format Format, level *int, ) (EstimateResult, error)
EstimateSize predicts the compressed output size of a compiled Plan before writing to disk. For small outputs (<= 512KB), it runs the real codec over the full stream in RAM for an exact byte count. For large outputs, it uses O(1) indexed seeking to sample 4 contiguous 128KB windows across the keyspace (at 0%, 33%, 66%, and 95%) through the real codec and compression level.
type Format ¶
type Format string
Format identifies a supported streaming compression algorithm.
func ParseFormat ¶
ParseFormat validates and normalizes a compression format name. Accepts "xz" as a convenient alias for "lzma".