storage

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 1

README

storagedb

Storage DB Data Access Layer

Supported backends:

  • badger
  • boltdb
  • bbolt
  • pebbledb (like rocksdb)

Documentation

Index

Constants

View Source
const NoTTL = 0

Variables

View Source
var ErrNotFound = os.ErrNotExist
View Source
var ManagedStorageClass = reflect.TypeOf((*ManagedStorage)(nil)).Elem()
View Source
var StorageClass = reflect.TypeOf((*Storage)(nil)).Elem()
View Source
var StorageManagementClass = reflect.TypeOf((*StorageManagement)(nil)).Elem()

Functions

This section is empty.

Types

type EnumerateOperation

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

func (*EnumerateOperation) Bucket

func (t *EnumerateOperation) Bucket(bucket []byte) *EnumerateOperation

func (*EnumerateOperation) ByPrefix

func (t *EnumerateOperation) ByPrefix(formatPrefix string, args ...interface{}) *EnumerateOperation

func (*EnumerateOperation) ByRawPrefix

func (t *EnumerateOperation) ByRawPrefix(prefix []byte) *EnumerateOperation

func (*EnumerateOperation) Do

func (t *EnumerateOperation) Do(cb func(key, value []byte) bool) error

func (*EnumerateOperation) DoProto

func (t *EnumerateOperation) DoProto(factory func() proto.Message, cb func(key []byte, value proto.Message) bool) error

func (*EnumerateOperation) OnlyKeys

func (t *EnumerateOperation) OnlyKeys() *EnumerateOperation

func (*EnumerateOperation) Seek

func (t *EnumerateOperation) Seek(formatSeek string, args ...interface{}) *EnumerateOperation

func (*EnumerateOperation) WithBatchSize

func (t *EnumerateOperation) WithBatchSize(batchSize int) *EnumerateOperation

type GetOperation

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

func (*GetOperation) Bucket

func (t *GetOperation) Bucket(bucket []byte) *GetOperation

func (*GetOperation) ByKey

func (t *GetOperation) ByKey(formatKey string, args ...interface{}) *GetOperation

func (*GetOperation) ByRawKey

func (t *GetOperation) ByRawKey(key []byte) *GetOperation

func (*GetOperation) Required

func (t *GetOperation) Required() *GetOperation

func (*GetOperation) ToBinary

func (t *GetOperation) ToBinary() ([]byte, error)

func (*GetOperation) ToProto

func (t *GetOperation) ToProto(container proto.Message) error

func (*GetOperation) ToString

func (t *GetOperation) ToString() (string, error)

type ManagedStorage

type ManagedStorage interface {
	Storage
	StorageManagement

	Instance() interface{}
}

type PutOperation

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

func (*PutOperation) Binary

func (t *PutOperation) Binary(value []byte) error

func (*PutOperation) Bucket

func (t *PutOperation) Bucket(bucket []byte) *PutOperation

func (*PutOperation) ByKey

func (t *PutOperation) ByKey(formatKey string, args ...interface{}) *PutOperation

func (*PutOperation) ByRawKey

func (t *PutOperation) ByRawKey(key []byte) *PutOperation

func (*PutOperation) Proto

func (t *PutOperation) Proto(msg proto.Message) error

func (*PutOperation) String

func (t *PutOperation) String(value string) error

func (*PutOperation) WithTtl

func (t *PutOperation) WithTtl(ttlSeconds int) *PutOperation

type RemoveOperation

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

func (*RemoveOperation) Bucket

func (t *RemoveOperation) Bucket(bucket []byte) *RemoveOperation

func (*RemoveOperation) ByKey

func (t *RemoveOperation) ByKey(formatKey string, args ...interface{}) *RemoveOperation

func (*RemoveOperation) ByRawKey

func (t *RemoveOperation) ByRawKey(key []byte) *RemoveOperation

func (*RemoveOperation) Do

func (t *RemoveOperation) Do() error

type Storage

type Storage interface {
	context.DisposableBean

	Get() *GetOperation

	Put() *PutOperation

	Remove() *RemoveOperation

	Enumerate() *EnumerateOperation

	GetRaw(bucket, key []byte, required bool) ([]byte, error)

	PutRaw(bucket, key, value []byte, ttlSeconds int) error

	RemoveRaw(bucket, key []byte) error

	EnumerateRaw(bucket, seek []byte, batchSize int, onlyKeys bool, cb func(key, value []byte) bool) error

	FetchKeysRaw(bucket []byte, batchSize int) ([][]byte, error)
}

type StorageManagement

type StorageManagement interface {
	Compact(discardRatio float64) error

	Backup(w io.Writer, since uint64) (uint64, error)

	Restore(r io.Reader) error

	DropAll() error

	DropWithPrefix(prefix []byte) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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