storage

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 10 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) (File, error)
	Glob(pattern string) ([]FileStat, 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

	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