storagecore

package module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound    = errors.New("storage: not found")
	ErrForbidden   = errors.New("storage: forbidden")
	ErrUnsupported = errors.New("storage: unsupported operation")
)

Functions

func JoinPrefix

func JoinPrefix(prefix, p string) string

func NormalizePath

func NormalizePath(p string) (string, error)

func RegisterDriver

func RegisterDriver(name string, factory DriverFactory)

Types

type ContextStorage

type ContextStorage interface {
	GetContext(ctx context.Context, p string) ([]byte, error)
	PutContext(ctx context.Context, p string, contents []byte) error
	DeleteContext(ctx context.Context, p string) error
	StatContext(ctx context.Context, p string) (Entry, error)
	ExistsContext(ctx context.Context, p string) (bool, error)
	ListContext(ctx context.Context, p string) ([]Entry, error)
	WalkContext(ctx context.Context, p string, fn func(Entry) error) error
	CopyContext(ctx context.Context, src, dst string) error
	MoveContext(ctx context.Context, src, dst string) error
	URLContext(ctx context.Context, p string) (string, error)
}

type DiskName

type DiskName string

type DriverFactory

type DriverFactory func(ctx context.Context, cfg ResolvedConfig) (Storage, error)

func LookupDriver

func LookupDriver(name string) (DriverFactory, bool)

type Entry

type Entry struct {
	Path  string
	Size  int64
	IsDir bool
}

type ResolvedConfig

type ResolvedConfig struct {
	Driver string

	Remote           string
	Prefix           string
	RcloneConfigPath string
	RcloneConfigData string

	S3Bucket          string
	S3Endpoint        string
	S3Region          string
	S3AccessKeyID     string
	S3SecretAccessKey string
	S3UsePathStyle    bool
	S3UnsignedPayload bool

	SFTPHost                  string
	SFTPPort                  int
	SFTPUser                  string
	SFTPPassword              string
	SFTPKeyPath               string
	SFTPKnownHostsPath        string
	SFTPInsecureIgnoreHostKey bool

	FTPHost               string
	FTPPort               int
	FTPUser               string
	FTPPassword           string
	FTPTLS                bool
	FTPInsecureSkipVerify bool

	DropboxToken string

	GCSBucket          string
	GCSCredentialsJSON string
	GCSEndpoint        string

	RedisAddr     string
	RedisUsername string
	RedisPassword string
	RedisDB       int
}

type Storage

type Storage interface {
	Get(p string) ([]byte, error)
	Put(p string, contents []byte) error
	Delete(p string) error
	Stat(p string) (Entry, error)
	Exists(p string) (bool, error)
	List(p string) ([]Entry, error)
	Walk(p string, fn func(Entry) error) error
	Copy(src, dst string) error
	Move(src, dst string) error
	URL(p string) (string, error)
}

Jump to

Keyboard shortcuts

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