objectstore

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package objectstore provides AppTheory's narrow object-store helper surface.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidGetLimit is returned when a Get request does not set a positive byte cap.
	ErrInvalidGetLimit = errors.New("objectstore: max bytes must be positive")
	// ErrObjectTooLarge is returned when a bounded Get would exceed its byte cap.
	ErrObjectTooLarge = errors.New("objectstore: object exceeds max bytes")
	// ErrObjectNotFound is returned by deterministic stores when the requested object is absent.
	ErrObjectNotFound = errors.New("objectstore: object not found")
)

Stable object-store operation errors.

View Source
var ErrInvalidEncryptionConfig = errors.New("objectstore: invalid encryption config")

ErrInvalidEncryptionConfig is returned when S3 encryption options are contradictory or incomplete.

View Source
var ErrInvalidObjectRef = errors.New("objectstore: invalid object ref")

ErrInvalidObjectRef is returned when an object reference is incomplete or unsupported.

View Source
var ErrInvalidStoreConfig = errors.New("objectstore: invalid store config")

ErrInvalidStoreConfig is returned when an object-store implementation is misconfigured.

Functions

This section is empty.

Types

type DeleteInput

type DeleteInput struct {
	Ref ObjectRef
}

DeleteInput removes one object reference. Ref.VersionID is honored by stores that support versioned objects.

type GetInput

type GetInput struct {
	Ref      ObjectRef
	MaxBytes int64
}

GetInput reads one object reference with a required maximum byte cap.

type GetOutput

type GetOutput struct {
	Ref         ObjectRef
	Payload     []byte
	ContentType string
	Metadata    map[string]string
}

GetOutput is the bounded byte payload returned by Store.Get.

type ObjectRef

type ObjectRef struct {
	Bucket    string
	Key       string
	VersionID string
}

ObjectRef identifies one object in an S3-compatible object store.

Bucket and Key are always required. VersionID is optional and is used only by version-aware operations such as Get and Delete.

func ParseObjectRef

func ParseObjectRef(raw string) (ObjectRef, error)

ParseObjectRef parses a strict s3://bucket/key reference.

The parser does not normalize, decode, or default any component: valid bucket and key values are preserved exactly as they appear in the input reference.

func (ObjectRef) Validate

func (r ObjectRef) Validate() error

Validate verifies that the reference has the components required for an AppTheory object-store operation.

type PutInput

type PutInput struct {
	Ref         ObjectRef
	Payload     []byte
	ContentType string
	Metadata    map[string]string
}

PutInput writes a byte payload to one object reference.

type S3EncryptionConfig

type S3EncryptionConfig struct {
	Mode     S3EncryptionMode
	KMSKeyID string
}

S3EncryptionConfig configures fail-closed S3 server-side encryption headers.

type S3EncryptionMode

type S3EncryptionMode string

S3EncryptionMode selects the server-side encryption headers emitted for S3 PutObject.

const (
	// S3EncryptionBucketDefault emits no server-side encryption headers and relies on bucket policy/defaults.
	S3EncryptionBucketDefault S3EncryptionMode = "bucket-default"
	// S3EncryptionS3Managed emits the S3-managed AES256 server-side encryption header.
	S3EncryptionS3Managed S3EncryptionMode = "s3-managed"
	// S3EncryptionKMS emits AWS KMS server-side encryption headers with a required key ID.
	S3EncryptionKMS S3EncryptionMode = "kms"
)

type S3StoreConfig

type S3StoreConfig struct {
	Encryption S3EncryptionConfig
}

S3StoreConfig configures the narrow S3-backed Store implementation.

type Store

type Store interface {
	Put(context.Context, PutInput) (ObjectRef, error)
	Get(context.Context, GetInput) (*GetOutput, error)
	Delete(context.Context, DeleteInput) error
}

Store is AppTheory's narrow object-store contract.

It intentionally supports only byte Put, bounded Get, and Delete. There is no unbounded read method and no listing, presigning, public URL, multipart, copy, head, or raw client escape hatch.

func NewS3Store

func NewS3Store(ctx context.Context, storeConfig S3StoreConfig) (Store, error)

NewS3Store loads AWS SDK v2 configuration and returns the S3-backed Store.

Jump to

Keyboard shortcuts

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