Packages

trait Conn extends ColOps with BooPicklers

Facade to Datomic Connection.

Has additional internal state to manage using adhoc and test databases.

Source
Conn.scala
Linear Supertypes
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Conn
  2. BooPicklers
  3. Helpers
  4. ColOps
  5. DateHandling
  6. RegexMatching
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class log extends AnyRef
    Definition Classes
    Helpers
  2. implicit class Regex extends AnyRef
    Definition Classes
    RegexMatching

Abstract Value Members

  1. abstract def db(implicit ec: ExecutionContext): Future[DatomicDb]

    Get current adhoc/test/live db.

  2. abstract def sync(t: Long): Conn

    Synchronize database to have all transactions completed up to and including time t.

    Synchronize database to have all transactions completed up to and including time t.

    Sets a flag with a time t on the connection to do the synchronization on the first subsequent query. Hereafter the flag is removed.

    The synchronization guarantees to include all transactions that are complete up to and including time t. sync does not communicate with the transactor, but it can block (within the Future) if the peer/client has not yet been notified of transactions up to time t.

    A Future with the synchronized database is returned for the query to use. The future can take arbitrarily long to complete. Waiting code should specify a timeout.

    Only use sync(t) when coordination of multiple peer/client processes is required.

    If peers/clients do not share a basis t, prefer sync.

    returns

    Connection with synchronization flag set

  3. abstract def sync: Conn

    Synchronize database to have all transactions completed up until now.

    Synchronize database to have all transactions completed up until now.

    Sets a flag on the connection to do the synchronization on the first subsequent query. Hereafter the flag is removed.

    The synchronization guarantees to include all transactions that are complete when the synchronization query is made. Before the query is executed, the connection communicates with the transactor to do the synchronization.

    A Future with the synchronized database is returned for the query to use. The future can take arbitrarily long to complete. Waiting code should specify a timeout.

    Only use sync when the following two conditions hold:

    1. coordination of multiple peer/client processes is required 2. peers/clients have no way to agree on a basis t for coordination
    returns

    Connection with synchronization flag set

  4. abstract def testDbAsOf(txR: TxReport)(implicit ec: ExecutionContext): Future[Unit]

    Use test database as of transaction report.

    Use test database as of transaction report.

    txR

    Transaction report

  5. abstract def testDbAsOf(d: Date)(implicit ec: ExecutionContext): Future[Unit]

    Use test database as of date.

    Use test database as of date.

    d

    Date

  6. abstract def testDbAsOf(t: Long)(implicit ec: ExecutionContext): Future[Unit]

    Use test database as of time t / tx id.

    Use test database as of time t / tx id.

    t

    Long Time t or tx id

  7. abstract def testDbAsOfNow(implicit ec: ExecutionContext): Future[Unit]

    Use test database as of now.

  8. abstract def testDbSince(txR: TxReport)(implicit ec: ExecutionContext): Future[Unit]

    Use test database since transaction report.

    Use test database since transaction report.

    txR

    Transaction report

  9. abstract def testDbSince(d: Date)(implicit ec: ExecutionContext): Future[Unit]

    Use test database since date.

    Use test database since date.

    d

    Date

  10. abstract def testDbSince(t: Long)(implicit ec: ExecutionContext): Future[Unit]

    Use test database since time t.

    Use test database since time t.

    t

    Long

  11. abstract def testDbWith(txMolecules: Future[Seq[Statement]]*)(implicit ec: ExecutionContext): Future[Unit]

    Use test database with temporary transaction statements.

    Use test database with temporary transaction statements.

    Transaction statements can be supplied from a molecule:

    for {
      conn <- futConn // implicit Future[Conn] instance in scope
    
      // Live data
      benId = Person.name("Ben").save.map(_.eid)
    
      // Use temporary db with statements of one or more tested transactions
      _ <- conn.testDbWith(
        Person.name("liz").getSaveStmts,
        benId.getRetractStmts
        // more...
      )
    
      // Query using temporary database
      _ <- Person.name.get.map(_ ==> List("Liz"))
    
      // Discard test db and go back to live db
      _ = conn.useLiveDb()
    
      // Query using unchanged live data
      _ <- Person.name.get.map(_ ==> List("Ben"))
    } yield ()
    txMolecules

    List of List of transaction Statement's

  12. abstract def transact(edn: String)(implicit ec: ExecutionContext): Future[TxReport]

    Transact EDN data string

    Transact EDN data string

    edn

    EDN transaction data string

    ec

    ExecutionContext for Future

    returns

    Future with TxReport

  13. abstract def useLiveDb(): Unit

    Get out of test mode and back to live db.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. implicit val anyPickler: Pickler[Any]
    Definition Classes
    BooPicklers
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def bigDec(arg: Any): BigDecimal
    Attributes
    protected
    Definition Classes
    Helpers
  7. implicit def boopickleSerializerDeserializer[T](implicit arg0: boopickle.Default.Pickler[T]): SerializerDeserializer[T, ByteBuffer]
    Definition Classes
    BooPicklers
  8. def clean(attr: String): String
    Definition Classes
    Helpers
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  10. implicit val connProxyPickler: CompositePickler[ConnProxy]
    Definition Classes
    BooPicklers
  11. def convert(tpe: String, arg: Any): (Any) ⇒ String
    Definition Classes
    ColOps
  12. def date2datomicStr(date: Date, zoneOffset: ZoneOffset = localZoneOffset): String
    Definition Classes
    DateHandling
  13. def date2datomicStr2(date: Date, zoneOffset: ZoneOffset = localZoneOffset): String
    Definition Classes
    DateHandling
  14. def date2str(date: Date, zoneOffset: ZoneOffset = localZoneOffset): String
    Definition Classes
    DateHandling
  15. implicit val datePickler: Pickler[Date]
    Definition Classes
    BooPicklers
  16. def daylight(ms: Long): Int
    Definition Classes
    DateHandling
  17. def debug(prefix: String, suffix: String = ""): Unit
    Attributes
    protected
  18. def double(arg: Any): String
    Attributes
    protected
    Definition Classes
    Helpers
  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  21. def escStr(s: String): String
    Definition Classes
    Helpers
  22. implicit val exPickler: CompositePickler[Throwable]
    Definition Classes
    BooPicklers
  23. def expandDateStr(dateStr: String): String
    Definition Classes
    DateHandling
  24. final def f(a: Any): Any
    Attributes
    protected
    Definition Classes
    Helpers
  25. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. def firstNs(model: Model): String
    Definition Classes
    Helpers
  27. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. def getKwName(kw: String): String
    Definition Classes
    Helpers
  29. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  30. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  31. def jsNumber(tpe: String, v: Any): Any
    Definition Classes
    Helpers
  32. def jsOnly(method: String): MoleculeException
    Attributes
    protected
  33. def jvmOnly(method: String): MoleculeException
    Attributes
    protected
  34. def jvmPeerOnly(method: String): MoleculeException
    Attributes
    protected
  35. def localOffset: String
    Definition Classes
    DateHandling
  36. def localZoneOffset: ZoneOffset
    Definition Classes
    DateHandling
  37. def marshallInputs(q: Query): (Seq[(Int, String, String)], Seq[(Int, String, Seq[String])], Seq[(Int, String, Seq[Seq[String]])])
    Definition Classes
    ColOps
  38. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  39. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  40. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  41. final def o(opt: Option[Any]): String
    Definition Classes
    Helpers
  42. final def os(opt: Option[Set[_]]): String
    Definition Classes
    Helpers
  43. def pad(longest: Int, shorter: Int): String
    Definition Classes
    Helpers
  44. def padS(longest: Int, str: String): String
    Definition Classes
    Helpers
  45. def peerOnly(method: String): MoleculeException
    Attributes
    protected
  46. def query(datalogQuery: String, inputs: Any*)(implicit ec: ExecutionContext): Future[List[List[AnyRef]]]

    Query Datomic directly with Datalog query and optional Scala inputs.

    Query Datomic directly with Datalog query and optional Scala inputs.

    for {
      conn <- futConn // implicit Future[Conn] instance in scope
    
      // Typed tuple result from molecule
      _ <- Ns.str.int.get.map(_ ==> List(
        ("Liz", 37),
        ("Ben", 42),
      ))
    
      // Any-type result from query
      _ <- conn.query(
        "[:find  ?b ?c :where [?a :Ns/str ?b][?a :Ns/int ?c]]"
      ).map(_ ==> List(
        List("Liz", 37),
        List("Ben", 42)
      ))
    
      // Any-type result from query with input(s)
      _ <- conn.query(
        "[:find  ?b ?c :in $ ?c :where [?a :Ns/str ?b][?a :Ns/int ?c]]",
        42
      ).map(_ ==> List(
        List("Ben", 42)
      ))
    
      // See datalog queries of molecules with `inspectGet`
      _ <- Ns.str.int.inspectGet // shows Datalog query...
    } yield ()
    datalogQuery

    Datomic query string

    inputs

    Optional input(s) to query

    returns

    Future[List[List[AnyRef]]]

  47. final def render(value: Any): String
    Definition Classes
    Helpers
  48. final def sq[T](values: Seq[T]): String
    Definition Classes
    Helpers
  49. def stmts2java(stmts: Seq[Statement]): List[List[_]]
  50. def str2date(s: String, zoneOffset: ZoneOffset = localZoneOffset): Date
    Definition Classes
    DateHandling
  51. def str2zdt(s: String, zoneOffset: ZoneOffset = localZoneOffset): ZonedDateTime
    Definition Classes
    DateHandling
  52. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  53. def thousands(i: Long): String
    Definition Classes
    Helpers
  54. final def time(n: Int, prev: Int = 0): Unit
    Attributes
    protected
    Definition Classes
    Helpers
  55. def toString(): String
    Definition Classes
    AnyRef → Any
  56. def transact(javaStmts: List[_])(implicit ec: ExecutionContext): Future[TxReport]

    Transact java statements

    Transact java statements

    Only works on jvm platform.

    returns

    Future with TxReport

  57. def transact(stmtsReader: Reader)(implicit ec: ExecutionContext): Future[TxReport]

    Transact statements from a java.util.Reader

    Transact statements from a java.util.Reader

    Only works on jvm platform.

    stmtsReader

    java.io.Reader

    returns

    Future with TxReport

  58. def truncateDateStr(dateStr: String): String
    Definition Classes
    DateHandling
  59. final def tupleToSeq(arg: Any): Seq[Any]
    Attributes
    protected
    Definition Classes
    Helpers
  60. def unescStr(s: String): String
    Definition Classes
    Helpers
  61. final def untupled(rawData: Iterable[Seq[Any]]): Iterable[Seq[Any]]
    Definition Classes
    Helpers
  62. implicit val uriPickler: Pickler[URI]
    Definition Classes
    BooPicklers
  63. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  66. def zone: ZoneId
    Definition Classes
    DateHandling

Inherited from BooPicklers

Inherited from Helpers

Inherited from ColOps

Inherited from DateHandling

Inherited from RegexMatching

Inherited from AnyRef

Inherited from Any

Ungrouped