objstore

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(c Config) error

Validate checks if the driver is supported and basic config is valid.

Types

type Config

type Config struct {
	Driver         string
	Bucket         string
	Region         string
	Endpoint       string
	AccessKey      string
	SecretKey      string
	ForcePathStyle bool
	BaseDir        string
	SignedURLTTL   time.Duration
	PublicURL      string // 公共访问 URL 前缀,如 https://cdn.example.comhttps://example.com/uploads
}

func FromEnv

func FromEnv() Config

type ListResult added in v0.1.2

type ListResult struct {
	Objects     []ObjectInfo
	Prefixes    []string
	IsTruncated bool
	NextMarker  string
}

ListResult 是 List 操作的返回结果

type ObjectInfo added in v0.1.2

type ObjectInfo struct {
	Key          string
	Size         int64
	LastModified time.Time
	ETag         string
	StorageClass string
}

ObjectInfo 表示对象元数据

type ReadSeeker

type ReadSeeker interface {
	Read(p []byte) (int, error)
	Seek(offset int64, whence int) (int64, error)
}

ReadSeeker abstracts the subset we need to stream into drivers.

type Store

type Store interface {
	Put(ctx context.Context, key string, r ReadSeeker, size int64, contentType string) error
	SignedURL(ctx context.Context, key string, method string, expiry time.Duration) (string, error)
	Delete(ctx context.Context, key string) error
	List(ctx context.Context, prefix, marker, delimiter string, limit int) (ListResult, error)
	CreatePrefix(ctx context.Context, prefix string) error
	RenamePrefix(ctx context.Context, oldPrefix, newPrefix string) error
}

func OpenCOS

func OpenCOS(_ context.Context, c Config) (Store, error)

func OpenFile

func OpenFile(_ context.Context, c Config) (Store, error)

func OpenOSS

func OpenOSS(_ context.Context, c Config) (Store, error)

func OpenS3

func OpenS3(ctx context.Context, c Config) (Store, error)

Jump to

Keyboard shortcuts

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