kv

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptAssumeDefaultIdx = "assume_default_idx"
	OptBloom            = "bloom"
)

Variables

View Source
var (
	ErrNoBucket  = errors.New("kv: no bucket")
	ErrEmptyPath = errors.New("kv: path to the database must be specified")
)
View Source
var (
	DefaultQuadIndexes = []QuadIndex{

		{Dirs: []quad.Direction{quad.Subject, quad.Predicate}},

		{Dirs: []quad.Direction{quad.Object, quad.Predicate, quad.Subject}},
	}
)

Functions

func CompareQuadDirections added in v0.9.0

func CompareQuadDirections(a, b []quad.Direction) bool

CompareQuadDirections compares two slices of quad directions for equality.

func CompareQuadIndexes added in v0.9.0

func CompareQuadIndexes(a, b []QuadIndex) bool

CompareQuadIndexes compares two slices of quad indexes for equality.

func Init

func Init(ctx context.Context, kv kv.KV, opt graph.Options) error

func New

func New(ctx context.Context, kv kv.KV, opt graph.Options) (graph.QuadStore, error)

func Register

func Register(name string, r Registration)

Types

type IndexScan added in v0.9.0

type IndexScan struct {
	Index  QuadIndex
	Values []uint64
}

func (IndexScan) BuildIterator added in v0.9.0

func (s IndexScan) BuildIterator(ctx context.Context, qs graph.QuadStore) iterator.Shape

func (IndexScan) Optimize added in v0.9.0

func (s IndexScan) Optimize(ctx context.Context, r shape.Optimizer) (shape.Shape, bool, error)

type InitFunc

type InitFunc func(string, graph.Options) (kv.KV, 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() any

type NewFunc

type NewFunc func(string, graph.Options) (kv.KV, error)

type QuadIndex

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

func (QuadIndex) Equal added in v0.9.0

func (ind QuadIndex) Equal(ot QuadIndex) bool

func (QuadIndex) Key

func (ind QuadIndex) Key(vals []uint64) kv.Key

func (QuadIndex) KeyFor

func (ind QuadIndex) KeyFor(p *proto.Primitive) kv.Key

type QuadIndexList added in v0.13.0

type QuadIndexList struct {

	// Indexes are the quad indexes in priority order.
	Indexes []*QuadIndexMeta `protobuf:"bytes,1,rep,name=indexes,proto3" json:"indexes,omitempty"`
	// contains filtered or unexported fields
}

QuadIndexList stores the configured quad indexes.

func (*QuadIndexList) CloneMessageVT added in v0.13.0

func (m *QuadIndexList) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*QuadIndexList) CloneVT added in v0.13.0

func (m *QuadIndexList) CloneVT() *QuadIndexList

func (*QuadIndexList) EqualMessageVT added in v0.13.0

func (this *QuadIndexList) EqualMessageVT(thatMsg any) bool

func (*QuadIndexList) EqualVT added in v0.13.0

func (this *QuadIndexList) EqualVT(that *QuadIndexList) bool

func (*QuadIndexList) GetIndexes added in v0.13.0

func (x *QuadIndexList) GetIndexes() []*QuadIndexMeta

func (*QuadIndexList) MarshalJSON added in v0.13.0

func (x *QuadIndexList) MarshalJSON() ([]byte, error)

MarshalJSON marshals the QuadIndexList to JSON.

func (*QuadIndexList) MarshalProtoJSON added in v0.13.0

func (x *QuadIndexList) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the QuadIndexList message to JSON.

func (*QuadIndexList) MarshalProtoText added in v0.13.0

func (x *QuadIndexList) MarshalProtoText() string

func (*QuadIndexList) MarshalToSizedBufferVT added in v0.13.0

func (m *QuadIndexList) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*QuadIndexList) MarshalToVT added in v0.13.0

func (m *QuadIndexList) MarshalToVT(dAtA []byte) (int, error)

func (*QuadIndexList) MarshalVT added in v0.13.0

func (m *QuadIndexList) MarshalVT() (dAtA []byte, err error)

func (*QuadIndexList) ProtoMessage added in v0.13.0

func (*QuadIndexList) ProtoMessage()

func (*QuadIndexList) Reset added in v0.13.0

func (x *QuadIndexList) Reset()

func (*QuadIndexList) SizeVT added in v0.13.0

func (m *QuadIndexList) SizeVT() (n int)

func (*QuadIndexList) String added in v0.13.0

func (x *QuadIndexList) String() string

func (*QuadIndexList) UnmarshalJSON added in v0.13.0

func (x *QuadIndexList) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the QuadIndexList from JSON.

func (*QuadIndexList) UnmarshalProtoJSON added in v0.13.0

func (x *QuadIndexList) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the QuadIndexList message from JSON.

func (*QuadIndexList) UnmarshalVT added in v0.13.0

func (m *QuadIndexList) UnmarshalVT(dAtA []byte) error

type QuadIndexMeta added in v0.13.0

type QuadIndexMeta struct {

	// Dirs are quad.Direction numeric values.
	Dirs []uint32 `protobuf:"varint,1,rep,packed,name=dirs,proto3" json:"dirs,omitempty"`
	// Unique indicates the index is unique.
	Unique bool `protobuf:"varint,2,opt,name=unique,proto3" json:"unique,omitempty"`
	// contains filtered or unexported fields
}

QuadIndexMeta stores a single quad index definition.

func (*QuadIndexMeta) CloneMessageVT added in v0.13.0

func (m *QuadIndexMeta) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*QuadIndexMeta) CloneVT added in v0.13.0

func (m *QuadIndexMeta) CloneVT() *QuadIndexMeta

func (*QuadIndexMeta) EqualMessageVT added in v0.13.0

func (this *QuadIndexMeta) EqualMessageVT(thatMsg any) bool

func (*QuadIndexMeta) EqualVT added in v0.13.0

func (this *QuadIndexMeta) EqualVT(that *QuadIndexMeta) bool

func (*QuadIndexMeta) GetDirs added in v0.13.0

func (x *QuadIndexMeta) GetDirs() []uint32

func (*QuadIndexMeta) GetUnique added in v0.13.0

func (x *QuadIndexMeta) GetUnique() bool

func (*QuadIndexMeta) MarshalJSON added in v0.13.0

func (x *QuadIndexMeta) MarshalJSON() ([]byte, error)

MarshalJSON marshals the QuadIndexMeta to JSON.

func (*QuadIndexMeta) MarshalProtoJSON added in v0.13.0

func (x *QuadIndexMeta) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the QuadIndexMeta message to JSON.

func (*QuadIndexMeta) MarshalProtoText added in v0.13.0

func (x *QuadIndexMeta) MarshalProtoText() string

func (*QuadIndexMeta) MarshalToSizedBufferVT added in v0.13.0

func (m *QuadIndexMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*QuadIndexMeta) MarshalToVT added in v0.13.0

func (m *QuadIndexMeta) MarshalToVT(dAtA []byte) (int, error)

func (*QuadIndexMeta) MarshalVT added in v0.13.0

func (m *QuadIndexMeta) MarshalVT() (dAtA []byte, err error)

func (*QuadIndexMeta) ProtoMessage added in v0.13.0

func (*QuadIndexMeta) ProtoMessage()

func (*QuadIndexMeta) Reset added in v0.13.0

func (x *QuadIndexMeta) Reset()

func (*QuadIndexMeta) SizeVT added in v0.13.0

func (m *QuadIndexMeta) SizeVT() (n int)

func (*QuadIndexMeta) String added in v0.13.0

func (x *QuadIndexMeta) String() string

func (*QuadIndexMeta) UnmarshalJSON added in v0.13.0

func (x *QuadIndexMeta) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the QuadIndexMeta from JSON.

func (*QuadIndexMeta) UnmarshalProtoJSON added in v0.13.0

func (x *QuadIndexMeta) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the QuadIndexMeta message from JSON.

func (*QuadIndexMeta) UnmarshalVT added in v0.13.0

func (m *QuadIndexMeta) UnmarshalVT(dAtA []byte) error

type QuadIterator

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

func (*QuadIterator) Iterate added in v0.9.0

func (it *QuadIterator) Iterate(ctx context.Context) iterator.Scanner

func (*QuadIterator) Lookup added in v0.9.0

func (it *QuadIterator) Lookup(ctx context.Context) iterator.Index

func (*QuadIterator) Optimize

func (it *QuadIterator) Optimize(ctx context.Context) (iterator.Shape, bool, error)

func (*QuadIterator) Sorted

func (it *QuadIterator) Sorted() bool

func (*QuadIterator) Stats

func (it *QuadIterator) Stats(ctx context.Context) (iterator.Costs, error)

func (*QuadIterator) String

func (it *QuadIterator) String() string

func (*QuadIterator) SubIterators

func (it *QuadIterator) SubIterators() []iterator.Shape

type QuadStore

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

func (*QuadStore) ApplyDeltas

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

func (*QuadStore) Close

func (qs *QuadStore) Close() error

func (*QuadStore) IterateIndexPrefixNextRefs added in v0.12.0

func (qs *QuadStore) IterateIndexPrefixNextRefs(
	ctx context.Context,
	ind QuadIndex,
	vals []uint64,
	cb func(Int64Value, func() (bool, error)) error,
) error

IterateIndexPrefixNextRefs scans an index prefix and yields refs for the single remaining indexed direction directly from the index key.

func (*QuadStore) NameOf

func (qs *QuadStore) NameOf(ctx context.Context, v graph.Ref) (quad.Value, error)

func (*QuadStore) NewQuadWriter added in v0.9.0

func (qs *QuadStore) NewQuadWriter(ctx context.Context) (quad.WriteCloser, error)

func (*QuadStore) NodesAllIterator

func (qs *QuadStore) NodesAllIterator(ctx context.Context) iterator.Shape

func (*QuadStore) OptimizeShape added in v0.9.0

func (qs *QuadStore) OptimizeShape(ctx context.Context, s shape.Shape) (shape.Shape, bool, error)

func (*QuadStore) Quad

func (qs *QuadStore) Quad(ctx context.Context, k graph.Ref) (quad.Quad, error)

func (*QuadStore) QuadDirection

func (qs *QuadStore) QuadDirection(ctx context.Context, val graph.Ref, d quad.Direction) (graph.Ref, error)

func (*QuadStore) QuadIterator

func (qs *QuadStore) QuadIterator(ctx context.Context, dir quad.Direction, v graph.Ref) iterator.Shape

func (*QuadStore) QuadIteratorSize added in v0.9.0

func (qs *QuadStore) QuadIteratorSize(ctx context.Context, d quad.Direction, v graph.Ref) (refs.Size, error)

func (*QuadStore) QuadsAllIterator

func (qs *QuadStore) QuadsAllIterator(ctx context.Context) iterator.Shape

func (*QuadStore) RefsOf added in v0.7.5

func (qs *QuadStore) RefsOf(ctx context.Context, nodes []quad.Value) ([]graph.Ref, error)

func (*QuadStore) Size

func (qs *QuadStore) Size(ctx context.Context) (int64, error)

func (*QuadStore) Stats added in v0.9.0

func (qs *QuadStore) Stats(ctx context.Context, exact bool) (graph.Stats, error)

func (*QuadStore) ValueOf

func (qs *QuadStore) ValueOf(ctx context.Context, s quad.Value) (graph.Ref, error)

func (*QuadStore) ValuesOf

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

type Registration

type Registration struct {
	NewFunc      NewFunc
	InitFunc     InitFunc
	IsPersistent bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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