Help us shape the future of Go! Take the 2026 Go Developer Survey

audiohistory

package
v1.42.4 Latest Latest
Warning

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

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

Documentation

Overview

Package audiohistory stores private audio artifacts and creates verified, independent snapshots for replay and export.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid = errors.New("audio history metadata is unknown or invalid")
	ErrChanged = errors.New("audio history changed during the operation")
)

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	Settings  Settings  `json:"settings"`
	Bytes     int64     `json:"bytes"`
	SHA256    string    `json:"sha256"`
}

type Settings

type Settings struct {
	Input        string  `json:"input"`
	Instructions string  `json:"instructions"`
	Model        string  `json:"model"`
	Voice        string  `json:"voice"`
	Format       string  `json:"format"`
	Speed        float64 `json:"speed"`
	Preview      bool    `json:"preview,omitempty"`
}

Settings records the explicitly private history of one audio request.

type Snapshot

type Snapshot struct {
	Entry Entry
	File  *os.File
	// contains filtered or unexported fields
}

Snapshot owns a read-only copy of one verified result. Consume File directly; File.Name is not a replay path. Unix snapshots have no directory entry.

func (*Snapshot) Close

func (s *Snapshot) Close() error

type Store

type Store struct{ Directory string }

func Default

func Default() (Store, error)

func (Store) Capture

func (s Store) Capture(ctx context.Context, body io.ReadCloser, settings Settings) (entry Entry, err error)

Capture closes body on every exit. A manifest becomes visible only after the complete audio, source close, and metadata close have all succeeded.

func (Store) Clear

func (s Store) Clear(ctx context.Context) error

Clear removes complete, validated history entries visible during its scan. A private manifest link makes interrupted deletions retryable. Unmarked pending captures, snapshots, corrupt entries, and unrelated files remain. Exported files are outside Store and are never visited.

func (Store) List

func (s Store) List(ctx context.Context) ([]Entry, error)

List returns valid entries alongside any damaged-entry errors. Uncommitted directories and unrelated names remain invisible and untouched.

func (Store) Open

func (s Store) Open(ctx context.Context, id string) (snapshot *Snapshot, err error)

Open verifies the manifest and original bytes before exposing a private copy. Later replacement, deletion, or rewriting of history cannot change that copy.

Jump to

Keyboard shortcuts

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