blob

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUserAssetKey

func IsUserAssetKey(key string) bool

func KeyForPath

func KeyForPath(stellaHome, abs string) (string, error)

KeyForPath returns the slash-separated key for abs relative to stellaHome.

func ValidateKey

func ValidateKey(key string) (string, error)

ValidateKey rejects absolute and traversal keys while preserving slash paths.

Types

type FSStore

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

func NewFSStore

func NewFSStore(root string) (*FSStore, error)

func (*FSStore) Delete

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

func (*FSStore) List

func (s *FSStore) List(ctx context.Context, prefix string) ([]string, error)

func (*FSStore) Open

func (s *FSStore) Open(ctx context.Context, key string) (io.ReadCloser, error)

func (*FSStore) Put

func (s *FSStore) Put(ctx context.Context, key string, r io.Reader) error

type S3Config

type S3Config struct {
	Endpoint  string
	Bucket    string
	AccessKey string
	SecretKey string
	Region    string
	UseSSL    bool
}

type S3Store

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

func NewS3Store

func NewS3Store(cfg S3Config) (*S3Store, error)

func (*S3Store) Delete

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

func (*S3Store) List

func (s *S3Store) List(ctx context.Context, prefix string) ([]string, error)

func (*S3Store) Open

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

func (*S3Store) Put

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

type Store

type Store interface {
	Put(ctx context.Context, key string, r io.Reader) error
	Open(ctx context.Context, key string) (io.ReadCloser, error)
	Delete(ctx context.Context, key string) error
	// List returns every key under prefix, as slash-separated keys relative to
	// the store root. prefix is validated with the same rules as a key
	// (traversal/absolute rejected). A prefix pointing at nothing yields an
	// empty slice, not an error.
	List(ctx context.Context, prefix string) ([]string, error)
}

Store persists durable user assets by STELLA_HOME-relative slash keys. It is a low-level object-store port: the authoritative asset semantics (durable-write, local materialization, restore, move, delete, cold-pod hydration) live in internal/asset, which is the only package that holds a Store. Transports and channel plugins receive the narrow asset ports, never this interface, and there is deliberately no process-global default: an asset store is injected.

func NewStoreFromConfig

func NewStoreFromConfig(c config.BlobS3Config) (Store, error)

NewStoreFromConfig builds the blob store from the raw S3 settings on the server config snapshot. It owns the group semantics the config layer deliberately does not: none set => no store (nil, nil); any set => the four core fields are required together; and the USE_SSL bool dialect (1/true/t/yes/y/on vs 0/false/f/no/n/off, default true) is preserved exactly rather than narrowed to strconv.ParseBool.

Jump to

Keyboard shortcuts

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