inmem

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage provides kvs.Storage functionality in local process memory. This instance can be used in a single-node configuration or in a test-purposes.

func NewStorage

func NewStorage() *Storage

NewStorage creates new instance of Storage

func (*Storage) Delete

func (st *Storage) Delete(_ context.Context, key string) error

Delete allows to delete a value by key. If the key doesn't exist, the operation will return no errors.ErrNotExist

func (*Storage) Get

func (st *Storage) Get(_ context.Context, key string) (io.ReadCloser, error)

Get allows to read a value by its key. If key is not found the ErrNotExist should be returned

func (*Storage) List

func (st *Storage) List(_ context.Context, path string) ([]string, error)

List returns a list of keys and sub-paths (part of an existing path which is a path itself), which have the prefix of the path argument

Example: for the keys list: "/abc", "/def/abc", "/def/aa1" List("/") -> "/abc", "/def/" List("/def/") -> "/def/abc", "/def/aa1"

func (*Storage) Put

func (st *Storage) Put(_ context.Context, key string, r io.Reader) error

Put allows to store value represented by reader r by the key

Jump to

Keyboard shortcuts

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