kvgraph

package
v0.0.0-...-fa720cf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DstEdgeKey

func DstEdgeKey(graph, src, dst, eid, label string, etype byte) []byte

DstEdgeKey creates a dest edge index key

func DstEdgeKeyParse

func DstEdgeKeyParse(key []byte) (string, string, string, string, string, byte)

DstEdgeKeyParse takes a dest index key entry and parses it into: `graph`, `dstVertexId`, `srcVertexId`, `edgeId`, `label`, `etype`

func DstEdgeKeyPrefix

func DstEdgeKeyPrefix(graph, src, dst, eid string) []byte

DstEdgeKeyPrefix creates a byte array prefix for a dest edge index entry

func DstEdgeListPrefix

func DstEdgeListPrefix(graph string) []byte

DstEdgeListPrefix returns a byte array prefix for all entries in the dest edge index for a graph

func DstEdgePrefix

func DstEdgePrefix(graph, id string) []byte

DstEdgePrefix returns a byte array prefix for all entries in the dest edge index a particular vertex (the dest vertex)

func EdgeKey

func EdgeKey(graph, id, src, dst, label string, etype byte) []byte

EdgeKey takes the required components of an edge key and returns the byte array

func EdgeKeyParse

func EdgeKeyParse(key []byte) (string, string, string, string, string, byte)

EdgeKeyParse takes a edge key and returns the elements encoded in it: `graph`, `edgeID`, `srcVertexId`, `dstVertexId`, `label`, `edgeType`

func EdgeKeyPrefix

func EdgeKeyPrefix(graph, id string) []byte

EdgeKeyPrefix returns the byte array prefix for a particular edge id

func EdgeListPrefix

func EdgeListPrefix(graph string) []byte

EdgeListPrefix returns a byte array prefix for all edges in a graph

func GraphKey

func GraphKey(graph string) []byte

GraphKey produces the byte key for a particular graph

func GraphKeyParse

func GraphKeyParse(key []byte) string

GraphKeyParse extracts the string name of a graph from a byte key

func GraphPrefix

func GraphPrefix() []byte

GraphPrefix returns the byte array prefix for all graph entry keys

func NewKVGraph

func NewKVGraph(kv kvi.KVInterface) gdbi.GraphDB

NewKVGraph creats a new instance of KVGraph given a KVInterface

func NewKVGraphDB

func NewKVGraphDB(name string, dbPath string) (gdbi.GraphDB, error)

NewKVGraphDB intitalize a new key value graph driver given the name of the driver and path/url to create the database at

func SrcEdgeKey

func SrcEdgeKey(graph, src, dst, eid, label string, etype byte) []byte

SrcEdgeKey creates a src edge index key

func SrcEdgeKeyParse

func SrcEdgeKeyParse(key []byte) (string, string, string, string, string, byte)

SrcEdgeKeyParse takes a src index key entry and parses it into: `graph`, `srcVertexId`, `dstVertexId`, `edgeId`, `label`, `etype`

func SrcEdgeKeyPrefix

func SrcEdgeKeyPrefix(graph, src, dst, eid string) []byte

SrcEdgeKeyPrefix creates a byte array prefix for a src edge index entry

func SrcEdgeListPrefix

func SrcEdgeListPrefix(graph string) []byte

SrcEdgeListPrefix returns a byte array prefix for all entries in the source edge index for a graph

func SrcEdgePrefix

func SrcEdgePrefix(graph, id string) []byte

SrcEdgePrefix returns a byte array prefix for all entries in the source edge index a particular vertex (the source vertex)

func VertexKey

func VertexKey(graph, id string) []byte

VertexKey generates the key given a vertexId

func VertexKeyParse

func VertexKeyParse(key []byte) (string, string)

VertexKeyParse takes a byte array key and returns: `graphId`, `vertexId`

func VertexListPrefix

func VertexListPrefix(graph string) []byte

VertexListPrefix returns a byte array prefix for all vertices in a graph

Types

type KVGraph

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

KVGraph implements the GripInterface using a generic key/value storage driver

func (*KVGraph) AddGraph

func (kgraph *KVGraph) AddGraph(graph string) error

AddGraph creates a new graph named `graph`

func (*KVGraph) BuildSchema

func (ma *KVGraph) BuildSchema(ctx context.Context, graph string, sampleN uint32, random bool) (*gripql.Graph, error)

BuildSchema returns the schema of a specific graph in the database

func (*KVGraph) Close

func (kgraph *KVGraph) Close() error

Close the connection

func (*KVGraph) DeleteGraph

func (kgraph *KVGraph) DeleteGraph(graph string) error

DeleteGraph deletes `graph`

func (*KVGraph) Graph

func (kgraph *KVGraph) Graph(graph string) (gdbi.GraphInterface, error)

Graph obtains the gdbi.DBI for a particular graph

func (*KVGraph) ListGraphs

func (kgraph *KVGraph) ListGraphs() []string

ListGraphs lists the graphs managed by this driver

type KVInterfaceGDB

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

KVInterfaceGDB implements the GDB interface using a genertic key/value storage driver

func (*KVInterfaceGDB) AddEdge

func (kgdb *KVInterfaceGDB) AddEdge(edges []*gdbi.Edge) error

AddEdge adds an edge to the graph, if the id is not "" and in already exists in the graph, it is replaced

func (*KVInterfaceGDB) AddVertex

func (kgdb *KVInterfaceGDB) AddVertex(vertices []*gdbi.Vertex) error

AddVertex adds an edge to the graph, if it already exists in the graph, it is replaced

func (*KVInterfaceGDB) AddVertexIndex

func (kgdb *KVInterfaceGDB) AddVertexIndex(label string, field string) error

AddVertexIndex add index to vertices

func (*KVInterfaceGDB) BulkAdd

func (kgdb *KVInterfaceGDB) BulkAdd(stream <-chan *gdbi.GraphElement) error

func (*KVInterfaceGDB) Compiler

func (kgdb *KVInterfaceGDB) Compiler() gdbi.Compiler

Compiler gets a compiler that will use the graph the execute the compiled query

func (*KVInterfaceGDB) DelEdge

func (kgdb *KVInterfaceGDB) DelEdge(eid string) error

DelEdge deletes edge with id `key`

func (*KVInterfaceGDB) DelVertex

func (kgdb *KVInterfaceGDB) DelVertex(id string) error

DelVertex deletes vertex with id `key`

func (*KVInterfaceGDB) DeleteVertexIndex

func (kgdb *KVInterfaceGDB) DeleteVertexIndex(label string, field string) error

DeleteVertexIndex delete index from vertices

func (*KVInterfaceGDB) GetEdge

func (kgdb *KVInterfaceGDB) GetEdge(id string, loadProp bool) *gdbi.Edge

GetEdge loads an edge given an id. It returns nil if not found

func (*KVInterfaceGDB) GetEdgeList

func (kgdb *KVInterfaceGDB) GetEdgeList(ctx context.Context, loadProp bool) <-chan *gdbi.Edge

GetEdgeList produces a channel of all edges in the graph

func (*KVInterfaceGDB) GetInChannel

func (kgdb *KVInterfaceGDB) GetInChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup

GetInChannel process requests of vertex ids and find the connected vertices on incoming edges

func (*KVInterfaceGDB) GetInEdgeChannel

func (kgdb *KVInterfaceGDB) GetInEdgeChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup

GetInEdgeChannel process requests of vertex ids and find the connected incoming edges

func (*KVInterfaceGDB) GetOutChannel

func (kgdb *KVInterfaceGDB) GetOutChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup

GetOutChannel process requests of vertex ids and find the connected vertices on outgoing edges

func (*KVInterfaceGDB) GetOutEdgeChannel

func (kgdb *KVInterfaceGDB) GetOutEdgeChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup

GetOutEdgeChannel process requests of vertex ids and find the connected outgoing edges

func (*KVInterfaceGDB) GetTimestamp

func (kgdb *KVInterfaceGDB) GetTimestamp() string

GetTimestamp returns the update timestamp

func (*KVInterfaceGDB) GetVertex

func (kgdb *KVInterfaceGDB) GetVertex(id string, loadProp bool) *gdbi.Vertex

GetVertex loads a vertex given an id. It returns a nil if not found

func (*KVInterfaceGDB) GetVertexChannel

func (kgdb *KVInterfaceGDB) GetVertexChannel(ctx context.Context, ids chan gdbi.ElementLookup, load bool) chan gdbi.ElementLookup

GetVertexChannel is passed a channel of vertex ids and it produces a channel of vertices

func (*KVInterfaceGDB) GetVertexIndexList

func (kgdb *KVInterfaceGDB) GetVertexIndexList() <-chan *gripql.IndexID

GetVertexIndexList lists out all the vertex indices for a graph

func (*KVInterfaceGDB) GetVertexList

func (kgdb *KVInterfaceGDB) GetVertexList(ctx context.Context, loadProp bool) <-chan *gdbi.Vertex

GetVertexList produces a channel of all edges in the graph

func (*KVInterfaceGDB) ListEdgeLabels

func (kgdb *KVInterfaceGDB) ListEdgeLabels() ([]string, error)

ListEdgeLabels returns a list of edge types in the graph

func (*KVInterfaceGDB) ListVertexLabels

func (kgdb *KVInterfaceGDB) ListVertexLabels() ([]string, error)

ListVertexLabels returns a list of vertex types in the graph

func (*KVInterfaceGDB) VertexLabelScan

func (kgdb *KVInterfaceGDB) VertexLabelScan(ctx context.Context, label string) chan string

VertexLabelScan produces a channel of all vertex ids in a graph that match a given label

Jump to

Keyboard shortcuts

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