Documentation
¶
Overview ¶
Package storage defines object storage operations and local and S3-backed implementations. Applications own authorization, encryption, retention, malware scanning, and data residency.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrS3NotConfigured = errors.New("storage: S3 provider is not configured")
ErrS3NotConfigured indicates an uninitialized S3 client.
Functions ¶
func GenerateCloudFrontURL ¶
GenerateCloudFrontURL formats a CloudFront CDN URL for asset distribution.
Types ¶
type LocalStorageProvider ¶
type LocalStorageProvider struct {
// contains filtered or unexported fields
}
LocalStorageProvider implements local disk object storage Provider.
func NewLocalStorageProvider ¶
func NewLocalStorageProvider(baseDir string) *LocalStorageProvider
NewLocalStorageProvider initializes a local disk storage provider.
func (*LocalStorageProvider) GetPresignedURL ¶
func (l *LocalStorageProvider) GetPresignedURL(ctx context.Context, key string, expiry time.Duration) (string, error)
GetPresignedURL returns the local serving path; it does not create a signature.
type Provider ¶
type Provider interface {
Upload(ctx context.Context, key string, data []byte, contentType string) (string, error)
GetPresignedURL(ctx context.Context, key string, expiry time.Duration) (string, error)
}
Provider defines the object storage contract for cloud S3 and local storage drivers.
type S3Client ¶
type S3Client struct {
// contains filtered or unexported fields
}
S3Client stores private objects using the AWS credential chain, SHA-256 integrity checks, and server-side encryption.
func NewS3Client ¶
NewS3Client validates configuration and loads the AWS credential chain.
type S3Config ¶
type S3Config struct {
Bucket string
Region string
Prefix string
EndpointURL string
PublicBaseURL string
KMSKeyID string
UsePathStyle bool
AllowInsecureHTTP bool
MaxUploadBytes int
Timeout time.Duration
RetryAttempts int
}
S3Config defines bucket, endpoint, encryption, retry, and capacity policy.