storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("coyote/storage: no such object")
	ErrBadKey   = errors.New("coyote/storage: invalid key")
)

Functions

func ValidKey

func ValidKey(key string) error

Types

type FileSystem

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

func NewFileSystem

func NewFileSystem(root string) *FileSystem

func (*FileSystem) Delete

func (f *FileSystem) Delete(_ context.Context, key string) error

func (*FileSystem) Exists

func (f *FileSystem) Exists(ctx context.Context, key string) bool

func (*FileSystem) List

func (f *FileSystem) List(_ context.Context, prefix string) ([]Stat, error)

func (*FileSystem) Move

func (f *FileSystem) Move(_ context.Context, from, to string) error

func (*FileSystem) Open

func (f *FileSystem) Open(_ context.Context, key string) (io.ReadSeekCloser, error)

func (*FileSystem) Root

func (f *FileSystem) Root() string

func (*FileSystem) Save

func (f *FileSystem) Save(ctx context.Context, key string, r io.Reader) (Stat, error)

func (*FileSystem) Stat

func (f *FileSystem) Stat(_ context.Context, key string) (Stat, error)

type Stat

type Stat struct {
	Key      string
	Size     int64
	Modified time.Time
}

type Storage

type Storage interface {
	Save(ctx context.Context, key string, r io.Reader) (Stat, error)
	Open(ctx context.Context, key string) (io.ReadSeekCloser, error)
	Stat(ctx context.Context, key string) (Stat, error)
	Delete(ctx context.Context, key string) error
	Exists(ctx context.Context, key string) bool
	Move(ctx context.Context, from, to string) error
	List(ctx context.Context, prefix string) ([]Stat, error)
}

Jump to

Keyboard shortcuts

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