Documentation
¶
Overview ¶
Package fpgagzip is the public SDK for the FPGA gzip shell.
The package provides a high-level file-to-file API and re-exports the device, pipeline, and configuration types used by the command-line tool. It is pure Go and accesses XDMA through the public device subpackage.
Index ¶
- Variables
- func AppendCSV(path string, result Result, opts Options) error
- type Config
- type Device
- type DevicePaths
- type Hardware
- type Options
- type Progress
- type Result
- func Compress(ctx context.Context, inputPath, outputPath string, hw Hardware, opts Options, ...) (Result, error)
- func CompressReader(ctx context.Context, input io.Reader, inputSize uint64, output io.Writer, ...) (Result, error)
- func Run(ctx context.Context, inputPath, outputPath string, hw Hardware, opts Options, ...) (Result, error)
- type Snapshot
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrWriterClosed is returned when Write is called after Close. ErrWriterClosed = errors.New("fpgagzip: writer is closed") // ErrWriterNotClosed is returned when Result is requested before Close. ErrWriterNotClosed = errors.New("fpgagzip: writer is not closed") )
var ErrHelp = config.ErrHelp
ErrHelp is returned by ParseConfig when --help is requested.
Functions ¶
Types ¶
type Config ¶
Config is the merged CLI/config-file/environment configuration.
func Parse ¶
Parse is kept as a short alias for ParseConfig for SDK callers that already use the package as their application's argument parser.
func ParseConfig ¶
ParseConfig parses CLI arguments using the same precedence rules as the command-line program: command line, environment, config file, then defaults.
type Device ¶
Device is an opened XDMA user BAR and H2C/C2H stream pair.
func Open ¶
func Open(paths DevicePaths) (*Device, error)
Open opens the XDMA devices described by paths. The caller must close the returned device.
type DevicePaths ¶
DevicePaths identifies the XDMA character devices.
type Hardware ¶
Hardware is the interface accepted by Run and Compress. The production implementation is *Device; applications can provide a simulator or wrapper that implements the same contract.
type Options ¶
Options controls the streaming pipeline.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns the settings validated for the gzip shell used by this module.
type Result ¶
Result contains validated output counters and timing information. Total, Pipeline, and FPGA use the same streaming boundary; Sync is reported separately and is completed before Run returns.
func Compress ¶
func Compress(ctx context.Context, inputPath, outputPath string, hw Hardware, opts Options, report func(Progress)) (Result, error)
Compress is an alias for Run, provided as a descriptive SDK entry point.
func CompressReader ¶
func CompressReader(ctx context.Context, input io.Reader, inputSize uint64, output io.Writer, hw Hardware, opts Options, report func(Progress)) (Result, error)
CompressReader compresses exactly inputSize bytes from input into output. It uses the supplied readers directly and does not create temporary files.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer has the shape of compress/gzip.Writer while using the FPGA gzip shell as its compressor. Write appends uncompressed bytes to an in-memory buffer. Close submits the complete buffer to the FPGA and writes the gzip stream to the destination.
The current shell requires the complete input length before it can start, so Write does not begin FPGA work. This API is intended for small and medium-sized payloads. For large inputs, use CompressReader with a known length or Compress/Run with a file path to avoid holding the input in RAM.
func NewWriter ¶
NewWriter returns an FPGA-backed writer using DefaultOptions. The argument order follows compress/gzip.NewWriter: the destination comes first.
func NewWriterContext ¶
func NewWriterContext(ctx context.Context, dst io.Writer, hw Hardware, opts Options, report func(Progress)) *Writer
NewWriterContext is NewWriterOptions with a context used when Close starts the FPGA operation.
func NewWriterOptions ¶
NewWriterOptions returns an FPGA-backed writer with explicit pipeline options and an optional progress callback.
func (*Writer) Close ¶
Close compresses the complete input buffer through the FPGA and writes the resulting gzip stream to the destination. Close is idempotent and returns the first error from the operation.
func (*Writer) Reset ¶
Reset discards the current input and reuses the writer for a new destination. It mirrors compress/gzip.Writer.Reset; the hardware, options, context, and progress callback remain unchanged.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client is a small HTTP client for fpga-gzipd.
|
Package client is a small HTTP client for fpga-gzipd. |
|
cmd
|
|
|
fpga-gzip
command
|
|
|
fpga-gzipd
command
Command fpga-gzipd exposes the pure-Go FPGA gzip pipeline over HTTP.
|
Command fpga-gzipd exposes the pure-Go FPGA gzip pipeline over HTTP. |
|
Package config owns command-line, environment and config-file parsing.
|
Package config owns command-line, environment and config-file parsing. |
|
Package device contains the small pure-Go access layer for the Xilinx XDMA character devices.
|
Package device contains the small pure-Go access layer for the Xilinx XDMA character devices. |
|
examples
|
|
|
sdk
command
Command sdk demonstrates using the public fpgagzip package from another Go program.
|
Command sdk demonstrates using the public fpgagzip package from another Go program. |
|
Package pipeline implements the gzip shell's file-to-file streaming workflow.
|
Package pipeline implements the gzip shell's file-to-file streaming workflow. |
|
Package server exposes the FPGA gzip pipeline as a small HTTP service.
|
Package server exposes the FPGA gzip pipeline as a small HTTP service. |
|
Package size parses human-readable byte sizes used by the CLI and config file.
|
Package size parses human-readable byte sizes used by the CLI and config file. |