Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neighbors step #2389

Merged
merged 2 commits into from
Sep 8, 2021
Merged

Conversation

adrianlzt
Copy link
Contributor

Like Descendants, but using edges in any direction (Descendants only
uses edges from parent to child, Neighbors uses from parent to child and
from child to parent).

The different with the Both step, is Neighbors accumulate nodes seen.
Example (pseudo-syntax):
A -> B -> C
G.V(A).Out().Out() return: C.

But:
G.V(A).Neighbors(2) return: A,B,C

The parameters allowed are the same as in Descendants.
Example:
G.V('foo').Neighbors('RelationType',Within('ownership','foobar'),2)

@adrianlzt
Copy link
Contributor Author

adrianlzt commented Aug 6, 2021

Should be merged after PR #2391, needs GetNodesEdges method.

Do just one call to get all the edges for the given nodes, instead of
one call for each node.

This new call has been added as a new method to Graph and Backends.
GetNodesEdges, return the list with all edges for a list of nodes.

Batching is used to avoid hitting the max number of clauses set by ES
(is set to the default value of 512).
Like Descendants, but using edges in any direction (Descendants only
uses edges from parent to child, Neighbors uses from parent to child and
from child to parent).

The different with the Both step, is Neighbors accumulate nodes seen.
Example (pseudo-syntax):
A -> B -> C
G.V(A).Out().Out() return: C.

But:
G.V(A).Neighbors(2) return: A,B,C

The parameters allowed are the same as in Descendants.
Example:
G.V('foo').Neighbors('RelationType',Within('ownership','foobar'),2)

To improve speed and reduce backend load when using persistent backends,
a new method, GetNodesFromIDs, is implemented in Graph and Backends.
This method only uses one call (or a few in we have hundreds of nodes,
see batching) to get all nodes from the backend.

Batching is used to avoid hitting the max number of clauses set by ES
(is set to the default value of 512).
@lebauce
Copy link
Member

lebauce commented Sep 2, 2021

run skydive-k8s-tests
run skydive-ovn-k8s-tests

adrianlzt added a commit to datadope-io/skydive that referenced this pull request Sep 3, 2021
This two PRs add modifications to graffiti/graph/elasticsearch.go
skydive-project#2391
skydive-project#2389

And bugfix to sync more than 10k docs break the API used.
This commit adapt those two commits to use the new API (searchEdges and
searchNodes)
@lebauce lebauce merged commit 1bd869a into skydive-project:master Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants