Documentation
¶
Overview ¶
Package s3 provides a replay.Driver that reads JSON-Lines event archives from S3 (or any S3-compatible store like MinIO) and feeds the records into the pipeline.
This is the standard "kappa replay" path for Kinesis-backed pipelines whose live retention is shorter than the desired backfill window. Events are typically archived to S3 by Kinesis Data Firehose with date-partitioning (e.g. year=/month=/day=/), or by Kafka Connect's S3 sink for Kafka topics.
Phase 1 supports JSON-Lines (one JSON object per line). Parquet support is a Phase 2 addition gated on real demand.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config[T any] struct { Client *s3.Client Bucket string // Prefix narrows the object scan (e.g. "events/year=2026/month=05/"). Empty means // the entire bucket. Prefix string // Decode converts a single JSON-Lines line to T. Decode Decoder[T] // OnDecodeError, if non-nil, is called for every line whose Decode returned an // error. Default behavior is to drop silently. OnDecodeError func(key string, lineNum int, raw []byte, err error) }
Config configures an S3 replay driver.
type Driver ¶
type Driver[T any] struct { // contains filtered or unexported fields }
Driver implements replay.Driver for S3-archived JSON-Lines events.
type ParquetConfig ¶ added in v0.2.0
type ParquetConfig[T any] struct { // Client is the S3 client. Required. Client *awss3.Client // Bucket is the S3 bucket. Required. Bucket string // Prefix narrows the object scan (e.g. "events/year=2026/month=05/"). // Empty means the entire bucket. Prefix string // Decode converts a single Arrow row into T. Required. Decode ParquetDecoder[T] // KeyFilter, when non-nil, decides whether to include a listed key. // Default behavior includes every key ending in ".parquet"; pass a // custom KeyFilter to broaden ("*.parquet.snappy") or narrow // ("only files newer than X"). KeyFilter func(key string) bool // BatchSize is the number of rows materialized per arrow.RecordBatch // pulled out of Parquet. Defaults to 4096. BatchSize int64 // Allocator is the Arrow memory allocator. Defaults to // memory.DefaultAllocator. Allocator memory.Allocator // OnDecodeError, when non-nil, is invoked for rows that fail to // decode. Default: drop silently and continue. Wire to a DLQ or // logger to surface poison rows. OnDecodeError func(key string, rowOrdinal int, err error) }
ParquetConfig configures a Parquet S3 replay driver.
type ParquetDecoder ¶ added in v0.2.0
type ParquetDecoder[T any] func(rec arrow.RecordBatch, row int) (T, error)
ParquetDecoder converts a single Parquet row (column-array + row index) into T. Implementations should pull only the columns they need from the arrow.RecordBatch by name; cross-record allocations are the caller's responsibility because the Record is reused after the call returns.
type ParquetDriver ¶ added in v0.2.0
type ParquetDriver[T any] struct { // contains filtered or unexported fields }
ParquetDriver implements replay.Driver for S3-archived Parquet event streams. The standard "kappa replay" shape for pipelines whose upstream archive is Spark-produced or Firehose-with-Parquet-format — 5-20x smaller than gzipped JSON Lines on the same data, predicate- pushdown-friendly, native to every modern columnar engine.
For ad-hoc / hand-built JSON dumps, the line-based Driver in this same package remains the right choice. Use this Parquet driver when the archive was written by a columnar engine.
func NewParquetDriver ¶ added in v0.2.0
func NewParquetDriver[T any](cfg ParquetConfig[T]) (*ParquetDriver[T], error)
NewParquetDriver returns a ParquetDriver. The S3 client is owned by the caller.
func (*ParquetDriver[T]) Close ¶ added in v0.2.0
func (d *ParquetDriver[T]) Close() error
Close is a no-op; the underlying client is owned by the caller.
func (*ParquetDriver[T]) Name ¶ added in v0.2.0
func (d *ParquetDriver[T]) Name() string
Name returns "s3-parquet:<bucket>/<prefix>".