kvs

package
v0.0.0-...-9872bba Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBytes

func ToBytes(i uint) []byte

ToBytes convert integer to byte array

func ToInt

func ToInt(bs []byte) uint

ToInt converts byte array to integer

Types

type BoltDB

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

BoltDB is one implementation of KVS

func NewBoltDB

func NewBoltDB(p string) (*BoltDB, error)

NewBoltDB returns BoltDB instance

func (*BoltDB) Close

func (b *BoltDB) Close() error

func (*BoltDB) Delete

func (b *BoltDB) Delete(key []byte) error

func (*BoltDB) GetKey

func (b *BoltDB) GetKey(val uint) ([]byte, error)

func (*BoltDB) GetKeys

func (b *BoltDB) GetKeys(vals []uint) ([][]byte, error)

GetKeys wraps multiple calls GetKey

func (*BoltDB) GetVal

func (b *BoltDB) GetVal(key []byte) (uint, error)

func (*BoltDB) Set

func (b *BoltDB) Set(key []byte, val uint) error

type GoLevel

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

func NewGoLevel

func NewGoLevel(p string) (*GoLevel, error)

func (*GoLevel) Close

func (g *GoLevel) Close() error

func (*GoLevel) Delete

func (g *GoLevel) Delete(key []byte) error

func (*GoLevel) GetKey

func (g *GoLevel) GetKey(val uint) ([]byte, error)

func (*GoLevel) GetKeys

func (g *GoLevel) GetKeys(vals []uint) ([][]byte, error)

GetKeys wraps multiple calls GetKey

func (*GoLevel) GetVal

func (g *GoLevel) GetVal(key []byte) (uint, error)

func (*GoLevel) Set

func (g *GoLevel) Set(key []byte, val uint) error

type KVS

type KVS interface {
	GetKey(uint) ([]byte, error)
	GetKeys([]uint) ([][]byte, error)
	GetVal([]byte) (uint, error)
	Set([]byte, uint) error
	Delete([]byte) error
	Close() error
}

type Redis

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

func NewRedis

func NewRedis(host, port, pass string, kv, vk int, pingTimeout, pingRetryFreq time.Duration) (*Redis, error)

NewRedis initializes Redis

func (*Redis) Close

func (r *Redis) Close() error

func (*Redis) Delete

func (r *Redis) Delete(key []byte) error

func (*Redis) GetKey

func (r *Redis) GetKey(val uint) ([]byte, error)

func (*Redis) GetKeys

func (r *Redis) GetKeys(vals []uint) ([][]byte, error)

GetKeys wraps multiple calls GetKey

func (*Redis) GetVal

func (r *Redis) GetVal(key []byte) (uint, error)

func (*Redis) Set

func (r *Redis) Set(key []byte, val uint) error

Jump to

Keyboard shortcuts

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