Skip to content

Commit

Permalink
Merge branch 'develop' as v0.6-RC2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhjames committed Nov 13, 2013
2 parents a8dd40e + 5fc387f commit ff705c8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
8 changes: 4 additions & 4 deletions common/src/main/scala/datomisca/DDatabase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class DDatabase(val underlying: datomic.Database) extends DatomicData {
* optional leading components of the index to match.
* @return an iterable collection of [[DDatom]].
*/
def datoms(index: Keyword, components: Keyword*): Iterable[DDatom] =
def datoms(index: Keyword, components: DatomicData*): Iterable[DDatom] =
new Iterable[DDatom] {
private val jIterable = underlying.datoms(index.toNative, components.map(_.toNative): _*)
override def iterator = new Iterator[DDatom] {
Expand Down Expand Up @@ -295,7 +295,7 @@ class DDatabase(val underlying: datomic.Database) extends DatomicData {
* @return an iterable collection of [[DDatom]].
* @see entidAt
*/
def seekDatoms(index: Keyword, components: Keyword*): Iterable[DDatom] =
def seekDatoms(index: Keyword, components: DatomicData*): Iterable[DDatom] =
new Iterable[DDatom] {
private val jIterable = underlying.seekDatoms(index.toNative, components.map(_.toNative): _*)
override def iterator = new Iterator[DDatom] {
Expand Down Expand Up @@ -324,9 +324,9 @@ class DDatabase(val underlying: datomic.Database) extends DatomicData {
* some end value (non-inclusive), or None if through end.
* @return an iterable collection of [[DDatom]].
*/
def indexRange(attr: Keyword, start: Option[AnyRef] = None, end: Option[AnyRef] = None): Iterable[DDatom] =
def indexRange(attr: Keyword, start: Option[DatomicData] = None, end: Option[DatomicData] = None): Iterable[DDatom] =
new Iterable[DDatom] {
private val jIterable = underlying.indexRange(attr.toNative, start.orNull, end.orNull)
private val jIterable = underlying.indexRange(attr.toNative, start.map(_.toNative).orNull, end.map(_.toNative).orNull)
override def iterator = new Iterator[DDatom] {
private val jIter = jIterable.iterator
override def hasNext = jIter.hasNext
Expand Down
8 changes: 5 additions & 3 deletions common/src/main/scala/datomisca/DEntity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

package datomisca

import scala.concurrent.blocking


class DEntity(val entity: datomic.Entity) extends DatomicData {
def toNative = entity

def id: Long = as[Long](Namespace.DB / "id")

def touch() = {
entity.touch()
blocking { entity.touch() }
this
}

Expand Down Expand Up @@ -52,7 +54,7 @@ class DEntity(val entity: datomic.Entity) extends DatomicData {

def keySet: Set[String] = {
val builder = Set.newBuilder[String]
val iter = entity.keySet.iterator
val iter = blocking { entity.keySet } .iterator
while (iter.hasNext) {
builder += iter.next()
}
Expand All @@ -61,7 +63,7 @@ class DEntity(val entity: datomic.Entity) extends DatomicData {

def toMap: Map[String, DatomicData] = {
val builder = Map.newBuilder[String, DatomicData]
val iter = entity.keySet.iterator
val iter = blocking { entity.keySet } .iterator
while (iter.hasNext) {
val key = iter.next()
builder += (key -> DatomicData.toDatomicData(entity.get(key)))
Expand Down
5 changes: 4 additions & 1 deletion core/src/main/scala/datomisca/queryExecutor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package datomisca

import scala.concurrent.blocking
import scala.util.control.NonFatal

import java.{util => ju}
Expand All @@ -36,7 +37,9 @@ private[datomisca] object QueryExecutor {

private def execQuery(q: AbstractQuery, in: Seq[AnyRef]): ju.Collection[ju.List[AnyRef]] =
try {
datomic.Peer.q(q.query, in: _*)
blocking {
datomic.Peer.q(q.query, in: _*)
}
} catch {
case ex: Throwable if ex.getMessage startsWith "processing" =>
val builder = Seq.newBuilder[String]
Expand Down
8 changes: 8 additions & 0 deletions extras/src/main/scala/datomisca/SchemaEntity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ object SchemaEntity {
this
}

def ++=(partial: PartialAddEntity): this.type = {
builder ++= partial.props
this
}

def partial(): PartialAddEntity =
new PartialAddEntity(builder.result())

def withId[T](id: T)(implicit ev: AsEntityId[T]): AddEntity =
new AddEntity(ev.conv(id), builder.result)
}
Expand Down
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import sbtunidoc.Plugin._
object DatomiscaBuild extends Build {

lazy val buildSettings = Defaults.defaultSettings ++ Seq(
version := "0.6-RC1",
version := "0.6-RC2",
organization := "com.pellucid",
scalaVersion := "2.10.2",
scalacOptions ++= Seq(
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/scala/datomisca/DatomicDatabaseSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class DatomicDatabaseSpec extends Specification {
Datomic.database.touch(e)
}

val datoms = Datomic.database.datoms(DDatabase.AEVT, user / "passwordHash")
val datoms = Datomic.database.datoms(DDatabase.AEVT, DKeyword(user / "passwordHash"))
println(s"Datoms: $datoms")

///////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit ff705c8

Please sign in to comment.