memory

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorage

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

MemoryStorage is a storage implementation that simply stores key-value pairs in a Go map in-memory. The map is protected by a mutex.

func Open

func Open(size int, overwrites bool) *MemoryStorage

Open opens a new MemoryStorage instance with internal map starting size.

func (*MemoryStorage) Clean

func (st *MemoryStorage) Clean(ctx context.Context) error

Clean: implements Storage.Clean().

func (*MemoryStorage) ReadBytes

func (st *MemoryStorage) ReadBytes(ctx context.Context, key string) ([]byte, error)

ReadBytes: implements Storage.ReadBytes().

func (*MemoryStorage) ReadStream

func (st *MemoryStorage) ReadStream(ctx context.Context, key string) (io.ReadCloser, error)

ReadStream: implements Storage.ReadStream().

func (*MemoryStorage) Remove

func (st *MemoryStorage) Remove(ctx context.Context, key string) error

Remove: implements Storage.Remove().

func (*MemoryStorage) Stat

func (st *MemoryStorage) Stat(ctx context.Context, key string) (*storage.Entry, error)

Stat: implements Storage.Stat().

func (*MemoryStorage) WalkKeys

func (st *MemoryStorage) WalkKeys(ctx context.Context, opts storage.WalkKeysOpts) error

WalkKeys: implements Storage.WalkKeys().

func (*MemoryStorage) WriteBytes

func (st *MemoryStorage) WriteBytes(ctx context.Context, key string, b []byte) (int, error)

WriteBytes: implements Storage.WriteBytes().

func (*MemoryStorage) WriteStream

func (st *MemoryStorage) WriteStream(ctx context.Context, key string, r io.Reader) (int64, error)

WriteStream: implements Storage.WriteStream().

Jump to

Keyboard shortcuts

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