storage

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint  string
	Region    string
	Bucket    string
	AccessKey string
	SecretKey string
}

Config holds the connection details for an S3-compatible object store.

type Store

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

Store puts, deletes, checks and links objects in an S3-compatible bucket.

func NewStore

func NewStore(ctx context.Context, cfg Config) *Store

NewStore builds a Store connected to the S3-compatible endpoint described by cfg.

The HTTP client forces HTTP/1.1: the Ceph RadosGW endpoint this app targets returns a PROTOCOL_ERROR over HTTP/2.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

Delete removes key from the bucket.

func (*Store) Exists

func (s *Store) Exists(ctx context.Context, key string) (bool, error)

Exists reports whether key is present in the bucket.

func (*Store) PublicURL

func (s *Store) PublicURL(key string) string

PublicURL builds the public CDN URL for key, e.g. "https://cdn.example.com/bucket/category/uuid.png".

func (*Store) Put

func (s *Store) Put(ctx context.Context, key string, body io.Reader, size int64, contentType string) error

Put uploads body to key, setting contentType and size (Content-Length) on the object.

Jump to

Keyboard shortcuts

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