run apache-rat.
Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/f416194c Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/f416194c Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/f416194c Branch: refs/heads/master Commit: f416194c11d97ee524a4c95852d42a5f0afb446d Parents: 39544dc Author: DO YUNG YOON <[email protected]> Authored: Sat Oct 28 09:32:53 2017 +0900 Committer: DO YUNG YOON <[email protected]> Committed: Mon Oct 30 10:12:22 2017 +0900 ---------------------------------------------------------------------- s2core/build.sbt | 3 +- .../scala/org/apache/s2graph/core/S2Graph.scala | 33 +++++++++++++-- .../s2graph/core/features/S2GraphFeatures.scala | 3 +- .../s2graph/core/storage/MutateResponse.scala | 19 +++++++++ .../apache/s2graph/core/storage/Storage.scala | 32 --------------- .../apache/s2graph/core/storage/StorageIO.scala | 19 +++++++++ .../core/storage/StorageManagement.scala | 19 +++++++++ .../s2graph/core/storage/StorageReadable.scala | 19 +++++++++ .../s2graph/core/storage/StorageSerDe.scala | 19 +++++++++ .../s2graph/core/storage/StorageWritable.scala | 19 +++++++++ .../storage/WriteWriteConflictResolver.scala | 19 +++++++++ .../hbase/AsynchbaseStorageManagement.scala | 19 +++++++++ .../hbase/AsynchbaseStorageReadable.scala | 21 +++++++++- .../storage/hbase/AsynchbaseStorageSerDe.scala | 19 +++++++++ .../hbase/AsynchbaseStorageWritable.scala | 19 +++++++++ .../s2graph/core/storage/StorageIOTest.scala | 42 +++++++++----------- .../core/storage/rocks/RocksStorageTest.scala | 33 --------------- 17 files changed, 261 insertions(+), 96 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/build.sbt ---------------------------------------------------------------------- diff --git a/s2core/build.sbt b/s2core/build.sbt index e7e602f..8033581 100644 --- a/s2core/build.sbt +++ b/s2core/build.sbt @@ -48,8 +48,7 @@ libraryDependencies ++= Seq( "org.specs2" %% "specs2-core" % specs2Version % "test", "org.apache.hadoop" % "hadoop-hdfs" % hadoopVersion , "org.apache.lucene" % "lucene-core" % "6.6.0", - "org.apache.lucene" % "lucene-queryparser" % "6.6.0", - "org.rocksdb" % "rocksdbjni" % "5.8.0" + "org.apache.lucene" % "lucene-queryparser" % "6.6.0" ) libraryDependencies := { http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala index 32724b4..92f68dc 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala @@ -31,7 +31,6 @@ import org.apache.s2graph.core.index.IndexProvider import org.apache.s2graph.core.io.tinkerpop.optimize.S2GraphStepStrategy import org.apache.s2graph.core.mysqls._ import org.apache.s2graph.core.storage.hbase.AsynchbaseStorage -import org.apache.s2graph.core.storage.rocks.RocksStorage import org.apache.s2graph.core.storage.{ MutateResponse, SKeyValue, Storage} import org.apache.s2graph.core.types._ import org.apache.s2graph.core.utils.{DeferCache, Extensions, logger} @@ -140,7 +139,6 @@ object S2Graph { storageBackend match { case "hbase" => new AsynchbaseStorage(graph, config) - case "rocks" => new RocksStorage(graph, config) case _ => throw new RuntimeException("not supported storage.") } } @@ -694,7 +692,7 @@ object S2Graph { // new Graph.OptOut(test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest$Traversals", method = "*", reason = "no"), // passed: all - + // new Graph.OptOut(test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.UnfoldTest$Traversals", method = "*", reason = "no"), // passed: all @@ -1145,7 +1143,7 @@ class S2Graph(_config: Config)(implicit val ec: ExecutionContext) extends Graph fallback } get } - + def getVertices(vertices: Seq[S2Vertex]): Future[Seq[S2Vertex]] = { def getVertices[Q](storage: Storage[Q])(vertices: Seq[S2Vertex]): Future[Seq[S2Vertex]] = { def fromResult(kvs: Seq[SKeyValue], @@ -1673,6 +1671,33 @@ class S2Graph(_config: Config)(implicit val ec: ExecutionContext) extends Graph vertex } + def toRequestEdge(queryRequest: QueryRequest, parentEdges: Seq[EdgeWithScore]): S2Edge = { + val srcVertex = queryRequest.vertex + val queryParam = queryRequest.queryParam + val tgtVertexIdOpt = queryParam.tgtVertexInnerIdOpt + val label = queryParam.label + val labelWithDir = queryParam.labelWithDir + val (srcColumn, tgtColumn) = label.srcTgtColumn(labelWithDir.dir) + val propsWithTs = label.EmptyPropsWithTs + + tgtVertexIdOpt match { + case Some(tgtVertexId) => // _to is given. + /* we use toSnapshotEdge so dont need to swap src, tgt */ + val src = srcVertex.innerId + val tgt = tgtVertexId + val (srcVId, tgtVId) = (SourceVertexId(srcColumn, src), TargetVertexId(tgtColumn, tgt)) + val (srcV, tgtV) = (newVertex(srcVId), newVertex(tgtVId)) + + newEdge(srcV, tgtV, label, labelWithDir.dir, propsWithTs = propsWithTs) + case None => + val src = srcVertex.innerId + val srcVId = SourceVertexId(srcColumn, src) + val srcV = newVertex(srcVId) + + newEdge(srcV, srcV, label, labelWithDir.dir, propsWithTs = propsWithTs, parentEdges = parentEdges) + } + } + /** * helper to create new Edge instance from given parameters on memory(not actually stored in storage). * http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/features/S2GraphFeatures.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/features/S2GraphFeatures.scala b/s2core/src/main/scala/org/apache/s2graph/core/features/S2GraphFeatures.scala index e2c4179..e21ffc8 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/features/S2GraphFeatures.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/features/S2GraphFeatures.scala @@ -22,8 +22,9 @@ package org.apache.s2graph.core.features import org.apache.tinkerpop.gremlin.structure.Graph.Features import org.apache.tinkerpop.gremlin.structure.Graph.Features.GraphFeatures - class S2GraphFeatures extends GraphFeatures { + + override def supportsComputer(): Boolean = false override def supportsThreadedTransactions(): Boolean = false http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/MutateResponse.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/MutateResponse.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/MutateResponse.scala index bed1152..a726d17 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/MutateResponse.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/MutateResponse.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage object MutateResponse { http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/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 c9353e1..2fe6e42 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 @@ -25,40 +25,8 @@ import org.apache.s2graph.core._ import org.apache.s2graph.core.storage.serde.Deserializable import org.apache.s2graph.core.storage.serde.indexedge.tall.IndexEdgeDeserializable import org.apache.s2graph.core.types._ - import scala.concurrent.{ExecutionContext, Future} -object Storage { - def toRequestEdge(graph: S2Graph)(queryRequest: QueryRequest, parentEdges: Seq[EdgeWithScore]): S2Edge = { - val srcVertex = queryRequest.vertex - val queryParam = queryRequest.queryParam - val tgtVertexIdOpt = queryParam.tgtVertexInnerIdOpt - val label = queryParam.label - val labelWithDir = queryParam.labelWithDir - val (srcColumn, tgtColumn) = label.srcTgtColumn(labelWithDir.dir) - val propsWithTs = label.EmptyPropsWithTs - - tgtVertexIdOpt match { - case Some(tgtVertexId) => // _to is given. - /* we use toSnapshotEdge so dont need to swap src, tgt */ - val src = srcVertex.innerId - val tgt = tgtVertexId - val (srcVId, tgtVId) = (SourceVertexId(srcColumn, src), TargetVertexId(tgtColumn, tgt)) - val (srcV, tgtV) = (graph.newVertex(srcVId), graph.newVertex(tgtVId)) - - graph.newEdge(srcV, tgtV, label, labelWithDir.dir, propsWithTs = propsWithTs) - case None => - val src = srcVertex.innerId - val srcVId = SourceVertexId(srcColumn, src) - val srcV = graph.newVertex(srcVId) - - graph.newEdge(srcV, srcV, label, labelWithDir.dir, propsWithTs = propsWithTs, parentEdges = parentEdges) - } - } - - -} - abstract class Storage[Q](val graph: S2Graph, val config: Config) { /* Storage backend specific resource management */ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageIO.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageIO.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageIO.scala index 2e11f0b..67033f0 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageIO.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageIO.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage import org.apache.hadoop.hbase.util.Bytes http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageManagement.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageManagement.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageManagement.scala index da94767..72a0b69 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageManagement.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageManagement.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage import com.typesafe.config.Config http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageReadable.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageReadable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageReadable.scala index 96669ca..7a0d8ef 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageReadable.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageReadable.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage import org.apache.s2graph.core.GraphExceptions.FetchTimeoutException http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageSerDe.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageSerDe.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageSerDe.scala index f973e0f..15b3576 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageSerDe.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageSerDe.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage import org.apache.s2graph.core.{IndexEdge, S2Graph, S2Vertex, SnapshotEdge} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageWritable.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageWritable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageWritable.scala index 216aece..80da3a9 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageWritable.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/StorageWritable.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage import scala.concurrent.{ExecutionContext, Future} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/WriteWriteConflictResolver.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/WriteWriteConflictResolver.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/WriteWriteConflictResolver.scala index eab5cab..79b764d 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/WriteWriteConflictResolver.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/WriteWriteConflictResolver.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage import java.util.concurrent.{Executors, TimeUnit} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageManagement.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageManagement.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageManagement.scala index c55c6c7..0fb3173 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageManagement.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageManagement.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage.hbase import java.util.concurrent.{Executors, TimeUnit} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageReadable.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageReadable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageReadable.scala index 4ef95b8..1cb6109 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageReadable.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageReadable.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage.hbase import java.util @@ -272,7 +291,7 @@ class AsynchbaseStorageReadable(val graph: S2Graph, val cacheTTL = queryParam.cacheTTLInMillis /* with version 4, request's type is (Scanner, (Int, Int)). otherwise GetRequest. */ - val edge = Storage.toRequestEdge(graph)(queryRequest, parentEdges) + val edge = graph.toRequestEdge(queryRequest, parentEdges) val request = buildRequest(queryRequest, edge) val (intervalMaxBytes, intervalMinBytes) = queryParam.buildInterval(Option(edge)) http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageSerDe.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageSerDe.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageSerDe.scala index ab1ff19..1bdd74e 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageSerDe.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageSerDe.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage.hbase import org.apache.s2graph.core.storage.serde.Deserializable http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageWritable.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageWritable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageWritable.scala index 1f7d863..7ca3782 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageWritable.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/hbase/AsynchbaseStorageWritable.scala @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage.hbase import org.apache.hadoop.hbase.util.Bytes http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala index fd9d2b3..a05be79 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/storage/StorageIOTest.scala @@ -1,8 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package org.apache.s2graph.core.storage import org.apache.s2graph.core.mysqls._ import org.apache.s2graph.core.storage.hbase.AsynchbaseStorageSerDe -import org.apache.s2graph.core.storage.rocks.RocksStorageSerDe import org.apache.s2graph.core.storage.serde.{StorageDeserializable, StorageSerializable} import org.apache.s2graph.core.{S2Vertex, TestCommonWithModels} import org.scalatest.{FunSuite, Matchers} @@ -34,26 +52,4 @@ class StorageIOTest extends FunSuite with Matchers with TestCommonWithModels { check(vertex, serDe.vertexSerializer, serDe.vertexDeserializer(vertex.serviceColumn.schemaVersion)) } - test("RocksStorageIO: VertexSerializer/Deserializer") { - def check(vertex: S2Vertex, - op: S2Vertex => StorageSerializable[S2Vertex], - deserializer: StorageDeserializable[S2Vertex]): Boolean = { - val sKeyValues = op(vertex).toKeyValues - val deserialized = deserializer.fromKeyValues(sKeyValues, None) - vertex == deserialized - } - - val serDe: StorageSerDe = new RocksStorageSerDe(graph) - val service = Service.findByName(serviceName, useCache = false).getOrElse { - throw new IllegalStateException("service not found.") - } - val column = ServiceColumn.find(service.id.get, columnName).getOrElse { - throw new IllegalStateException("column not found.") - } - - val vertexId = graph.newVertexId(service, column, 1L) - val vertex = graph.newVertex(vertexId) - - check(vertex, serDe.vertexSerializer, serDe.vertexDeserializer(vertex.serviceColumn.schemaVersion)) - } } http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/f416194c/s2core/src/test/scala/org/apache/s2graph/core/storage/rocks/RocksStorageTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/storage/rocks/RocksStorageTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/storage/rocks/RocksStorageTest.scala deleted file mode 100644 index 8a8a532..0000000 --- a/s2core/src/test/scala/org/apache/s2graph/core/storage/rocks/RocksStorageTest.scala +++ /dev/null @@ -1,33 +0,0 @@ -package org.apache.s2graph.core.storage.rocks - -import org.apache.s2graph.core.TestCommonWithModels -import org.apache.s2graph.core.mysqls.{Service, ServiceColumn} -import org.apache.tinkerpop.gremlin.structure.T -import org.scalatest.{FunSuite, Matchers} - -import scala.collection.JavaConversions._ - -class RocksStorageTest extends FunSuite with Matchers with TestCommonWithModels { - initTests() - - test("VertexTest: shouldNotGetConcurrentModificationException()") { - val service = Service.findByName(serviceName, useCache = false).getOrElse { - throw new IllegalStateException("service not found.") - } - val column = ServiceColumn.find(service.id.get, columnName).getOrElse { - throw new IllegalStateException("column not found.") - } - - val vertexId = graph.newVertexId(service, column, 1L) - - val vertex = graph.newVertex(vertexId) - for (i <- (0 until 10)) { - vertex.addEdge(labelName, vertex) - } - - println(graph.edges().toSeq) - println("*" * 100) - vertex.remove() - println(graph.vertices().toSeq) - } -}
