store

package
v0.0.0-...-499f22c Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCacheSize = 1024
	DefaultCacheTTL  = 60 * 3 // 3min
)

Variables

View Source
var (
	ErrNotFound         = errors.New("data not found")
	ErrInvalidPagingKey = errors.New("invalid paging key")
)

Functions

func Unmarshal

func Unmarshal(values [][]byte, dests []proto.Message) (err error)

Types

type Batch

type Batch interface {
	Put(item ...data.StorableData)
	PutWithTime(t *timestamppb.Timestamp, item ...data.StorableData)
	Delete(item data.StorableData)

	Commit() error

	Reset()
	Close() error

	Empty() bool
	Len() int
	Contents() ([][]byte, [][]byte)
}

func NewBatch

func NewBatch(db *pebble.DB, c *lru.LRUCache) Batch

type DB

type DB interface {
	Batch() Batch
	Get(key []byte, result proto.Message) (err error)
	List(prefix []byte, results interface{}) (err error)
	DeleteAll(prefix []byte) error
	Clear() error
	Close() error
}

type PebbleBatch

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

func (*PebbleBatch) Close

func (b *PebbleBatch) Close() error

func (*PebbleBatch) Commit

func (b *PebbleBatch) Commit() error

func (*PebbleBatch) Contents

func (b *PebbleBatch) Contents() ([][]byte, [][]byte)

func (*PebbleBatch) Delete

func (b *PebbleBatch) Delete(value data.StorableData)

func (*PebbleBatch) Empty

func (b *PebbleBatch) Empty() bool

func (*PebbleBatch) Len

func (b *PebbleBatch) Len() int

func (*PebbleBatch) Put

func (b *PebbleBatch) Put(item ...data.StorableData)

func (*PebbleBatch) PutWithTime

func (b *PebbleBatch) PutWithTime(t *timestamppb.Timestamp, item ...data.StorableData)

func (*PebbleBatch) Reset

func (b *PebbleBatch) Reset()

type PebbleDB

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

func NewPebbleDB

func NewPebbleDB(path string, isMem bool, opt *pebble.Options) (d PebbleDB, err error)

func (*PebbleDB) Batch

func (d *PebbleDB) Batch() Batch

func (*PebbleDB) Clear

func (d *PebbleDB) Clear() error

NOTE: don't work as expected

func (*PebbleDB) Close

func (d *PebbleDB) Close() error

func (*PebbleDB) DeleteAll

func (d *PebbleDB) DeleteAll(prefix []byte) error

func (*PebbleDB) Get

func (d *PebbleDB) Get(key []byte, result proto.Message) (err error)

func (*PebbleDB) List

func (d *PebbleDB) List(prefix []byte, results interface{}) (err error)

Jump to

Keyboard shortcuts

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