storage

package
v0.0.0-...-d7906e4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBackendName = "_"

Variables

This section is empty.

Functions

func Initialize

func Initialize(db db.Handler, cfg Config, logger zerolog.Logger) error

func InsertBackend

func InsertBackend(d db.Handler, name string, driver Driver, params map[string]string) error

func ListBackends

func ListBackends() map[string]Backend

Types

type Backend

type Backend interface {
	Name() string
	OpenRead(name string, start, length int) (io.ReadCloser, error)
	Delete(name string) error
	DeleteAll(names []string) []error
	Copy(ctx context.Context, src Backend, srcName, destName string) error
}

func GetBackend

func GetBackend(name string) (Backend, error)

type BackendConfig

type BackendConfig struct {
	Name   string            `json:"name"`
	Driver string            `json:"driver"`
	Params map[string]string `json:"params"`
}

type Config

type Config struct {
	Root string `koanf:"root"`
	Temp string `koanf:"temp"`
}

type Driver

type Driver struct {
	Name        string
	Description string
	Params      []string
	Create      func(name string, params map[string]string) (Backend, error)
}

func FindDriver

func FindDriver(driverName string) (Driver, error)

func ListDrivers

func ListDrivers() []Driver

type LocalBackend

type LocalBackend interface {
	Backend
	OpenWrite(name string) (io.WriteCloser, error)
	// contains filtered or unexported methods
}

func DefaultBackend

func DefaultBackend() LocalBackend

Jump to

Keyboard shortcuts

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