storage

package
v0.30.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESConfig

type AESConfig struct {
	Base64Key string
}

type Chest

type Chest interface {
	Open(path string) (fs.File, error)
	Glob(pattern string) ([]FileStat, error)
	ReadDir(name string) ([]fs.DirEntry, error)

	ReplaceFile(oldpath, newpath string) error
	ReplaceDir(oldpath, newpath string) error

	MkdirAll(path string) error
	RmdirAll(path string) error

	WriteFile(path string, contents []byte) error
}

func New

func New(cfg Config) (Chest, error)

New returns a Chest given the configuration provided. It can also wrap that Chest in an encryption routine on each operation.

func NewEncrypted

func NewEncrypted(underlying Chest, crypt *cryptfs.FS) Chest

func NewFilesystem

func NewFilesystem(root string) (Chest, error)

type Config

type Config struct {
	Filesystem FilesystemConfig
	Encryption EncryptionConfig
}

type EncryptionConfig

type EncryptionConfig struct {
	AES      *AESConfig
	Encoding string
}

type File

type File interface {
	Filename() string
	FullPath() string

	Stat() (fs.FileInfo, error)
	Read([]byte) (int, error)
	Close() error
}

type FileStat

type FileStat struct {
	RelativePath string
	ModTime      time.Time
}

type FilesystemConfig

type FilesystemConfig struct {
	Directory string
}

Jump to

Keyboard shortcuts

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