graph

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheOnlyMode int = iota
	PersistentOnlyMode
	DefaultMode
)

Define the running cache mode, memory and/or persisent

View Source
const (
	SyncMsgType             = "Sync"
	SyncRequestMsgType      = "SyncRequest"
	SyncReplyMsgType        = "SyncReply"
	HostGraphDeletedMsgType = "HostGraphDeleted"
	NodeUpdatedMsgType      = "NodeUpdated"
	NodeDeletedMsgType      = "NodeDeleted"
	NodeAddedMsgType        = "NodeAdded"
	EdgeUpdatedMsgType      = "EdgeUpdated"
	EdgeDeletedMsgType      = "EdgeDeleted"
	EdgeAddedMsgType        = "EdgeAdded"
)

Graph message type

View Source
const (
	// Namespace used for WebSocket message
	Namespace = "Graph"
)

Variables

View Source
var (
	ErrSyncRequestMalFormed = errors.New("SyncRequestMsg malformed")
	ErrSyncMsgMalFormed     = errors.New("SyncMsg/SyncReplyMsg malformed")
)

Graph error message

View Source
var ErrBadConfig = errors.New("elasticsearch : Config file is misconfigured, check elasticsearch key format")

ErrBadConfig elasticsearch configuration file is incorrect

Functions

func NewFilterForEdge added in v0.12.0

func NewFilterForEdge(parent Identifier, child Identifier) *filters.Filter

NewFilterForEdge creates a filter based on parent or child

func NewFilterForMetadata added in v0.12.0

func NewFilterForMetadata(m Metadata) (*filters.Filter, error)

NewFilterForMetadata creates a new filter based on metadata

func NewFilterForTime added in v0.12.0

func NewFilterForTime(t time.Time) *filters.Filter

NewFilterForTime creates a filter including time slice t

func NewFilterForTimeSlice added in v0.12.0

func NewFilterForTimeSlice(t *common.TimeSlice) *filters.Filter

NewFilterForTimeSlice creates a filter based on a time slice between CreatedAt and DeletedAt time.Now() is used as reference if t == nil

func UnmarshalWSMessage

func UnmarshalWSMessage(msg *shttp.WSJSONMessage) (string, interface{}, error)

UnmarshalWSMessage deserialize the websocket message

Types

type CachedBackend added in v0.12.0

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

CachedBackend describes a cache mechanism in memory and/or persistent database

func NewCachedBackend added in v0.12.0

func NewCachedBackend(persistent GraphBackend) (*CachedBackend, error)

NewCachedBackend creates new graph cache mechanism

func (*CachedBackend) EdgeAdded added in v0.12.0

func (c *CachedBackend) EdgeAdded(e *Edge) bool

EdgeAdded add an edge in the cache

func (*CachedBackend) EdgeDeleted added in v0.12.0

func (c *CachedBackend) EdgeDeleted(e *Edge) bool

EdgeDeleted delete an edge in the cache

func (*CachedBackend) GetEdge added in v0.12.0

func (c *CachedBackend) GetEdge(i Identifier, t *common.TimeSlice) []*Edge

GetEdge retrieve an edge within a time slice

func (*CachedBackend) GetEdgeNodes added in v0.12.0

func (c *CachedBackend) GetEdgeNodes(e *Edge, t *common.TimeSlice, parentMetadata, childMetadata Metadata) ([]*Node, []*Node)

GetEdgeNodes retrieve a list of nodes from an edge within a time slice, matching metadata

func (*CachedBackend) GetEdges added in v0.12.0

func (c *CachedBackend) GetEdges(t *common.TimeSlice, m Metadata) []*Edge

GetEdges returns a list of edges with a time slice, matching metadata

func (*CachedBackend) GetNode added in v0.12.0

func (c *CachedBackend) GetNode(i Identifier, t *common.TimeSlice) []*Node

GetNode retrieve a node from the cache within a time slice

func (*CachedBackend) GetNodeEdges added in v0.12.0

func (c *CachedBackend) GetNodeEdges(n *Node, t *common.TimeSlice, m Metadata) (edges []*Edge)

GetNodeEdges retrieve a list of edges from a node within a time slice, matching metadata

func (*CachedBackend) GetNodes added in v0.12.0

func (c *CachedBackend) GetNodes(t *common.TimeSlice, m Metadata) []*Node

GetNodes returns a list of nodes with a time slice, matching metadata

func (*CachedBackend) MetadataUpdated added in v0.12.0

func (c *CachedBackend) MetadataUpdated(i interface{}) bool

MetadataUpdated updates metadata

func (*CachedBackend) NodeAdded added in v0.12.0

func (c *CachedBackend) NodeAdded(n *Node) bool

NodeAdded same the node in the cache

func (*CachedBackend) NodeDeleted added in v0.12.0

func (c *CachedBackend) NodeDeleted(n *Node) bool

NodeDeleted Delete the node in the cache

func (*CachedBackend) SetMode added in v0.12.0

func (c *CachedBackend) SetMode(mode int)

SetMode set cache mode

func (*CachedBackend) WithContext added in v0.12.0

func (c *CachedBackend) WithContext(graph *Graph, context GraphContext) (*Graph, error)

WithContext returns a graph matching the context, usually within time slice

type DefaultGraphListener added in v0.3.0

type DefaultGraphListener struct {
}

DefaultGraphListener default implementation of a graph listener, can be used when not implementing the whole set of callbacks

func (*DefaultGraphListener) OnEdgeAdded added in v0.3.0

func (c *DefaultGraphListener) OnEdgeAdded(e *Edge)

OnEdgeAdded event

func (*DefaultGraphListener) OnEdgeDeleted added in v0.3.0

func (c *DefaultGraphListener) OnEdgeDeleted(e *Edge)

OnEdgeDeleted event

func (*DefaultGraphListener) OnEdgeUpdated added in v0.3.0

func (c *DefaultGraphListener) OnEdgeUpdated(e *Edge)

OnEdgeUpdated event

func (*DefaultGraphListener) OnNodeAdded added in v0.3.0

func (c *DefaultGraphListener) OnNodeAdded(n *Node)

OnNodeAdded event

func (*DefaultGraphListener) OnNodeDeleted added in v0.3.0

func (c *DefaultGraphListener) OnNodeDeleted(n *Node)

OnNodeDeleted event

func (*DefaultGraphListener) OnNodeUpdated added in v0.3.0

func (c *DefaultGraphListener) OnNodeUpdated(n *Node)

OnNodeUpdated event

type Edge

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

Edge of the graph linked by a parent and a child

func (*Edge) Decode added in v0.5.0

func (e *Edge) Decode(i interface{}) error

Decode deserialize the current edge

func (*Edge) GetChild added in v0.5.0

func (e *Edge) GetChild() Identifier

GetChild returns child

func (*Edge) GetField added in v0.12.0

func (e *Edge) GetField(name string) (interface{}, error)

func (*Edge) GetFieldInt64 added in v0.12.0

func (e *Edge) GetFieldInt64(field string) (_ int64, err error)

func (*Edge) GetFieldString added in v0.12.0

func (e *Edge) GetFieldString(name string) (string, error)

GetFieldString returns the associated Field name

func (*Edge) GetFieldStringList added in v0.12.0

func (e *Edge) GetFieldStringList(name string) ([]string, error)

func (*Edge) GetParent added in v0.5.0

func (e *Edge) GetParent() Identifier

GetParent returns parent

func (*Edge) Host added in v0.5.0

func (e *Edge) Host() string

func (*Edge) JSONRawMessage added in v0.12.0

func (e *Edge) JSONRawMessage() *json.RawMessage

JSONRawMessage creates a JSON raw message

func (*Edge) MarshalJSON

func (e *Edge) MarshalJSON() ([]byte, error)

MarshalJSON serialize in JSON

func (*Edge) MatchMetadata added in v0.5.0

func (e *Edge) MatchMetadata(f Metadata) bool

func (*Edge) Metadata added in v0.3.0

func (e *Edge) Metadata() Metadata

Metadata returns a copy in order to avoid direct modification of metadata leading in loosing notification.

func (*Edge) String

func (e *Edge) String() string

type ElasticSearchBackend added in v0.9.0

type ElasticSearchBackend struct {
	GraphBackend
	// contains filtered or unexported fields
}

ElasticSearchBackend describes a presisent backend based on ElasticSearch

func NewElasticSearchBackend added in v0.9.0

func NewElasticSearchBackend(addr string, port string, maxConns int, retrySeconds int, bulkMaxDocs int, bulkMaxDelay int) (*ElasticSearchBackend, error)

NewElasticSearchBackend creates a new graph backend and connect to an ElasticSearch database

func NewElasticSearchBackendFromConfig added in v0.9.0

func NewElasticSearchBackendFromConfig() (*ElasticSearchBackend, error)

NewElasticSearchBackendFromConfig creates a new graph backend based on configuration file parameters

func (*ElasticSearchBackend) EdgeAdded added in v0.12.0

func (b *ElasticSearchBackend) EdgeAdded(e *Edge) bool

EdgeAdded add an edge in the database

func (*ElasticSearchBackend) EdgeDeleted added in v0.12.0

func (b *ElasticSearchBackend) EdgeDeleted(e *Edge) bool

EdgeDeleted delete an edge in the database

func (*ElasticSearchBackend) GetEdge added in v0.9.0

func (b *ElasticSearchBackend) GetEdge(i Identifier, t *common.TimeSlice) []*Edge

GetEdge get an edge within a time slice

func (*ElasticSearchBackend) GetEdgeNodes added in v0.9.0

func (b *ElasticSearchBackend) GetEdgeNodes(e *Edge, t *common.TimeSlice, parentMetadata, childMetadata Metadata) (parents []*Node, children []*Node)

GetEdgeNodes returns the parents and child nodes of an edge within time slice, matching metadatas

func (*ElasticSearchBackend) GetEdges added in v0.9.0

func (b *ElasticSearchBackend) GetEdges(t *common.TimeSlice, m Metadata) []*Edge

GetEdges returns a list of edges within time slice, matching metadata

func (*ElasticSearchBackend) GetNode added in v0.9.0

func (b *ElasticSearchBackend) GetNode(i Identifier, t *common.TimeSlice) []*Node

GetNode get a node within a time slice

func (*ElasticSearchBackend) GetNodeEdges added in v0.9.0

func (b *ElasticSearchBackend) GetNodeEdges(n *Node, t *common.TimeSlice, m Metadata) (edges []*Edge)

GetNodeEdges returns a list of a node edges within time slice

func (*ElasticSearchBackend) GetNodes added in v0.9.0

func (b *ElasticSearchBackend) GetNodes(t *common.TimeSlice, m Metadata) []*Node

GetNodes returns a list of nodes within time slice, matching metadata

func (*ElasticSearchBackend) MetadataUpdated added in v0.12.0

func (b *ElasticSearchBackend) MetadataUpdated(i interface{}) bool

MetadataUpdated updates a node metadata in the database

func (*ElasticSearchBackend) NodeAdded added in v0.12.0

func (b *ElasticSearchBackend) NodeAdded(n *Node) bool

NodeAdded add a node

func (*ElasticSearchBackend) NodeDeleted added in v0.12.0

func (b *ElasticSearchBackend) NodeDeleted(n *Node) bool

NodeDeleted delete a node

func (*ElasticSearchBackend) Query added in v0.12.0

func (b *ElasticSearchBackend) Query(obj string, tsq *TimedSearchQuery) (sr elastigo.SearchResult, _ error)

Query the database for a "node" or "edge"

func (*ElasticSearchBackend) SearchEdges added in v0.12.0

func (b *ElasticSearchBackend) SearchEdges(tsq *TimedSearchQuery) (edges []*Edge)

SearchEdges search edges matching the query

func (*ElasticSearchBackend) SearchNodes added in v0.12.0

func (b *ElasticSearchBackend) SearchNodes(tsq *TimedSearchQuery) (nodes []*Node)

SearchNodes search nodes matching the query

func (*ElasticSearchBackend) WithContext added in v0.9.0

func (b *ElasticSearchBackend) WithContext(graph *Graph, context GraphContext) (*Graph, error)

WithContext step

type Graph

type Graph struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Graph describes the graph object based on events and context mechanism An associated backend is used as storage

func NewGraph

func NewGraph(host string, backend GraphBackend) *Graph

NewGraph creates a new graph based on the backend

func NewGraphFromConfig added in v0.5.0

func NewGraphFromConfig(backend GraphBackend) *Graph

NewGraphFromConfig creates a new graph based on configuration

func NewGraphWithContext added in v0.5.0

func NewGraphWithContext(hostID string, backend GraphBackend, context GraphContext) (*Graph, error)

NewGraphWithContext creates a new graph based on backedn within the context

func (*Graph) AddEdge

func (g *Graph) AddEdge(e *Edge) bool

AddEdge in the graph

func (*Graph) AddEventListener

func (g *Graph) AddEventListener(l GraphEventListener)

AddEventListener subscibe a new graph listener

func (*Graph) AddMetadata added in v0.3.0

func (g *Graph) AddMetadata(i interface{}, k string, v interface{}) bool

AddMetadata add a metadata to an associated edge or node

func (*Graph) AddNode

func (g *Graph) AddNode(n *Node) bool

AddNode in the graph

func (*Graph) AreLinked

func (g *Graph) AreLinked(n1 *Node, n2 *Node, m Metadata) bool

AreLinked returns true if nodes n1, n2 are linked

func (*Graph) DelEdge

func (g *Graph) DelEdge(e *Edge) bool

DelEdge delete an edge

func (*Graph) DelHostGraph added in v0.9.0

func (g *Graph) DelHostGraph(host string)

DelHostGraph delete the associated node with the hostname host

func (*Graph) DelMetadata added in v0.12.0

func (g *Graph) DelMetadata(i interface{}, k string) bool

DelMetadata delete a metadata to an associated edge or node

func (*Graph) DelNode

func (g *Graph) DelNode(n *Node) bool

DelNode delete the node n in the graph

func (*Graph) EdgeAdded added in v0.12.0

func (g *Graph) EdgeAdded(e *Edge) bool

EdgeAdded add an edge

func (*Graph) EdgeDeleted added in v0.12.0

func (g *Graph) EdgeDeleted(e *Edge)

EdgeDeleted event

func (*Graph) EdgeUpdated added in v0.12.0

func (g *Graph) EdgeUpdated(e *Edge) bool

EdgeUpdated updates an edge

func (*Graph) GetContext added in v0.5.0

func (g *Graph) GetContext() GraphContext

GetContext returns the current context

func (*Graph) GetEdge

func (g *Graph) GetEdge(i Identifier) *Edge

GetEdge with Identifier i

func (*Graph) GetEdgeNodes added in v0.3.0

func (g *Graph) GetEdgeNodes(e *Edge, parentMetadata, childMetadata Metadata) ([]*Node, []*Node)

GetEdgeNodes returns a list of nodes of an edge

func (*Graph) GetEdges

func (g *Graph) GetEdges(m Metadata) []*Edge

GetEdges returns a list of edges

func (*Graph) GetHost added in v0.12.0

func (g *Graph) GetHost() string

GetHost returns the graph host

func (*Graph) GetNode

func (g *Graph) GetNode(i Identifier) *Node

GetNode from Identifier

func (*Graph) GetNodeEdges added in v0.5.0

func (g *Graph) GetNodeEdges(n *Node, m Metadata) []*Edge

GetNodeEdges returns a list of edges of a node

func (*Graph) GetNodes

func (g *Graph) GetNodes(m Metadata) []*Node

GetNodes returns a list of nodes

func (g *Graph) Link(n1 *Node, n2 *Node, m Metadata) *Edge

Link the nodes n1, n2 with a new edge

func (*Graph) LookupChildren

func (g *Graph) LookupChildren(n *Node, f Metadata, em Metadata) (nodes []*Node)

LookupChildren returns a list of children nodes

func (*Graph) LookupFirstChild added in v0.3.0

func (g *Graph) LookupFirstChild(n *Node, f Metadata) *Node

LookupFirstChild returns the child

func (*Graph) LookupFirstNode

func (g *Graph) LookupFirstNode(m Metadata) *Node

LookupFirstNode returns the fist node matching metadata

func (*Graph) LookupParents added in v0.9.0

func (g *Graph) LookupParents(n *Node, f Metadata, em Metadata) (nodes []*Node)

LookupParents returns the associated parents edge of a node

func (*Graph) LookupShortestPath added in v0.3.0

func (g *Graph) LookupShortestPath(n *Node, m Metadata, em Metadata) []*Node

LookupShortestPath returns the shortest path (list of node)

func (*Graph) MarshalJSON

func (g *Graph) MarshalJSON() ([]byte, error)

MarshalJSON serialize the graph in JSON

func (*Graph) NewEdge

func (g *Graph) NewEdge(i Identifier, p *Node, c *Node, m Metadata) *Edge

NewEdge creates a new edge in the graph based on Identifier, parent, child nodes and metadata

func (*Graph) NewNode

func (g *Graph) NewNode(i Identifier, m Metadata, h ...string) *Node

NewNode creates a new node in the graph with attached metadata

func (*Graph) NodeAdded added in v0.12.0

func (g *Graph) NodeAdded(n *Node) bool

NodeAdded in the graph

func (*Graph) NodeDeleted added in v0.12.0

func (g *Graph) NodeDeleted(n *Node)

NodeDeleted event

func (*Graph) NodeUpdated added in v0.12.0

func (g *Graph) NodeUpdated(n *Node) bool

NodeUpdated updates a node

func (*Graph) RemoveEventListener added in v0.3.0

func (g *Graph) RemoveEventListener(l GraphEventListener)

RemoveEventListener unsubscribe a graph listener

func (*Graph) SetMetadata

func (g *Graph) SetMetadata(i interface{}, m Metadata) bool

SetMetadata associate metadata to an edge or node

func (*Graph) StartMetadataTransaction added in v0.3.0

func (g *Graph) StartMetadataTransaction(i interface{}) *MetadataTransaction

StartMetadataTransaction start a new transaction

func (*Graph) String

func (g *Graph) String() string
func (g *Graph) Unlink(n1 *Node, n2 *Node)

Unlink the nodes n1, n2 ; delete the associated edge

func (*Graph) WithContext added in v0.5.0

func (g *Graph) WithContext(c GraphContext) (*Graph, error)

WithContext select a graph within a context

type GraphBackend

type GraphBackend interface {
	NodeAdded(n *Node) bool
	NodeDeleted(n *Node) bool
	GetNode(i Identifier, at *common.TimeSlice) []*Node
	GetNodeEdges(n *Node, at *common.TimeSlice, m Metadata) []*Edge

	EdgeAdded(e *Edge) bool
	EdgeDeleted(e *Edge) bool
	GetEdge(i Identifier, at *common.TimeSlice) []*Edge
	GetEdgeNodes(e *Edge, at *common.TimeSlice, parentMetadata, childMetadata Metadata) ([]*Node, []*Node)

	MetadataUpdated(e interface{}) bool

	GetNodes(t *common.TimeSlice, m Metadata) []*Node
	GetEdges(t *common.TimeSlice, m Metadata) []*Edge

	WithContext(graph *Graph, context GraphContext) (*Graph, error)
}

GraphBackend interface mechanism used as storage

func BackendFromConfig

func BackendFromConfig() (backend GraphBackend, err error)

BackendFromConfig creates a new graph backend based on configuration memory, orientdb, elasticsearch backend are supported

type GraphContext added in v0.5.0

type GraphContext struct {
	TimeSlice *common.TimeSlice
}

GraphContext describes within time slice

type GraphEventListener

type GraphEventListener interface {
	OnNodeUpdated(n *Node)
	OnNodeAdded(n *Node)
	OnNodeDeleted(n *Node)
	OnEdgeUpdated(e *Edge)
	OnEdgeAdded(e *Edge)
	OnEdgeDeleted(e *Edge)
}

GraphEventListener describes the graph events interface mechanism

type HostNodeTIDMap added in v0.9.0

type HostNodeTIDMap map[string][]string

HostNodeTIDMap a map of host and node ID

func BuildHostNodeTIDMap added in v0.9.0

func BuildHostNodeTIDMap(nodes []*Node) HostNodeTIDMap

BuildHostNodeTIDMap creates a map filled with host and associated node.ID

type Identifier

type Identifier string

Identifier graph ID

func GenID

func GenID() Identifier

GenID helper generate a node Identifier

type InterfaceMetric added in v0.12.0

type InterfaceMetric struct {
	RxPackets         int64
	TxPackets         int64
	RxBytes           int64
	TxBytes           int64
	RxErrors          int64
	TxErrors          int64
	RxDropped         int64
	TxDropped         int64
	Multicast         int64
	Collisions        int64
	RxLengthErrors    int64
	RxOverErrors      int64
	RxCrcErrors       int64
	RxFrameErrors     int64
	RxFifoErrors      int64
	RxMissedErrors    int64
	TxAbortedErrors   int64
	TxCarrierErrors   int64
	TxFifoErrors      int64
	TxHeartbeatErrors int64
	TxWindowErrors    int64
	RxCompressed      int64
	TxCompressed      int64
}

InterfaceMetric the interface packets counters

func (*InterfaceMetric) Add added in v0.12.0

Add do a sum operation on interface metric

func (*InterfaceMetric) GetFieldInt64 added in v0.12.0

func (im *InterfaceMetric) GetFieldInt64(field string) (int64, error)

GetFieldInt64 returns field by name

type MemoryBackend

type MemoryBackend struct {
	GraphBackend
	// contains filtered or unexported fields
}

MemoryBackend describes the memory backend

func NewMemoryBackend

func NewMemoryBackend() (*MemoryBackend, error)

NewMemoryBackend creates a new graph memory backend

func (*MemoryBackend) EdgeAdded added in v0.12.0

func (m *MemoryBackend) EdgeAdded(e *Edge) bool

EdgeAdded event add an edge in the memory backend

func (*MemoryBackend) EdgeDeleted added in v0.12.0

func (m *MemoryBackend) EdgeDeleted(e *Edge) bool

EdgeDeleted in the graph backend

func (*MemoryBackend) GetEdge

func (m *MemoryBackend) GetEdge(i Identifier, t *common.TimeSlice) []*Edge

GetEdge in the graph backend

func (*MemoryBackend) GetEdgeNodes

func (m *MemoryBackend) GetEdgeNodes(e *Edge, t *common.TimeSlice, parentMetadata, childMetadata Metadata) ([]*Node, []*Node)

GetEdgeNodes returns a list of nodes of an edge

func (MemoryBackend) GetEdges

func (m MemoryBackend) GetEdges(t *common.TimeSlice, metadata Metadata) (edges []*Edge)

GetEdges from the graph backend

func (*MemoryBackend) GetNode

func (m *MemoryBackend) GetNode(i Identifier, t *common.TimeSlice) []*Node

GetNode from the graph backend

func (*MemoryBackend) GetNodeEdges

func (m *MemoryBackend) GetNodeEdges(n *Node, t *common.TimeSlice, meta Metadata) []*Edge

GetNodeEdges returns a list of edges of a node

func (MemoryBackend) GetNodes

func (m MemoryBackend) GetNodes(t *common.TimeSlice, metadata Metadata) (nodes []*Node)

GetNodes from the graph backend

func (*MemoryBackend) MetadataUpdated added in v0.12.0

func (m *MemoryBackend) MetadataUpdated(i interface{}) bool

MetadataUpdated returns true

func (*MemoryBackend) NodeAdded added in v0.12.0

func (m *MemoryBackend) NodeAdded(n *Node) bool

NodeAdded in the graph backend

func (*MemoryBackend) NodeDeleted added in v0.12.0

func (m *MemoryBackend) NodeDeleted(n *Node) (removed bool)

NodeDeleted in the graph backend

func (*MemoryBackend) WithContext added in v0.9.0

func (m *MemoryBackend) WithContext(graph *Graph, context GraphContext) (*Graph, error)

WithContext returns a graph based on context

type MemoryBackendEdge

type MemoryBackendEdge struct {
	*Edge
}

MemoryBackendEdge a memory backend edge

func (MemoryBackendEdge) GetField added in v0.12.0

func (e MemoryBackendEdge) GetField(name string) (interface{}, error)

func (MemoryBackendEdge) GetFieldInt64 added in v0.12.0

func (e MemoryBackendEdge) GetFieldInt64(field string) (_ int64, err error)

func (MemoryBackendEdge) GetFieldStringList added in v0.12.0

func (e MemoryBackendEdge) GetFieldStringList(name string) ([]string, error)

func (MemoryBackendEdge) Host added in v0.5.0

func (e MemoryBackendEdge) Host() string

func (MemoryBackendEdge) MatchMetadata added in v0.5.0

func (e MemoryBackendEdge) MatchMetadata(f Metadata) bool

func (MemoryBackendEdge) Metadata added in v0.3.0

func (e MemoryBackendEdge) Metadata() Metadata

Metadata returns a copy in order to avoid direct modification of metadata leading in loosing notification.

type MemoryBackendNode

type MemoryBackendNode struct {
	*Node
	// contains filtered or unexported fields
}

MemoryBackendNode a memory backend node

func (MemoryBackendNode) GetField added in v0.12.0

func (e MemoryBackendNode) GetField(name string) (interface{}, error)

func (MemoryBackendNode) GetFieldInt64 added in v0.12.0

func (e MemoryBackendNode) GetFieldInt64(field string) (_ int64, err error)

func (MemoryBackendNode) GetFieldString added in v0.12.0

func (e MemoryBackendNode) GetFieldString(field string) (_ string, err error)

func (MemoryBackendNode) GetFieldStringList added in v0.12.0

func (e MemoryBackendNode) GetFieldStringList(name string) ([]string, error)

func (MemoryBackendNode) Host added in v0.5.0

func (e MemoryBackendNode) Host() string

func (MemoryBackendNode) MatchMetadata added in v0.5.0

func (e MemoryBackendNode) MatchMetadata(f Metadata) bool

func (MemoryBackendNode) Metadata added in v0.3.0

func (e MemoryBackendNode) Metadata() Metadata

Metadata returns a copy in order to avoid direct modification of metadata leading in loosing notification.

type Metadata added in v0.3.0

type Metadata map[string]interface{}

Metadata describes the graph node metadata type

func (Metadata) Clone added in v0.12.0

func (m Metadata) Clone() Metadata

Clone a metadata

func (*Metadata) String added in v0.3.0

func (m *Metadata) String() string

type MetadataTransaction added in v0.3.0

type MetadataTransaction struct {
	Metadata Metadata
	// contains filtered or unexported fields
}

MetadataTransaction describes a metadata(s) transaction in the graph

func (*MetadataTransaction) AddMetadata added in v0.3.0

func (t *MetadataTransaction) AddMetadata(k string, v interface{})

AddMetadata in the current transaction

func (*MetadataTransaction) Commit added in v0.3.0

func (t *MetadataTransaction) Commit()

Commit the current transaction to the graph

type Node

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

Node of the graph

func (*Node) Decode added in v0.5.0

func (n *Node) Decode(i interface{}) error

Decode deserialize the node

func (*Node) GetField added in v0.12.0

func (e *Node) GetField(name string) (interface{}, error)

func (*Node) GetFieldInt64 added in v0.12.0

func (e *Node) GetFieldInt64(field string) (_ int64, err error)

func (*Node) GetFieldString added in v0.12.0

func (e *Node) GetFieldString(field string) (_ string, err error)

func (*Node) GetFieldStringList added in v0.12.0

func (e *Node) GetFieldStringList(name string) ([]string, error)

func (*Node) Host added in v0.5.0

func (e *Node) Host() string

func (*Node) JSONRawMessage added in v0.12.0

func (n *Node) JSONRawMessage() *json.RawMessage

JSONRawMessage creates JSON raw message

func (*Node) MarshalJSON

func (n *Node) MarshalJSON() ([]byte, error)

MarshalJSON serialize in JSON

func (*Node) MatchMetadata added in v0.5.0

func (e *Node) MatchMetadata(f Metadata) bool

func (*Node) Metadata added in v0.3.0

func (e *Node) Metadata() Metadata

Metadata returns a copy in order to avoid direct modification of metadata leading in loosing notification.

func (*Node) String

func (n *Node) String() string

type OrientDBBackend added in v0.5.0

type OrientDBBackend struct {
	GraphBackend
	// contains filtered or unexported fields
}

OrientDBBackend describes an OrientDB backend

func NewOrientDBBackend added in v0.5.0

func NewOrientDBBackend(addr string, database string, username string, password string) (*OrientDBBackend, error)

NewOrientDBBackend creates a new graph backend and connect to an OrientDB instance

func NewOrientDBBackendFromConfig added in v0.5.0

func NewOrientDBBackendFromConfig() (*OrientDBBackend, error)

NewOrientDBBackendFromConfig creates a new OrientDB database client based on configuration

func (*OrientDBBackend) EdgeAdded added in v0.12.0

func (o *OrientDBBackend) EdgeAdded(e *Edge) bool

EdgeAdded add a node in the database

func (*OrientDBBackend) EdgeDeleted added in v0.12.0

func (o *OrientDBBackend) EdgeDeleted(e *Edge) bool

EdgeDeleted delete a node in the database

func (*OrientDBBackend) GetEdge added in v0.5.0

func (o *OrientDBBackend) GetEdge(i Identifier, t *common.TimeSlice) (edges []*Edge)

GetEdge get an edge within a time slice

func (*OrientDBBackend) GetEdgeNodes added in v0.5.0

func (o *OrientDBBackend) GetEdgeNodes(e *Edge, t *common.TimeSlice, parentMetadata, childMetadata Metadata) (parents []*Node, children []*Node)

GetEdgeNodes returns the parents and child nodes of an edge within time slice, matching metadata

func (*OrientDBBackend) GetEdges added in v0.5.0

func (o *OrientDBBackend) GetEdges(t *common.TimeSlice, m Metadata) (edges []*Edge)

GetEdges returns a list of edges within time slice, matching metadata

func (*OrientDBBackend) GetNode added in v0.5.0

func (o *OrientDBBackend) GetNode(i Identifier, t *common.TimeSlice) (nodes []*Node)

GetNode get a node within a time slice

func (*OrientDBBackend) GetNodeEdges added in v0.5.0

func (o *OrientDBBackend) GetNodeEdges(n *Node, t *common.TimeSlice, m Metadata) (edges []*Edge)

GetNodeEdges returns a list of a node edges within time slice

func (*OrientDBBackend) GetNodes added in v0.5.0

func (o *OrientDBBackend) GetNodes(t *common.TimeSlice, m Metadata) (nodes []*Node)

GetNodes returns a list of nodes within time slice, matching metadata

func (*OrientDBBackend) MetadataUpdated added in v0.12.0

func (o *OrientDBBackend) MetadataUpdated(i interface{}) bool

MetadataUpdated returns true if a metadata has been updated in the database, based on ArchivedAt

func (*OrientDBBackend) NodeAdded added in v0.12.0

func (o *OrientDBBackend) NodeAdded(n *Node) bool

NodeAdded add a node in the database

func (*OrientDBBackend) NodeDeleted added in v0.12.0

func (o *OrientDBBackend) NodeDeleted(n *Node) bool

NodeDeleted delete a node in the database

func (*OrientDBBackend) WithContext added in v0.9.0

func (o *OrientDBBackend) WithContext(graph *Graph, context GraphContext) (*Graph, error)

WithContext step

type SyncMsg added in v0.13.0

type SyncMsg struct {
	Nodes []*Node
	Edges []*Edge
}

SyncMsg describes graph syncho message

type TimedSearchQuery added in v0.12.0

type TimedSearchQuery struct {
	filters.SearchQuery
	TimeFilter     *filters.Filter
	MetadataFilter *filters.Filter
}

TimedSearchQuery describes a search query within a time slice and metadata filters

Source Files

  • cachedbackend.go
  • elasticsearch.go
  • filters.go
  • graph.go
  • memory.go
  • message.go
  • metrics.go
  • orientdb.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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