objectstore

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

ErrNotFound is returned when an object does not exist in the store.

Functions

This section is empty.

Types

type Client

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

Client wraps an S3-compatible object store client.

func New

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

New creates a new S3-compatible client.

func (*Client) Delete

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

Delete removes an object.

func (*Client) Exists

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

Exists checks whether an object exists.

func (*Client) Get

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

Get downloads an object as a stream and returns its size.

func (*Client) Head

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

Head returns the size of an object.

func (*Client) List

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

List lists objects 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 from a seekable reader.

func (*Client) PutLargeFile

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

PutLargeFile uploads a local file using the client library's multipart support.

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 settings.

func ConfigFromEnv

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

ConfigFromEnv reads S3-compatible storage settings from the environment. It optionally falls back to ~/.config/epoch/s3.env when values are missing.

Jump to

Keyboard shortcuts

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