storage

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.Wrap(errorx.Err_NOT_FOUND, "record not found")
	ErrExists         = errors.Wrap(errorx.Err_ALREADY_EXISTS, "key/bucket exists")
	ErrEmptyNode      = errors.Wrap(errorx.Err_INVALID_ARGUMENT, "empty node")
	ErrEmptyLeaf      = errors.Wrap(errorx.Err_INVALID_ARGUMENT, "empty leaf")
	ErrNoSuchBucket   = errors.Wrap(errorx.Err_NOT_FOUND, "no such bucket")
	ErrNoParentBucket = errors.Wrap(errorx.Err_INVALID_ARGUMENT, "no parent bucket")
)

Functions

func KeySplitter

func KeySplitter(s string) (paths []string, leaf string)

Types

type KV

type KV interface {
	// GetKV get value of key
	GetKV(key string, isDir bool) (*apicassemdb.Entity, error)

	// SetKV save key and value
	SetKV(key string, value *apicassemdb.Entity, isDir bool) error

	// UnsetKV save key and value
	UnsetKV(key string, isDir bool) error

	// Range iterates all keys or buckets under the given key.
	Range(key string, seek string, limit int) (*RangeResult, error)
}

KV is a proxy who helps convert data between logic and persistence.Not only all parameters of KV are logic datatype, but also all return values.

func NewEmptyRepository

func NewEmptyRepository() KV

func NewRepository

func NewRepository(c *conf.Bolt) (KV, error)

type RangeResult

type RangeResult struct {
	Items       []*apicassemdb.Entity
	HasMore     bool
	NextSeekKey string
	ExpiredKeys []string
}

Jump to

Keyboard shortcuts

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