Documentation
¶
Index ¶
- Constants
- Variables
- func NewFilterForEdge(parent Identifier, child Identifier) *filters.Filter
- func NewFilterForMetadata(m Metadata) (*filters.Filter, error)
- func NewFilterForTime(t time.Time) *filters.Filter
- func NewFilterForTimeSlice(t *common.TimeSlice) *filters.Filter
- func UnmarshalWSMessage(msg shttp.WSMessage) (string, interface{}, error)
- type CachedBackend
- func (c *CachedBackend) EdgeAdded(e *Edge) bool
- func (c *CachedBackend) EdgeDeleted(e *Edge) bool
- func (c *CachedBackend) GetEdge(i Identifier, t *common.TimeSlice) []*Edge
- func (c *CachedBackend) GetEdgeNodes(e *Edge, t *common.TimeSlice, parentMetadata, childMetadata Metadata) ([]*Node, []*Node)
- func (c *CachedBackend) GetEdges(t *common.TimeSlice, m Metadata) []*Edge
- func (c *CachedBackend) GetNode(i Identifier, t *common.TimeSlice) []*Node
- func (c *CachedBackend) GetNodeEdges(n *Node, t *common.TimeSlice, m Metadata) (edges []*Edge)
- func (c *CachedBackend) GetNodes(t *common.TimeSlice, m Metadata) []*Node
- func (c *CachedBackend) MetadataUpdated(i interface{}) bool
- func (c *CachedBackend) NodeAdded(n *Node) bool
- func (c *CachedBackend) NodeDeleted(n *Node) bool
- func (c *CachedBackend) SetMode(mode int)
- func (c *CachedBackend) WithContext(graph *Graph, context GraphContext) (*Graph, error)
- type DefaultGraphListener
- func (c *DefaultGraphListener) OnEdgeAdded(e *Edge)
- func (c *DefaultGraphListener) OnEdgeDeleted(e *Edge)
- func (c *DefaultGraphListener) OnEdgeUpdated(e *Edge)
- func (c *DefaultGraphListener) OnNodeAdded(n *Node)
- func (c *DefaultGraphListener) OnNodeDeleted(n *Node)
- func (c *DefaultGraphListener) OnNodeUpdated(n *Node)
- type Edge
- func (e *Edge) Decode(i interface{}) error
- func (e *Edge) GetChild() Identifier
- func (e *Edge) GetField(name string) (interface{}, error)
- func (e *Edge) GetFieldInt64(field string) (_ int64, err error)
- func (e *Edge) GetFieldString(name string) (string, error)
- func (e *Edge) GetFieldStringList(name string) ([]string, error)
- func (e *Edge) GetParent() Identifier
- func (e *Edge) Host() string
- func (e *Edge) JSONRawMessage() *json.RawMessage
- func (e *Edge) MarshalJSON() ([]byte, error)
- func (e *Edge) MatchMetadata(f Metadata) bool
- func (e *Edge) Metadata() Metadata
- func (e *Edge) String() string
- type ElasticSearchBackend
- func (b *ElasticSearchBackend) EdgeAdded(e *Edge) bool
- func (b *ElasticSearchBackend) EdgeDeleted(e *Edge) bool
- func (b *ElasticSearchBackend) GetEdge(i Identifier, t *common.TimeSlice) []*Edge
- func (b *ElasticSearchBackend) GetEdgeNodes(e *Edge, t *common.TimeSlice, parentMetadata, childMetadata Metadata) (parents []*Node, children []*Node)
- func (b *ElasticSearchBackend) GetEdges(t *common.TimeSlice, m Metadata) []*Edge
- func (b *ElasticSearchBackend) GetNode(i Identifier, t *common.TimeSlice) []*Node
- func (b *ElasticSearchBackend) GetNodeEdges(n *Node, t *common.TimeSlice, m Metadata) (edges []*Edge)
- func (b *ElasticSearchBackend) GetNodes(t *common.TimeSlice, m Metadata) []*Node
- func (b *ElasticSearchBackend) MetadataUpdated(i interface{}) bool
- func (b *ElasticSearchBackend) NodeAdded(n *Node) bool
- func (b *ElasticSearchBackend) NodeDeleted(n *Node) bool
- func (b *ElasticSearchBackend) Query(obj string, tsq *TimedSearchQuery) (sr elastigo.SearchResult, _ error)
- func (b *ElasticSearchBackend) SearchEdges(tsq *TimedSearchQuery) (edges []*Edge)
- func (b *ElasticSearchBackend) SearchNodes(tsq *TimedSearchQuery) (nodes []*Node)
- func (b *ElasticSearchBackend) WithContext(graph *Graph, context GraphContext) (*Graph, error)
- type Graph
- func (g *Graph) AddEdge(e *Edge) bool
- func (g *Graph) AddEventListener(l GraphEventListener)
- func (g *Graph) AddMetadata(i interface{}, k string, v interface{}) bool
- func (g *Graph) AddNode(n *Node) bool
- func (g *Graph) AreLinked(n1 *Node, n2 *Node, m Metadata) bool
- func (g *Graph) DelEdge(e *Edge)
- func (g *Graph) DelHostGraph(host string)
- func (g *Graph) DelMetadata(i interface{}, k string) bool
- func (g *Graph) DelNode(n *Node)
- func (g *Graph) EdgeAdded(e *Edge) bool
- func (g *Graph) EdgeDeleted(e *Edge)
- func (g *Graph) EdgeUpdated(e *Edge) bool
- func (g *Graph) GetContext() GraphContext
- func (g *Graph) GetEdge(i Identifier) *Edge
- func (g *Graph) GetEdgeNodes(e *Edge, parentMetadata, childMetadata Metadata) ([]*Node, []*Node)
- func (g *Graph) GetEdges(m Metadata) []*Edge
- func (g *Graph) GetHost() string
- func (g *Graph) GetNode(i Identifier) *Node
- func (g *Graph) GetNodeEdges(n *Node, m Metadata) []*Edge
- func (g *Graph) GetNodes(m Metadata) []*Node
- func (g *Graph) Link(n1 *Node, n2 *Node, m Metadata) *Edge
- func (g *Graph) LookupChildren(n *Node, f Metadata, em Metadata) (nodes []*Node)
- func (g *Graph) LookupFirstChild(n *Node, f Metadata) *Node
- func (g *Graph) LookupFirstNode(m Metadata) *Node
- func (g *Graph) LookupParents(n *Node, f Metadata, em Metadata) (nodes []*Node)
- func (g *Graph) LookupShortestPath(n *Node, m Metadata, em Metadata) []*Node
- func (g *Graph) MarshalJSON() ([]byte, error)
- func (g *Graph) NewEdge(i Identifier, p *Node, c *Node, m Metadata) *Edge
- func (g *Graph) NewNode(i Identifier, m Metadata, h ...string) *Node
- func (g *Graph) NodeAdded(n *Node) bool
- func (g *Graph) NodeDeleted(n *Node)
- func (g *Graph) NodeUpdated(n *Node) bool
- func (g *Graph) RemoveEventListener(l GraphEventListener)
- func (g *Graph) SetMetadata(i interface{}, m Metadata) bool
- func (g *Graph) StartMetadataTransaction(i interface{}) *MetadataTransaction
- func (g *Graph) String() string
- func (g *Graph) Unlink(n1 *Node, n2 *Node)
- func (g *Graph) WithContext(c GraphContext) (*Graph, error)
- type GraphBackend
- type GraphContext
- type GraphEventListener
- type HostNodeTIDMap
- type Identifier
- type InterfaceMetric
- type MemoryBackend
- func (m *MemoryBackend) EdgeAdded(e *Edge) bool
- func (m *MemoryBackend) EdgeDeleted(e *Edge) bool
- func (m *MemoryBackend) GetEdge(i Identifier, t *common.TimeSlice) []*Edge
- func (m *MemoryBackend) GetEdgeNodes(e *Edge, t *common.TimeSlice, parentMetadata, childMetadata Metadata) ([]*Node, []*Node)
- func (m MemoryBackend) GetEdges(t *common.TimeSlice, metadata Metadata) (edges []*Edge)
- func (m *MemoryBackend) GetNode(i Identifier, t *common.TimeSlice) []*Node
- func (m *MemoryBackend) GetNodeEdges(n *Node, t *common.TimeSlice, meta Metadata) []*Edge
- func (m MemoryBackend) GetNodes(t *common.TimeSlice, metadata Metadata) (nodes []*Node)
- func (m *MemoryBackend) MetadataUpdated(i interface{}) bool
- func (m *MemoryBackend) NodeAdded(n *Node) bool
- func (m *MemoryBackend) NodeDeleted(n *Node) bool
- func (m *MemoryBackend) WithContext(graph *Graph, context GraphContext) (*Graph, error)
- type MemoryBackendEdge
- func (e MemoryBackendEdge) GetField(name string) (interface{}, error)
- func (e MemoryBackendEdge) GetFieldInt64(field string) (_ int64, err error)
- func (e MemoryBackendEdge) GetFieldStringList(name string) ([]string, error)
- func (e MemoryBackendEdge) Host() string
- func (e MemoryBackendEdge) MatchMetadata(f Metadata) bool
- func (e MemoryBackendEdge) Metadata() Metadata
- type MemoryBackendNode
- func (e MemoryBackendNode) GetField(name string) (interface{}, error)
- func (e MemoryBackendNode) GetFieldInt64(field string) (_ int64, err error)
- func (e MemoryBackendNode) GetFieldString(field string) (_ string, err error)
- func (e MemoryBackendNode) GetFieldStringList(name string) ([]string, error)
- func (e MemoryBackendNode) Host() string
- func (e MemoryBackendNode) MatchMetadata(f Metadata) bool
- func (e MemoryBackendNode) Metadata() Metadata
- type Metadata
- type MetadataTransaction
- type Node
- func (n *Node) Decode(i interface{}) error
- func (e *Node) GetField(name string) (interface{}, error)
- func (e *Node) GetFieldInt64(field string) (_ int64, err error)
- func (e *Node) GetFieldString(field string) (_ string, err error)
- func (e *Node) GetFieldStringList(name string) ([]string, error)
- func (e *Node) Host() string
- func (n *Node) JSONRawMessage() *json.RawMessage
- func (n *Node) MarshalJSON() ([]byte, error)
- func (e *Node) MatchMetadata(f Metadata) bool
- func (e *Node) Metadata() Metadata
- func (n *Node) String() string
- type OrientDBBackend
- func (o *OrientDBBackend) EdgeAdded(e *Edge) bool
- func (o *OrientDBBackend) EdgeDeleted(e *Edge) bool
- func (o *OrientDBBackend) GetEdge(i Identifier, t *common.TimeSlice) (edges []*Edge)
- func (o *OrientDBBackend) GetEdgeNodes(e *Edge, t *common.TimeSlice, parentMetadata, childMetadata Metadata) (parents []*Node, children []*Node)
- func (o *OrientDBBackend) GetEdges(t *common.TimeSlice, m Metadata) (edges []*Edge)
- func (o *OrientDBBackend) GetNode(i Identifier, t *common.TimeSlice) (nodes []*Node)
- func (o *OrientDBBackend) GetNodeEdges(n *Node, t *common.TimeSlice, m Metadata) (edges []*Edge)
- func (o *OrientDBBackend) GetNodes(t *common.TimeSlice, m Metadata) (nodes []*Node)
- func (o *OrientDBBackend) MetadataUpdated(i interface{}) bool
- func (o *OrientDBBackend) NodeAdded(n *Node) bool
- func (o *OrientDBBackend) NodeDeleted(n *Node) bool
- func (o *OrientDBBackend) WithContext(graph *Graph, context GraphContext) (*Graph, error)
- type Server
- func (s *Server) AddEventHandler(h ServerEventHandler)
- func (s *Server) OnEdgeAdded(e *Edge)
- func (s *Server) OnEdgeDeleted(e *Edge)
- func (s *Server) OnEdgeUpdated(e *Edge)
- func (s *Server) OnMessage(c *shttp.WSClient, msg shttp.WSMessage)
- func (s *Server) OnNodeAdded(n *Node)
- func (s *Server) OnNodeDeleted(n *Node)
- func (s *Server) OnNodeUpdated(n *Node)
- type ServerEventHandler
- type SyncReplyMsg
- type TimedSearchQuery
Constants ¶
Define the running cache mode, memory and/or persisent
const ( SyncRequestMsgType = "SyncRequest" SyncReplyMsgType = "SyncReply" HostGraphDeletedMsgType = "HostGraphDeleted" NodeUpdatedMsgType = "NodeUpdated" NodeDeletedMsgType = "NodeDeleted" NodeAddedMsgType = "NodeAdded" EdgeUpdatedMsgType = "EdgeUpdated" EdgeDeletedMsgType = "EdgeDeleted" EdgeAddedMsgType = "EdgeAdded" )
Graph message type
const (
Namespace = "Graph"
)
Namespace websocket message : Graph
Variables ¶
var ( ErrSyncRequestMalFormed = errors.New("SyncRequestMsg malformed") ErrSyncReplyMsgMalFormed = errors.New("SyncReplyMsg malformed") )
Graph error message
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
NewFilterForMetadata creates a new filter based on metadata
func NewFilterForTime ¶ added in v0.12.0
NewFilterForTime creates a filter including time slice t
func NewFilterForTimeSlice ¶ added in v0.12.0
NewFilterForTimeSlice creates a filter based on a time slice between CreatedAt and DeletedAt time.Now() is used as reference if t == nil
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
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
Decode deserialize the current edge
func (*Edge) GetFieldInt64 ¶ added in v0.12.0
func (*Edge) GetFieldString ¶ added in v0.12.0
GetFieldString returns the associated Field name
func (*Edge) GetFieldStringList ¶ added in v0.12.0
func (*Edge) GetParent ¶ added in v0.5.0
func (e *Edge) GetParent() Identifier
GetParent returns parent
func (*Edge) JSONRawMessage ¶ added in v0.12.0
func (e *Edge) JSONRawMessage() *json.RawMessage
JSONRawMessage creates a JSON raw message
func (*Edge) MarshalJSON ¶
MarshalJSON serialize in JSON
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 ¶
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) AddEventListener ¶
func (g *Graph) AddEventListener(l GraphEventListener)
AddEventListener subscibe a new graph listener
func (*Graph) AddMetadata ¶ added in v0.3.0
AddMetadata add a metadata to an associated edge or node
func (*Graph) AreLinked ¶
AreLinked returns true if nodes n1, n2 are linked
func (*Graph) DelHostGraph ¶ added in v0.9.0
DelHostGraph delete the associated node with the hostname host
func (*Graph) DelMetadata ¶ added in v0.12.0
DelMetadata delete a metadata to an associated edge or node
func (*Graph) EdgeAdded ¶ added in v0.12.0
EdgeAdded add an edge
func (*Graph) EdgeUpdated ¶ added in v0.12.0
EdgeUpdated updates an edge
func (*Graph) GetContext ¶ added in v0.5.0
func (g *Graph) GetContext() GraphContext
GetContext returns the current context
func (*Graph) GetEdgeNodes ¶ added in v0.3.0
GetEdgeNodes returns a list of nodes of an edge
func (*Graph) GetEdges ¶
GetEdges returns a list of edges
func (*Graph) GetHost ¶ added in v0.12.0
GetHost returns the graph host
func (*Graph) GetNodeEdges ¶ added in v0.5.0
GetNodeEdges returns a list of edges of a node
func (*Graph) GetNodes ¶
GetNodes returns a list of nodes
func (*Graph) Link ¶
Link the nodes n1, n2 with a new edge
func (*Graph) LookupChildren ¶
LookupChildren returns a list of children nodes
func (*Graph) LookupFirstChild ¶ added in v0.3.0
LookupFirstChild returns the child
func (*Graph) LookupFirstNode ¶
LookupFirstNode returns the fist node matching metadata
func (*Graph) LookupParents ¶ added in v0.9.0
LookupParents returns the associated parents edge of a node
func (*Graph) LookupShortestPath ¶ added in v0.3.0
LookupShortestPath returns the shortest path (list of node)
func (*Graph) MarshalJSON ¶
MarshalJSON serialize the graph in JSON
func (*Graph) NewEdge ¶
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
NodeAdded in the graph
func (*Graph) NodeUpdated ¶ added in v0.12.0
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 ¶
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) Unlink ¶
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
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
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 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
func (im *InterfaceMetric) Add(m common.Metric) common.Metric
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 ¶
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) 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 (MemoryBackendEdge) GetFieldInt64 ¶ added in v0.12.0
func (MemoryBackendEdge) GetFieldStringList ¶ added in v0.12.0
func (MemoryBackendEdge) MatchMetadata ¶ added in v0.5.0
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 (MemoryBackendNode) GetFieldInt64 ¶ added in v0.12.0
func (MemoryBackendNode) GetFieldString ¶ added in v0.12.0
func (MemoryBackendNode) GetFieldStringList ¶ added in v0.12.0
func (MemoryBackendNode) MatchMetadata ¶ added in v0.5.0
type Metadata ¶ added in v0.3.0
type Metadata map[string]interface{}
Metadata describes the graph node metadata type
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
Decode deserialize the node
func (*Node) GetFieldInt64 ¶ added in v0.12.0
func (*Node) GetFieldString ¶ added in v0.12.0
func (*Node) GetFieldStringList ¶ added in v0.12.0
func (*Node) JSONRawMessage ¶ added in v0.12.0
func (n *Node) JSONRawMessage() *json.RawMessage
JSONRawMessage creates JSON raw message
func (*Node) MarshalJSON ¶
MarshalJSON serialize in JSON
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
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 Server ¶
type Server struct {
shttp.DefaultWSServerEventHandler
WSServer *shttp.WSServer
Graph *Graph
// contains filtered or unexported fields
}
Server describes a graph server based on websocket
func NewServer ¶
NewServer creates a new graph server based on a websocket server
func (*Server) AddEventHandler ¶ added in v0.12.0
func (s *Server) AddEventHandler(h ServerEventHandler)
AddEventHandler subscribe a new graph server event handler
func (*Server) OnMessage ¶ added in v0.12.0
OnMessage event
type ServerEventHandler ¶ added in v0.12.0
type ServerEventHandler interface {
OnGraphMessage(c *shttp.WSClient, m shttp.WSMessage, msgType string, obj interface{})
}
ServerEventHandler interface event
type SyncReplyMsg ¶ added in v0.12.0
SyncReplyMsg describes graph syncho message
Source Files
¶
- cachedbackend.go
- elasticsearch.go
- filters.go
- graph.go
- memory.go
- message.go
- metrics.go
- orientdb.go
- server.go