kv

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = errors.New("kv: not found")
	ErrNoBucket     = errors.New("kv: bucket is missing")
	ErrBucketExists = errors.New("kv: bucket already exists")
)
View Source
var (
	DefaultQuadIndexes = []QuadIndex{
		{Dirs: []quad.Direction{quad.Subject}},
		{Dirs: []quad.Direction{quad.Object}},
	}
)

Functions

func Each

func Each(ctx context.Context, b Bucket, pref []byte, fnc func(k, v []byte) error) error

func GetOne

func GetOne(ctx context.Context, b Bucket, key []byte) ([]byte, error)

func Init

func Init(kv BucketKV, opt graph.Options) error

func New

func New(kv BucketKV, _ graph.Options) (graph.QuadStore, error)

func Register

func Register(name string, r Registration)

func Update

func Update(ctx context.Context, kv BucketKV, update func(tx BucketTx) error) error

func View

func View(kv BucketKV, view func(tx BucketTx) error) error

Types

type AllIterator

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

func NewAllIterator

func NewAllIterator(nodes bool, qs *QuadStore, cons *constraint) *AllIterator

func (*AllIterator) Clone

func (it *AllIterator) Clone() graph.Iterator

func (*AllIterator) Close

func (it *AllIterator) Close() error

func (*AllIterator) Contains

func (it *AllIterator) Contains(ctx context.Context, v graph.Value) bool

func (*AllIterator) Err

func (it *AllIterator) Err() error

func (*AllIterator) Next

func (it *AllIterator) Next(ctx context.Context) bool

func (*AllIterator) NextPath

func (it *AllIterator) NextPath(ctx context.Context) bool

func (*AllIterator) Optimize

func (it *AllIterator) Optimize() (graph.Iterator, bool)

func (*AllIterator) Reset

func (it *AllIterator) Reset()

func (*AllIterator) Result

func (it *AllIterator) Result() graph.Value

func (*AllIterator) Size

func (it *AllIterator) Size() (int64, bool)

func (*AllIterator) Sorted

func (it *AllIterator) Sorted() bool

func (*AllIterator) Stats

func (it *AllIterator) Stats() graph.IteratorStats

func (*AllIterator) String

func (it *AllIterator) String() string

func (*AllIterator) SubIterators

func (it *AllIterator) SubIterators() []graph.Iterator

No subiterators.

func (*AllIterator) TagResults

func (it *AllIterator) TagResults(dst map[string]graph.Value)

func (*AllIterator) Tagger

func (it *AllIterator) Tagger() *graph.Tagger

func (*AllIterator) Type

func (it *AllIterator) Type() graph.Type

func (*AllIterator) UID

func (it *AllIterator) UID() uint64

type Base

type Base interface {
	Type() string
	Close() error
}

type Bucket

type Bucket interface {
	Get(ctx context.Context, keys [][]byte) ([][]byte, error)
	Put(k, v []byte) error
	Del(k []byte) error
	Scan(pref []byte) KVIterator
}

type BucketKV

type BucketKV interface {
	Base
	Tx(update bool) (BucketTx, error)
}

func FromFlat

func FromFlat(flat FlatKV) BucketKV

type BucketKey

type BucketKey struct {
	Bucket, Key []byte
}

type BucketTx

type BucketTx interface {
	Tx
	Bucket(name []byte) Bucket
	Get(ctx context.Context, keys []BucketKey) ([][]byte, error)
}

type FillBucket

type FillBucket interface {
	SetFillPercent(v float64)
}

type FlatKV

type FlatKV interface {
	Base
	Tx(update bool) (FlatTx, error)
}

type FlatTx

type FlatTx interface {
	Tx
	Bucket
}

type InitFunc

type InitFunc func(string, graph.Options) (BucketKV, error)

type Int64Set

type Int64Set []uint64

func (Int64Set) Len

func (a Int64Set) Len() int

func (Int64Set) Less

func (a Int64Set) Less(i, j int) bool

func (Int64Set) Swap

func (a Int64Set) Swap(i, j int)

type Int64Value

type Int64Value uint64

func (Int64Value) Key

func (v Int64Value) Key() interface{}

type KVIterator

type KVIterator interface {
	Next(ctx context.Context) bool
	Err() error
	Close() error
	Key() []byte
	Val() []byte
}

type NewFunc

type NewFunc func(string, graph.Options) (BucketKV, error)

type QuadIndex

type QuadIndex struct {
	Dirs   []quad.Direction
	Unique bool
}

func (QuadIndex) Bucket

func (ind QuadIndex) Bucket() []byte

func (QuadIndex) Key

func (ind QuadIndex) Key(vals []uint64) []byte

func (QuadIndex) KeyFor

func (ind QuadIndex) KeyFor(p *proto.Primitive) []byte

type QuadIterator

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

func NewQuadIterator

func NewQuadIterator(qs *QuadStore, ind QuadIndex, vals []uint64) *QuadIterator

func (*QuadIterator) Clone

func (it *QuadIterator) Clone() graph.Iterator

func (*QuadIterator) Close

func (it *QuadIterator) Close() error

func (*QuadIterator) Contains

func (it *QuadIterator) Contains(ctx context.Context, v graph.Value) bool

func (*QuadIterator) Err

func (it *QuadIterator) Err() error

func (*QuadIterator) Next

func (it *QuadIterator) Next(ctx context.Context) bool

func (*QuadIterator) NextPath

func (it *QuadIterator) NextPath(ctx context.Context) bool

func (*QuadIterator) Optimize

func (it *QuadIterator) Optimize() (graph.Iterator, bool)

func (*QuadIterator) Reset

func (it *QuadIterator) Reset()

func (*QuadIterator) Result

func (it *QuadIterator) Result() graph.Value

func (*QuadIterator) Size

func (it *QuadIterator) Size() (int64, bool)

func (*QuadIterator) Sorted

func (it *QuadIterator) Sorted() bool

func (*QuadIterator) Stats

func (it *QuadIterator) Stats() graph.IteratorStats

func (*QuadIterator) String

func (it *QuadIterator) String() string

func (*QuadIterator) SubIterators

func (it *QuadIterator) SubIterators() []graph.Iterator

func (*QuadIterator) TagResults

func (it *QuadIterator) TagResults(dst map[string]graph.Value)

func (*QuadIterator) Tagger

func (it *QuadIterator) Tagger() *graph.Tagger

func (*QuadIterator) Type

func (it *QuadIterator) Type() graph.Type

func (*QuadIterator) UID

func (it *QuadIterator) UID() uint64

type QuadStore

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

func (*QuadStore) ApplyDeltas

func (qs *QuadStore) ApplyDeltas(in []graph.Delta, ignoreOpts graph.IgnoreOpts) error

func (*QuadStore) Close

func (qs *QuadStore) Close() error

func (*QuadStore) NameOf

func (qs *QuadStore) NameOf(v graph.Value) quad.Value

func (*QuadStore) NodesAllIterator

func (qs *QuadStore) NodesAllIterator() graph.Iterator

func (*QuadStore) OptimizeIterator

func (qs *QuadStore) OptimizeIterator(it graph.Iterator) (graph.Iterator, bool)

func (*QuadStore) Quad

func (qs *QuadStore) Quad(k graph.Value) quad.Quad

func (*QuadStore) QuadDirection

func (qs *QuadStore) QuadDirection(val graph.Value, d quad.Direction) graph.Value

func (*QuadStore) QuadIterator

func (qs *QuadStore) QuadIterator(dir quad.Direction, v graph.Value) graph.Iterator

func (*QuadStore) QuadsAllIterator

func (qs *QuadStore) QuadsAllIterator() graph.Iterator

func (*QuadStore) Size

func (qs *QuadStore) Size() int64

func (*QuadStore) ValueOf

func (qs *QuadStore) ValueOf(s quad.Value) graph.Value

func (*QuadStore) ValuesOf

func (qs *QuadStore) ValuesOf(ctx context.Context, vals []graph.Value) ([]quad.Value, error)

type Registration

type Registration struct {
	NewFunc      NewFunc
	InitFunc     InitFunc
	IsPersistent bool
}

type Tx

type Tx interface {
	Commit(ctx context.Context) error
	Rollback() error
}

Directories

Path Synopsis
Package b implements a B+tree.
Package b implements a B+tree.

Jump to

Keyboard shortcuts

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