Repository: incubator-s2graph Updated Branches: refs/heads/master a18ec278e -> e674a2550
http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala index 44d4a2a..c5daa99 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala @@ -21,7 +21,7 @@ package org.apache.s2graph.core.storage.serde.snapshotedge.wide import org.apache.hadoop.hbase.util.Bytes import org.apache.s2graph.core.{S2Edge, SnapshotEdge} -import org.apache.s2graph.core.mysqls.LabelIndex +import org.apache.s2graph.core.schema.LabelIndex import org.apache.s2graph.core.storage.serde.Serializable import org.apache.s2graph.core.storage.serde.StorageSerializable._ import org.apache.s2graph.core.types.VertexId http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/tall/VertexDeserializable.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/tall/VertexDeserializable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/tall/VertexDeserializable.scala index 2a7cd6a..a1f5705 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/tall/VertexDeserializable.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/tall/VertexDeserializable.scala @@ -19,7 +19,7 @@ package org.apache.s2graph.core.storage.serde.vertex.tall -import org.apache.s2graph.core.mysqls.ColumnMeta +import org.apache.s2graph.core.schema.ColumnMeta import org.apache.s2graph.core.storage.CanSKeyValue import org.apache.s2graph.core.storage.serde.Deserializable import org.apache.s2graph.core.storage.serde.StorageDeserializable._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/wide/VertexDeserializable.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/wide/VertexDeserializable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/wide/VertexDeserializable.scala index d1d4d7d..f27cc5c 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/wide/VertexDeserializable.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/vertex/wide/VertexDeserializable.scala @@ -19,7 +19,7 @@ package org.apache.s2graph.core.storage.serde.vertex.wide -import org.apache.s2graph.core.mysqls.ColumnMeta +import org.apache.s2graph.core.schema.ColumnMeta import org.apache.s2graph.core.storage.CanSKeyValue import org.apache.s2graph.core.storage.serde.Deserializable import org.apache.s2graph.core.storage.serde.StorageDeserializable._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/main/scala/org/apache/s2graph/core/types/HBaseType.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/types/HBaseType.scala b/s2core/src/main/scala/org/apache/s2graph/core/types/HBaseType.scala index 77951c0..f88509f 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/types/HBaseType.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/types/HBaseType.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.core.types import org.apache.hadoop.hbase.util.Bytes -import org.apache.s2graph.core.mysqls.LabelMeta +import org.apache.s2graph.core.schema.LabelMeta object HBaseType { val VERSION4 = "v4" http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala b/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala index b1de0c4..1ad56b3 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala @@ -21,7 +21,7 @@ package org.apache.s2graph.core.types import org.apache.hadoop.hbase.util.Bytes import org.apache.s2graph.core.{GraphUtil, S2Vertex} -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.core.types.HBaseType._ import org.apache.s2graph.core.io.Conversions._ import play.api.libs.json.Json http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/main/scala/org/apache/s2graph/core/utils/Logger.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/utils/Logger.scala b/s2core/src/main/scala/org/apache/s2graph/core/utils/Logger.scala index b402c0f..36c1a6d 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/utils/Logger.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/utils/Logger.scala @@ -19,12 +19,15 @@ package org.apache.s2graph.core.utils +import com.typesafe.config.ConfigFactory import org.slf4j.LoggerFactory import play.api.libs.json.JsValue import scala.language.{higherKinds, implicitConversions} +import scala.util.{Random, Try} object logger { + val conf = ConfigFactory.load() trait Loggable[T] { def toLogMessage(msg: T): String @@ -53,12 +56,17 @@ object logger { private val metricLogger = LoggerFactory.getLogger("metrics") private val queryLogger = LoggerFactory.getLogger("query") private val malformedLogger = LoggerFactory.getLogger("malformed") + private val syncLogger = LoggerFactory.getLogger("meta_sync") def metric[T: Loggable](msg: => T) = metricLogger.info(implicitly[Loggable[T]].toLogMessage(msg)) + def syncInfo[T: Loggable](msg: => T) = syncLogger.info(implicitly[Loggable[T]].toLogMessage(msg)) + def info[T: Loggable](msg: => T) = logger.info(implicitly[Loggable[T]].toLogMessage(msg)) - def debug[T: Loggable](msg: => T) = logger.debug(implicitly[Loggable[T]].toLogMessage(msg)) + def warn[T: Loggable](msg: => T) = logger.warn(implicitly[Loggable[T]].toLogMessage(msg)) + + def debug[T: Loggable](msg: => T) = if (logger.isDebugEnabled) logger.debug(implicitly[Loggable[T]].toLogMessage(msg)) def error[T: Loggable](msg: => T, exception: => Throwable) = errorLogger.error(implicitly[Loggable[T]].toLogMessage(msg), exception) http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/main/scala/org/apache/s2graph/core/utils/SafeUpdateCache.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/utils/SafeUpdateCache.scala b/s2core/src/main/scala/org/apache/s2graph/core/utils/SafeUpdateCache.scala index a98104c..cc9bd4b 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/utils/SafeUpdateCache.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/utils/SafeUpdateCache.scala @@ -19,60 +19,123 @@ package org.apache.s2graph.core.utils +import java.io._ import java.util.concurrent.atomic.AtomicBoolean import com.google.common.cache.CacheBuilder - +import com.google.common.hash.Hashing import scala.collection.JavaConversions._ import scala.concurrent.{ExecutionContext, Future} -import scala.util.{Failure, Success} +import scala.util.{Failure, Success, Try} object SafeUpdateCache { case class CacheKey(key: String) + def serialise(value: AnyRef): Try[Array[Byte]] = { + import scala.pickling.Defaults._ + import scala.pickling.binary._ + + val result = Try(value.pickle.value) + result.failed.foreach { e => + logger.syncInfo(s"[Serialise failed]: ${value}, ${e}") + } + + result + } + + def deserialise(bytes: Array[Byte]): Try[AnyRef] = { + import scala.pickling.Defaults._ + import scala.pickling.binary._ + + Try(BinaryPickle(bytes).unpickle[AnyRef]) + } + + def fromBytes(cache: SafeUpdateCache, bytes: Array[Byte]): Unit = { + import org.apache.hadoop.io.WritableUtils + + val bais = new ByteArrayInputStream(bytes) + val input = new DataInputStream(bais) + + try { + val size = WritableUtils.readVInt(input) + (1 to size).foreach { ith => + val cacheKey = WritableUtils.readVLong(input) + val value = deserialise(WritableUtils.readCompressedByteArray(input)) + value.foreach { dsv => + cache.putInner(cacheKey, dsv) + } + } + } finally { + bais.close() + input.close() + } + } } -class SafeUpdateCache[T](prefix: String, maxSize: Int, ttl: Int)(implicit executionContext: ExecutionContext) { +class SafeUpdateCache(maxSize: Int, + ttl: Int) + (implicit executionContext: ExecutionContext) { + import java.lang.{Long => JLong} import SafeUpdateCache._ - implicit class StringOps(key: String) { - def toCacheKey = new CacheKey(prefix + ":" + key) + private val cache = CacheBuilder.newBuilder().maximumSize(maxSize) + .build[JLong, (AnyRef, Int, AtomicBoolean)]() + + private def toCacheKey(key: String): Long = { + Hashing.murmur3_128().hashBytes(key.getBytes("UTF-8")).asLong() } - def toTs() = (System.currentTimeMillis() / 1000).toInt + private def toTs() = (System.currentTimeMillis() / 1000).toInt - private val cache = CacheBuilder.newBuilder().maximumSize(maxSize).build[CacheKey, (T, Int, AtomicBoolean)]() + def put(key: String, value: AnyRef, broadcast: Boolean = false): Unit = { + val cacheKey = toCacheKey(key) + cache.put(cacheKey, (value, toTs, new AtomicBoolean(false))) + } + + def putInner(cacheKey: Long, value: AnyRef): Unit = { + cache.put(cacheKey, (value, toTs, new AtomicBoolean(false))) + } - def put(key: String, value: T) = cache.put(key.toCacheKey, (value, toTs, new AtomicBoolean(false))) + def invalidate(key: String, broadcast: Boolean = true) = { + val cacheKey = toCacheKey(key) + cache.invalidate(cacheKey) + } - def invalidate(key: String) = cache.invalidate(key.toCacheKey) + def invalidateInner(cacheKey: Long): Unit = { + cache.invalidate(cacheKey) + } - def withCache(key: String)(op: => T): T = { - val cacheKey = key.toCacheKey + def withCache[T <: AnyRef](key: String, broadcast: Boolean)(op: => T): T = { + val cacheKey = toCacheKey(key) val cachedValWithTs = cache.getIfPresent(cacheKey) if (cachedValWithTs == null) { + val value = op // fetch and update cache. - val newValue = op - cache.put(cacheKey, (newValue, toTs(), new AtomicBoolean(false))) - newValue + put(key, value, broadcast) + value } else { - val (cachedVal, updatedAt, isUpdating) = cachedValWithTs + val (_cachedVal, updatedAt, isUpdating) = cachedValWithTs + val cachedVal = _cachedVal.asInstanceOf[T] + if (toTs() < updatedAt + ttl) cachedVal // in cache TTL else { val running = isUpdating.getAndSet(true) + if (running) cachedVal else { - Future(op)(executionContext) onComplete { + val value = op + Future(value)(executionContext) onComplete { case Failure(ex) => - cache.put(cacheKey, (cachedVal, toTs(), new AtomicBoolean(false))) // keep old value - logger.error(s"withCache update failed: $cacheKey") + put(key, cachedVal, false) + logger.error(s"withCache update failed: $cacheKey", ex) case Success(newValue) => - cache.put(cacheKey, (newValue, toTs(), new AtomicBoolean(false))) // update new value + put(key, newValue, broadcast = (broadcast && newValue != cachedVal)) logger.info(s"withCache update success: $cacheKey") } + cachedVal } } @@ -81,10 +144,35 @@ class SafeUpdateCache[T](prefix: String, maxSize: Int, ttl: Int)(implicit execut def invalidateAll() = cache.invalidateAll() - def getAllData() : List[(String, T)] = { - cache.asMap().map { case (key, value) => - (key.key.substring(prefix.size + 1), value._1) - }.toList + def asMap() = cache.asMap() + + def get(key: String) = cache.asMap().get(toCacheKey(key)) + + def toBytes(): Array[Byte] = { + import org.apache.hadoop.io.WritableUtils + val baos = new ByteArrayOutputStream() + val output = new DataOutputStream(baos) + + try { + val m = cache.asMap() + val size = m.size() + + WritableUtils.writeVInt(output, size) + for (key <- m.keys) { + val (value, _, _) = m.get(key) + WritableUtils.writeVLong(output, key) + serialise(value).foreach { sv => + WritableUtils.writeCompressedByteArray(output, sv) + } + } + output.flush() + baos.toByteArray + } finally { + baos.close() + output.close() + } } + + def shutdown() = {} } http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/main/scala/org/apache/s2graph/core/utils/Sync.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/utils/Sync.scala b/s2core/src/main/scala/org/apache/s2graph/core/utils/Sync.scala new file mode 100644 index 0000000..fb5dbe6 --- /dev/null +++ b/s2core/src/main/scala/org/apache/s2graph/core/utils/Sync.scala @@ -0,0 +1,181 @@ +//package org.apache.s2graph.core.utils +// +//import java.util.Properties +// +//import io.reactivex._ +//import io.reactivex.schedulers.Schedulers +//import org.apache.kafka.clients.consumer.KafkaConsumer +//import org.apache.kafka.clients.producer.{Callback, KafkaProducer, ProducerRecord, RecordMetadata} +//import org.apache.s2graph.core.ExceptionHandler +// +// +//trait Sync[VALUE] { +// type KV = (String, VALUE) +// +// val EmptyValue: VALUE +// val SyncId: String +// val SkipSelfBroadcast: Boolean +// +// val delim = "___" // ! do not change +// +// // public +// val emitter = io.reactivex.processors.PublishProcessor.create[KV]() +// +// def send(key: String): Unit = send(key, EmptyValue) +// +// def send(key: String, value: VALUE): Unit = sendImpl(encodeKey(key), value) +// +// def shutdown(): Unit = { +// emitter.onComplete() +// } +// +// protected def emit(kv: KV): Unit = { +// val (encodedKey, value) = kv +// val (sid, key) = decodeKey(encodedKey) +// +// if (SkipSelfBroadcast && sid == SyncId) { +// logger.syncInfo(s"[Message ignore] sent by self: ${SyncId}") +// // pass +// } else { +// emitter.onNext(key -> value) +// logger.syncInfo(s"[Message emit success]: selfId: ${SyncId}, from: ${sid}") +// } +// } +// +// protected def sendImpl(key: String, value: VALUE): Unit +// +// private def encodeKey(key: String): String = s"${SyncId}${delim}${key}" +// +// private def decodeKey(key: String): (String, String) = { +// val Array(cid, decodedKey) = key.split(delim) +// cid -> decodedKey +// } +//} +// +//class MemorySync(syncId: String) extends Sync[Array[Byte]] { +// +// override val EmptyValue: Array[Byte] = Array.empty[Byte] +// +// override val SyncId: String = syncId +// +// override val SkipSelfBroadcast: Boolean = false +// +// override protected def sendImpl(key: String, value: Array[Byte]): Unit = emit(key -> value) +//} +// +//object KafkaSync { +// +// import java.util.Properties +// +// val keySerializer = "org.apache.kafka.common.serialization.StringSerializer" +// val valueSerializer = "org.apache.kafka.common.serialization.ByteArraySerializer" +// val keyDeserializer = "org.apache.kafka.common.serialization.StringDeserializer" +// val valueDeserializer = "org.apache.kafka.common.serialization.ByteArrayDeserializer" +// +// val maxMessageSize = "15728640" // 15 MB +// +// def producerConfig(brokers: String): Properties = { +// val props = ExceptionHandler.toKafkaProp(brokers) +// +// props.setProperty("key.serializer", keySerializer) +// props.setProperty("value.serializer", valueSerializer) +// props.setProperty("message.max.bytes", maxMessageSize) +// props.setProperty("max.request.size", maxMessageSize) +// +// +// props +// } +// +// def consumerConfig(brokers: String, groupId: String): Properties = { +// val props = new Properties() +// +// props.put("bootstrap.servers", brokers) +// props.put("group.id", groupId) +// props.put("enable.auto.commit", "false") +// props.put("key.deserializer", keyDeserializer) +// props.put("value.deserializer", valueDeserializer) +// props.put("max.partition.fetch.bytes", maxMessageSize) +// props.put("fetch.message.max.bytes", maxMessageSize) +// +// props +// } +//} +// +//class KafkaSync(topic: String, +// syncId: String, +// producerConfig: Properties, +// consumerConfig: Properties, +// skipSelfBroadcast: Boolean = true, +// seekTo: String = "end" +// ) extends Sync[Array[Byte]] { +// +// type VALUE = Array[Byte] +// +// val consumerTimeout: Int = 1000 +// +// override val EmptyValue = Array.empty[Byte] +// +// override val SyncId = syncId +// +// override val SkipSelfBroadcast: Boolean = skipSelfBroadcast +// +// lazy val producer = new KafkaProducer[String, VALUE](producerConfig) +// +// lazy val consumer = { +// import scala.collection.JavaConverters._ +// +// val kc = new KafkaConsumer[String, VALUE](consumerConfig) +// kc.subscribe(Seq(topic).asJava) +// kc.poll(consumerTimeout * 10) // Just for meta info sync +// +// if (seekTo == "end") { +// kc.seekToEnd(kc.assignment()) +// } else if (seekTo == "beginning") { +// kc.seekToBeginning(kc.assignment()) +// } else { +// // pass +// } +// +// kc +// } +// +// // Emit event from kafka consumer: Flowable is just for while loop, not for Observabl +// Flowable.create(new FlowableOnSubscribe[KV] { +// import scala.collection.JavaConverters._ +// +// override def subscribe(e: FlowableEmitter[KV]) = { +// while (true) { +// val ls = consumer.poll(consumerTimeout).asScala.map(record => record.key() -> record.value()) +// ls.foreach(emit) +// +// if (ls.nonEmpty) { +// consumer.commitSync() +// logger.syncInfo(s"[Kafka consume success]: message size: ${ls.size}]") +// } +// } +// +// e.onComplete() +// } +// }, BackpressureStrategy.BUFFER).subscribeOn(Schedulers.single()).subscribe() +// +// override protected def sendImpl(key: String, value: VALUE): Unit = { +// val record = new ProducerRecord[String, VALUE](topic, key, value) +// +// producer.send(record, new Callback { +// override def onCompletion(metadata: RecordMetadata, exception: Exception) = { +// if (exception != null) { +// logger.syncInfo(s"[Kafka produce failed]: from: key: ${key} e: ${exception}") +// } else { +// logger.syncInfo(s"[Kafka produce success]: from: ${SyncId} ${metadata}") +// } +// } +// }) +// } +// +// override def shutdown(): Unit = { +// super.shutdown() +// +// producer.close() +// consumer.close() +// } +//} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/resources/reference.conf ---------------------------------------------------------------------- diff --git a/s2core/src/test/resources/reference.conf b/s2core/src/test/resources/reference.conf new file mode 100644 index 0000000..d7fe546 --- /dev/null +++ b/s2core/src/test/resources/reference.conf @@ -0,0 +1,61 @@ +# +# 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. +# + +# APP PHASE +phase = test + +host = localhost + +# Hbase +hbase.table.compression.algorithm="gz" +hbase.zookeeper.quorum=${host} + +# Asynchbase +hbase.client.retries.number=100 +hbase.rpcs.buffered_flush_interval=100 +hbase.rpc.timeout=0 + +# local retry number +max.retry.number=100 +max.back.off=50 + +# Future cache. +future.cache.max.size=100000 +future.cache.expire.after.write=10000 +future.cache.expire.after.access=5000 +future.cache.metric.interval=60000 + +# Local Cache +cache.ttl.seconds=60 +cache.max.size=100000 + +# DB +s2graph.models.table.name = "models-dev" + +db.default.driver = "org.h2.Driver" +db.default.url = "jdbc:h2:file:./var/metastore;MODE=MYSQL" +db.default.user = "sa" +db.default.password = "sa" + + +akka { + loggers = ["akka.event.slf4j.Slf4jLogger"] + loglevel = "DEBUG" +} + http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/Integrate/CrudTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/Integrate/CrudTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/Integrate/CrudTest.scala index 4ed7905..1baa89d 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/Integrate/CrudTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/Integrate/CrudTest.scala @@ -19,7 +19,7 @@ package org.apache.s2graph.core.Integrate -import org.apache.s2graph.core.mysqls.{Label, LabelMeta} +import org.apache.s2graph.core.schema.{Label, LabelMeta} import org.apache.s2graph.core.utils.logger import play.api.libs.json.{JsObject, Json} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala b/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala index c7d9f59..0177543 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.core.Integrate import com.typesafe.config._ -import org.apache.s2graph.core.mysqls.{GlobalIndex, Label, Model} +import org.apache.s2graph.core.schema.{GlobalIndex, Label, Schema} import org.apache.s2graph.core.rest.{RequestParser, RestHandler} import org.apache.s2graph.core.utils.logger import org.apache.s2graph.core._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/ManagementTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/ManagementTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/ManagementTest.scala index b2c1113..c2ca367 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/ManagementTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/ManagementTest.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.core import org.apache.s2graph.core.Integrate.IntegrateCommon -import org.apache.s2graph.core.mysqls.Label +import org.apache.s2graph.core.schema.Label import play.api.libs.json.Json class ManagementTest extends IntegrateCommon { http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/S2EdgeTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/S2EdgeTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/S2EdgeTest.scala index 2b439bc..05096e1 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/S2EdgeTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/S2EdgeTest.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.core import org.apache.s2graph.core.JSONParser._ -import org.apache.s2graph.core.mysqls.{ServiceColumn, LabelMeta} +import org.apache.s2graph.core.schema.{ServiceColumn, LabelMeta} import org.apache.s2graph.core.types.{InnerVal, InnerValLikeWithTs, VertexId} import org.apache.s2graph.core.utils.logger import org.scalatest.FunSuite http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/TestCommon.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/TestCommon.scala b/s2core/src/test/scala/org/apache/s2graph/core/TestCommon.scala index 3f6cd2a..ea43a76 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/TestCommon.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/TestCommon.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.core import org.apache.hadoop.hbase.util.Bytes -import org.apache.s2graph.core.mysqls.{LabelIndex, LabelMeta} +import org.apache.s2graph.core.schema.{LabelIndex, LabelMeta} import org.apache.s2graph.core.types.{HBaseType, InnerVal, InnerValLikeWithTs, LabelWithDirection} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/TestCommonWithModels.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/TestCommonWithModels.scala b/s2core/src/test/scala/org/apache/s2graph/core/TestCommonWithModels.scala index 6ac77e4..488b294 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/TestCommonWithModels.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/TestCommonWithModels.scala @@ -21,7 +21,7 @@ package org.apache.s2graph.core import com.typesafe.config.{Config, ConfigFactory} import org.apache.s2graph.core.Management.JsonModel.{Index, Prop} -import org.apache.s2graph.core.mysqls.{Label, LabelIndex, Service, ServiceColumn} +import org.apache.s2graph.core.schema.{Label, LabelIndex, Service, ServiceColumn} import org.apache.s2graph.core.types.{InnerVal, LabelWithDirection} import scalikejdbc.AutoSession http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/benchmark/GraphUtilSpec.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/benchmark/GraphUtilSpec.scala b/s2core/src/test/scala/org/apache/s2graph/core/benchmark/GraphUtilSpec.scala index 03ea50a..87e09bc 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/benchmark/GraphUtilSpec.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/benchmark/GraphUtilSpec.scala @@ -21,7 +21,7 @@ package org.apache.s2graph.core.benchmark import org.apache.hadoop.hbase.util.Bytes import org.apache.s2graph.core.GraphUtil -import org.apache.s2graph.core.mysqls.ServiceColumn +import org.apache.s2graph.core.schema.ServiceColumn import org.apache.s2graph.core.types.{HBaseType, InnerVal, SourceVertexId} import scala.collection.mutable http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala index a5349dc..4a87cb2 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/index/IndexProviderTest.scala @@ -23,7 +23,7 @@ import org.apache.s2graph.core.Integrate.IntegrateCommon import org.apache.s2graph.core._ import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer import org.apache.tinkerpop.gremlin.process.traversal.{Order, P} -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.core.types.{InnerVal, InnerValLikeWithTs} import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper import org.apache.tinkerpop.gremlin.structure.T http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/io/ConversionTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/io/ConversionTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/io/ConversionTest.scala index bc53e2f..d44bbe7 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/io/ConversionTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/io/ConversionTest.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.core.io //import org.apache.s2graph.core.{EdgeId, S2VertexPropertyId} -import org.apache.s2graph.core.mysqls.{ColumnMeta, Service, ServiceColumn} +import org.apache.s2graph.core.schema.{ColumnMeta, Service, ServiceColumn} import org.apache.s2graph.core.types.{InnerVal, VertexId} import org.apache.s2graph.core.utils.logger import org.scalatest.{FunSuite, Matchers} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/models/ModelTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/models/ModelTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/models/ModelTest.scala deleted file mode 100644 index 87a84ae..0000000 --- a/s2core/src/test/scala/org/apache/s2graph/core/models/ModelTest.scala +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.models - -import org.apache.s2graph.core.TestCommonWithModels -import org.apache.s2graph.core.mysqls.Label -import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers} - -class ModelTest extends FunSuite with Matchers with TestCommonWithModels with BeforeAndAfterAll { - override def beforeAll(): Unit = { - initTests() - } - - override def afterAll(): Unit = { - graph.shutdown() - } - - test("test Label.findByName") { - val labelOpt = Label.findByName(labelName, useCache = false) - println(labelOpt) - labelOpt.isDefined shouldBe true - val indices = labelOpt.get.indices - indices.size > 0 shouldBe true - println(indices) - val defaultIndexOpt = labelOpt.get.defaultIndex - println(defaultIndexOpt) - defaultIndexOpt.isDefined shouldBe true - val metas = labelOpt.get.metaProps - println(metas) - metas.size > 0 shouldBe true - val srcService = labelOpt.get.srcService - println(srcService) - val tgtService = labelOpt.get.tgtService - println(tgtService) - val service = labelOpt.get.service - println(service) - val srcColumn = labelOpt.get.srcService - println(srcColumn) - val tgtColumn = labelOpt.get.tgtService - println(tgtColumn) - } -} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala index 0920a89..342d9c6 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/parsers/WhereParserTest.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.core.parsers import org.apache.s2graph.core._ -import org.apache.s2graph.core.mysqls.{ServiceColumn, Label, LabelMeta} +import org.apache.s2graph.core.schema.{ServiceColumn, Label, LabelMeta} import org.apache.s2graph.core.rest.TemplateHelper import org.apache.s2graph.core.types._ import org.apache.s2graph.core.utils.logger http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/schema/SchemaTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/schema/SchemaTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/schema/SchemaTest.scala new file mode 100644 index 0000000..1843a57 --- /dev/null +++ b/s2core/src/test/scala/org/apache/s2graph/core/schema/SchemaTest.scala @@ -0,0 +1,77 @@ +/* + * 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.schema + +import org.apache.s2graph.core.TestCommonWithModels +import org.apache.s2graph.core.utils.SafeUpdateCache +import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers} + +class SchemaTest extends FunSuite with Matchers with TestCommonWithModels with BeforeAndAfterAll { + override def beforeAll(): Unit = { + initTests() + } + + override def afterAll(): Unit = { + graph.shutdown() + } + + test("test Label.findByName") { + val labelOpt = Label.findByName(labelName, useCache = false) + println(labelOpt) + labelOpt.isDefined shouldBe true + val indices = labelOpt.get.indices + indices.size > 0 shouldBe true + println(indices) + val defaultIndexOpt = labelOpt.get.defaultIndex + println(defaultIndexOpt) + defaultIndexOpt.isDefined shouldBe true + val metas = labelOpt.get.metaProps + println(metas) + metas.size > 0 shouldBe true + val srcService = labelOpt.get.srcService + println(srcService) + val tgtService = labelOpt.get.tgtService + println(tgtService) + val service = labelOpt.get.service + println(service) + val srcColumn = labelOpt.get.srcService + println(srcColumn) + val tgtColumn = labelOpt.get.tgtService + println(tgtColumn) + } + + test("serialize/deserialize Schema.") { + import scala.collection.JavaConverters._ + val originalMap = Schema.safeUpdateCache.asMap().asScala + val newCache = new SafeUpdateCache(Schema.maxSize, Schema.ttl)(scala.concurrent.ExecutionContext.Implicits.global) + Schema.fromBytes(newCache, Schema.toBytes()) + val newMap = newCache.asMap().asScala + + originalMap.size shouldBe newMap.size + originalMap.keySet shouldBe newMap.keySet + + originalMap.keySet.foreach { key => + val (originalVal, _, _) = originalMap(key) + val (newVal, _, _) = newMap(key) + + originalVal shouldBe newVal + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/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 f1331e3..05dfbf3 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 @@ -19,7 +19,7 @@ package org.apache.s2graph.core.storage -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.core.storage.hbase.AsynchbaseStorageSerDe import org.apache.s2graph.core.storage.serde.{StorageDeserializable, StorageSerializable} import org.apache.s2graph.core.{S2Vertex, S2VertexLike, TestCommonWithModels} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala index 4f38e18..23ad143 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/storage/hbase/IndexEdgeTest.scala @@ -19,7 +19,7 @@ package org.apache.s2graph.core.storage.hbase -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.core.types._ import org.apache.s2graph.core.TestCommonWithModels import org.scalatest.{FunSuite, Matchers} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/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 index 4aecb33..b871dd6 100644 --- 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 @@ -20,7 +20,7 @@ package org.apache.s2graph.core.storage.rocks import org.apache.s2graph.core.TestCommonWithModels -import org.apache.s2graph.core.mysqls.{Service, ServiceColumn} +import org.apache.s2graph.core.schema.{Service, ServiceColumn} import org.apache.tinkerpop.gremlin.structure.T import org.scalatest.{FunSuite, Matchers} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala index f52f86a..0467f7d 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala @@ -24,7 +24,7 @@ import org.apache.s2graph.core.GraphExceptions.LabelNotExistException import org.apache.s2graph.core.Management.JsonModel.Prop import org.apache.s2graph.core.S2Graph.{DefaultColumnName, DefaultServiceName} import org.apache.s2graph.core._ -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.core.types.{HBaseType, InnerVal, VertexId} import org.apache.s2graph.core.utils.logger import org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala ---------------------------------------------------------------------- diff --git a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala index 45060cc..04268d6 100644 --- a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala +++ b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/structure/S2GraphTest.scala @@ -24,7 +24,7 @@ import java.util.function.Predicate import org.apache.s2graph.core.GraphExceptions.LabelNotExistException import org.apache.s2graph.core.Management.JsonModel.Prop import org.apache.s2graph.core._ -import org.apache.s2graph.core.mysqls.{GlobalIndex, Service, ServiceColumn} +import org.apache.s2graph.core.schema.{GlobalIndex, Service, ServiceColumn} import org.apache.s2graph.core.tinkerpop.S2GraphProvider import org.apache.s2graph.core.utils.logger import org.apache.tinkerpop.gremlin.process.traversal.{Compare, P, Scope} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/ExactStorageGraph.scala ---------------------------------------------------------------------- diff --git a/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/ExactStorageGraph.scala b/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/ExactStorageGraph.scala index caddf8d..2f599e0 100644 --- a/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/ExactStorageGraph.scala +++ b/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/ExactStorageGraph.scala @@ -23,7 +23,7 @@ import akka.actor.ActorSystem import akka.stream.ActorMaterializer import com.typesafe.config.Config import org.apache.http.HttpStatus -import org.apache.s2graph.core.mysqls.Label +import org.apache.s2graph.core.schema.Label import org.apache.s2graph.counter.config.S2CounterConfig import org.apache.s2graph.counter.core import org.apache.s2graph.counter.core.ExactCounter.ExactValueMap http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/RankingStorageGraph.scala ---------------------------------------------------------------------- diff --git a/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/RankingStorageGraph.scala b/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/RankingStorageGraph.scala index b9ca9a4..1439118 100644 --- a/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/RankingStorageGraph.scala +++ b/s2counter_core/src/main/scala/org/apache/s2graph/counter/core/v2/RankingStorageGraph.scala @@ -24,7 +24,7 @@ import akka.stream.ActorMaterializer import com.typesafe.config.Config import org.apache.commons.httpclient.HttpStatus import org.apache.s2graph.core.GraphUtil -import org.apache.s2graph.core.mysqls.Label +import org.apache.s2graph.core.schema.Label import org.apache.s2graph.counter.config.S2CounterConfig import org.apache.s2graph.counter.core.RankingCounter.RankingValueMap import org.apache.s2graph.counter.core.v2.ExactStorageGraph._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2counter_core/src/main/scala/org/apache/s2graph/counter/helper/CounterAdmin.scala ---------------------------------------------------------------------- diff --git a/s2counter_core/src/main/scala/org/apache/s2graph/counter/helper/CounterAdmin.scala b/s2counter_core/src/main/scala/org/apache/s2graph/counter/helper/CounterAdmin.scala index 17ecc87..d61f70b 100644 --- a/s2counter_core/src/main/scala/org/apache/s2graph/counter/helper/CounterAdmin.scala +++ b/s2counter_core/src/main/scala/org/apache/s2graph/counter/helper/CounterAdmin.scala @@ -22,7 +22,7 @@ package org.apache.s2graph.counter.helper import com.typesafe.config.Config import org.apache import org.apache.s2graph.core.S2Graph -import org.apache.s2graph.core.mysqls.Label +import org.apache.s2graph.core.schema.Label import org.apache.s2graph.counter import org.apache.s2graph.counter.config.S2CounterConfig import org.apache.s2graph.counter.core.{RankingCounter, ExactCounter} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2counter_core/src/test/scala/org/apache/s2graph/counter/core/RankingCounterSpec.scala ---------------------------------------------------------------------- diff --git a/s2counter_core/src/test/scala/org/apache/s2graph/counter/core/RankingCounterSpec.scala b/s2counter_core/src/test/scala/org/apache/s2graph/counter/core/RankingCounterSpec.scala index 2ab4823..aba035a 100644 --- a/s2counter_core/src/test/scala/org/apache/s2graph/counter/core/RankingCounterSpec.scala +++ b/s2counter_core/src/test/scala/org/apache/s2graph/counter/core/RankingCounterSpec.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.counter.core import com.typesafe.config.ConfigFactory -import org.apache.s2graph.core.mysqls.Label +import org.apache.s2graph.core.schema.Label import org.apache.s2graph.core.{Management, S2Graph, S2Graph$} import org.apache.s2graph.counter.config.S2CounterConfig import org.apache.s2graph.counter.core.TimedQualifier.IntervalUnit http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2counter_core/src/test/scala/org/apache/s2graph/counter/models/CounterModelSpec.scala ---------------------------------------------------------------------- diff --git a/s2counter_core/src/test/scala/org/apache/s2graph/counter/models/CounterModelSpec.scala b/s2counter_core/src/test/scala/org/apache/s2graph/counter/models/CounterModelSpec.scala deleted file mode 100644 index be79e23..0000000 --- a/s2counter_core/src/test/scala/org/apache/s2graph/counter/models/CounterModelSpec.scala +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.counter.models - -import com.typesafe.config.ConfigFactory -import org.specs2.mutable.Specification - -class CounterModelSpec extends Specification { - val config = ConfigFactory.load() - - DBModel.initialize(config) - - "CounterModel" should { - val model = new CounterModel(config) - "findById" in { - model.findById(0, useCache = false) must beNone - } - - "findByServiceAction using cache" in { - val service = "test" - val action = "test_action" - val counter = Counter(useFlag = true, 2, service, action, Counter.ItemType.STRING, - autoComb = true, "", useProfile = true, None, useRank = true, 0, None, None, None, None, None, None) - model.createServiceAction(counter) - model.findByServiceAction(service, action, useCache = false) must beSome - val opt = model.findByServiceAction(service, action, useCache = true) - opt must beSome - model.findById(opt.get.id) must beSome - model.deleteServiceAction(opt.get) - model.findById(opt.get.id) must beSome - model.findById(opt.get.id, useCache = false) must beNone - } - - "create and delete policy" in { - val (service, action) = ("test", "test_case") - for { - policy <- model.findByServiceAction(service, action, useCache = false) - } { - model.deleteServiceAction(policy) - } - model.createServiceAction(Counter(useFlag = true, 2, service, action, Counter.ItemType.STRING, - autoComb = true, "", useProfile = true, None, useRank = true, 0, None, None, None, None, None, None)) - model.findByServiceAction(service, action, useCache = false).map { policy => - policy.service mustEqual service - policy.action mustEqual action - model.deleteServiceAction(policy) - policy - } must beSome - model.findByServiceAction(service, action, useCache = false) must beNone - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2counter_core/src/test/scala/org/apache/s2graph/counter/models/CounterSchemaSpec.scala ---------------------------------------------------------------------- diff --git a/s2counter_core/src/test/scala/org/apache/s2graph/counter/models/CounterSchemaSpec.scala b/s2counter_core/src/test/scala/org/apache/s2graph/counter/models/CounterSchemaSpec.scala new file mode 100644 index 0000000..2de7248 --- /dev/null +++ b/s2counter_core/src/test/scala/org/apache/s2graph/counter/models/CounterSchemaSpec.scala @@ -0,0 +1,69 @@ +/* + * 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.counter.models + +import com.typesafe.config.ConfigFactory +import org.specs2.mutable.Specification + +class CounterSchemaSpec extends Specification { + val config = ConfigFactory.load() + + DBModel.initialize(config) + + "CounterModel" should { + val model = new CounterModel(config) + "findById" in { + model.findById(0, useCache = false) must beNone + } + + "findByServiceAction using cache" in { + val service = "test" + val action = "test_action" + val counter = Counter(useFlag = true, 2, service, action, Counter.ItemType.STRING, + autoComb = true, "", useProfile = true, None, useRank = true, 0, None, None, None, None, None, None) + model.createServiceAction(counter) + model.findByServiceAction(service, action, useCache = false) must beSome + val opt = model.findByServiceAction(service, action, useCache = true) + opt must beSome + model.findById(opt.get.id) must beSome + model.deleteServiceAction(opt.get) + model.findById(opt.get.id) must beSome + model.findById(opt.get.id, useCache = false) must beNone + } + + "create and delete policy" in { + val (service, action) = ("test", "test_case") + for { + policy <- model.findByServiceAction(service, action, useCache = false) + } { + model.deleteServiceAction(policy) + } + model.createServiceAction(Counter(useFlag = true, 2, service, action, Counter.ItemType.STRING, + autoComb = true, "", useProfile = true, None, useRank = true, 0, None, None, None, None, None, None)) + model.findByServiceAction(service, action, useCache = false).map { policy => + policy.service mustEqual service + policy.action mustEqual action + model.deleteServiceAction(policy) + policy + } must beSome + model.findByServiceAction(service, action, useCache = false) must beNone + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2counter_loader/src/main/scala/org/apache/s2graph/counter/loader/core/DimensionProps.scala ---------------------------------------------------------------------- diff --git a/s2counter_loader/src/main/scala/org/apache/s2graph/counter/loader/core/DimensionProps.scala b/s2counter_loader/src/main/scala/org/apache/s2graph/counter/loader/core/DimensionProps.scala index f941224..4d9f5f5 100644 --- a/s2counter_loader/src/main/scala/org/apache/s2graph/counter/loader/core/DimensionProps.scala +++ b/s2counter_loader/src/main/scala/org/apache/s2graph/counter/loader/core/DimensionProps.scala @@ -22,7 +22,7 @@ package org.apache.s2graph.counter.loader.core import akka.actor.ActorSystem import akka.stream.ActorMaterializer import org.apache.commons.httpclient.HttpStatus -import org.apache.s2graph.core.mysqls.{Bucket, Experiment, Service} +import org.apache.s2graph.core.schema.{Bucket, Experiment, Service} import org.apache.s2graph.counter.loader.config.StreamingConfig import org.apache.s2graph.counter.models.Counter import org.apache.s2graph.counter.util.{RetryAsync, CollectionCache, CollectionCacheConfig} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2counter_loader/src/test/scala/org/apache/s2graph/counter/loader/core/CounterEtlFunctionsSpec.scala ---------------------------------------------------------------------- diff --git a/s2counter_loader/src/test/scala/org/apache/s2graph/counter/loader/core/CounterEtlFunctionsSpec.scala b/s2counter_loader/src/test/scala/org/apache/s2graph/counter/loader/core/CounterEtlFunctionsSpec.scala index 35575fb..8d58692 100644 --- a/s2counter_loader/src/test/scala/org/apache/s2graph/counter/loader/core/CounterEtlFunctionsSpec.scala +++ b/s2counter_loader/src/test/scala/org/apache/s2graph/counter/loader/core/CounterEtlFunctionsSpec.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.counter.loader.core import com.typesafe.config.ConfigFactory -import org.apache.s2graph.core.mysqls.{Label, Service} +import org.apache.s2graph.core.schema.{Label, Service} import org.apache.s2graph.core.types.HBaseType import org.apache.s2graph.core.{S2Graph, Management} import org.apache.s2graph.counter.models.DBModel http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2graphql/src/main/scala/org/apache/s2graph/graphql/GraphQLServer.scala ---------------------------------------------------------------------- diff --git a/s2graphql/src/main/scala/org/apache/s2graph/graphql/GraphQLServer.scala b/s2graphql/src/main/scala/org/apache/s2graph/graphql/GraphQLServer.scala index c2597d6..ddb21b2 100644 --- a/s2graphql/src/main/scala/org/apache/s2graph/graphql/GraphQLServer.scala +++ b/s2graphql/src/main/scala/org/apache/s2graph/graphql/GraphQLServer.scala @@ -44,6 +44,7 @@ import scala.util.{Failure, Success, Try} object GraphQLServer { + val className = Schema.getClass.getName val logger = LoggerFactory.getLogger(this.getClass) // Init s2graph @@ -56,7 +57,7 @@ object GraphQLServer { val s2graph = new S2Graph(config) val schemaCacheTTL = Try(config.getInt("schemaCacheTTL")).getOrElse(-1) val s2Repository = new GraphRepository(s2graph) - val schemaCache = new SafeUpdateCache[Schema[GraphRepository, Any]]("schema", maxSize = 1, ttl = schemaCacheTTL) + val schemaCache = new SafeUpdateCache(1, ttl = schemaCacheTTL) def endpoint(requestJSON: spray.json.JsValue)(implicit e: ExecutionContext): Route = { @@ -97,7 +98,8 @@ object GraphQLServer { } private def executeGraphQLQuery(query: Document, op: Option[String], vars: JsObject)(implicit e: ExecutionContext) = { - val s2schema = schemaCache.withCache("s2Schema")(createNewSchema()) + val cacheKey = className + "s2Schema" + val s2schema = schemaCache.withCache(cacheKey, broadcast = false)(createNewSchema()) import GraphRepository._ val resolver: DeferredResolver[GraphRepository] = DeferredResolver.fetchers(vertexFetcher, edgeFetcher) http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2graphql/src/main/scala/org/apache/s2graph/graphql/bind/Unmarshaller.scala ---------------------------------------------------------------------- diff --git a/s2graphql/src/main/scala/org/apache/s2graph/graphql/bind/Unmarshaller.scala b/s2graphql/src/main/scala/org/apache/s2graph/graphql/bind/Unmarshaller.scala index 807fe48..61c58e8 100644 --- a/s2graphql/src/main/scala/org/apache/s2graph/graphql/bind/Unmarshaller.scala +++ b/s2graphql/src/main/scala/org/apache/s2graph/graphql/bind/Unmarshaller.scala @@ -20,8 +20,8 @@ package org.apache.s2graph.graphql.bind import org.apache.s2graph.core.Management.JsonModel._ -import org.apache.s2graph.core.mysqls.{Label, ServiceColumn} -import org.apache.s2graph.core.{QueryParam, S2EdgeLike, S2VertexLike} +import org.apache.s2graph.core.schema.ServiceColumn +import org.apache.s2graph.core.{S2EdgeLike, S2VertexLike} import org.apache.s2graph.graphql.repository.GraphRepository import org.apache.s2graph.graphql.types.S2Type._ import sangria.marshalling._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2graphql/src/main/scala/org/apache/s2graph/graphql/repository/GraphRepository.scala ---------------------------------------------------------------------- diff --git a/s2graphql/src/main/scala/org/apache/s2graph/graphql/repository/GraphRepository.scala b/s2graphql/src/main/scala/org/apache/s2graph/graphql/repository/GraphRepository.scala index 3bfa556..90037cf 100644 --- a/s2graphql/src/main/scala/org/apache/s2graph/graphql/repository/GraphRepository.scala +++ b/s2graphql/src/main/scala/org/apache/s2graph/graphql/repository/GraphRepository.scala @@ -21,7 +21,7 @@ package org.apache.s2graph.graphql.repository import org.apache.s2graph.core.Management.JsonModel._ import org.apache.s2graph.core._ -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.core.rest.RequestParser import org.apache.s2graph.core.storage.MutateResponse import org.apache.s2graph.core.types._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/FieldResolver.scala ---------------------------------------------------------------------- diff --git a/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/FieldResolver.scala b/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/FieldResolver.scala index cb6238f..478517f 100644 --- a/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/FieldResolver.scala +++ b/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/FieldResolver.scala @@ -20,7 +20,8 @@ package org.apache.s2graph.graphql.types import org.apache.s2graph.core._ -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.index.IndexProvider +import org.apache.s2graph.core.schema._ import org.apache.s2graph.graphql.bind.AstHelper import org.apache.s2graph.graphql.repository.GraphRepository import org.apache.s2graph.graphql.types.S2Type.EdgeQueryParam @@ -70,7 +71,7 @@ object FieldResolver { } def serviceColumnOnService(column: ServiceColumn, c: Context[GraphRepository, Any]): VertexQueryParam = { - val prefix = s"${GlobalIndex.serviceField}:${column.service.serviceName} AND ${GlobalIndex.serviceColumnField}:${column.columnName}" + val prefix = s"${IndexProvider.serviceField}:${column.service.serviceName} AND ${IndexProvider.serviceColumnField}:${column.columnName}" val ids = c.argOpt[Any]("id").toSeq ++ c.argOpt[List[Any]]("ids").toList.flatten val offset = c.arg[Int]("offset") http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/ManagementType.scala ---------------------------------------------------------------------- diff --git a/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/ManagementType.scala b/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/ManagementType.scala index 0312abf..1475280 100644 --- a/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/ManagementType.scala +++ b/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/ManagementType.scala @@ -19,7 +19,7 @@ package org.apache.s2graph.graphql.types -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.graphql.repository.GraphRepository import sangria.schema._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/S2Type.scala ---------------------------------------------------------------------- diff --git a/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/S2Type.scala b/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/S2Type.scala index c10d85e..49e6b82 100644 --- a/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/S2Type.scala +++ b/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/S2Type.scala @@ -21,7 +21,7 @@ package org.apache.s2graph.graphql.types import org.apache.s2graph.core.Management.JsonModel._ import org.apache.s2graph.core._ -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.graphql import org.apache.s2graph.graphql.repository.GraphRepository import sangria.schema._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/StaticType.scala ---------------------------------------------------------------------- diff --git a/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/StaticType.scala b/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/StaticType.scala index aca832c..83168f4 100644 --- a/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/StaticType.scala +++ b/s2graphql/src/main/scala/org/apache/s2graph/graphql/types/StaticType.scala @@ -21,7 +21,7 @@ package org.apache.s2graph.graphql.types import org.apache.s2graph.core.Management.JsonModel._ import org.apache.s2graph.core.{JSONParser, S2EdgeLike, S2VertexLike} -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.core.storage.MutateResponse import org.apache.s2graph.graphql.repository.GraphRepository import sangria.macros.derive._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala ---------------------------------------------------------------------- diff --git a/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala b/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala index acd6f66..72412f5 100644 --- a/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala +++ b/s2graphql/src/test/scala/org/apache/s2graph/graphql/TestGraph.scala @@ -22,7 +22,7 @@ package org.apache.s2graph.graphql import com.typesafe.config.Config import org.apache.s2graph import org.apache.s2graph.core.Management.JsonModel.Prop -import org.apache.s2graph.core.mysqls.{Label, Model, Service} +import org.apache.s2graph.core.schema.{Label, Schema, Service} import org.apache.s2graph.core.rest.RequestParser import org.apache.s2graph.core.{Management, S2Graph} import org.apache.s2graph.graphql @@ -77,7 +77,7 @@ trait TestGraph { } class EmptyGraph(config: Config) extends TestGraph { - Model.apply(config) + Schema.apply(config) lazy val graph = new S2Graph(config)(scala.concurrent.ExecutionContext.Implicits.global) lazy val management = new Management(graph) @@ -92,7 +92,7 @@ class EmptyGraph(config: Config) extends TestGraph { override def repository: GraphRepository = s2Repository override def open(): Unit = { - Model.shutdown(true) + Schema.shutdown(true) } } http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/DegreeKey.scala ---------------------------------------------------------------------- diff --git a/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/DegreeKey.scala b/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/DegreeKey.scala index 561c676..27747f6 100644 --- a/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/DegreeKey.scala +++ b/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/DegreeKey.scala @@ -22,7 +22,7 @@ package org.apache.s2graph.s2jobs import org.apache.s2graph.core._ import org.apache.s2graph.core.storage.SKeyValue import org.apache.hadoop.hbase.{KeyValue => HKeyValue} -import org.apache.s2graph.core.mysqls.{Label, LabelMeta} +import org.apache.s2graph.core.schema.{Label, LabelMeta} import org.apache.s2graph.core.types.{InnerValLikeWithTs, SourceVertexId} import play.api.libs.json.Json http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/S2GraphHelper.scala ---------------------------------------------------------------------- diff --git a/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/S2GraphHelper.scala b/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/S2GraphHelper.scala index b0b4aed..975714a 100644 --- a/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/S2GraphHelper.scala +++ b/s2jobs/src/main/scala/org/apache/s2graph/s2jobs/S2GraphHelper.scala @@ -21,6 +21,7 @@ package org.apache.s2graph.s2jobs import com.typesafe.config.Config import org.apache.s2graph.core._ +import org.apache.s2graph.core.schema.{Label, LabelMeta} import org.apache.s2graph.core.storage.SKeyValue import org.apache.spark.sql.Row import org.apache.spark.sql.types.StructType http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/BaseSparkTest.scala ---------------------------------------------------------------------- diff --git a/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/BaseSparkTest.scala b/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/BaseSparkTest.scala index 3fa8cea..e8a3e86 100644 --- a/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/BaseSparkTest.scala +++ b/s2jobs/src/test/scala/org/apache/s2graph/s2jobs/BaseSparkTest.scala @@ -23,9 +23,9 @@ import java.io.{File, PrintWriter} import com.holdenkarau.spark.testing.DataFrameSuiteBase import org.apache.s2graph.core.Management.JsonModel.{Index, Prop} -import org.apache.s2graph.core.mysqls.{Label, ServiceColumn} -import org.apache.s2graph.core.types.HBaseType +import org.apache.s2graph.core.schema.{Label, ServiceColumn} import org.apache.s2graph.core.{Management, S2Graph} +import org.apache.s2graph.core.types.HBaseType import org.apache.s2graph.s2jobs.loader.GraphFileOptions import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers} http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2rest_netty/src/main/scala/org/apache/s2graph/rest/netty/Server.scala ---------------------------------------------------------------------- diff --git a/s2rest_netty/src/main/scala/org/apache/s2graph/rest/netty/Server.scala b/s2rest_netty/src/main/scala/org/apache/s2graph/rest/netty/Server.scala index 126f193..6615cec 100644 --- a/s2rest_netty/src/main/scala/org/apache/s2graph/rest/netty/Server.scala +++ b/s2rest_netty/src/main/scala/org/apache/s2graph/rest/netty/Server.scala @@ -34,7 +34,7 @@ import io.netty.handler.codec.http._ import io.netty.handler.logging.{LogLevel, LoggingHandler} import io.netty.util.CharsetUtil import org.apache.s2graph.core.GraphExceptions.{BadQueryException} -import org.apache.s2graph.core.mysqls.Experiment +import org.apache.s2graph.core.schema.Experiment import org.apache.s2graph.core.rest.RestHandler import org.apache.s2graph.core.rest.RestHandler.{CanLookup, HandlerResult} import org.apache.s2graph.core.utils.Extensions._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2rest_play/app/org/apache/s2graph/rest/play/controllers/AdminController.scala ---------------------------------------------------------------------- diff --git a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/AdminController.scala b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/AdminController.scala index 23bda0a..00702cf 100644 --- a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/AdminController.scala +++ b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/AdminController.scala @@ -20,7 +20,7 @@ package org.apache.s2graph.rest.play.controllers import org.apache.s2graph.core.Management -import org.apache.s2graph.core.mysqls._ +import org.apache.s2graph.core.schema._ import org.apache.s2graph.core.rest.RequestParser import org.apache.s2graph.core.utils.logger import play.api.libs.functional.syntax._ http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2rest_play/app/org/apache/s2graph/rest/play/controllers/CounterController.scala ---------------------------------------------------------------------- diff --git a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/CounterController.scala b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/CounterController.scala index b3ac89d..c751250 100644 --- a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/CounterController.scala +++ b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/CounterController.scala @@ -22,7 +22,7 @@ package org.apache.s2graph.rest.play.controllers import org.apache.kafka.clients.producer.ProducerRecord import org.apache.s2graph.core.ExceptionHandler import org.apache.s2graph.core.ExceptionHandler.KafkaMessage -import org.apache.s2graph.core.mysqls.Label +import org.apache.s2graph.core.schema.Label import org.apache.s2graph.counter import org.apache.s2graph.counter.config.S2CounterConfig import org.apache.s2graph.counter.core.TimedQualifier.IntervalUnit http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/8a388a42/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala ---------------------------------------------------------------------- diff --git a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala index 69878f8..310b098 100644 --- a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala +++ b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/EdgeController.scala @@ -22,7 +22,7 @@ package org.apache.s2graph.rest.play.controllers import com.fasterxml.jackson.databind.JsonMappingException import org.apache.s2graph.core.ExceptionHandler.KafkaMessage import org.apache.s2graph.core._ -import org.apache.s2graph.core.mysqls.Label +import org.apache.s2graph.core.schema.Label import org.apache.s2graph.core.rest.RequestParser import org.apache.s2graph.core.utils.logger import org.apache.s2graph.core.storage.{IncrementResponse, MutateResponse}
