store

package
v0.0.0-...-0828f7b Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 5 Imported by: 2

README

Storage Engine

This package provides a Facade for the underlying storage engine.

TODO

Read about BadgerDB and optimizations (do this after replication and reading DB internals):

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type BadgerDBStore

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

TODO(AD) RunValueLogGC

func (*BadgerDBStore) Close

func (s *BadgerDBStore) Close() error

func (*BadgerDBStore) Delete

func (s *BadgerDBStore) Delete(k []byte) error

func (*BadgerDBStore) Get

func (s *BadgerDBStore) Get(k []byte) ([]byte, error)

func (*BadgerDBStore) Put

func (s *BadgerDBStore) Put(k []byte, v []byte) error

type Error

type Error struct {
	Inner      error
	Message    string
	StackTrace string
	Misc       map[string]interface{}
}

func (Error) Error

func (err Error) Error() string

type InMemoryStore

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

InMemoryStore implements Store using a simple in memory map. This should be only used for testing and development not production use.

func (*InMemoryStore) Close

func (s *InMemoryStore) Close() error

func (*InMemoryStore) Delete

func (s *InMemoryStore) Delete(k []byte) error

Delete removes the given key if it exists.

func (*InMemoryStore) Get

func (s *InMemoryStore) Get(k []byte) ([]byte, error)

Get returns the value associated with the given key.

func (*InMemoryStore) Put

func (s *InMemoryStore) Put(k []byte, v []byte) error

Put inserts the given key and associated value.

type Store

type Store interface {
	Get(k []byte) ([]byte, error)
	Put(k []byte, v []byte) error
	Delete(k []byte) error
	Close() error
}

Store provides an interface to the storage engine.

func NewBadgerDBStore

func NewBadgerDBStore(path string) (Store, error)

func NewInMemoryStore

func NewInMemoryStore() Store

NewInMemoryStore returns a new InMemoryStore.

type StoreErr

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

Jump to

Keyboard shortcuts

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