grids

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: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DstEdgeKey

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

DstEdgeKey creates a dest edge index key

func DstEdgeKeyParse

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

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

func DstEdgeKeyPrefix

func DstEdgeKeyPrefix(src, dst, eid uint64) []byte

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

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 uint64) []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 uint64) []byte

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

func EdgeKeyParse

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

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

func EdgeKeyPrefix

func EdgeKeyPrefix(id uint64) []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 GetRawProcessor

func GetRawProcessor(db *Graph, ps gdbi.PipelineState, stmt *gripql.GraphStatement) (gdbi.Processor, error)

func NewCompiler

func NewCompiler(ggraph *Graph) gdbi.Compiler

func NewGraphDB

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

NewKVGraphDB intitalize a new grids graph driver

func SelectPath

func SelectPath(stmts []*gripql.GraphStatement, path []int) []*gripql.GraphStatement

func SrcEdgeKey

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

SrcEdgeKey creates a src edge index key

func SrcEdgeKeyParse

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

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

func SrcEdgeKeyPrefix

func SrcEdgeKeyPrefix(eid, src, dst uint64) []byte

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

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 uint64) []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 uint64) []byte

VertexKey generates the key given a vertexId

func VertexKeyParse

func VertexKeyParse(key []byte) uint64

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

func VertexListPrefix

func VertexListPrefix() []byte

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

Types

type Compiler

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

func (Compiler) Compile

func (comp Compiler) Compile(stmts []*gripql.GraphStatement, opts *gdbi.CompileOptions) (gdbi.Pipeline, error)

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

DeleteGraph deletes `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 GRIDDataElement

type GRIDDataElement struct {
	Gid    uint64
	To     uint64
	From   uint64
	Label  uint64
	Data   map[string]interface{}
	Loaded bool
}

func DataElementToGRID

func DataElementToGRID(d *gdbi.DataElement, g *Graph) (*GRIDDataElement, error)

func (*GRIDDataElement) Copy

func (rd *GRIDDataElement) Copy() *GRIDDataElement

func (*GRIDDataElement) DataElement

func (rd *GRIDDataElement) DataElement(ggraph *Graph) *gdbi.DataElement

func (*GRIDDataElement) EdgeDataElement

func (rd *GRIDDataElement) EdgeDataElement(ggraph *Graph) *gdbi.Edge

func (*GRIDDataElement) VertexDataElement

func (rd *GRIDDataElement) VertexDataElement(ggraph *Graph) *gdbi.Vertex

type GRIDDataElementID

type GRIDDataElementID struct {
	IsVertex bool
	Gid      uint64
}

type GRIDTraveler

type GRIDTraveler struct {
	Graph       *Graph
	Current     *GRIDDataElement
	Marks       map[string]*GRIDDataElement
	Selections  map[string]*GRIDDataElement
	Aggregation *gdbi.Aggregate
	Count       uint32
	Render      interface{}
	Path        []GRIDDataElementID
	Signal      *gdbi.Signal
}

func NewGRIDTraveler

func NewGRIDTraveler(tr gdbi.Traveler, isVertex bool, gg *Graph) *GRIDTraveler

func (*GRIDTraveler) AddCurrent

func (t *GRIDTraveler) AddCurrent(r *gdbi.DataElement) gdbi.Traveler

AddCurrent creates a new copy of the travel with new 'current' value

func (*GRIDTraveler) AddMark

func (t *GRIDTraveler) AddMark(label string, r *gdbi.DataElement) gdbi.Traveler

AddMark adds a result to travels state map using `label` as the name

func (*GRIDTraveler) AddRawCurrent

func (t *GRIDTraveler) AddRawCurrent(r *GRIDDataElement) *GRIDTraveler

func (*GRIDTraveler) Copy

func (t *GRIDTraveler) Copy() gdbi.Traveler

AddCurrent creates a new copy of the travel with new 'current' value

func (*GRIDTraveler) GRIDCopy

func (t *GRIDTraveler) GRIDCopy() *GRIDTraveler

func (GRIDTraveler) GetAggregation

func (t GRIDTraveler) GetAggregation() *gdbi.Aggregate

func (*GRIDTraveler) GetCount

func (t *GRIDTraveler) GetCount() uint32

func (*GRIDTraveler) GetCurrent

func (t *GRIDTraveler) GetCurrent() *gdbi.DataElement

GetCurrent get current result value attached to the traveler

func (*GRIDTraveler) GetCurrentID

func (t *GRIDTraveler) GetCurrentID() string

func (*GRIDTraveler) GetMark

func (t *GRIDTraveler) GetMark(label string) *gdbi.DataElement

GetMark gets stored result in travels state using its label

func (*GRIDTraveler) GetPath

func (t *GRIDTraveler) GetPath() []gdbi.DataElementID

func (*GRIDTraveler) GetRender

func (t *GRIDTraveler) GetRender() interface{}

func (*GRIDTraveler) GetSelections

func (t *GRIDTraveler) GetSelections() map[string]*gdbi.DataElement

func (*GRIDTraveler) GetSignal

func (tr *GRIDTraveler) GetSignal() gdbi.Signal

func (*GRIDTraveler) HasMark

func (t *GRIDTraveler) HasMark(label string) bool

HasMark checks to see if a results is stored in a travelers statemap

func (*GRIDTraveler) IsNull

func (tr *GRIDTraveler) IsNull() bool

func (*GRIDTraveler) IsSignal

func (tr *GRIDTraveler) IsSignal() bool

func (*GRIDTraveler) ListMarks

func (t *GRIDTraveler) ListMarks() []string

ListMarks returns the list of marks in a travelers statemap

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 string, field string) error

AddVertexIndex add index to vertices

func (*Graph) BulkAdd

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

func (*Graph) Close

func (g *Graph) Close() error

Close the connection

func (*Graph) Compiler

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

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

func (*Graph) DelEdge

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

DelEdge deletes edge with id `key`

func (*Graph) DelVertex

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

DelVertex deletes vertex with id `key`

func (*Graph) DeleteVertexIndex

func (ggraph *Graph) DeleteVertexIndex(label string, 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

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

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) RawGetEdgeList

func (ggraph *Graph) RawGetEdgeList(ctx context.Context) <-chan *GRIDDataElement

func (*Graph) RawGetInChannel

func (ggraph *Graph) RawGetInChannel(reqChan chan *RawElementLookup, edgeLabels []string) chan *RawElementLookup

func (*Graph) RawGetInEdgeChannel

func (ggraph *Graph) RawGetInEdgeChannel(reqChan chan *RawElementLookup, edgeLabels []string) chan *RawElementLookup

func (*Graph) RawGetOutChannel

func (ggraph *Graph) RawGetOutChannel(reqChan chan *RawElementLookup, edgeLabels []string) chan *RawElementLookup

func (*Graph) RawGetOutEdgeChannel

func (ggraph *Graph) RawGetOutEdgeChannel(reqChan chan *RawElementLookup, edgeLabels []string) chan *RawElementLookup

func (*Graph) RawGetVertexChannel

func (ggraph *Graph) RawGetVertexChannel(reqChan chan *RawElementLookup) <-chan *RawElementLookup

func (*Graph) RawGetVertexList

func (ggraph *Graph) RawGetVertexList(ctx context.Context) <-chan *GRIDDataElement

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 KeyMap

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

func NewKeyMap

func NewKeyMap(kv *pogreb.DB) *KeyMap

func (*KeyMap) Close

func (km *KeyMap) Close()

func (*KeyMap) DelEdgeKey

func (km *KeyMap) DelEdgeKey(id string) error

DelEdgeKey

func (*KeyMap) DelVertexKey

func (km *KeyMap) DelVertexKey(id string) error

DelVertexKey

func (*KeyMap) GetEdgeID

func (km *KeyMap) GetEdgeID(key uint64) (string, bool)

GetEdgeID gets the GID string for a given edge id uint64

func (*KeyMap) GetEdgeKey

func (km *KeyMap) GetEdgeKey(id string) (uint64, bool)

GetEdgeKey gets the uint64 key for a given GID string

func (*KeyMap) GetEdgeLabel

func (km *KeyMap) GetEdgeLabel(key uint64) uint64

func (*KeyMap) GetLabelID

func (km *KeyMap) GetLabelID(key uint64) (string, bool)

GetLabelID gets the GID for a given uint64 label key

func (*KeyMap) GetLabelKey

func (km *KeyMap) GetLabelKey(id string) (uint64, bool)

func (*KeyMap) GetVertexID

func (km *KeyMap) GetVertexID(key uint64) (string, bool)

GetVertexID

func (*KeyMap) GetVertexKey

func (km *KeyMap) GetVertexKey(id string) (uint64, bool)

func (*KeyMap) GetVertexLabel

func (km *KeyMap) GetVertexLabel(key uint64) uint64

func (*KeyMap) GetsertEdgeKey

func (km *KeyMap) GetsertEdgeKey(id, label string) (uint64, uint64)

GetsertEdgeKey gets or inserts a new uint64 id for a given edge GID string

func (*KeyMap) GetsertLabelKey

func (km *KeyMap) GetsertLabelKey(id string) uint64

GetsertLabelKey gets-or-inserts a new label key uint64 for a given string

func (*KeyMap) GetsertVertexKey

func (km *KeyMap) GetsertVertexKey(id, label string) (uint64, uint64)

GetsertVertexKey : Get or Insert Vertex Key

type PathInEProc

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

func (*PathInEProc) Process

func (r *PathInEProc) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe, out gdbi.OutPipe) context.Context

type PathInEdgeAdjProc

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

func (*PathInEdgeAdjProc) Process

type PathInProc

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

func (*PathInProc) Process

func (r *PathInProc) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe, out gdbi.OutPipe) context.Context

type PathLabelProc

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

func (*PathLabelProc) Process

func (r *PathLabelProc) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe, out gdbi.OutPipe) context.Context

type PathOutEProc

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

func (*PathOutEProc) Process

func (r *PathOutEProc) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe, out gdbi.OutPipe) context.Context

type PathOutEdgeAdjProc

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

PathOutAdjEProc process edge to out

func (*PathOutEdgeAdjProc) Process

type PathOutProc

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

func (*PathOutProc) Process

func (r *PathOutProc) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe, out gdbi.OutPipe) context.Context

type PathVProc

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

func (*PathVProc) Process

func (r *PathVProc) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe, out gdbi.OutPipe) context.Context

type RawElementLookup

type RawElementLookup struct {
	ID      uint64
	Ref     *GRIDTraveler
	Element *GRIDDataElement
}

ElementLookup request to look up data

func (*RawElementLookup) IsSignal

func (rel *RawElementLookup) IsSignal() bool

Jump to

Keyboard shortcuts

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