db

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCursorNotFound = errors.New("cursor not found")
View Source
var ErrInvalidArguments = errors.New("invalid arguments")
View Source
var ErrNotFound = errors.New("not found")
View Source
var InfiniteEndBytes = []byte{}/* 128 elements not displayed */

FIXME: open-ended scans need to be implemented in kvdb

Functions

This section is empty.

Types

type CursorError

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

type DB

type DB struct {
	QueryRowsLimit int
	// contains filtered or unexported fields
}

func New

func New(dsn string, logger *zap.Logger, tracer logging.Tracer) (*DB, error)

func (*DB) AddOperation

func (l *DB) AddOperation(op *pbkv.KVOperation)

func (*DB) AddOperations

func (l *DB) AddOperations(ops *pbkv.KVOperations)

func (*DB) Flush

func (l *DB) Flush(ctx context.Context, cursor *sink.Cursor) (count int, err error)

func (*DB) Get

func (l *DB) Get(ctx context.Context, key string) (val []byte, err error)

func (*DB) GetByPrefix

func (l *DB) GetByPrefix(ctx context.Context, prefix string, limit int) (values []*kvv1.KV, limitReached bool, err error)

func (*DB) GetCursor

func (l *DB) GetCursor(ctx context.Context) (*sink.Cursor, error)

func (*DB) GetMany

func (l *DB) GetMany(ctx context.Context, keys []string) (values [][]byte, err error)

func (*DB) MarshalLogObject

func (l *DB) MarshalLogObject(encoder zapcore.ObjectEncoder) error

func (*DB) Scan

func (l *DB) Scan(ctx context.Context, begin, exclusiveEnd string, limit int) (values []*kvv1.KV, limitReached bool, err error)

func (*DB) WriteCursor

func (l *DB) WriteCursor(ctx context.Context, c *sink.Cursor) error

type DBLoader

type DBLoader interface {
	AddOperations(ops *kvv1.KVOperations)
	AddOperation(op *kvv1.KVOperation)
	Flush(ctx context.Context, cursor *sink.Cursor) (count int, err error)
	GetCursor(ctx context.Context) (*sink.Cursor, error)
	WriteCursor(ctx context.Context, c *sink.Cursor) error
}

type DBReader

type DBReader interface {
	Get(ctx context.Context, key string) (value []byte, err error)
	GetMany(ctx context.Context, keys []string) (values [][]byte, err error)
	GetByPrefix(ctx context.Context, prefix string, limit int) (values []*kvv1.KV, limitReached bool, err error)
	Scan(ctx context.Context, start string, exclusiveEnd string, limit int) (values []*kvv1.KV, limitReached bool, err error)
}

Jump to

Keyboard shortcuts

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