storage

package
v0.0.0-...-e6657e5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type FS

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

func NewFS

func NewFS(opts FSOptions) *FS

func (*FS) Delete

func (f *FS) Delete(ctx context.Context, key string) error

func (*FS) Read

func (f *FS) Read(ctx context.Context, key string) ([]byte, error)

func (*FS) ReadStreaming

func (f *FS) ReadStreaming(ctx context.Context, key string) (io.ReadCloser, error)

func (*FS) Save

func (f *FS) Save(ctx context.Context, key string, content []byte) error

func (*FS) SaveStreaming

func (f *FS) SaveStreaming(ctx context.Context, key string) (io.WriteCloser, error)

type FSOptions

type FSOptions struct {
	Folder string `json:"folder"`
}

type Logged

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

func WithLogger

func WithLogger(s Storage) *Logged

func (*Logged) Delete

func (c *Logged) Delete(ctx context.Context, key string) error

func (*Logged) Read

func (c *Logged) Read(ctx context.Context, key string) ([]byte, error)

func (*Logged) ReadStreaming

func (c *Logged) ReadStreaming(ctx context.Context, key string) (io.ReadCloser, error)

func (*Logged) Save

func (c *Logged) Save(ctx context.Context, key string, content []byte) error

func (*Logged) SaveStreaming

func (c *Logged) SaveStreaming(ctx context.Context, key string) (io.WriteCloser, error)

type Memory

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

func NewMemory

func NewMemory() *Memory

func (*Memory) Delete

func (m *Memory) Delete(ctx context.Context, key string) error

func (*Memory) Read

func (m *Memory) Read(ctx context.Context, key string) ([]byte, error)

func (*Memory) ReadStreaming

func (m *Memory) ReadStreaming(ctx context.Context, key string) (io.ReadCloser, error)

func (*Memory) Save

func (m *Memory) Save(ctx context.Context, key string, content []byte) error

func (*Memory) SaveStreaming

func (m *Memory) SaveStreaming(ctx context.Context, key string) (io.WriteCloser, error)

type Storage

type Storage interface {
	Read(ctx context.Context, key string) ([]byte, error)
	ReadStreaming(ctx context.Context, key string) (io.ReadCloser, error)
	Save(ctx context.Context, key string, content []byte) error
	SaveStreaming(ctx context.Context, key string) (io.WriteCloser, error)
	Delete(ctx context.Context, key string) error
}

Jump to

Keyboard shortcuts

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