{"modulePath":"github.com/lfhy/compactfs","version":"v1.0.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package decoder\n\nPackage decoder implements pure Go chunk decoders independently of storage, worker protocols, and the corresponding encoders.\n\n## Constants\n\n```go\nconst MaxGzipFastSize = 16 \u003c\u003c 20\n```\nMaxGzipFastSize bounds speculative output allocation, including corrupt ISIZE fields. Larger chunks still decode through the general streaming path.\n\n## Types\n\n```go\ntype Decoder interface {\n\tName() string\n\tDecode(ctx context.Context, src io.Reader, dst io.Writer) error\n}\n```\nDecoder restores one stored chunk. Its name describes the wire format, independently of whether CPU or FPGA hardware originally encoded the chunk.\n\n```go\ntype Gzip struct{}\n```\nGzip decodes standard gzip, using a bounded fixed-Huffman fast path for complete chunks and the general pure Go decoder for other streams.\n\n```go\nfunc (Gzip) Decode(ctx context.Context, src io.Reader, dst io.Writer) error\n```\nDecode decodes a gzip reader. bytes.Reader and bytes.Buffer expose a complete chunk to DecodeBytes through WriteTo without copying their backing slice. Other readers use the general streaming decoder, with no whole-input buffering.\n\n```go\nfunc (Gzip) DecodeBytes(ctx context.Context, encoded []byte, dst io.Writer) error\n```\nDecodeBytes decodes a complete gzip byte slice. It accepts concatenated members, optional headers, and all standard DEFLATE block types. The fast path never publishes bytes until the entire member's size and CRC have been verified. Callers must not modify encoded during the call.\n\n```go\nfunc (Gzip) Name() string\n```\n\n```go\ntype LZ4 struct{}\n```\nLZ4 accepts standard independent-block frames, including the FPGA profile's checksummed frames and uncompressed-block fallback.\n\n```go\nfunc (LZ4) Decode(ctx context.Context, src io.Reader, dst io.Writer) error\n```\n\n```go\nfunc (LZ4) Name() string\n```\n\n```go\ntype MinLZ struct{}\n```\nMinLZ restores independent checksummed streams from CPU or FPGA encoders.\n\n```go\nfunc (MinLZ) Decode(ctx context.Context, src io.Reader, dst io.Writer) error\n```\n\n```go\nfunc (MinLZ) Name() string\n```\n\n```go\ntype Raw struct{}\n```\nRaw copies an uncompressed chunk byte-for-byte.\n\n```go\nfunc (Raw) Decode(ctx context.Context, src io.Reader, dst io.Writer) error\n```\n\n```go\nfunc (Raw) Name() string\n```\n\n```go\ntype Zstd struct{}\n```\nZstd decodes standard Zstandard frames without cgo.\n\n```go\nfunc (Zstd) Decode(ctx context.Context, src io.Reader, dst io.Writer) error\n```\n\n```go\nfunc (Zstd) Name() string\n```\n\n","path":"github.com/lfhy/compactfs/codec/decoder","name":"decoder","synopsis":"Package decoder implements pure Go chunk decoders independently of storage, worker protocols, and the corresponding encoders.","isRedistributable":true}
