Documentation
¶
Overview ¶
Package objectstore provides AppTheory's narrow object-store helper surface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
var ErrInvalidEncryptionConfig = errors.New("objectstore: invalid encryption config")
ErrInvalidEncryptionConfig is returned when S3 encryption options are contradictory or incomplete.
var ErrInvalidObjectRef = errors.New("objectstore: invalid object ref")
ErrInvalidObjectRef is returned when an object reference is incomplete or unsupported.
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 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 ¶
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 ¶
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.
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.