storage

package
v0.0.0-...-5e8511f Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: AGPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReadOnly = errors.New("Readonly storage")

Functions

func BenchmarkStorageProvider

func BenchmarkStorageProvider(storage StorageProvider, b *testing.B)

func TeardownTestEnv

func TeardownTestEnv() error

func TestStorageProvider

func TestStorageProvider(provider StorageProvider, t *testing.T)

Types

type File

type File interface {
	io.ReadCloser
	io.WriteCloser
}

type FileInfo

type FileInfo struct {
	Name      string    `json:"name"`
	FullPath  string    `json:"full_path"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Size      uint64    `json:"size"`
	Directory bool      `json:"directory"`
}

type PostConfigure

type PostConfigure interface {
	OnConfigure() error
}

Implement this interface if you want to be notified after your config is loaded, in case you need to do additional initialization using the config values

type ReadonlyStorage

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

func (*ReadonlyStorage) Delete

func (r *ReadonlyStorage) Delete(ctx context.Context, user *models.User, fullpath string) error

func (*ReadonlyStorage) File

func (r *ReadonlyStorage) File(ctx context.Context, user *models.User, fullpath string) (File, error)

func (*ReadonlyStorage) InitUser

func (r *ReadonlyStorage) InitUser(ctx context.Context, user *models.User) error

func (*ReadonlyStorage) ListDirectory

func (r *ReadonlyStorage) ListDirectory(ctx context.Context, user *models.User, path string) (<-chan FileInfo, error)

func (*ReadonlyStorage) Mkdir

func (r *ReadonlyStorage) Mkdir(ctx context.Context, user *models.User, path string) error

func (*ReadonlyStorage) Move

func (r *ReadonlyStorage) Move(ctx context.Context, user *models.User, src string, dst string) error

type StorageProvider

type StorageProvider interface {
	InitUser(ctx context.Context, user *models.User) error
	Mkdir(ctx context.Context, user *models.User, path string) error
	Move(ctx context.Context, user *models.User, src, dst string) error
	ListDirectory(ctx context.Context, user *models.User, path string) (<-chan FileInfo, error)
	File(ctx context.Context, user *models.User, fullpath string) (File, error)
	Delete(ctx context.Context, user *models.User, fullpath string) error
}

TODO: Add support for https://pkg.golang.ir/io#ReaderAt and https://pkg.golang.ir/io#WriterAt ?

func ReadOnly

func ReadOnly(provider StorageProvider) StorageProvider

func SetupTestEnv

func SetupTestEnv(provider StorageProvider, tmpdir string) (StorageProvider, error)

Directories

Path Synopsis
builtin

Jump to

Keyboard shortcuts

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