refs

package
v0.7.7-0...-1310f3b Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToKey

func ToKey(v Ref) interface{}

ToKey prepares Ref to be stored inside maps, calling Key() if necessary.

func ValuesOf

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

Types

type BatchNamer

type BatchNamer interface {
	ValuesOf(ctx context.Context, vals []Ref) ([]quad.Value, error)
	RefsOf(ctx context.Context, nodes []quad.Value) ([]Ref, error)
}

type Namer

type Namer interface {
	// Given a node ID, return the opaque token used by the QuadStore
	// to represent that id. Returns nil, nil on not found.
	ValueOf(quad.Value) (Ref, error)
	// Given an opaque token, return the node that it represents.
	// Returns nil, nil on not found.
	NameOf(Ref) (quad.Value, error)
}

type PreFetchedValue

type PreFetchedValue interface {
	Ref
	NameOf() quad.Value
}

PreFetchedValue is an optional interface for graph.Ref to indicate that quadstore has already loaded a value into memory.

func PreFetched

func PreFetched(v quad.Value) PreFetchedValue

type QuadHash

type QuadHash struct {
	Subject   ValueHash
	Predicate ValueHash
	Object    ValueHash
	Label     ValueHash
}

func (QuadHash) Dirs

func (q QuadHash) Dirs() [4]ValueHash

func (QuadHash) Get

func (q QuadHash) Get(d quad.Direction) ValueHash

func (QuadHash) Key

func (q QuadHash) Key() interface{}

func (*QuadHash) Set

func (q *QuadHash) Set(d quad.Direction, h ValueHash)

type Ref

type Ref interface {
	// Key returns a dynamic type that is comparable according to the Go language specification.
	// The returned value must be unique for each receiver value.
	Key() interface{}
}

Ref defines an opaque "quad store reference" type. However the backend wishes to implement it, a Ref is merely a token to a quad or a node that the backing store itself understands, and the base iterators pass around.

For example, in a very traditional, graphd-style graph, these are int64s (guids of the primitives). In a very direct sort of graph, these could be pointers to structs, or merely quads, or whatever works best for the backing store.

These must be comparable, or return a comparable version on Key.

func RefsOf

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

type Size

type Size struct {
	Value int64
	Exact bool
}

Size of a graph (either in nodes or quads).

type ValueHash

type ValueHash [quad.HashSize]byte

ValueHash is a hash of a single value.

func HashOf

func HashOf(s quad.Value) (out ValueHash)

func (ValueHash) Key

func (h ValueHash) Key() interface{}

func (ValueHash) String

func (h ValueHash) String() string

func (ValueHash) Valid

func (h ValueHash) Valid() bool

Jump to

Keyboard shortcuts

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