objectstore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package objectstore provides an S3-compatible object store for generated assets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetKey

func AssetKey(orgID, projectID, assetID, ext string) string

AssetKey builds an org/project-scoped object key.

Types

type Config

type Config struct {
	Endpoint  string // host:port (no scheme), e.g. localhost:9000
	AccessKey string
	SecretKey string
	Region    string
	Bucket    string
	UseSSL    bool
	PathStyle bool
}

Config configures an S3-compatible endpoint.

type PutOptions

type PutOptions struct {
	ContentType string
	Metadata    map[string]string
}

PutOptions controls object metadata on write.

type S3

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

S3 is a MinIO/S3-backed Store.

func New

func New(cfg Config) (*S3, error)

New builds an S3 store. Returns nil, nil when Endpoint or Bucket is empty.

func (*S3) PresignGet

func (s *S3) PresignGet(ctx context.Context, key string, ttl time.Duration) (string, error)

PresignGet returns a time-limited GET URL.

func (*S3) Put

func (s *S3) Put(ctx context.Context, key string, body io.Reader, size int64, opts PutOptions) error

Put uploads an object.

type Store

type Store interface {
	Put(ctx context.Context, key string, body io.Reader, size int64, opts PutOptions) error
	PresignGet(ctx context.Context, key string, ttl time.Duration) (string, error)
}

Store is the asset persistence port.

Jump to

Keyboard shortcuts

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