storage

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("file already exists")

Functions

This section is empty.

Types

type FilePointer

type FilePointer struct {
	File     *os.File
	Metadata *Metadata
}

func (*FilePointer) Close

func (f *FilePointer) Close() error

type Metadata

type Metadata struct {
	Class    string    `cbor:"c"`
	Oneshot  bool      `cbor:"o"`
	MimeType string    `cbor:"m"`
	Expiry   time.Time `cbor:"e"`
}

type Params

type Params struct {
	fx.In

	Loader *config.Loader
	Ctx    context.Context
	Lc     fx.Lifecycle
	Log    *slog.Logger
}

type Result

type Result struct {
	fx.Out

	Output *Storage
}

func New

func New(p Params) (r Result, err error)

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

func (*Storage) DeleteFile

func (o *Storage) DeleteFile(ctx context.Context, path string) error

func (*Storage) FileExists

func (o *Storage) FileExists(ctx context.Context, path string) (ok bool, err error)

func (*Storage) Migrate

func (o *Storage) Migrate() error

func (*Storage) ReadFile

func (o *Storage) ReadFile(ctx context.Context, path string) (*FilePointer, error)

the caller is responsible to close the filepointer

func (*Storage) WriteFile

func (o *Storage) WriteFile(ctx context.Context, opts *WriteFileOptions) error

type WriteFileOptions

type WriteFileOptions struct {
	File     io.Reader
	Name     string
	Metadata *Metadata
}

Jump to

Keyboard shortcuts

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