Packages

  • package root

    Documentation/API for the Molecule library - a meta DSL for the Datomic database.

    scalamolecule.org | Github | Forum

    Definition Classes
    root
  • package molecule

    Molecule library - a Scala meta-DSL for the Datomic database.

    Molecule library - a Scala meta-DSL for the Datomic database.

    Definition Classes
    root
  • package core
    Definition Classes
    molecule
  • package api
    Definition Classes
    core
  • package getAsyncObj

    Asynchronous getter methods to retrieve data as objects.

    Asynchronous getter methods to retrieve data as objects.

    For convenience, all synchronous getter methods from the get package are here wrapped in Futures.

    The Datomic On-Prem(ises) server model provides a Peer that returns data synchronously. The Peer which lives in application memory caches data aggressively and for data fitting in memory, latency can be extremely low and queries return very fast. And even when access to disk is needed, clever branching is used. Memcached is also an option.

    The Datomic Cloud model data returns data asynchronously. If Datomic creates a Java API for the Cloud model, Molecule could relatively easy adapt to this model too. In the meanwhile, Future-wrapped methods in this package can be used.

    Molecule has 4 groups of asynchronous getters for objects, each returning Futures of data in various formats:

    • GetAsyncObjArray - fastest retrieved typed data set. Can be traversed with a fast while loop
    • GetAsyncObjIterable - for lazily traversing row by row
    • GetAsyncObjList - default getter returning Lists of objects. Convenient typed data, suitable for smaller data sets
    • GetAsyncRaw - fastest retrieved raw un-typed data from Datomic

    Getters in each of the 4 groups come with 5 time-dependent variations:

    • getAsync [current data]
    • getAsyncAsOf
    • getAsyncSince
    • getAsyncWith
    • getAsyncHistory

    Each time variation has various overloads taking different parameters (see each group for more info).

    Definition Classes
    api
    See also

    equivalent synchronous getters in the getTpl package.

  • GetAsyncObjArray
  • GetAsyncObjIterable
  • GetAsyncObjList
t

molecule.core.api.getAsyncObj

GetAsyncObjArray

trait GetAsyncObjArray[Obj, Tpl] extends AnyRef

Asynchronous data getter methods on molecules returning Future[Array[Obj]].

The fastest way of getting a large typed data set since data is applied to a super fast pre-allocated Array. The Array can then be traversed with a fast while loop.

Ns.int.insert(1, 2, 3)

// Map over Future
Ns.int.getAsyncObjArray.map { rowObjects =>
  rowObjects.map(_.int) === Array(1, 2, 3)

  // Fast while loop
  var i = 0
  val length = rowObjects.length
  while(i < length) {
    println(rowObjects(i).int) // Do stuff with row object...
    i += 1
  }
}

Each asynchronous getter in this package simply wraps the result of its equivalent synchronous getter (in the get package) in a Future. getAsyncObjArrayAsOf thus wraps the result of getObjArrayAsOf in a Future and so on.

Self Type
Molecule_0[Obj, Tpl] with GetObjArray[Obj, Tpl]
Source
GetAsyncObjArray.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. GetAsyncObjArray
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def getAsyncObjArray(n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule.

    Get Future with Array of n rows as objects matching molecule.

    For more info and code examples see equivalent synchronous getObjArray method.

    n

    Number of rows

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  10. def getAsyncObjArray(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule.

    Get Future with Array of all rows as objects matching molecule.

    For more info and code examples see equivalent synchronous getObjArray method.

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  11. def getAsyncObjArrayAsOf(date: Date, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule as of date.

    Get Future with Array of n rows as objects matching molecule as of date.

    Get data at a human point in time (a java.util.Date).

    For more info and code examples see equivalent synchronous getObjArrayAsOf method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    date

    java.util.Date

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  12. def getAsyncObjArrayAsOf(date: Date)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule as of date.

    Get Future with Array of all rows as objects matching molecule as of date.

    Get data at a human point in time (a java.util.Date).

    For more info and code examples see equivalent synchronous getObjArrayAsOf method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    date

    java.util.Date

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  13. def getAsyncObjArrayAsOf(tx: TxReport, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule as of tx.

    Get Future with Array of n rows as objects matching molecule as of tx.

    Datomic's internal asOf method can take a transaction entity id as argument to retrieve a database value as of that transaction (including).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    For more info and code examples see equivalent synchronous getObjArrayAsOf method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    tx

    TxReport (returned from all molecule transaction operations)

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  14. def getAsyncObjArrayAsOf(tx: TxReport)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule as of tx.

    Get Future with Array of all rows as objects matching molecule as of tx.

    Datomic's internal asOf method can take a transaction entity id as argument to retrieve a database value as of that transaction (including).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    For more info and code examples see equivalent synchronous getObjArrayAsOf method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    tx

    TxReport (returned from all molecule transaction operations)

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  15. def getAsyncObjArrayAsOf(t: Long, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule as of transaction time t.

    Get Future with Array of n rows as objects matching molecule as of transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved in a getHistory call for an attribute and then be used to get data as of that point in time (including that transaction).

    For more info and code examples see equivalent synchronous getObjArrayAsOf method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    t

    Long Transaction time t

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  16. def getAsyncObjArrayAsOf(t: Long)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule as of transaction time t.

    Get Future with Array of all rows as objects matching molecule as of transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved in a getHistory call for an attribute and then be used to get data as of that point in time (including that transaction).

    For more info and code examples see equivalent synchronous getObjArrayAsOf method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    t

    Transaction time t

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  17. def getAsyncObjArraySince(date: Date, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule since date.

    Get Future with Array of n rows as objects matching molecule since date.

    Get data added/retracted since a human point in time (a java.util.Date).

    For more info and code examples see equivalent synchronous getObjArraySince method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    date

    java.util.Date

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  18. def getAsyncObjArraySince(date: Date)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule since date.

    Get Future with Array of all rows as objects matching molecule since date.

    Get data added/retracted since a human point in time (a java.util.Date).

    For more info and code examples see equivalent synchronous getObjArraySince method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    date

    java.util.Date

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  19. def getAsyncObjArraySince(tx: TxReport, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule since tx.

    Get Future with Array of n rows as objects matching molecule since tx.

    Datomic's internal since can take a transaction entity id as argument to retrieve a database value since that transaction (excluding the transaction itself).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    For more info and code examples see equivalent synchronous getObjArraySince method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    tx

    TxReport

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  20. def getAsyncObjArraySince(tx: TxReport)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule since tx.

    Get Future with Array of all rows as objects matching molecule since tx.

    Datomic's internal since can take a transaction entity id as argument to retrieve a database value since that transaction (excluding the transaction itself).

    Instead of supplying the transaction entity id, in Molecule we supply a TxReport that contains the transaction entity id (which is used as argument to Datomic internally). This is more convenient when using Molecule since we get a TxReport from transaction operations like get, update, retract etc.

    For more info and code examples see equivalent synchronous getObjArraySince method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    tx

    TxReport

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  21. def getAsyncObjArraySince(t: Long, n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule since transaction time t.

    Get Future with Array of n rows as objects matching molecule since transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved by calling t on the tx report returned from transactional operations and then be used to get data since that point in time (excluding that transaction).

    For more info and code examples see equivalent synchronous getObjArraySince method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    t

    Transaction time t

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  22. def getAsyncObjArraySince(t: Long)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule since transaction time t.

    Get Future with Array of all rows as objects matching molecule since transaction time t.

    Transaction time t is an auto-incremented transaction number assigned internally by Datomic.

    t can for instance be retrieved by calling t on the tx report returned from transactional operations and then be used to get data since that point in time (excluding that transaction).

    For more info and code examples see equivalent synchronous getObjArraySince method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    t

    Transaction time t

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  23. def getAsyncObjArrayWith(txData: List[_], n: Int)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule with applied raw transaction data.

    Get Future with Array of n rows as objects matching molecule with applied raw transaction data.

    Apply raw transaction data to in-memory "branch" of db without affecting db.

    For more info and code examples see equivalent synchronous getObjArrayWith method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    txData

    Raw transaction data as java.util.List[Object]

    n

    Int Number of rows returned

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  24. def getAsyncObjArrayWith(txData: List[_])(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule with applied raw transaction data.

    Get Future with Array of all rows as objects matching molecule with applied raw transaction data.

    Apply raw transaction data to in-memory "branch" of db without affecting db.

    For more info and code examples see equivalent synchronous getObjArrayWith method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    txData

    Raw transaction data as java.util.List[Object]

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  25. def getAsyncObjArrayWith(n: Int, txMolecules: Seq[Seq[Statement]]*)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of n rows as objects matching molecule with applied molecule transaction data.

    Get Future with Array of n rows as objects matching molecule with applied molecule transaction data.

    Apply one or more molecule transactions to in-memory "branch" of db without affecting db.

    For more info and code examples see equivalent synchronous getObjArrayWith method.

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    The Array is only populated with n rows of type-casted objects.

    n

    Int Number of rows returned

    txMolecules

    Transaction statements from applied Molecules with test data

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

    Note

    Note how the n parameter has to come before the txMolecules vararg.

  26. def getAsyncObjArrayWith(txMolecules: Seq[Seq[Statement]]*)(implicit conn: Conn, objType: ClassTag[Obj], tplType: ClassTag[Tpl]): Future[Array[Obj]]

    Get Future with Array of all rows as objects matching molecule with applied molecule transaction data.

    Get Future with Array of all rows as objects matching molecule with applied molecule transaction data.

    Apply one or more molecule transactions to in-memory "branch" of db without affecting db.

    For more info and code examples see equivalent synchronous getObjArrayWith method.

    Multiple transactions can be applied to test more complex what-if scenarios!

    Getting a pre-allocated Array populated with typed data is the fastest way to query Datomic with Molecule. Looping the Array in a while loop with a mutable index pointer will also be the fastest way to traverse the data set.

    txMolecules

    Transaction statements from applied Molecules with test data

    conn

    Implicit Conn value in scope

    tplType

    Implicit ClassTag[Obj] to capture the object type for Array

    returns

    Future[Array[Obj]] where Obj is an object type having property types matching the attributes of the molecule

  27. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  30. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  31. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  33. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  34. def toString(): String
    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

getAsync

getAsyncArrayAsOf

getAsyncArraySince

getAsyncArrayWith

Ungrouped