store

package
v0.0.0-...-e899ace Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisStore

func NewRedisStore() *redisStore

func OpenDB

func OpenDB(path string) (*gorocksdb.DB, error)

OpenDB opens a new database.

Types

type Storage

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

Storage contains database handle and options.

func (*Storage) Close

func (store *Storage) Close()

Close the opened database.

func (*Storage) Get

func (store *Storage) Get(key []byte) ([]byte, error)

Get the value according to the key.

func (*Storage) Init

func (store *Storage) Init(path string) error

Init the database.

func (*Storage) Save

func (store *Storage) Save(key []byte, value []byte) error

Save key and value.

func (*Storage) SaveValue

func (store *Storage) SaveValue(value []byte) ([]byte, error)

SaveValue only save value, and the key is generated by hash function.

type StorageProvider

type StorageProvider interface {
	Init(path string) error
	Save(key []byte, value []byte) error
	SaveValue(value []byte) ([]byte, error)
	Get(key []byte) ([]byte, error)
}

StorageProvider abstract all storage .

Jump to

Keyboard shortcuts

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