store

package
v0.0.0-...-0bc4b66 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultWeight is default weight
	DefaultWeight = 1.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddOption

type AddOption func(*AddOptions)

AddOption sets options

type AddOptions

type AddOptions struct {
	Attrs    attrs.Attrs
	Metadata metadata.Metadata
}

AddOptions are store options

func NewAddOptions

func NewAddOptions() AddOptions

NewOptions returns default add options

type DOTEdge

type DOTEdge interface {
	Edge
	// DOTID returns Graphviz DOT ID
	DOTID() string
	// SetDOTID sets Graphviz DOT ID
	SetDOTID(string)
}

DOTEdge is a GraphViz DOT Edge

type DOTGraph

type DOTGraph interface {
	Graph
	// DOTID returns DOT graph ID
	DOTID() string
	// DOTAttributers returns global graph DOT attributes
	DOTAttributers() (graph, node, edge encoding.Attributer)
	// DOT returns Graphviz graph
	DOT() (string, error)
}

DOTGraph returns Graphiz DOT store

type DOTNode

type DOTNode interface {
	Node
	// DOTID returns Graphviz DOT ID
	DOTID() string
	// SetDOTID sets Graphviz DOT ID
	SetDOTID(string)
}

DOTNode is a GraphViz DOT Node

type DOTOption

type DOTOption func(*Options)

DOTOption configures store

type DOTOptions

type DOTOptions struct {
	GraphAttrs attrs.DOT
	NodeAttrs  attrs.DOT
	EdgeAttrs  attrs.DOT
}

DOTOptions are DOT options

type DelOption

type DelOption func(*DelOptions)

DelOption sets options

type DelOptions

type DelOptions struct {
	Attrs    attrs.Attrs
	Metadata metadata.Metadata
}

DelOptions are store options

func NewDelOptions

func NewDelOptions() DelOptions

NewDelOptions returns default del options

type Edge

type Edge interface {
	Entity
	// From returns the from node of the edge
	From() Node
	// To returns the to node of the edge.
	To() Node
	// Weight returns edge weight
	Weight() float64
}

Edge is an edge between two nodes

type Entity

type Entity interface {
	// UID returns unique ID
	UID() string
	// Attrs returns attributes
	Attrs() attrs.Attrs
	// Metadata returns metadata
	Metadata() metadata.Metadata
}

Entity is store entity

type Graph

type Graph interface {
	// Node returns the node with the given ID if it exists
	// in the graph, and nil otherwise.
	Node(id string) (Node, error)
	// Nodes returns all the nodes in the graph.
	Nodes() ([]Node, error)
	// Edges returns all the edges between the nodes vid and uid
	Edges(uid, vid string) ([]Edge, error)
	// Link links two nodes and returns the new edge between them
	// or it returns error if the link couldn't be created.
	Link(Node, Node, LinkOptions) (Edge, error)
	// SubGraph returns a subgraph of the graph starting at Node
	// up to the given depth or it returns error.
	SubGraph(Node, int) (Graph, error)
}

Graph is a graph of API objects

type LinkOption

type LinkOption func(*LinkOptions)

LinkOption sets options

type LinkOptions

type LinkOptions struct {
	Line     bool
	Weight   float64
	Relation string
	Attrs    attrs.Attrs
	Metadata metadata.Metadata
}

LinkOptions are link options

func NewLinkOptions

func NewLinkOptions() LinkOptions

NewLinkOptions returns default link options

type Node

type Node interface {
	Entity
}

Node is a graph node

type Option

type Option func(*Options)

Option configures store

type Options

type Options struct {
	DOTOptions DOTOptions
}

Options are store options

func NewOptions

func NewOptions() Options

type Store

type Store interface {
	Graph
	// Add adds an api.Object to the store and returns it
	Add(api.Object, AddOptions) (Entity, error)
	// Delete deletes an entity from the store
	Delete(Entity, DelOptions) error
	// Query queries the store and returns the results
	Query(*query.Query) ([]Entity, error)
}

Store allows to store and query the graph of API objects

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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