cas

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package cas implements immutable local content-addressed storage for sanitized payloads and their strongly typed Evidence envelopes. It deliberately cannot accept arbitrary raw payload bytes.

Index

Constants

View Source
const (
	DefaultMaxObjectBytes int64 = 256 << 20
	EvidenceSchemaVersion       = "urn:agentapi-doctor:evidence:v1alpha2"
)

Variables

View Source
var (
	ErrCorruptObject  = errors.New("CAS object digest mismatch")
	ErrObjectConflict = errors.New("CAS object identity already has different content")
	ErrRootReplaced   = errors.New("CAS root identity changed")
)

Functions

func SealEvidenceMeta

func SealEvidenceMeta(producer schema.Producer, createdAt schema.UTCTime, evidence schema.Evidence) (schema.EnvelopeMeta, error)

SealEvidenceMeta is the single definition of the recorder's immutable Evidence projection. Both recorder creation and CAS reads use it, so a projection change cannot silently make newly written references dangling.

Types

type Store

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

func Open

func Open(root string, maxObjectBytes int64) (*Store, error)

func (*Store) Get

func (store *Store) Get(ctx context.Context, digest schema.Digest) ([]byte, error)

func (*Store) GetEvidence

func (store *Store) GetEvidence(ctx context.Context, ref schema.ObjectRef) (schema.Evidence, error)

GetEvidence resolves a report Evidence ref to a strict canonical envelope. It verifies the full-envelope storage object, typed schema, envelope ref, independently recomputed immutable projection digest, payload, and complete relation graph.

func (*Store) Put

func (store *Store) Put(ctx context.Context, payload redaction.SanitizedPayload) (schema.ObjectRef, error)

Put accepts only a SanitizedPayload, preserving the write-before-redaction type boundary for payload objects.

func (*Store) PutEvidence

func (store *Store) PutEvidence(ctx context.Context, evidence schema.Evidence) (schema.ObjectRef, error)

PutEvidence persists one validated Evidence envelope. Its ObjectRef digest remains the digest of the immutable Evidence projection. A separate full-envelope content object protects all canonical envelope bytes at rest.

func (*Store) Verify

func (store *Store) Verify(ctx context.Context, digest schema.Digest) error

Jump to

Keyboard shortcuts

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