file

package
v0.9.22 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package file is the JSONL file backend for payload logging: one Record per line. The zero-dependency default backend; the s3 backend (which pulls a cloud SDK and is excluded from minimal builds) lives alongside in pkg/payload/s3. Implements payload.Sink.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader is a payload.Reader backed by the same JSONL file Sink writes to. Get scans the file for the request id — fine for dogfood files (MB range). There is no List: the Logs list is served by the log store, not the body store.

func NewReader

func NewReader(path string) *Reader

NewReader constructs a Reader for path. Path must match the Sink the relay is currently writing to.

func (*Reader) Get

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

Get scans for the record with the given request id, returning the newest match (a re-run reusing an id). Returns payload.ErrNotFound when absent or when the file doesn't exist yet.

type Sink

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

Sink appends one JSONL line per Record. Bodies serialize as base64 (json's []byte encoding), so the file is lossless for any content. Safe for concurrent Write via an internal mutex. Buffering is the OS's job — no userland buffer.

func NewSink

func NewSink(path string) (*Sink, error)

NewSink opens (creating, append-mode) path for the sink.

func NewSinkFromWriter

func NewSinkFromWriter(w io.Writer) *Sink

NewSinkFromWriter wraps an existing writer (tests, stdout).

func (*Sink) Close

func (s *Sink) Close() error

Close closes the underlying file (if NewSink opened one). Satisfies payload.Closer so the emitter flushes on shutdown.

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