// Package storage provides a file-object seam (Phase 7 item 4). Only the
// local filesystem adapter is implemented; an S3/R2-compatible adapter is
// deferred until a real consumer exists. Keys are opaque paths; adapters must
// reject traversal.
package storage

import (
	"context"
	"errors"
	"io"
)

var (
	ErrNotFound      = errors.New("storage: object not found")
	ErrInvalidKey    = errors.New("storage: invalid key")
	ErrAlreadyExists = errors.New("storage: object already exists")
)

// Store is the persistence seam for binary objects.
type Store interface {
	// Put writes r under key, overwriting any existing object.
	Put(ctx context.Context, key string, r io.Reader) error
	// Get opens the object for reading. Caller closes.
	Get(ctx context.Context, key string) (io.ReadCloser, error)
	// Delete removes the object. Missing keys are not an error.
	Delete(ctx context.Context, key string) error
	// Exists reports whether the object exists.
	Exists(ctx context.Context, key string) (bool, error)
}
