skip storing vertex's belongsTo property when insert edge unless label's extra
option is set as {"skipVertex": false}.
Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/b5a44d93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/b5a44d93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/b5a44d93
Branch: refs/heads/master
Commit: b5a44d9321c46f2d4c3296ea6d05e0198bd06e3c
Parents: 03af01e
Author: DO YUNG YOON <[email protected]>
Authored: Tue Mar 29 17:34:20 2016 +0900
Committer: DO YUNG YOON <[email protected]>
Committed: Thu Nov 10 06:05:37 2016 +0900
----------------------------------------------------------------------
.../org/apache/s2graph/core/storage/Storage.scala | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/b5a44d93/s2core/src/main/scala/org/apache/s2graph/core/storage/Storage.scala
----------------------------------------------------------------------
diff --git
a/s2core/src/main/scala/org/apache/s2graph/core/storage/Storage.scala
b/s2core/src/main/scala/org/apache/s2graph/core/storage/Storage.scala
index 70e47a7..f5cc4f4 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/Storage.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/Storage.scala
@@ -326,6 +326,7 @@ abstract class Storage[R](val config: Config)(implicit ec:
ExecutionContext) {
val (_, edgeUpdate) =
if (edge.op == GraphUtil.operations("delete"))
Edge.buildDeleteBulk(None, edge)
else Edge.buildOperation(None, Seq(edge))
+
buildVertexPutsAsync(edge) ++ indexedEdgeMutations(edgeUpdate) ++
snapshotEdgeMutations(edgeUpdate) ++ increments(edgeUpdate)
}
@@ -1322,10 +1323,15 @@ abstract class Storage[R](val config: Config)(implicit
ec: ExecutionContext) {
}
def buildVertexPutsAsync(edge: Edge): Seq[SKeyValue] =
- if (edge.op == GraphUtil.operations("delete"))
- buildDeleteBelongsToId(edge.srcForVertex) ++
buildDeleteBelongsToId(edge.tgtForVertex)
- else
- vertexSerializer(edge.srcForVertex).toKeyValues ++
vertexSerializer(edge.tgtForVertex).toKeyValues
+ edge.label.extraOptions.get("skipVertex") match {
+ case Some(v) if v == false =>
+ if (edge.op == GraphUtil.operations("delete"))
+ buildDeleteBelongsToId(edge.srcForVertex) ++
buildDeleteBelongsToId(edge.tgtForVertex)
+ else
+ vertexSerializer(edge.srcForVertex).toKeyValues ++
vertexSerializer(edge.tgtForVertex).toKeyValues
+ case _ => Seq.empty
+ }
+
def buildPutsAll(vertex: Vertex): Seq[SKeyValue] = {
vertex.op match {