grids

package
v0.0.0-...-93cb1e8 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VTABLE_PREFIX = "v_"
	ETABLE_PREFIX = "e_"
)

Variables

This section is empty.

Functions

func AddSpecialFields

func AddSpecialFields(v *gdbi.Vertex) any

func DstEdgeKey

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

DstEdgeKey creates a dest edge index key

func DstEdgeKeyParse

func DstEdgeKeyParse(key []byte) (eid string, sid string, did string, label string)

func DstEdgeListPrefix

func DstEdgeListPrefix() []byte

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

func DstEdgePrefix

func DstEdgePrefix(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(id, src, dst, label string) []byte

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

func EdgeKeyParse

func EdgeKeyParse(key []byte) (eid string, sid string, did string, label string)

func EdgeKeyPrefix

func EdgeKeyPrefix(id string) []byte

EdgeKeyPrefix returns the byte array prefix for a particular edge id

func EdgeListPrefix

func EdgeListPrefix() []byte

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

func GridsOptimizer

func GridsOptimizer(pipe []*gripql.GraphStatement) []*gripql.GraphStatement

func MatchesHasExpression

func MatchesHasExpression(val any, stmt *gripql.HasExpression) bool

func NewGraphDB

func NewGraphDB(baseDir string) (gdbi.GraphDB, error)

NewKVGraphDB intitalize a new grids graph driver

func SrcEdgeKey

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

SrcEdgeKey creates a src edge index key

func SrcEdgeKeyParse

func SrcEdgeKeyParse(key []byte) (eid string, sid string, did string, label string)

func SrcEdgeListPrefix

func SrcEdgeListPrefix() []byte

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

func SrcEdgePrefix

func SrcEdgePrefix(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(id string) []byte

VertexKey generates the key given a vertexId

func VertexKeyParse

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

func VertexListPrefix

func VertexListPrefix() []byte

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

Types

type GDB

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

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

func (*GDB) AddGraph

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

AddGraph creates a new graph named `graph`

func (*GDB) BuildSchema

func (ma *GDB) 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 (*GDB) Close

func (kgraph *GDB) Close() error

Close the graphs

func (*GDB) DeleteGraph

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

Since each graph has its own directory, delete the directory to delete the graph

func (*GDB) Graph

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

Graph obtains the gdbi.DBI for a particular graph

func (*GDB) ListGraphs

func (gdb *GDB) ListGraphs() []string

ListGraphs lists the graphs managed by this driver

type Graph

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

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

func (*Graph) AddEdge

func (ggraph *Graph) 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 (*Graph) AddVertex

func (ggraph *Graph) AddVertex(vertices []*gdbi.Vertex) error

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

func (*Graph) AddVertexIndex

func (ggraph *Graph) AddVertexIndex(label, field string) error

AddVertexIndex add index to vertices

func (*Graph) BulkAdd

func (ggraph *Graph) BulkAdd(stream <-chan *gdbi.GraphElement) error

func (*Graph) BulkDel

func (ggraph *Graph) BulkDel(data *gdbi.DeleteData) error

New Bulk Delete Function. Testing... BulkDel deletes vertices and edges in bulk.

func (*Graph) Close

func (g *Graph) Close() error

Close the connection

func (*Graph) Compiler

func (ggraph *Graph) Compiler() gdbi.Compiler

func (*Graph) DelEdge

func (ggraph *Graph) DelEdge(eid string) error

func (*Graph) DelVertex

func (ggraph *Graph) DelVertex(id string) error

func (*Graph) DeleteAnyRow

func (ggraph *Graph) DeleteAnyRow(id string, label string, edgeFlag bool) error

func (*Graph) DeleteVertexIndex

func (ggraph *Graph) DeleteVertexIndex(label, field string) error

DeleteVertexIndex delete index from vertices

func (*Graph) GetEdge

func (ggraph *Graph) GetEdge(id string, loadProp bool) *gdbi.Edge

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

func (*Graph) GetEdgeList

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

GetEdgeList produces a channel of all edges in the graph

func (*Graph) GetInChannel

func (ggraph *Graph) 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 (*Graph) GetInEdgeChannel

func (ggraph *Graph) 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 (*Graph) GetOutChannel

func (ggraph *Graph) 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 (*Graph) GetOutEdgeChannel

func (ggraph *Graph) 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 (*Graph) GetTimestamp

func (ggraph *Graph) GetTimestamp() string

GetTimestamp returns the update timestamp

func (*Graph) GetVertex

func (ggraph *Graph) GetVertex(id string, loadProp bool) *gdbi.Vertex

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

func (*Graph) GetVertexChannel

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

func (*Graph) GetVertexIndexList

func (ggraph *Graph) GetVertexIndexList() <-chan *gripql.IndexID

GetVertexIndexList lists out all the vertex indices for a graph

func (*Graph) GetVertexList

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

GetVertexList produces a channel of all edges in the graph

func (*Graph) ListEdgeLabels

func (ggraph *Graph) ListEdgeLabels() ([]string, error)

ListEdgeLabels returns a list of edge types in the graph

func (*Graph) ListVertexLabels

func (ggraph *Graph) ListVertexLabels() ([]string, error)

ListVertexLabels returns a list of vertex types in the graph

func (*Graph) VertexLabelScan

func (ggraph *Graph) VertexLabelScan(ctx context.Context, label string) chan string

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

type GripQLFilter

type GripQLFilter struct {
	Expression *gripql.HasExpression
}

func (*GripQLFilter) GetFilter

func (f *GripQLFilter) GetFilter() any

func (*GripQLFilter) IsNoOp

func (f *GripQLFilter) IsNoOp() bool

func (*GripQLFilter) Matches

func (f *GripQLFilter) Matches(row any) bool

func (*GripQLFilter) RequiredFields

func (f *GripQLFilter) RequiredFields() []string

type OptimizationRule

type OptimizationRule struct {
	Match   func(pipe []*gripql.GraphStatement) bool
	Replace func(pipe []*gripql.GraphStatement) []*gripql.GraphStatement
}

Jump to

Keyboard shortcuts

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