s3

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package s3 is the object-store backend for payload logging: one JSON object per Record. S3-compatible via minio-go, so it targets AWS S3, MinIO, and other compatible stores with the same client. Implements payload.Sink.

This package pulls in the minio-go SDK. It is excluded from the relay "minimal" build (see cmd/relay's build-tagged sink seam), so a minimal binary/image carries none of these deps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint  string // host:port (no scheme), e.g. "s3.amazonaws.com" or "minio.dev-stack:9000"
	Bucket    string
	Region    string // optional; AWS uses it, MinIO ignores it
	AccessKey string
	SecretKey string
	Prefix    string // key prefix, e.g. "payloads"; trailing slash optional
	UseSSL    bool
}

Config holds the object-store connection + placement settings.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is a payload.Reader over the object layout the Sink writes (<prefix>/YYYY/MM/DD/<request_id>.json). Get locates a single object by request-id suffix. There is no List — the Logs list is served by the log store, not the body store.

func NewReader

func NewReader(ctx context.Context, cfg Config) (*Reader, error)

NewReader constructs a Reader against the same bucket/prefix the Sink targets. It verifies the bucket is reachable.

func (*Reader) Get

func (r *Reader) Get(ctx context.Context, requestID string) (payload.Record, error)

Get fetches the object whose key ends with /<requestID>.json. Without a timestamp the date partition is unknown, so it scans recursively under the prefix and stops at the first match. Returns payload.ErrNotFound if absent.

type Sink

type Sink struct {
	// contains filtered or unexported fields
}

Sink writes each Record as an object at <prefix>/<YYYY>/<MM>/<DD>/<request_id>.json. PutObject is synchronous per call; the emitter's single drain goroutine serializes writes and drop-on-full upstream protects the hot path.

func New

func New(ctx context.Context, cfg Config) (*Sink, error)

New constructs the sink and verifies the bucket is reachable.

func (*Sink) Write

func (s *Sink) Write(r payload.Record) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL