represent

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VTypeNone VType = ""
	ETypeNone EType = ""
)

Variables

View Source
var Identifiers []Identifier

Functions

func FindDataset

func FindDataset(g CoreGraph, envid int, name []string) (id int, success bool)

func FindEnvironment

func FindEnvironment(g CoreGraph, props ps.Map) (envid int, success bool)

func GenerateDot

func GenerateDot(g CoreGraph) []byte

Generates a .dot-format representation of the given CoreGraph, suitable for rendering into output by graphviz (or other utilities).

func GenericMerge

func GenericMerge(old, nu ps.Map) ps.Map

func Identify

func Identify(g CoreGraph, sd SplitData) int

func Qbe

func Qbe(v ...interface{}) edgeFilter

first string is etype, then pairs after that are props

func Qbv

func Qbv(v ...interface{}) vertexFilter

first string is vtype, then pairs after that are props

Types

type CoreGraph

type CoreGraph interface {
	// Merge a message into the graph, returning a pointer to the new graph
	// that contains the resulting updates.
	Merge(msg interpret.Message) CoreGraph

	// Enumerates the outgoing edges from the ego vertex, limiting the result set
	// to those that pass the provided filter (if any).
	OutWith(egoId int, ef EFilter) (es []StandardEdge)

	// Enumerates the incoming edges from the ego vertex, limiting the result set
	// to those that pass the provided filter (if any).
	InWith(egoId int, ef EFilter) (es []StandardEdge)

	// Enumerates the successors (targets of outgoing edges) from the ego vertex,
	// limiting the result set to those that pass the provided edge and vertex
	// filters (if any).
	SuccessorsWith(egoId int, vef VEFilter) (vts []VertexTuple)

	// Enumerates the predecessors (sources of incoming edges) from the ego vertex,
	// limiting the result set to those that pass the provided edge and vertex
	// filters (if any).
	PredecessorsWith(egoId int, vef VEFilter) (vts []VertexTuple)

	// Enumerates the vertices that pass the provided vertex filter (if any).
	VerticesWith(vf VFilter) (vs []VertexTuple)

	// Gets the vertex tuple associated with a given id.
	Get(id int) (VertexTuple, error)

	// Returns the message id for the current version of the graph. The graph's
	// contents are guaranteed to represent the state resulting from a correct
	// in-order interpretation of the messages up to the id, inclusive.
	MsgId() int
}

CoreGraph is the interface provided by pipeviz' main graph object.

It is a persistent/immutable datastructure: only the Merge() method is able to change the graph, but that method returns a pointer to a new graph rather than updating in-place. (These copies typically share structure for efficiency)

All other methods are read-only, and generally provide composable parts that work together to facilitate the creation of larger traversals/queries.

func NewGraph

func NewGraph() CoreGraph

type EFilter

type EFilter interface {
	EType() EType
	EProps() []PropQ
}

type EType

type EType string

A value indicating an edge's type. For now, done as a string.

type EdgeSpec

type EdgeSpec interface {
}

TODO for now, no structure to this. change to queryish form later

type EdgeSpecs

type EdgeSpecs []EdgeSpec

type Identifier

type Identifier interface {
	CanIdentify(data Vertex) bool
	Matches(a Vertex, b Vertex) bool
}

Identifiers represent the logic for identifying specific types of objects that may be contained within the graph, and finding matches between these types of objects

type IdentifierComm

type IdentifierComm struct{}

func (IdentifierComm) CanIdentify

func (i IdentifierComm) CanIdentify(data Vertex) bool

func (IdentifierComm) Matches

func (i IdentifierComm) Matches(a Vertex, b Vertex) bool

type IdentifierCommit

type IdentifierCommit struct{}

func (IdentifierCommit) CanIdentify

func (i IdentifierCommit) CanIdentify(data Vertex) bool

func (IdentifierCommit) Matches

func (i IdentifierCommit) Matches(a Vertex, b Vertex) bool

type IdentifierDataset

type IdentifierDataset struct{}

func (IdentifierDataset) CanIdentify

func (i IdentifierDataset) CanIdentify(data Vertex) bool

func (IdentifierDataset) Matches

func (i IdentifierDataset) Matches(a Vertex, b Vertex) bool

type IdentifierEnvironment

type IdentifierEnvironment struct{}

Identifier for Environments

func (IdentifierEnvironment) CanIdentify

func (i IdentifierEnvironment) CanIdentify(data Vertex) bool

func (IdentifierEnvironment) Matches

func (i IdentifierEnvironment) Matches(a Vertex, b Vertex) bool

type IdentifierLogicState

type IdentifierLogicState struct{}

func (IdentifierLogicState) CanIdentify

func (i IdentifierLogicState) CanIdentify(data Vertex) bool

func (IdentifierLogicState) Matches

func (i IdentifierLogicState) Matches(a Vertex, b Vertex) bool

type IdentifierParentDataset

type IdentifierParentDataset struct{}

func (IdentifierParentDataset) CanIdentify

func (i IdentifierParentDataset) CanIdentify(data Vertex) bool

func (IdentifierParentDataset) Matches

func (i IdentifierParentDataset) Matches(a Vertex, b Vertex) bool

type IdentifierProcess

type IdentifierProcess struct{}

func (IdentifierProcess) CanIdentify

func (i IdentifierProcess) CanIdentify(data Vertex) bool

func (IdentifierProcess) Matches

func (i IdentifierProcess) Matches(a Vertex, b Vertex) bool

type IdentifierTestResult

type IdentifierTestResult struct{}

func (IdentifierTestResult) CanIdentify

func (i IdentifierTestResult) CanIdentify(data Vertex) bool

func (IdentifierTestResult) Matches

func (i IdentifierTestResult) Matches(a Vertex, b Vertex) bool

type IdentifierVcsLabel

type IdentifierVcsLabel struct{}

func (IdentifierVcsLabel) CanIdentify

func (i IdentifierVcsLabel) CanIdentify(data Vertex) bool

func (IdentifierVcsLabel) Matches

func (i IdentifierVcsLabel) Matches(a Vertex, b Vertex) bool

type PropQ

type PropQ struct {
	K string
	V interface{}
}

Used in queries to specify property k/v pairs.

type Property

type Property struct {
	MsgSrc int         `json:"msgsrc"`
	Value  interface{} `json:"value"`
}

type SpecCommit

type SpecCommit struct {
	Sha1 interpret.Sha1
}

type SpecDatasetHierarchy

type SpecDatasetHierarchy struct {
	NamePath []string // path through the series of names that arrives at the final dataset
}

type SpecLocalLogic

type SpecLocalLogic struct {
	Path string
}

type SpecNetListener

type SpecNetListener struct {
	Port  int
	Proto string
}

type SpecParentDataset

type SpecParentDataset struct {
	Name string
}

type SpecUnixDomainListener

type SpecUnixDomainListener struct {
	Path string
}

type SplitData

type SplitData struct {
	Vertex    Vertex
	EdgeSpecs EdgeSpecs
}

func Split

func Split(d interface{}, id int) ([]SplitData, error)

TODO hardcoded for now, till code generation

type Splitter

type Splitter func(data interface{}, id int) ([]SplitData, error)

TODO unused until plugging/codegen

type StandardEdge

type StandardEdge struct {
	Source int
	Target int
	EType  EType
	// TODO do these *actually* need to be persistent structures?
	Props ps.Map
	// contains filtered or unexported fields
}

func Resolve

func Resolve(g CoreGraph, mid int, src VertexTuple, d EdgeSpec) (StandardEdge, bool)

Attempts to resolve an EdgeSpec into a real edge. This process has two steps:

1. Finding the target node. 2. Seeing if this edge already exists between source and target.

It is the responsibility of the edge spec's type handler to determine what "if an edge already exists" means, as well as whether to overwrite/merge or duplicate the edge in such a case.

type VEFilter

type VEFilter interface {
	EFilter
	VFilter
}

type VFilter

type VFilter interface {
	VType() VType
	VProps() []PropQ
}

type VType

type VType string

A value indicating a vertex's type. For now, done as a string.

type Vertex

type Vertex interface {
	// Merges another vertex into this vertex. Error is indicated if the
	// dynamic types do not match.
	Merge(Vertex) (Vertex, error)
	// Returns a string representing the object type. Used for namespacing keys, etc.
	// While this is (currently) implemented as a method, its result must be invariant.
	// TODO use string-const generator, other tricks to enforce invariance, compact space use
	Typ() VType
	// Returns a persistent map with the vertex's properties.
	// TODO generate more type-restricted versions of the map?
	Props() ps.Map
}

type VertexTuple

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

func (VertexTuple) Flat

func (vt VertexTuple) Flat() (flat flatVTuple)

flatten the persistent structures in the vtTuple down into conventional ones (typically for easy printing). TODO if this is gonna be exported, it's gotta be cleaned up

func (VertexTuple) Id

func (vt VertexTuple) Id() int

Returns the numeric id of the vertex tuple.

func (VertexTuple) OutEdges

func (vt VertexTuple) OutEdges() []StandardEdge

Returns the out-edges of the vertex tuple.

func (VertexTuple) Vertex

func (vt VertexTuple) Vertex() Vertex

Returns the vertex data of the vertex tuple.

Jump to

Keyboard shortcuts

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