storage

package
v0.4.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFragmented = errors.New("storage fragmented")

ErrFragmented is an error that indicates this storage instance is currently fragmented and it cannot be serialized.

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

ErrKeyNotFound is an error that indicates that the requested key could not be found in the DB.

View Source
var ErrKeyTooLarge = errors.New("key too large")

ErrKeyTooLarge is an error that indicates the given key is large than the determined key size. The current maximum key length is 256.

View Source
var ErrNotImplemented = errors.New("not implemented yet")

ErrNotImplemented means that the interface implementation does not support the functionality required to fulfill the request.

Functions

This section is empty.

Types

type Config

type Config struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(cfg map[string]interface{}) *Config

func (*Config) Add

func (c *Config) Add(key string, value interface{})

func (*Config) Copy

func (c *Config) Copy() *Config

func (*Config) Delete

func (c *Config) Delete(key string)

func (*Config) Get

func (c *Config) Get(key string) (interface{}, error)

func (*Config) ToMap

func (c *Config) ToMap() map[string]interface{}

type Engine

type Engine interface {
	SetConfig(*Config)
	SetLogger(*log.Logger)
	Start() error
	NewEntry() Entry
	Name() string
	Fork(*Config) (Engine, error)
	PutRaw(uint64, []byte) error
	Put(uint64, Entry) error
	GetRaw(uint64) ([]byte, error)
	Get(uint64) (Entry, error)
	GetTTL(uint64) (int64, error)
	GetKey(uint64) (string, error)
	Delete(uint64) error
	UpdateTTL(uint64, Entry) error
	Import([]byte) (Engine, error)
	Export() ([]byte, error)
	Stats() Stats
	Check(uint64) bool
	Range(func(uint64, Entry) bool)
	RegexMatchOnKeys(string, func(uint64, Entry) bool) error
	Compaction() (bool, error)
	Close() error
	Destroy() error
}

func LoadAsPlugin

func LoadAsPlugin(pluginPath string) (Engine, error)

type Entry

type Entry interface {
	SetKey(string)
	Key() string
	SetValue([]byte)
	Value() []byte
	SetTTL(int64)
	TTL() int64
	SetTimestamp(int642 int64)
	Timestamp() int64
	Encode() []byte
	Decode([]byte)
}

type Stats

type Stats struct {
	Allocated int
	Inuse     int
	Garbage   int
	Length    int
	NumTables int
	Extras    map[string]interface{}
}

Jump to

Keyboard shortcuts

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