gdbi

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

Documentation

Index

Constants

View Source
const (
	// StateCustom The Pipeline will be emitting custom data structures
	StateCustom = 0
	// StateVertexList The Pipeline will be emitting a list of vertices
	StateVertexList = 1
	// StateEdgeList The Pipeline will be emitting a list of edges
	StateEdgeList = 2
	// StateRawVertexList The Pipeline will be emitting a list of all vertices, if there is an index
	// based filter, you can use skip listening and use that
	StateRawVertexList = 3
	// StateRawEdgeList The Pipeline will be emitting a list of all edges, if there is an index
	// based filter, you can use skip listening and use that
	StateRawEdgeList = 4
)

These consts mark the type of a Pipeline traveler chan

Variables

This section is empty.

Functions

func DualProcessor

func DualProcessor(ctx context.Context, reqChan chan ElementLookup, load bool, loader LoadData, deserializer Deserialize) chan ElementLookup

func LookupBatcher

func LookupBatcher(req chan ElementLookup, batchSize int, timeout time.Duration) chan []ElementLookup

Types

type Aggregate

type Aggregate struct {
	Name  string
	Key   interface{}
	Value float64
}

type BaseTraveler

type BaseTraveler struct {
	Current     *DataElement
	Marks       map[string]*DataElement
	Selections  map[string]*DataElement
	Aggregation *Aggregate
	Count       uint32
	Render      interface{}
	Path        []DataElementID
	Signal      *Signal
}

Traveler is a query element that traverse the graph

func (*BaseTraveler) AddCurrent

func (t *BaseTraveler) AddCurrent(r *DataElement) Traveler

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

func (*BaseTraveler) AddMark

func (t *BaseTraveler) AddMark(label string, r *DataElement) Traveler

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

func (*BaseTraveler) Copy

func (t *BaseTraveler) Copy() Traveler

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

func (BaseTraveler) GetAggregation

func (t BaseTraveler) GetAggregation() *Aggregate

func (*BaseTraveler) GetCount

func (t *BaseTraveler) GetCount() uint32

func (*BaseTraveler) GetCurrent

func (t *BaseTraveler) GetCurrent() *DataElement

GetCurrent get current result value attached to the traveler

func (*BaseTraveler) GetCurrentID

func (t *BaseTraveler) GetCurrentID() string

func (*BaseTraveler) GetMark

func (t *BaseTraveler) GetMark(label string) *DataElement

GetMark gets stored result in travels state using its label

func (*BaseTraveler) GetPath

func (t *BaseTraveler) GetPath() []DataElementID

func (*BaseTraveler) GetRender

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

func (*BaseTraveler) GetSelections

func (t *BaseTraveler) GetSelections() map[string]*DataElement

func (*BaseTraveler) GetSignal

func (tr *BaseTraveler) GetSignal() Signal

func (*BaseTraveler) HasMark

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

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

func (*BaseTraveler) IsNull

func (tr *BaseTraveler) IsNull() bool

func (*BaseTraveler) IsSignal

func (tr *BaseTraveler) IsSignal() bool

func (*BaseTraveler) ListMarks

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

ListMarks returns the list of marks in a travelers statemap

type CompileOptions

type CompileOptions struct {
	//Compile pipeline extension
	PipelineExtension  DataType
	ExtensionMarkTypes map[string]DataType
}

type Compiler

type Compiler interface {
	Compile(stmts []*gripql.GraphStatement, opts *CompileOptions) (Pipeline, error)
}

Compiler takes a gripql query and turns it into an executable pipeline

type CustomProcGen

type CustomProcGen interface {
	GetType() DataType
	GetProcessor(db GraphInterface, ps PipelineState) (Processor, error)
}

type DataElement

type DataElement struct {
	ID       string
	Label    string
	From, To string
	Data     map[string]interface{}
	Loaded   bool
}

DataElement is a single data element

func (*DataElement) ToDict

func (elem *DataElement) ToDict() map[string]interface{}

ToDict converts data element to generic map

func (*DataElement) ToEdge

func (elem *DataElement) ToEdge() *gripql.Edge

ToEdge converts data element to edge

func (*DataElement) ToVertex

func (elem *DataElement) ToVertex() *gripql.Vertex

ToVertex converts data element to vertex

type DataElementID

type DataElementID struct {
	Vertex string
	Edge   string
}

type DataType

type DataType uint8

DataType is a possible output data type

const (
	NoData DataType = iota
	VertexData
	EdgeData
	CountData
	AggregationData
	SelectionData
	RenderData
	PathData
)

DataTypes

func DataTypeString

func DataTypeString(s string) (DataType, error)

DataTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func DataTypeValues

func DataTypeValues() []DataType

DataTypeValues returns all values of the enum

func (DataType) IsADataType

func (i DataType) IsADataType() bool

IsADataType returns "true" if the value is listed in the enum definition. "false" otherwise

func (DataType) String

func (i DataType) String() string

type Deserialize

type Deserialize func(req ElementLookup, data interface{}) ElementLookup

type Edge

type Edge = DataElement

func NewElementFromEdge

func NewElementFromEdge(e *gripql.Edge) *Edge

type ElementLookup

type ElementLookup struct {
	ID     string
	Ref    Traveler
	Vertex *Vertex
	Edge   *Edge
}

ElementLookup request to look up data

func (ElementLookup) IsSignal

func (req ElementLookup) IsSignal() bool

type GraphDB

type GraphDB interface {
	AddGraph(string) error
	DeleteGraph(string) error
	ListGraphs() []string
	Graph(graphID string) (GraphInterface, error)
	BuildSchema(ctx context.Context, graphID string, sampleN uint32, random bool) (*gripql.Graph, error)
	Close() error
}

GraphDB is the base interface for graph databases

type GraphElement

type GraphElement struct {
	Vertex *Vertex
	Edge   *Edge
	Graph  string
}

func NewGraphElement

func NewGraphElement(g *gripql.GraphElement) *GraphElement

type GraphInterface

type GraphInterface interface {
	Compiler() Compiler

	GetTimestamp() string

	GetVertex(key string, load bool) *Vertex
	GetEdge(key string, load bool) *Edge

	AddVertex(vertex []*Vertex) error
	AddEdge(edge []*Edge) error

	BulkAdd(<-chan *GraphElement) error

	DelVertex(key string) error
	DelEdge(key string) error

	VertexLabelScan(ctx context.Context, label string) chan string
	// EdgeLabelScan(ctx context.Context, label string) chan string
	ListVertexLabels() ([]string, error)
	ListEdgeLabels() ([]string, error)

	AddVertexIndex(label string, field string) error
	DeleteVertexIndex(label string, field string) error
	GetVertexIndexList() <-chan *gripql.IndexID

	GetVertexList(ctx context.Context, load bool) <-chan *Vertex
	GetEdgeList(ctx context.Context, load bool) <-chan *Edge

	GetVertexChannel(ctx context.Context, req chan ElementLookup, load bool) chan ElementLookup
	GetOutChannel(ctx context.Context, req chan ElementLookup, load bool, emitNull bool, edgeLabels []string) chan ElementLookup
	GetInChannel(ctx context.Context, req chan ElementLookup, load bool, emitNull bool, edgeLabels []string) chan ElementLookup
	GetOutEdgeChannel(ctx context.Context, req chan ElementLookup, load bool, emitNull bool, edgeLabels []string) chan ElementLookup
	GetInEdgeChannel(ctx context.Context, req chan ElementLookup, load bool, emitNull bool, edgeLabels []string) chan ElementLookup
}

GraphInterface is the base Graph data storage interface, the PipeEngine will be able to run queries on a data system backend that implements this interface

type InPipe

type InPipe <-chan Traveler

InPipe incoming traveler messages

type LoadData

type LoadData func(req ElementLookup, load bool) chan interface{}

type Manager

type Manager interface {
	//Get handle to temporary KeyValue store driver
	GetTempKV() kvi.KVInterface
	Cleanup()
}

Manager is a resource manager that is passed to processors to allow them ] to make resource requests

type OutPipe

type OutPipe chan<- Traveler

OutPipe collects output traveler messages

type Pipeline

type Pipeline interface {
	Graph() GraphInterface
	Processors() []Processor
	DataType() DataType
	MarkTypes() map[string]DataType
}

Pipeline represents a set of processors

type PipelineState

type PipelineState interface {
	GetLastType() DataType
	SetLastType(DataType)
}

type Processor

type Processor interface {
	Process(ctx context.Context, man Manager, in InPipe, out OutPipe) context.Context
}

Processor is the interface for a step in the pipe engine

type RetrievedData

type RetrievedData struct {
	Req  ElementLookup
	Data interface{}
}

type Signal

type Signal struct {
	Dest string
	ID   int
}

type Traveler

type Traveler interface {
	IsSignal() bool
	GetSignal() Signal
	IsNull() bool
	GetCurrent() *DataElement
	GetCurrentID() string
	AddCurrent(r *DataElement) Traveler
	Copy() Traveler
	HasMark(label string) bool
	GetMark(label string) *DataElement
	AddMark(label string, r *DataElement) Traveler
	ListMarks() []string
	GetSelections() map[string]*DataElement
	GetRender() interface{}
	GetPath() []DataElementID
	GetAggregation() *Aggregate
	GetCount() uint32
}

type Vertex

type Vertex = DataElement

func NewElementFromVertex

func NewElementFromVertex(v *gripql.Vertex) *Vertex

func (*Vertex) Validate

func (vertex *Vertex) Validate() error

Validate returns an error if the vertex is invalid

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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