storage

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ArtifactsFileName = "artifacts.json"

Variables

This section is empty.

Functions

func SaveArtifacts added in v0.1.2

func SaveArtifacts(filePath string, doc ArtifactsDocument) error

SaveArtifacts writes an artifacts.json document to disk.

Types

type ArtifactRecord

type ArtifactRecord struct {
	Name             string            `json:"name"`
	RelPath          string            `json:"rel_path"`
	MediaType        string            `json:"media_type"`
	Role             core.ArtifactRole `json:"role"`
	SizeBytes        int64             `json:"size_bytes"`
	Checksum         core.Checksum     `json:"checksum"`
	CreatedAt        time.Time         `json:"created_at"`
	UploadedAt       *time.Time        `json:"uploaded_at,omitempty"`        // set after a successful upload/confirm
	RemoteArtifactID string            `json:"remote_artifact_id,omitempty"` // backend-assigned ULID
}

ArtifactRecord is the persisted form of a single artifact entry.

type ArtifactsDocument

type ArtifactsDocument struct {
	SchemaVersion string           `json:"schema_version"`
	Artifacts     []ArtifactRecord `json:"artifacts"`
}

ArtifactsDocument caches artifact metadata for a run.

func LoadArtifacts

func LoadArtifacts(filePath string) (ArtifactsDocument, error)

LoadArtifacts reads an artifacts.json file from disk.

func NewArtifactsDocument added in v0.1.2

func NewArtifactsDocument(runDir string, artifacts []core.Artifact) (ArtifactsDocument, error)

NewArtifactsDocument builds an ArtifactsDocument from in-memory artifacts, normalizing each artifact's absolute Path into a runDir-relative slash path.

type FS

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

FS persists capture runs to the local filesystem.

func NewFS

func NewFS(path string) *FS

NewFS constructs a filesystem-backed store rooted at the provided path.

func (*FS) Artifacts

func (f *FS) Artifacts() []core.Artifact

Artifacts returns the artifacts generated during Finalize.

func (*FS) Finalize

func (f *FS) Finalize(run *core.Run) (retErr error)

Finalize closes open handles, computes checksums, and emits artifact metadata.

func (*FS) Start

func (f *FS) Start(run *core.Run) error

Start prepares the run directory and data file for streaming records.

func (*FS) Write

func (f *FS) Write(records []core.Record) error

Write appends normalized records to the NDJSON stream.

type ManifestDocument

type ManifestDocument struct {
	RunID        string               `json:"run_id"`
	Schema       string               `json:"schema_version"`
	Source       core.SourceMeta      `json:"source"`
	Manifest     core.Manifest        `json:"manifest"`
	Capture      core.CaptureSettings `json:"capture"`
	Started      time.Time            `json:"started"`
	Completed    *time.Time           `json:"completed,omitempty"`
	RecordsCount uint64               `json:"records_count"`
	PrimaryData  string               `json:"primary_data_uri"`
}

ManifestDocument represents the serialized metadata persisted alongside capture artifacts.

func LoadManifest

func LoadManifest(path string) (ManifestDocument, error)

LoadManifest reads a manifest.json file from disk.

type Store

type Store interface {
	Start(run *core.Run) error
	Write([]core.Record) error
	Finalize(run *core.Run) error
	Artifacts() []core.Artifact
}

Store abstracts the persistence layer used by capture pipelines.

Jump to

Keyboard shortcuts

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