Documentation ¶
Index ¶
- Constants
- Variables
- func ClientOrigin(c ws.Speaker) string
- func DelField(obj map[string]interface{}, k string) bool
- func DelSubGraphOfOrigin(g *Graph, origin string)
- func GetMapField(obj map[string]interface{}, k string) (interface{}, error)
- func GetMapFieldKeys(obj map[string]interface{}) []string
- func Hash(values ...interface{}) string
- func NewFilterForEdge(parent Identifier, child Identifier) *filters.Filter
- func NormalizeValue(obj interface{}) interface{}
- func Origin(hostID string, kind service.Type) string
- func SetMapField(obj map[string]interface{}, k string, v interface{}) bool
- func SortEdges(edges []*Edge, sortBy string, sortOrder filters.SortOrder)
- func SortNodes(nodes []*Node, sortBy string, sortOrder filters.SortOrder)
- type Backend
- type CachedBackend
- func (c *CachedBackend) AddListener(listener PersistentBackendListener)
- func (c *CachedBackend) EdgeAdded(e *Edge) error
- func (c *CachedBackend) EdgeDeleted(e *Edge) error
- func (c *CachedBackend) GetEdge(i Identifier, t Context) []*Edge
- func (c *CachedBackend) GetEdgeNodes(e *Edge, t Context, parentMetadata, childMetadata ElementMatcher) ([]*Node, []*Node)
- func (c *CachedBackend) GetEdges(t Context, m ElementMatcher) []*Edge
- func (c *CachedBackend) GetNode(i Identifier, t Context) []*Node
- func (c *CachedBackend) GetNodeEdges(n *Node, t Context, m ElementMatcher) (edges []*Edge)
- func (c *CachedBackend) GetNodes(t Context, m ElementMatcher) []*Node
- func (c *CachedBackend) GetNodesEdges(n []*Node, t Context, m ElementMatcher) (edges []*Edge)
- func (c *CachedBackend) GetNodesFromIDs(i []Identifier, t Context) []*Node
- func (c *CachedBackend) IsHistorySupported() bool
- func (c *CachedBackend) MetadataUpdated(i interface{}) error
- func (c *CachedBackend) NodeAdded(n *Node) error
- func (c *CachedBackend) NodeDeleted(n *Node) error
- func (c *CachedBackend) OnStarted()
- func (c *CachedBackend) SetMode(mode int)
- func (c *CachedBackend) Start() error
- func (c *CachedBackend) Stop()
- type Context
- type DefaultGraphListener
- func (c *DefaultGraphListener) OnEdgeAdded(e *Edge)
- func (c *DefaultGraphListener) OnEdgeDeleted(e *Edge)
- func (c *DefaultGraphListener) OnEdgeUpdated(e *Edge, ops []PartiallyUpdatedOp)
- func (c *DefaultGraphListener) OnNodeAdded(n *Node)
- func (c *DefaultGraphListener) OnNodeDeleted(n *Node)
- func (c *DefaultGraphListener) OnNodeUpdated(n *Node, ops []PartiallyUpdatedOp)
- type DefaultLinker
- type Edge
- func (e *Edge) GetField(field string) (interface{}, error)
- func (e *Edge) GetFieldBool(field string) (_ bool, err error)
- func (e *Edge) GetFieldInt64(field string) (_ int64, err error)
- func (e *Edge) GetFieldKeys() []string
- func (e *Edge) GetFieldString(name string) (string, error)
- func (e *Edge) GetFieldStringList(key string) ([]string, error)
- func (e *Edge) GetFields(names []string) (interface{}, error)
- func (e *Edge) MatchBool(name string, predicate getter.BoolPredicate) bool
- func (e *Edge) MatchInt64(name string, predicate getter.Int64Predicate) bool
- func (e *Edge) MatchMetadata(f ElementMatcher) bool
- func (e *Edge) MatchString(name string, predicate getter.StringPredicate) bool
- func (e *Edge) String() string
- func (e *Edge) UnmarshalJSON(b []byte) error
- type EdgePartiallyUpdated
- type ElasticSearchBackend
- func (b *ElasticSearchBackend) AddListener(listener PersistentBackendListener)
- func (b *ElasticSearchBackend) EdgeAdded(e *Edge) error
- func (b *ElasticSearchBackend) EdgeDeleted(e *Edge) error
- func (b *ElasticSearchBackend) FlushElements(m ElementMatcher) error
- func (b *ElasticSearchBackend) GetEdge(i Identifier, t Context) []*Edge
- func (b *ElasticSearchBackend) GetEdgeNodes(e *Edge, t Context, parentMetadata, childMetadata ElementMatcher) (parents []*Node, children []*Node)
- func (b *ElasticSearchBackend) GetEdges(t Context, m ElementMatcher) []*Edge
- func (b *ElasticSearchBackend) GetNode(i Identifier, t Context) []*Node
- func (b *ElasticSearchBackend) GetNodeEdges(n *Node, t Context, m ElementMatcher) (edges []*Edge)
- func (b *ElasticSearchBackend) GetNodes(t Context, m ElementMatcher) []*Node
- func (b *ElasticSearchBackend) GetNodesEdges(nodeList []*Node, t Context, m ElementMatcher) (edges []*Edge)
- func (b *ElasticSearchBackend) GetNodesFromIDs(identifiersList []Identifier, t Context) []*Node
- func (b *ElasticSearchBackend) IsHistorySupported() bool
- func (b *ElasticSearchBackend) MetadataUpdated(i interface{}) error
- func (b *ElasticSearchBackend) NodeAdded(n *Node) error
- func (b *ElasticSearchBackend) NodeDeleted(n *Node) error
- func (b *ElasticSearchBackend) OnStarted()
- func (b *ElasticSearchBackend) Query(typ string, tsq *TimedSearchQuery, scrollAPI bool, ...)
- func (b *ElasticSearchBackend) Start() error
- func (b *ElasticSearchBackend) Stop()
- func (b *ElasticSearchBackend) Sync(g *Graph, elementFilter *ElementFilter) error
- type ElementFilter
- type ElementMatcher
- type Elements
- type EventHandler
- type EventListener
- type Graph
- func (g *Graph) AddEdge(e *Edge) error
- func (g *Graph) AddEventListener(l EventListener)
- func (g *Graph) AddMetadata(i interface{}, k string, v interface{}) error
- func (g *Graph) AddNode(n *Node) error
- func (g *Graph) AreLinked(n1 *Node, n2 *Node, m ElementMatcher) bool
- func (g *Graph) CloneWithContext(context Context) (*Graph, error)
- func (g *Graph) CreateEdge(i Identifier, p *Node, c *Node, m Metadata, t Time, h ...string) *Edge
- func (g *Graph) CreateNode(i Identifier, m Metadata, t Time, h ...string) *Node
- func (g *Graph) DelEdge(e *Edge) error
- func (g *Graph) DelMetadata(i interface{}, k string) error
- func (g *Graph) DelNode(n *Node) error
- func (g *Graph) DelNodes(m ElementMatcher) error
- func (g *Graph) Diff(newGraph *Graph) (addedNodes []*Node, removedNodes []*Node, addedEdges []*Edge, ...)
- func (g *Graph) EdgeAdded(e *Edge) error
- func (g *Graph) EdgeDeleted(e *Edge) error
- func (g *Graph) EdgePartiallyUpdated(id Identifier, revision int64, updatedAt Time, ops ...PartiallyUpdatedOp) error
- func (g *Graph) EdgeUpdated(e *Edge, ops ...PartiallyUpdatedOp) error
- func (g *Graph) Elements() *Elements
- func (g *Graph) GetContext() Context
- func (g *Graph) GetEdge(i Identifier) *Edge
- func (g *Graph) GetEdgeNodes(e *Edge, parentMetadata, childMetadata ElementMatcher) ([]*Node, []*Node)
- func (g *Graph) GetEdges(m ElementMatcher) []*Edge
- func (g *Graph) GetFirstLink(parent, child *Node, m ElementMatcher) *Edge
- func (g *Graph) GetHost() string
- func (g *Graph) GetNode(i Identifier) *Node
- func (g *Graph) GetNodeEdges(n *Node, m ElementMatcher) []*Edge
- func (g *Graph) GetNodes(m ElementMatcher) []*Node
- func (g *Graph) GetNodesEdges(n []*Node, m ElementMatcher) []*Edge
- func (g *Graph) GetNodesFromIDs(i []Identifier) []*Node
- func (g *Graph) GetNodesMap(t Context) map[Identifier]*Node
- func (g *Graph) GetOrigin() string
- func (g *Graph) Link(n1 *Node, n2 *Node, m Metadata, h ...string) (*Edge, error)
- func (g *Graph) LookupChildren(n *Node, f ElementMatcher, em ElementMatcher) (nodes []*Node)
- func (g *Graph) LookupFirstChild(n *Node, f ElementMatcher) *Node
- func (g *Graph) LookupFirstNode(m ElementMatcher) *Node
- func (g *Graph) LookupParents(n *Node, f ElementMatcher, em ElementMatcher) (nodes []*Node)
- func (g *Graph) LookupShortestPath(n *Node, m ElementMatcher, em ElementMatcher) []*Node
- func (g *Graph) MarshalJSON() ([]byte, error)
- func (g *Graph) NewEdge(i Identifier, p *Node, c *Node, m Metadata, h ...string) (*Edge, error)
- func (g *Graph) NewNode(i Identifier, m Metadata, h ...string) (*Node, error)
- func (g *Graph) NodeAdded(n *Node) error
- func (g *Graph) NodeDeleted(n *Node) error
- func (g *Graph) NodePartiallyUpdated(id Identifier, revision int64, updatedAt Time, ops ...PartiallyUpdatedOp) error
- func (g *Graph) NodeUpdated(n *Node) error
- func (g *Graph) RemoveEventListener(l EventListener)
- func (g *Graph) SetMetadata(i interface{}, m Metadata) error
- func (g *Graph) StartMetadataTransaction(i interface{}) *MetadataTransaction
- func (g *Graph) String() string
- func (g *Graph) Unlink(n1 *Node, n2 *Node) error
- func (g *Graph) UpdateMetadata(i interface{}, key string, mutator func(obj interface{}) bool) error
- type Identifier
- type Indexer
- func (i *Indexer) AddEventListener(l EventListener)
- func (i *Indexer) FromHash(hash string) (nodes []*Node, values []interface{})
- func (i *Indexer) Get(values ...interface{}) ([]*Node, []interface{})
- func (i *Indexer) GetNode(values ...interface{}) (*Node, interface{})
- func (i *Indexer) Index(id Identifier, n *Node, kv map[string]interface{})
- func (i *Indexer) OnNodeAdded(n *Node)
- func (i *Indexer) OnNodeDeleted(n *Node)
- func (i *Indexer) OnNodeUpdated(n *Node, ops []PartiallyUpdatedOp)
- func (i *Indexer) RemoveEventListener(l EventListener)
- func (i *Indexer) Start() error
- func (i *Indexer) Stop()
- func (i *Indexer) Unindex(id Identifier, n *Node)
- type Linker
- type LinkerEventListener
- type ListenerHandler
- type MemoryBackend
- func (m *MemoryBackend) EdgeAdded(e *Edge) error
- func (m *MemoryBackend) EdgeDeleted(e *Edge) error
- func (m *MemoryBackend) GetEdge(i Identifier, t Context) []*Edge
- func (m *MemoryBackend) GetEdgeNodes(e *Edge, t Context, parentMetadata, childMetadata ElementMatcher) ([]*Node, []*Node)
- func (m MemoryBackend) GetEdges(t Context, metadata ElementMatcher) (edges []*Edge)
- func (m *MemoryBackend) GetNode(i Identifier, t Context) []*Node
- func (m *MemoryBackend) GetNodeEdges(n *Node, t Context, meta ElementMatcher) []*Edge
- func (m MemoryBackend) GetNodes(t Context, metadata ElementMatcher) (nodes []*Node)
- func (m *MemoryBackend) GetNodesEdges(nodeList []*Node, t Context, meta ElementMatcher) []*Edge
- func (m *MemoryBackend) GetNodesFromIDs(identifiersList []Identifier, t Context) []*Node
- func (m *MemoryBackend) IsHistorySupported() bool
- func (m *MemoryBackend) MetadataUpdated(i interface{}) error
- func (m *MemoryBackend) NodeAdded(n *Node) error
- func (m *MemoryBackend) NodeDeleted(n *Node) error
- type MemoryBackendEdge
- func (e MemoryBackendEdge) GetField(field string) (interface{}, error)
- func (e MemoryBackendEdge) GetFieldBool(field string) (_ bool, err error)
- func (e MemoryBackendEdge) GetFieldInt64(field string) (_ int64, err error)
- func (e MemoryBackendEdge) GetFieldKeys() []string
- func (e MemoryBackendEdge) GetFieldStringList(key string) ([]string, error)
- func (e MemoryBackendEdge) GetFields(names []string) (interface{}, error)
- type MemoryBackendNode
- func (e MemoryBackendNode) GetField(field string) (interface{}, error)
- func (e MemoryBackendNode) GetFieldBool(field string) (_ bool, err error)
- func (e MemoryBackendNode) GetFieldInt64(field string) (_ int64, err error)
- func (e MemoryBackendNode) GetFieldKeys() []string
- func (e MemoryBackendNode) GetFieldString(field string) (_ string, err error)
- func (e MemoryBackendNode) GetFieldStringList(key string) ([]string, error)
- func (e MemoryBackendNode) GetFields(names []string) (interface{}, error)
- func (e MemoryBackendNode) MatchBool(field string, predicate getter.BoolPredicate) bool
- func (e MemoryBackendNode) MatchInt64(field string, predicate getter.Int64Predicate) bool
- func (e MemoryBackendNode) MatchMetadata(f ElementMatcher) bool
- func (e MemoryBackendNode) MatchString(field string, predicate getter.StringPredicate) bool
- type Metadata
- func (m *Metadata) ApplyUpdates(ops ...PartiallyUpdatedOp) error
- func (m Metadata) Copy() Metadata
- func (m Metadata) DelField(k string) bool
- func (m Metadata) Filter() (*filters.Filter, error)
- func (m Metadata) GetField(key string) (interface{}, error)
- func (m Metadata) GetFieldBool(key string) (bool, error)
- func (m Metadata) GetFieldInt64(key string) (int64, error)
- func (m Metadata) GetFieldKeys() []string
- func (m Metadata) GetFieldString(key string) (string, error)
- func (m Metadata) Match(g getter.Getter) bool
- func (m Metadata) MatchBool(key string, predicate getter.BoolPredicate) bool
- func (m Metadata) MatchInt64(key string, predicate getter.Int64Predicate) bool
- func (m Metadata) MatchString(key string, predicate getter.StringPredicate) bool
- func (m *Metadata) SetField(k string, v interface{}) bool
- func (m *Metadata) SetFieldAndNormalize(k string, v interface{}) bool
- type MetadataDecoder
- type MetadataIndexer
- type MetadataIndexerLinker
- type MetadataTransaction
- type Node
- func (n *Node) Copy() *Node
- func (e *Node) GetField(field string) (interface{}, error)
- func (e *Node) GetFieldBool(field string) (_ bool, err error)
- func (e *Node) GetFieldInt64(field string) (_ int64, err error)
- func (e *Node) GetFieldKeys() []string
- func (e *Node) GetFieldString(field string) (_ string, err error)
- func (e *Node) GetFieldStringList(key string) ([]string, error)
- func (e *Node) GetFields(names []string) (interface{}, error)
- func (e *Node) MatchBool(field string, predicate getter.BoolPredicate) bool
- func (e *Node) MatchInt64(field string, predicate getter.Int64Predicate) bool
- func (e *Node) MatchMetadata(f ElementMatcher) bool
- func (e *Node) MatchString(field string, predicate getter.StringPredicate) bool
- func (n *Node) String() string
- func (n *Node) UnmarshalJSON(b []byte) error
- type NodeAction
- type NodeHasher
- type NodePartiallyUpdated
- type OrientDBBackend
- func (o *OrientDBBackend) AddListener(listener PersistentBackendListener)
- func (o *OrientDBBackend) EdgeAdded(e *Edge) error
- func (o *OrientDBBackend) EdgeDeleted(e *Edge) error
- func (o *OrientDBBackend) FlushElements(e ElementMatcher) error
- func (o *OrientDBBackend) GetEdge(i Identifier, t Context) []*Edge
- func (o *OrientDBBackend) GetEdgeNodes(e *Edge, t Context, parentMetadata, childMetadata ElementMatcher) (parents []*Node, children []*Node)
- func (o *OrientDBBackend) GetEdges(t Context, m ElementMatcher) (edges []*Edge)
- func (o *OrientDBBackend) GetNode(i Identifier, t Context) (nodes []*Node)
- func (o *OrientDBBackend) GetNodeEdges(n *Node, t Context, m ElementMatcher) (edges []*Edge)
- func (o *OrientDBBackend) GetNodes(t Context, m ElementMatcher) (nodes []*Node)
- func (o *OrientDBBackend) GetNodesEdges(nodeList []*Node, t Context, m ElementMatcher) (edges []*Edge)
- func (o *OrientDBBackend) GetNodesFromIDs(identifiersList []Identifier, t Context) (nodes []*Node)
- func (o *OrientDBBackend) IsHistorySupported() bool
- func (o *OrientDBBackend) MetadataUpdated(i interface{}) error
- func (o *OrientDBBackend) NodeAdded(n *Node) error
- func (o *OrientDBBackend) NodeDeleted(n *Node) error
- func (o *OrientDBBackend) OnStarted()
- func (o *OrientDBBackend) Start() error
- func (o *OrientDBBackend) Stop()
- func (o *OrientDBBackend) Sync(g *Graph, elementFilter *ElementFilter) error
- type PartiallyUpdatedOp
- type PartiallyUpdatedOpType
- type PersistentBackend
- type PersistentBackendListener
- type Processor
- type ResourceLinker
- type Time
- type TimeSlice
- type TimedSearchQuery
Constants ¶
const ( CacheOnlyMode int = iota DefaultMode )
Define the running cache mode, memory and/or persistent
const ( NodeUpdated graphEventType = iota + 1 NodeAdded NodeDeleted EdgeUpdated EdgeAdded EdgeDeleted )
Graph events
const ( SortByInt64 int = iota + 1 SortByString )
Sort criteria
const (
// MetadataPrefix used to access user metadata
MetadataPrefix = "Metadata."
)
Variables ¶
var ( ErrElementNotFound = errors.New("Graph element not found") ErrNodeNotFound = errors.New("Node not found") ErrEdgeNotFound = errors.New("Edge not found") ErrParentNotFound = errors.New("Parent node not found") ErrChildNotFound = errors.New("Child node not found") ErrEdgeConflict = errors.New("Edge ID conflict") ErrNodeConflict = errors.New("Node ID conflict") ErrInternal = errors.New("Internal backend error") )
Graph errors
var ( // NodeMetadataDecoders is a map that owns special type metadata decoder NodeMetadataDecoders = make(map[string]MetadataDecoder) // EdgeMetadataDecoders is a map that owns special type metadata decoder EdgeMetadataDecoders = make(map[string]MetadataDecoder) )
var (
ErrCacheBackendModeUnknown = errors.New("Cache backend mode unknown")
)
Cachebackend graph errors
Functions ¶
func ClientOrigin ¶
ClientOrigin return a string identifying a client using its service type and host id
func DelSubGraphOfOrigin ¶
DelSubGraphOfOrigin deletes all the nodes with a specified origin
func GetMapField ¶
GetMapField retrieves a value from a tree from the dot key like "a.b.c.d"
func GetMapFieldKeys ¶
GetMapFieldKeys returns all the keys using dot notation
func NewFilterForEdge ¶
func NewFilterForEdge(parent Identifier, child Identifier) *filters.Filter
NewFilterForEdge creates a filter based on parent or child
func NormalizeValue ¶
func NormalizeValue(obj interface{}) interface{}
NormalizeValue returns a version of the passed value that can be safely marshalled to JSON
func SetMapField ¶
SetMapField set a value in a tree based on dot key ("a.b.c.d" = "ok")
Types ¶
type Backend ¶
type Backend interface { NodeAdded(n *Node) error NodeDeleted(n *Node) error GetNode(i Identifier, at Context) []*Node GetNodesFromIDs(i []Identifier, at Context) []*Node GetNodeEdges(n *Node, at Context, m ElementMatcher) []*Edge GetNodesEdges(n []*Node, at Context, m ElementMatcher) []*Edge EdgeAdded(e *Edge) error EdgeDeleted(e *Edge) error GetEdge(i Identifier, at Context) []*Edge GetEdgeNodes(e *Edge, at Context, parentMetadata, childMetadata ElementMatcher) ([]*Node, []*Node) MetadataUpdated(e interface{}) error GetNodes(t Context, m ElementMatcher) []*Node GetEdges(t Context, m ElementMatcher) []*Edge IsHistorySupported() bool }
Backend interface mechanism used as storage
type CachedBackend ¶
type CachedBackend struct {
// contains filtered or unexported fields
}
CachedBackend describes a cache mechanism in memory and/or persistent database
func NewCachedBackend ¶
func NewCachedBackend(persistent PersistentBackend, electionService etcd.MasterElectionService, host string, serviceType service.Type) (*CachedBackend, error)
NewCachedBackend creates new graph cache mechanism
func (*CachedBackend) AddListener ¶
func (c *CachedBackend) AddListener(listener PersistentBackendListener)
AddListener registers a listener to the cached backend
func (*CachedBackend) EdgeAdded ¶
func (c *CachedBackend) EdgeAdded(e *Edge) error
EdgeAdded add an edge in the cache
func (*CachedBackend) EdgeDeleted ¶
func (c *CachedBackend) EdgeDeleted(e *Edge) error
EdgeDeleted delete an edge in the cache
func (*CachedBackend) GetEdge ¶
func (c *CachedBackend) GetEdge(i Identifier, t Context) []*Edge
GetEdge retrieve an edge within a time slice
func (*CachedBackend) GetEdgeNodes ¶
func (c *CachedBackend) GetEdgeNodes(e *Edge, t Context, parentMetadata, childMetadata ElementMatcher) ([]*Node, []*Node)
GetEdgeNodes retrieve a list of nodes from an edge within a time slice, matching metadata
func (*CachedBackend) GetEdges ¶
func (c *CachedBackend) GetEdges(t Context, m ElementMatcher) []*Edge
GetEdges returns a list of edges with a time slice, matching metadata
func (*CachedBackend) GetNode ¶
func (c *CachedBackend) GetNode(i Identifier, t Context) []*Node
GetNode retrieve a node from the cache within a time slice
func (*CachedBackend) GetNodeEdges ¶
func (c *CachedBackend) GetNodeEdges(n *Node, t Context, m ElementMatcher) (edges []*Edge)
GetNodeEdges retrieve a list of edges from a node within a time slice, matching metadata
func (*CachedBackend) GetNodes ¶
func (c *CachedBackend) GetNodes(t Context, m ElementMatcher) []*Node
GetNodes returns a list of nodes with a time slice, matching metadata
func (*CachedBackend) GetNodesEdges ¶
func (c *CachedBackend) GetNodesEdges(n []*Node, t Context, m ElementMatcher) (edges []*Edge)
GetNodesEdges return the list of all edges for a list of nodes within time slice, matching metadata
func (*CachedBackend) GetNodesFromIDs ¶
func (c *CachedBackend) GetNodesFromIDs(i []Identifier, t Context) []*Node
GetNodesFromIDs retrieve the list of nodes for the list of identifiers from the cache within a time slice
func (*CachedBackend) IsHistorySupported ¶
func (c *CachedBackend) IsHistorySupported() bool
IsHistorySupported returns whether the persistent backend supports history
func (*CachedBackend) MetadataUpdated ¶
func (c *CachedBackend) MetadataUpdated(i interface{}) error
MetadataUpdated updates metadata
func (*CachedBackend) NodeAdded ¶
func (c *CachedBackend) NodeAdded(n *Node) error
NodeAdded same the node in the cache
func (*CachedBackend) NodeDeleted ¶
func (c *CachedBackend) NodeDeleted(n *Node) error
NodeDeleted Delete the node in the cache
func (*CachedBackend) OnStarted ¶
func (c *CachedBackend) OnStarted()
OnStarted implements PersistentBackendListener interface
type DefaultGraphListener ¶
type DefaultGraphListener struct{}
DefaultGraphListener default implementation of a graph listener, can be used when not implementing the whole set of callbacks
func (*DefaultGraphListener) OnEdgeAdded ¶
func (c *DefaultGraphListener) OnEdgeAdded(e *Edge)
OnEdgeAdded event
func (*DefaultGraphListener) OnEdgeDeleted ¶
func (c *DefaultGraphListener) OnEdgeDeleted(e *Edge)
OnEdgeDeleted event
func (*DefaultGraphListener) OnEdgeUpdated ¶
func (c *DefaultGraphListener) OnEdgeUpdated(e *Edge, ops []PartiallyUpdatedOp)
OnEdgeUpdated event
func (*DefaultGraphListener) OnNodeAdded ¶
func (c *DefaultGraphListener) OnNodeAdded(n *Node)
OnNodeAdded event
func (*DefaultGraphListener) OnNodeDeleted ¶
func (c *DefaultGraphListener) OnNodeDeleted(n *Node)
OnNodeDeleted event
func (*DefaultGraphListener) OnNodeUpdated ¶
func (c *DefaultGraphListener) OnNodeUpdated(n *Node, ops []PartiallyUpdatedOp)
OnNodeUpdated event
type DefaultLinker ¶
type DefaultLinker struct { }
DefaultLinker returns a linker that does nothing
func (*DefaultLinker) GetABLinks ¶
func (dl *DefaultLinker) GetABLinks(node *Node) []*Edge
GetABLinks returns all the outgoing links for a node
func (*DefaultLinker) GetBALinks ¶
func (dl *DefaultLinker) GetBALinks(node *Node) []*Edge
GetBALinks returns all the incoming links for a node
type Edge ¶
type Edge struct { Parent Identifier Child Identifier // contains filtered or unexported fields }
Edge of the graph linked by a parent and a child
func CreateEdge ¶
CreateEdge returns a new edge not bound to any graph
func (*Edge) GetFieldBool ¶
func (*Edge) GetFieldInt64 ¶
func (*Edge) GetFieldKeys ¶
func (e *Edge) GetFieldKeys() []string
func (*Edge) GetFieldString ¶
GetFieldString implements Getter interface
func (*Edge) GetFieldStringList ¶
func (*Edge) MatchBool ¶
func (e *Edge) MatchBool(name string, predicate getter.BoolPredicate) bool
MatchBool implements Getter interface
func (*Edge) MatchInt64 ¶
func (e *Edge) MatchInt64(name string, predicate getter.Int64Predicate) bool
MatchInt64 implements Getter interface
func (*Edge) MatchMetadata ¶
func (e *Edge) MatchMetadata(f ElementMatcher) bool
MatchMetadata returns when an edge matches a specified filter or metadata
func (*Edge) MatchString ¶
func (e *Edge) MatchString(name string, predicate getter.StringPredicate) bool
MatchString implements Getter interface
func (*Edge) UnmarshalJSON ¶
UnmarshalJSON custom unmarshal function
type EdgePartiallyUpdated ¶
type EdgePartiallyUpdated struct { Edge *Edge Ops []PartiallyUpdatedOp }
EdgePartiallyUpdated partial updates of a edge
type ElasticSearchBackend ¶
type ElasticSearchBackend struct {
// contains filtered or unexported fields
}
ElasticSearchBackend describes a persistent backend based on ElasticSearch
func NewElasticSearchBackendFromConfig ¶
func NewElasticSearchBackendFromConfig(cfg es.Config, extraDynamicTemplates map[string]interface{}, electionService etcd.MasterElectionService, logger logging.Logger) (*ElasticSearchBackend, error)
NewElasticSearchBackendFromConfig creates a new graph backend from an ES configuration structure
func (*ElasticSearchBackend) AddListener ¶
func (b *ElasticSearchBackend) AddListener(listener PersistentBackendListener)
AddListener implement PersistentBackendListener interface
func (*ElasticSearchBackend) EdgeAdded ¶
func (b *ElasticSearchBackend) EdgeAdded(e *Edge) error
EdgeAdded add an edge in the database
func (*ElasticSearchBackend) EdgeDeleted ¶
func (b *ElasticSearchBackend) EdgeDeleted(e *Edge) error
EdgeDeleted delete an edge in the database
func (*ElasticSearchBackend) FlushElements ¶
func (b *ElasticSearchBackend) FlushElements(m ElementMatcher) error
FlushElements deletes a set of nodes and edges
func (*ElasticSearchBackend) GetEdge ¶
func (b *ElasticSearchBackend) GetEdge(i Identifier, t Context) []*Edge
GetEdge get an edge within a time slice
func (*ElasticSearchBackend) GetEdgeNodes ¶
func (b *ElasticSearchBackend) GetEdgeNodes(e *Edge, t Context, parentMetadata, childMetadata ElementMatcher) (parents []*Node, children []*Node)
GetEdgeNodes returns the parents and child nodes of an edge within time slice, matching metadatas
func (*ElasticSearchBackend) GetEdges ¶
func (b *ElasticSearchBackend) GetEdges(t Context, m ElementMatcher) []*Edge
GetEdges returns a list of edges within time slice, matching metadata
func (*ElasticSearchBackend) GetNode ¶
func (b *ElasticSearchBackend) GetNode(i Identifier, t Context) []*Node
GetNode get a node within a time slice
func (*ElasticSearchBackend) GetNodeEdges ¶
func (b *ElasticSearchBackend) GetNodeEdges(n *Node, t Context, m ElementMatcher) (edges []*Edge)
GetNodeEdges returns a list of a node edges within time slice
func (*ElasticSearchBackend) GetNodes ¶
func (b *ElasticSearchBackend) GetNodes(t Context, m ElementMatcher) []*Node
GetNodes returns a list of nodes within time slice, matching metadata
func (*ElasticSearchBackend) GetNodesEdges ¶
func (b *ElasticSearchBackend) GetNodesEdges(nodeList []*Node, t Context, m ElementMatcher) (edges []*Edge)
GetNodesEdges return the list of all edges for a list of nodes within time slice
func (*ElasticSearchBackend) GetNodesFromIDs ¶
func (b *ElasticSearchBackend) GetNodesFromIDs(identifiersList []Identifier, t Context) []*Node
GetNodesFromIDs get the list of nodes for the list of identifiers within a time slice
func (*ElasticSearchBackend) IsHistorySupported ¶
func (b *ElasticSearchBackend) IsHistorySupported() bool
IsHistorySupported returns that this backend does support history
func (*ElasticSearchBackend) MetadataUpdated ¶
func (b *ElasticSearchBackend) MetadataUpdated(i interface{}) error
MetadataUpdated updates a node metadata in the database
func (*ElasticSearchBackend) NodeAdded ¶
func (b *ElasticSearchBackend) NodeAdded(n *Node) error
NodeAdded add a node
func (*ElasticSearchBackend) NodeDeleted ¶
func (b *ElasticSearchBackend) NodeDeleted(n *Node) error
NodeDeleted delete a node
func (*ElasticSearchBackend) OnStarted ¶
func (b *ElasticSearchBackend) OnStarted()
OnStarted implements storage client listener interface
func (*ElasticSearchBackend) Query ¶
func (b *ElasticSearchBackend) Query(typ string, tsq *TimedSearchQuery, scrollAPI bool, hits chan<- *elastic.SearchHit)
Query the database for a "node" or "edge" Return a channel where the hits will be send. Done channel indicates the query has finished
func (*ElasticSearchBackend) Sync ¶
func (b *ElasticSearchBackend) Sync(g *Graph, elementFilter *ElementFilter) error
Sync adds all the nodes and edges with the specified filter into an other graph
type ElementFilter ¶
type ElementFilter struct {
// contains filtered or unexported fields
}
ElementFilter implements ElementMatcher interface based on filter
func NewElementFilter ¶
func NewElementFilter(f *filters.Filter) *ElementFilter
NewElementFilter returns a new ElementFilter
type ElementMatcher ¶
ElementMatcher defines an interface used to match an element
type EventHandler ¶
type EventHandler struct { insanelock.RWMutex // contains filtered or unexported fields }
EventHandler describes an object that notifies listeners with graph events
func NewEventHandler ¶
func NewEventHandler(maxEvents int) *EventHandler
NewEventHandler instantiate a new event handler
func (*EventHandler) AddEventListener ¶
func (g *EventHandler) AddEventListener(l EventListener)
AddEventListener subscribe a new graph listener
func (*EventHandler) NotifyEvent ¶
func (g *EventHandler) NotifyEvent(kind graphEventType, element interface{}, ops ...PartiallyUpdatedOp)
NotifyEvent notifies all the listeners of an event. NotifyEvent makes sure that we don't enter a notify endless loop.
func (*EventHandler) RemoveEventListener ¶
func (g *EventHandler) RemoveEventListener(l EventListener)
RemoveEventListener unsubscribe a graph listener
type EventListener ¶
type EventListener interface { OnNodeUpdated(n *Node, ops []PartiallyUpdatedOp) OnNodeAdded(n *Node) OnNodeDeleted(n *Node) OnEdgeUpdated(e *Edge, ops []PartiallyUpdatedOp) OnEdgeAdded(e *Edge) OnEdgeDeleted(e *Edge) }
EventListener describes the graph events interface mechanism
type Graph ¶
type Graph struct { insanelock.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 (*Graph) AddEventListener ¶
func (g *Graph) AddEventListener(l EventListener)
AddEventListener subscribe a new graph listener
func (*Graph) AddMetadata ¶
AddMetadata add a metadata to an associated edge or node
func (*Graph) AreLinked ¶
func (g *Graph) AreLinked(n1 *Node, n2 *Node, m ElementMatcher) bool
AreLinked returns true if nodes n1, n2 are linked
func (*Graph) CloneWithContext ¶
CloneWithContext creates a new graph based on the given one and the given context
func (*Graph) CreateEdge ¶
CreateEdge creates a new edge and adds it to the graph
func (*Graph) CreateNode ¶
CreateNode creates a new node and adds it to the graph
func (*Graph) DelMetadata ¶
DelMetadata delete a metadata to an associated edge or node
func (*Graph) DelNodes ¶
func (g *Graph) DelNodes(m ElementMatcher) error
DelNodes deletes nodes for given matcher
func (*Graph) Diff ¶
func (g *Graph) Diff(newGraph *Graph) (addedNodes []*Node, removedNodes []*Node, addedEdges []*Edge, removedEdges []*Edge)
Diff computes the difference between two graphs
func (*Graph) EdgePartiallyUpdated ¶
func (g *Graph) EdgePartiallyUpdated(id Identifier, revision int64, updatedAt Time, ops ...PartiallyUpdatedOp) error
EdgePartiallyUpdated partially updates an edge
func (*Graph) EdgeUpdated ¶
func (g *Graph) EdgeUpdated(e *Edge, ops ...PartiallyUpdatedOp) error
EdgeUpdated updates an edge
func (*Graph) GetContext ¶
GetContext returns the current context
func (*Graph) GetEdgeNodes ¶
func (g *Graph) GetEdgeNodes(e *Edge, parentMetadata, childMetadata ElementMatcher) ([]*Node, []*Node)
GetEdgeNodes returns a list of nodes of an edge
func (*Graph) GetEdges ¶
func (g *Graph) GetEdges(m ElementMatcher) []*Edge
GetEdges returns a list of edges
func (*Graph) GetFirstLink ¶
func (g *Graph) GetFirstLink(parent, child *Node, m ElementMatcher) *Edge
GetFirstLink get Link between the parent and the child node
func (*Graph) GetNodeEdges ¶
func (g *Graph) GetNodeEdges(n *Node, m ElementMatcher) []*Edge
GetNodeEdges returns a list of edges of a node
func (*Graph) GetNodes ¶
func (g *Graph) GetNodes(m ElementMatcher) []*Node
GetNodes returns a list of nodes
func (*Graph) GetNodesEdges ¶
func (g *Graph) GetNodesEdges(n []*Node, m ElementMatcher) []*Edge
GetNodesEdges returns the list with all edges for a list of nodes
func (*Graph) GetNodesFromIDs ¶
func (g *Graph) GetNodesFromIDs(i []Identifier) []*Node
GetNodesFromIDs returns a list of nodes from a list of identifiers
func (*Graph) GetNodesMap ¶
func (g *Graph) GetNodesMap(t Context) map[Identifier]*Node
GetNodesMap returns a map of nodes within a time slice
func (*Graph) LookupChildren ¶
func (g *Graph) LookupChildren(n *Node, f ElementMatcher, em ElementMatcher) (nodes []*Node)
LookupChildren returns a list of children nodes
func (*Graph) LookupFirstChild ¶
func (g *Graph) LookupFirstChild(n *Node, f ElementMatcher) *Node
LookupFirstChild returns the child
func (*Graph) LookupFirstNode ¶
func (g *Graph) LookupFirstNode(m ElementMatcher) *Node
LookupFirstNode returns the fist node matching metadata
func (*Graph) LookupParents ¶
func (g *Graph) LookupParents(n *Node, f ElementMatcher, em ElementMatcher) (nodes []*Node)
LookupParents returns the associated parents edge of a node
func (*Graph) LookupShortestPath ¶
func (g *Graph) LookupShortestPath(n *Node, m ElementMatcher, em ElementMatcher) []*Node
LookupShortestPath based on Dijkstra algorithm
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) NodePartiallyUpdated ¶
func (g *Graph) NodePartiallyUpdated(id Identifier, revision int64, updatedAt Time, ops ...PartiallyUpdatedOp) error
NodePartiallyUpdated partially updates a node
func (*Graph) RemoveEventListener ¶
func (g *Graph) RemoveEventListener(l EventListener)
RemoveEventListener unsubscribe a graph listener
func (*Graph) SetMetadata ¶
SetMetadata associate metadata to an edge or node
func (*Graph) StartMetadataTransaction ¶
func (g *Graph) StartMetadataTransaction(i interface{}) *MetadataTransaction
StartMetadataTransaction start a new transaction
type Indexer ¶
type Indexer struct { insanelock.RWMutex DefaultGraphListener // contains filtered or unexported fields }
Indexer provides a way to index graph nodes. A node can be mapped to multiple hash,value pairs. A hash can also be mapped to multiple nodes.
func NewIndexer ¶
func NewIndexer(g *Graph, listenerHandler ListenerHandler, hashNode NodeHasher, appendOnly bool) *Indexer
NewIndexer returns a new graph indexer with the associated hashing callback
func (*Indexer) AddEventListener ¶
func (i *Indexer) AddEventListener(l EventListener)
AddEventListener subscribes a new graph listener
func (*Indexer) FromHash ¶
FromHash returns the nodes mapped by a hash along with their associated values
func (*Indexer) Get ¶
Get computes the hash of the passed parameters and returns the matching nodes with their respective value
func (*Indexer) GetNode ¶
GetNode computes the hash of the passed parameters and returns the first matching node with its respective value
func (*Indexer) Index ¶
func (i *Indexer) Index(id Identifier, n *Node, kv map[string]interface{})
Index indexes a node with a set of hash -> value map
func (*Indexer) OnNodeUpdated ¶
func (i *Indexer) OnNodeUpdated(n *Node, ops []PartiallyUpdatedOp)
OnNodeUpdated event
func (*Indexer) RemoveEventListener ¶
func (i *Indexer) RemoveEventListener(l EventListener)
RemoveEventListener unsubscribe a graph listener
func (*Indexer) Stop ¶
func (i *Indexer) Stop()
Stop removes the graph indexer from the graph listeners
func (*Indexer) Unindex ¶
func (i *Indexer) Unindex(id Identifier, n *Node)
Unindex removes the node and its associated hashes from the index
type Linker ¶
Linker describes an object that returns incoming edges to a node and outgoing edges from that node
type LinkerEventListener ¶
type LinkerEventListener interface {
OnError(err error)
}
LinkerEventListener defines the event interface for linker
type ListenerHandler ¶
type ListenerHandler interface { AddEventListener(l EventListener) RemoveEventListener(l EventListener) }
ListenerHandler describes an other that manages a set of event listeners
type MemoryBackend ¶
type MemoryBackend struct { Backend // 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 ¶
func (m *MemoryBackend) EdgeAdded(e *Edge) error
EdgeAdded event add an edge in the memory backend
func (*MemoryBackend) EdgeDeleted ¶
func (m *MemoryBackend) EdgeDeleted(e *Edge) error
EdgeDeleted in the graph backend
func (*MemoryBackend) GetEdge ¶
func (m *MemoryBackend) GetEdge(i Identifier, t Context) []*Edge
GetEdge in the graph backend
func (*MemoryBackend) GetEdgeNodes ¶
func (m *MemoryBackend) GetEdgeNodes(e *Edge, t Context, parentMetadata, childMetadata ElementMatcher) ([]*Node, []*Node)
GetEdgeNodes returns a list of nodes of an edge
func (MemoryBackend) GetEdges ¶
func (m MemoryBackend) GetEdges(t Context, metadata ElementMatcher) (edges []*Edge)
GetEdges from the graph backend
func (*MemoryBackend) GetNode ¶
func (m *MemoryBackend) GetNode(i Identifier, t Context) []*Node
GetNode from the graph backend
func (*MemoryBackend) GetNodeEdges ¶
func (m *MemoryBackend) GetNodeEdges(n *Node, t Context, meta ElementMatcher) []*Edge
GetNodeEdges returns a list of edges of a node
func (MemoryBackend) GetNodes ¶
func (m MemoryBackend) GetNodes(t Context, metadata ElementMatcher) (nodes []*Node)
GetNodes from the graph backend
func (*MemoryBackend) GetNodesEdges ¶
func (m *MemoryBackend) GetNodesEdges(nodeList []*Node, t Context, meta ElementMatcher) []*Edge
GetNodesEdges returns the list of edges for a list of nodes
func (*MemoryBackend) GetNodesFromIDs ¶
func (m *MemoryBackend) GetNodesFromIDs(identifiersList []Identifier, t Context) []*Node
GetNodesFromIDs from the graph backend
func (*MemoryBackend) IsHistorySupported ¶
func (m *MemoryBackend) IsHistorySupported() bool
IsHistorySupported returns that this backend doesn't support history
func (*MemoryBackend) MetadataUpdated ¶
func (m *MemoryBackend) MetadataUpdated(i interface{}) error
MetadataUpdated return true
func (*MemoryBackend) NodeAdded ¶
func (m *MemoryBackend) NodeAdded(n *Node) error
NodeAdded in the graph backend
func (*MemoryBackend) NodeDeleted ¶
func (m *MemoryBackend) NodeDeleted(n *Node) error
NodeDeleted in the graph backend
type MemoryBackendEdge ¶
type MemoryBackendEdge struct {
*Edge
}
MemoryBackendEdge a memory backend edge
func (MemoryBackendEdge) GetFieldBool ¶
func (MemoryBackendEdge) GetFieldInt64 ¶
func (MemoryBackendEdge) GetFieldKeys ¶
func (e MemoryBackendEdge) GetFieldKeys() []string
func (MemoryBackendEdge) GetFieldStringList ¶
type MemoryBackendNode ¶
type MemoryBackendNode struct { *Node // contains filtered or unexported fields }
MemoryBackendNode a memory backend node
func (MemoryBackendNode) GetFieldBool ¶
func (MemoryBackendNode) GetFieldInt64 ¶
func (MemoryBackendNode) GetFieldKeys ¶
func (e MemoryBackendNode) GetFieldKeys() []string
func (MemoryBackendNode) GetFieldString ¶
func (MemoryBackendNode) GetFieldStringList ¶
func (MemoryBackendNode) MatchBool ¶
func (e MemoryBackendNode) MatchBool(field string, predicate getter.BoolPredicate) bool
func (MemoryBackendNode) MatchInt64 ¶
func (e MemoryBackendNode) MatchInt64(field string, predicate getter.Int64Predicate) bool
func (MemoryBackendNode) MatchMetadata ¶
func (e MemoryBackendNode) MatchMetadata(f ElementMatcher) bool
MatchMetadata returns whether a graph element matches with the provided filter or metadata
func (MemoryBackendNode) MatchString ¶
func (e MemoryBackendNode) MatchString(field string, predicate getter.StringPredicate) bool
type Metadata ¶
type Metadata map[string]interface{}
Metadata describes the graph node metadata type. It implements ElementMatcher based only on Metadata. easyjson:json
func DefToMetadata ¶
DefToMetadata converts a string in k1=v1,k2=v2,... format to a metadata object
func (*Metadata) ApplyUpdates ¶
func (m *Metadata) ApplyUpdates(ops ...PartiallyUpdatedOp) error
ApplyUpdates applies a serie of partial updates to a graph element
func (Metadata) GetFieldBool ¶
GetFieldBool returns the value of a bool field
func (Metadata) GetFieldInt64 ¶
GetFieldInt64 returns the value of a integer field
func (Metadata) GetFieldKeys ¶
GetFieldKeys returns all the keys of the medata
func (Metadata) GetFieldString ¶
GetFieldString returns the value of a string field
func (Metadata) MatchBool ¶
func (m Metadata) MatchBool(key string, predicate getter.BoolPredicate) bool
MatchBool implements Getter interface
func (Metadata) MatchInt64 ¶
func (m Metadata) MatchInt64(key string, predicate getter.Int64Predicate) bool
MatchInt64 implements Getter interface
func (Metadata) MatchString ¶
func (m Metadata) MatchString(key string, predicate getter.StringPredicate) bool
MatchString implements Getter interface
func (*Metadata) SetFieldAndNormalize ¶
SetFieldAndNormalize set metadata value after normalization (and deepcopy)
type MetadataDecoder ¶
type MetadataDecoder func(raw json.RawMessage) (getter.Getter, error)
MetadataDecoder defines a json rawmessage decoder which has to return a object implementing the getter interface
type MetadataIndexer ¶
type MetadataIndexer struct { *Indexer // contains filtered or unexported fields }
MetadataIndexer describes a metadata based graph indexer
func NewMetadataIndexer ¶
func NewMetadataIndexer(g *Graph, listenerHandler ListenerHandler, m ElementMatcher, indexes ...string) (indexer *MetadataIndexer)
NewMetadataIndexer returns a new metadata graph indexer for the nodes matching the graph filter `m`, indexing the metadata with `indexes`
func (*MetadataIndexer) Sync ¶
func (i *MetadataIndexer) Sync()
Sync synchronizes the index with the graph
type MetadataIndexerLinker ¶
type MetadataIndexerLinker struct { *ResourceLinker // contains filtered or unexported fields }
MetadataIndexerLinker describes an object that links resources from one indexer to resources from an other indexer.
func NewMetadataIndexerLinker ¶
func NewMetadataIndexerLinker(g *Graph, indexer1, indexer2 *MetadataIndexer, edgeMetadata Metadata) *MetadataIndexerLinker
NewMetadataIndexerLinker returns a new metadata based linker
func (*MetadataIndexerLinker) GetABLinks ¶
func (mil *MetadataIndexerLinker) GetABLinks(node *Node) (edges []*Edge)
GetABLinks returns all the outgoing links for a node
func (*MetadataIndexerLinker) GetBALinks ¶
func (mil *MetadataIndexerLinker) GetBALinks(node *Node) (edges []*Edge)
GetBALinks returns all the incoming links for a node
type MetadataTransaction ¶
type MetadataTransaction struct {
// contains filtered or unexported fields
}
MetadataTransaction describes a metadata transaction in the graph
func (*MetadataTransaction) AddMetadata ¶
func (t *MetadataTransaction) AddMetadata(k string, v interface{})
AddMetadata in the current transaction
func (*MetadataTransaction) Commit ¶
func (t *MetadataTransaction) Commit() error
Commit the current transaction to the graph
func (*MetadataTransaction) DelMetadata ¶
func (t *MetadataTransaction) DelMetadata(k string)
DelMetadata in the current transaction
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node of the graph
func CreateNode ¶
CreateNode returns a new node not bound to a graph
func (*Node) GetFieldBool ¶
func (*Node) GetFieldInt64 ¶
func (*Node) GetFieldKeys ¶
func (e *Node) GetFieldKeys() []string
func (*Node) GetFieldString ¶
func (*Node) GetFieldStringList ¶
func (*Node) MatchBool ¶
func (e *Node) MatchBool(field string, predicate getter.BoolPredicate) bool
func (*Node) MatchInt64 ¶
func (e *Node) MatchInt64(field string, predicate getter.Int64Predicate) bool
func (*Node) MatchMetadata ¶
func (e *Node) MatchMetadata(f ElementMatcher) bool
MatchMetadata returns whether a graph element matches with the provided filter or metadata
func (*Node) MatchString ¶
func (e *Node) MatchString(field string, predicate getter.StringPredicate) bool
func (*Node) UnmarshalJSON ¶
UnmarshalJSON custom unmarshal function
type NodeAction ¶
NodeAction is a callback to perform on a node. The action is kept active as long as it returns true.
type NodeHasher ¶
NodeHasher describes a callback that is called to map a node to a set of hash,value pairs
type NodePartiallyUpdated ¶
type NodePartiallyUpdated struct { Node *Node Ops []PartiallyUpdatedOp }
NodePartiallyUpdated partial updates of a node
type OrientDBBackend ¶
type OrientDBBackend struct {
// contains filtered or unexported fields
}
OrientDBBackend describes an OrientDB backend
func NewOrientDBBackend ¶
func NewOrientDBBackend(addr string, database string, username string, password string, logger logging.Logger) (*OrientDBBackend, error)
NewOrientDBBackend creates a new graph backend and connect to an OrientDB instance
func (*OrientDBBackend) AddListener ¶
func (o *OrientDBBackend) AddListener(listener PersistentBackendListener)
AddListener implement PersistentBackendListener interface
func (*OrientDBBackend) EdgeAdded ¶
func (o *OrientDBBackend) EdgeAdded(e *Edge) error
EdgeAdded add a node in the database
func (*OrientDBBackend) EdgeDeleted ¶
func (o *OrientDBBackend) EdgeDeleted(e *Edge) error
EdgeDeleted delete a node in the database
func (*OrientDBBackend) FlushElements ¶
func (o *OrientDBBackend) FlushElements(e ElementMatcher) error
FlushElements deletes a set of nodes and edges
func (*OrientDBBackend) GetEdge ¶
func (o *OrientDBBackend) GetEdge(i Identifier, t Context) []*Edge
GetEdge get an edge within a time slice
func (*OrientDBBackend) GetEdgeNodes ¶
func (o *OrientDBBackend) GetEdgeNodes(e *Edge, t Context, parentMetadata, childMetadata ElementMatcher) (parents []*Node, children []*Node)
GetEdgeNodes returns the parents and child nodes of an edge within time slice, matching metadata
func (*OrientDBBackend) GetEdges ¶
func (o *OrientDBBackend) GetEdges(t Context, m ElementMatcher) (edges []*Edge)
GetEdges returns a list of edges within time slice
func (*OrientDBBackend) GetNode ¶
func (o *OrientDBBackend) GetNode(i Identifier, t Context) (nodes []*Node)
GetNode get a node within a time slice
func (*OrientDBBackend) GetNodeEdges ¶
func (o *OrientDBBackend) GetNodeEdges(n *Node, t Context, m ElementMatcher) (edges []*Edge)
GetNodeEdges returns a list of a node edges within time slice
func (*OrientDBBackend) GetNodes ¶
func (o *OrientDBBackend) GetNodes(t Context, m ElementMatcher) (nodes []*Node)
GetNodes returns a list of nodes within time slice
func (*OrientDBBackend) GetNodesEdges ¶
func (o *OrientDBBackend) GetNodesEdges(nodeList []*Node, t Context, m ElementMatcher) (edges []*Edge)
GetNodesEdges returns a list of a node edges within time slice
func (*OrientDBBackend) GetNodesFromIDs ¶
func (o *OrientDBBackend) GetNodesFromIDs(identifiersList []Identifier, t Context) (nodes []*Node)
func (*OrientDBBackend) IsHistorySupported ¶
func (o *OrientDBBackend) IsHistorySupported() bool
IsHistorySupported returns that this backend does support history
func (*OrientDBBackend) MetadataUpdated ¶
func (o *OrientDBBackend) MetadataUpdated(i interface{}) error
MetadataUpdated returns true if a metadata has been updated in the database, based on ArchivedAt
func (*OrientDBBackend) NodeAdded ¶
func (o *OrientDBBackend) NodeAdded(n *Node) error
NodeAdded add a node in the database
func (*OrientDBBackend) NodeDeleted ¶
func (o *OrientDBBackend) NodeDeleted(n *Node) error
NodeDeleted delete a node in the database
func (*OrientDBBackend) OnStarted ¶
func (o *OrientDBBackend) OnStarted()
OnStarted implements the client interface
func (*OrientDBBackend) Sync ¶
func (o *OrientDBBackend) Sync(g *Graph, elementFilter *ElementFilter) error
Sync adds all the nodes and edges with the specified filter into an other graph
type PartiallyUpdatedOp ¶
type PartiallyUpdatedOp struct { Type PartiallyUpdatedOpType Key string Value interface{} }
PartiallyUpdatedOp describes a way to update partially node or edge
type PartiallyUpdatedOpType ¶
type PartiallyUpdatedOpType int
PartiallyUpdatedOpType operation type add/del
const ( // PartiallyUpdatedAddOpType add metadata PartiallyUpdatedAddOpType PartiallyUpdatedOpType = iota + 1 // PartiallyUpdatedDelOpType del metadata PartiallyUpdatedDelOpType )
type PersistentBackend ¶
type PersistentBackend interface { Backend AddListener(listener PersistentBackendListener) FlushElements(m ElementMatcher) error Sync(*Graph, *ElementFilter) error Start() error Stop() }
PersistentBackend describes the interface of a persistent storage backend
type PersistentBackendListener ¶
type PersistentBackendListener interface {
OnStarted()
}
type Processor ¶
type Processor struct { insanelock.RWMutex DefaultGraphListener *MetadataIndexer // contains filtered or unexported fields }
Processor encapsulates an indexer that will process NodeActions on the nodes that filter
func NewProcessor ¶
func NewProcessor(g *Graph, listenerHandler ListenerHandler, m ElementMatcher, indexes ...string) (processor *Processor)
NewProcessor creates a Processor on the graph g, a stream of events controlled by listenerHandler, that match a first set of metadata m. Actions will be associated to a given set of values for indexes.
func (*Processor) Cancel ¶
func (processor *Processor) Cancel(values ...interface{})
Cancel the actions attached to a given set of values.
func (*Processor) DoAction ¶
func (processor *Processor) DoAction(action NodeAction, values ...interface{})
DoAction will perform the action for nodes matching values.
type ResourceLinker ¶
type ResourceLinker struct { insanelock.RWMutex // contains filtered or unexported fields }
ResourceLinker returns a resource linker. It listens for events from 2 graph events sources to determine if resources from one source should be linked with resources of the other source.
func NewResourceLinker ¶
func NewResourceLinker(g *Graph, glhs1 []ListenerHandler, glhs2 []ListenerHandler, linker Linker, m Metadata) *ResourceLinker
NewResourceLinker returns a new resource linker
func (*ResourceLinker) AddEventListener ¶
func (rl *ResourceLinker) AddEventListener(l LinkerEventListener)
AddEventListener subscribe a new linker listener
func (*ResourceLinker) RemoveEventListener ¶
func (rl *ResourceLinker) RemoveEventListener(l LinkerEventListener)
RemoveEventListener unsubscribe a linker listener
func (*ResourceLinker) Start ¶
func (rl *ResourceLinker) Start() error
Start linking resources by listening for graph events
type Time ¶
Time describes time type used in the graph
func (Time) MarshalJSON ¶
MarshalJSON custom marshalling function
func (*Time) UnmarshalJSON ¶
UnmarshalJSON custom unmarshalling function
type TimeSlice ¶
TimeSlice defines a time boudary values
func NewTimeSlice ¶
NewTimeSlice creates a new TimeSlice based on Start and Last
type TimedSearchQuery ¶
type TimedSearchQuery struct { filters.SearchQuery TimeFilter *filters.Filter ElementFilter *filters.Filter }
TimedSearchQuery describes a search query within a time slice and metadata filters