recordexport

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package recordexport builds immutable, checksummed copies without changing the original records. Missing/racing/unrecorded material is always explicit.

Index

Constants

View Source
const MaxFiles = 200000

Variables

View Source
var ErrCapacity = errors.New("record export exceeds file/byte capacity")

Functions

func Redact

func Redact(data []byte) []byte

func RedactJSON

func RedactJSON(out io.WriteCloser) io.WriteCloser

JSON rows remain valid JSON. Raw binary files are omitted separately.

Types

type Builder

type Builder struct {
	Dir          string
	Manifest     Manifest
	Limit, Bytes int64
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, dir string, ids []int64, redacted bool, limit int64) (*Builder, error)

func (*Builder) Finish

func (b *Builder) Finish(zipPath string) (checksum string, size int64, err error)

func (*Builder) Index

func (b *Builder) Index() error

func (*Builder) JSON

func (b *Builder) JSON(name string, v any) error

func (*Builder) Omit

func (b *Builder) Omit(p, reason string)

func (*Builder) Open

func (b *Builder) Open(name string) (io.WriteCloser, error)

func (*Builder) Transcript

func (b *Builder) Transcript(source, prefix string) error

Transcript copies only complete records at/before the database snapshot. It reads at most the initial file length, so concurrent appends cannot prolong it.

func (*Builder) Tree

func (b *Builder) Tree(source, prefix string, cutoff time.Time) error

Tree never follows symlinks. OpenRoot prevents file substitution from escaping the selected tree; SameFile catches swaps of the selected root itself.

func (*Builder) Write

func (b *Builder) Write(name string, data []byte) error

type Entry

type Entry struct {
	Path   string `json:"path"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
}

type Manifest

type Manifest struct {
	Format      int        `json:"format"`
	TaskIDs     []int64    `json:"task_ids"`
	Cutoff      time.Time  `json:"database_cutoff"`
	CompletedAt time.Time  `json:"completed_at"`
	Redacted    bool       `json:"redacted"`
	Files       []Entry    `json:"files"`
	Omissions   []Omission `json:"omissions"`
	Notes       []string   `json:"notes"`
}

type Omission

type Omission struct {
	Path   string `json:"path"`
	Reason string `json:"reason"`
}

Jump to

Keyboard shortcuts

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