cache

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cache stores verified remote documents independently of SQLite.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid   = errors.New("invalid_remote_document_cache_request")
	ErrIntegrity = errors.New("remote_document_cache_integrity_failed")
)

Functions

This section is empty.

Types

type Cache

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

func New

func New(root string) (*Cache, error)

New requires an already prepared private directory. Names come exclusively from validated content hashes, never remote paths or display names.

func (*Cache) Read

func (cache *Cache) Read(
	ctx context.Context,
	reference jobcontract.ReportReference,
	fetch func(context.Context, io.ReadWriteSeeker) error,
) ([]byte, error)

Read resumes a private partial file and returns bytes only after validation, file sync and atomic durable publication. Existing complete files are checked without calling fetch. Errors preserve partials and never reset corrupt data.

Jump to

Keyboard shortcuts

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