storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package storage persists challenge attachments and future blobs behind the ObjectStore interface. v0.1 implementation: S3Store (MinIO). The interface is S3-shaped on purpose so the concrete store can change without touching callers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint  string
	AccessKey string
	SecretKey string
	Bucket    string
	UseSSL    bool
}

Config are the S3 connection parameters (a subset of the app config).

type ObjectStore

type ObjectStore interface {
	// Put stores r under key. size is the exact byte length; contentType is the MIME type.
	Put(ctx context.Context, key string, r io.Reader, size int64, contentType string) error
	// Get opens the object at key for reading. The caller closes it.
	Get(ctx context.Context, key string) (io.ReadCloser, error)
	// Delete removes the object at key. Deleting a missing key is not an error.
	Delete(ctx context.Context, key string) error
}

ObjectStore is the blob persistence interface. Only main.go and this package's tests may reference the concrete implementation.

type S3Store

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

S3Store implements ObjectStore against any S3-compatible endpoint (MinIO in v0.1).

func NewS3Store

func NewS3Store(ctx context.Context, cfg Config) (*S3Store, error)

NewS3Store connects, ensures the bucket exists, and returns the store.

func (*S3Store) Delete

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

Delete implements ObjectStore. Removing a missing key is not an error.

func (*S3Store) Get

func (s *S3Store) Get(ctx context.Context, key string) (io.ReadCloser, error)

Get implements ObjectStore.

func (*S3Store) Put

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

Put implements ObjectStore.

func (*S3Store) Ready

func (s *S3Store) Ready(ctx context.Context) error

Ready reports whether the store is reachable (used by /readyz).

Jump to

Keyboard shortcuts

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