objectstore

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package objectstore provides an S3-compatible blob storage client.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a requested object does not exist.

Functions

This section is empty.

Types

type Client

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

Client wraps a MinIO S3 client with key prefixing.

func New

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

New creates an S3 client from the given configuration.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, key string) error

Delete removes an object by key.

func (*Client) Exists

func (c *Client) Exists(ctx context.Context, key string) (bool, error)

Exists reports whether an object with the given key exists.

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string) (io.ReadCloser, int64, error)

Get returns a streaming reader and size for the given key.

func (*Client) Head

func (c *Client) Head(ctx context.Context, key string) (int64, error)

Head returns the size of an object without downloading it.

func (*Client) List

func (c *Client) List(ctx context.Context, prefix string) ([]string, error)

List returns all object keys under the given prefix.

func (*Client) Put

func (c *Client) Put(ctx context.Context, key string, body io.Reader, size int64) error

Put uploads an object with the given key.

func (*Client) PutLargeFile

func (c *Client) PutLargeFile(ctx context.Context, key, filePath string) error

PutLargeFile uploads a local file using multipart upload.

type Config

type Config struct {
	Endpoint  string
	AccessKey string //nolint:gosec // configuration schema field name
	SecretKey string //nolint:gosec // configuration schema field name
	Bucket    string
	Region    string
	Prefix    string
	Secure    bool
}

Config holds S3-compatible object store connection settings.

func ConfigFromEnv

func ConfigFromEnv(prefix string) (*Config, error)

ConfigFromEnv reads S3 settings from environment, falling back to ~/.config/epoch/s3.env.

Jump to

Keyboard shortcuts

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