objectstore

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Bucket() string
	BucketExists(ctx context.Context) (bool, error)
	EnsureBucket(ctx context.Context) error
	PutObject(ctx context.Context, key string, body io.Reader, size int64, opts PutOptions) (ObjectInfo, error)
	GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
	DeleteObject(ctx context.Context, key string) error
	StatObject(ctx context.Context, key string) (ObjectInfo, error)
	ListObjects(ctx context.Context, opts ListOptions) ([]ObjectInfo, error)
	CopyObject(ctx context.Context, srcKey, dstKey string, opts PutOptions) (ObjectInfo, error)
	PresignPut(ctx context.Context, key string, ttl time.Duration) (*url.URL, error)
	PresignGet(ctx context.Context, key string, ttl time.Duration) (*url.URL, error)
}

type GetOptions

type GetOptions struct {
	Offset int64
	Length int64
}

type ListOptions

type ListOptions struct {
	Prefix    string
	Recursive bool
	Limit     int
}

type MinIOClient

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

func NewMinIO

func NewMinIO(ctx context.Context, cfg MinIOConfig, opts ...Option) (*MinIOClient, error)

func (*MinIOClient) Bucket

func (m *MinIOClient) Bucket() string

func (*MinIOClient) BucketExists

func (m *MinIOClient) BucketExists(ctx context.Context) (bool, error)

func (*MinIOClient) CopyObject

func (m *MinIOClient) CopyObject(ctx context.Context, srcKey, dstKey string, opts PutOptions) (ObjectInfo, error)

func (*MinIOClient) DeleteObject

func (m *MinIOClient) DeleteObject(ctx context.Context, key string) error

func (*MinIOClient) EnsureBucket

func (m *MinIOClient) EnsureBucket(ctx context.Context) error

func (*MinIOClient) GetObject

func (m *MinIOClient) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)

func (*MinIOClient) ListObjects

func (m *MinIOClient) ListObjects(ctx context.Context, opts ListOptions) ([]ObjectInfo, error)

func (*MinIOClient) PresignGet

func (m *MinIOClient) PresignGet(ctx context.Context, key string, ttl time.Duration) (*url.URL, error)

func (*MinIOClient) PresignPut

func (m *MinIOClient) PresignPut(ctx context.Context, key string, ttl time.Duration) (*url.URL, error)

func (*MinIOClient) PutObject

func (m *MinIOClient) PutObject(ctx context.Context, key string, body io.Reader, size int64, opts PutOptions) (ObjectInfo, error)

func (*MinIOClient) Raw

func (m *MinIOClient) Raw() *minio.Client

func (*MinIOClient) StatObject

func (m *MinIOClient) StatObject(ctx context.Context, key string) (ObjectInfo, error)

type MinIOConfig

type MinIOConfig struct {
	Provider         string `json:"provider" yaml:"provider"`
	Endpoint         string `json:"endpoint" yaml:"endpoint"`
	AccessKey        string `json:"access_key" yaml:"access_key"`
	SecretKey        string `json:"secret_key" yaml:"secret_key"`
	SessionToken     string `json:"session_token" yaml:"session_token"`
	Bucket           string `json:"bucket" yaml:"bucket"`
	Region           string `json:"region" yaml:"region"`
	UseSSL           bool   `json:"use_ssl" yaml:"use_ssl"`
	AutoCreateBucket bool   `json:"auto_create_bucket" yaml:"auto_create_bucket"`
}

type ObjectInfo

type ObjectInfo struct {
	Bucket       string
	Key          string
	Size         int64
	ETag         string
	ContentType  string
	LastModified time.Time
}

type Option

type Option func(*options)

func WithLogger

func WithLogger(l *slog.Logger) Option

func WithMetrics

func WithMetrics(m *metrics.Metrics) Option

type PutOptions

type PutOptions struct {
	ContentType  string
	Metadata     map[string]string
	CacheControl string
	SSE          any
}

Jump to

Keyboard shortcuts

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