storage

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

ErrNotFound is returned when a requested path does not exist in storage.

Functions

This section is empty.

Types

type LocalStorage

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

LocalStorage implements Storage using the local filesystem.

func NewLocalStorage

func NewLocalStorage(basePath string) (*LocalStorage, error)

NewLocalStorage creates a new LocalStorage rooted at basePath.

func (*LocalStorage) Delete

func (s *LocalStorage) Delete(_ context.Context, path string) error

func (*LocalStorage) Exists

func (s *LocalStorage) Exists(_ context.Context, path string) (bool, error)

func (*LocalStorage) List

func (s *LocalStorage) List(_ context.Context, prefix string) ([]string, error)

func (*LocalStorage) Read

func (s *LocalStorage) Read(_ context.Context, path string) ([]byte, error)

func (*LocalStorage) Write

func (s *LocalStorage) Write(_ context.Context, path string, data []byte) error

type S3Storage

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

S3Storage implements Storage using AWS S3.

func NewS3Storage

func NewS3Storage(ctx context.Context, bucket, prefix, region string) (*S3Storage, error)

NewS3Storage creates a new S3Storage.

func (*S3Storage) Delete

func (s *S3Storage) Delete(ctx context.Context, path string) error

func (*S3Storage) Exists

func (s *S3Storage) Exists(ctx context.Context, path string) (bool, error)

func (*S3Storage) List

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

func (*S3Storage) Read

func (s *S3Storage) Read(ctx context.Context, path string) ([]byte, error)

func (*S3Storage) Write

func (s *S3Storage) Write(ctx context.Context, path string, data []byte) error

type Storage

type Storage interface {
	Read(ctx context.Context, path string) ([]byte, error)
	Write(ctx context.Context, path string, data []byte) error
	Delete(ctx context.Context, path string) error
	List(ctx context.Context, prefix string) ([]string, error)
	Exists(ctx context.Context, path string) (bool, error)
}

Storage provides an abstraction over key-value style file storage.

Jump to

Keyboard shortcuts

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