storage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrResourceNotFound = errors.New("resource not found")
View Source
var ErrSnapshotNotFound = errors.New("snapshot not found")
View Source
var ErrUninitialized = errors.New("uninitialized storage")
View Source
var ErrUnknownStorage = errors.New("unknown storage type")

Functions

func FS added in v0.5.0

func FS() iofs.FS

func GetResource added in v0.2.0

func GetResource(key string) (io.ReadCloser, error)

func GetResourceSize added in v0.2.0

func GetResourceSize(key string) uint

func GetResourceURL added in v0.3.0

func GetResourceURL(key string) (string, bool)

func GetSnapshot

func GetSnapshot(key string) (io.ReadCloser, error)

func GetSnapshotSize added in v0.2.0

func GetSnapshotSize(key string) uint

func Hash

func Hash(x []byte) string

func Init

func Init(sCfg config.Storage) error

func SaveResource added in v0.2.0

func SaveResource(key string, resource []byte) error

func SaveSnapshot

func SaveSnapshot(key string, snapshot []byte) error

Types

type Storage

type Storage interface {
	FS() (iofs.FS, error)
	GetSnapshot(string) io.ReadCloser
	GetSnapshotSize(string) uint
	SaveSnapshot(string, []byte) error
	SaveResource(string, []byte) error
	GetResource(string) io.ReadCloser
	GetResourceSize(string) uint
	// return values: URL, isFullURL (true/false)
	GetResourceURL(string) (string, bool)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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