TxnStep

sealed trait TxnStep[+M <: TxnMode, +A]

Embedded language for safely working with(in) an IndexedDB transaction.

This is necessary because whilst all the transaction methods are async, any other type of asynchronicity is not supported and will result in IndexedDB automatically committing and closing the transaction, in which case, further interaction with the transaction will result in a runtime error.

Therefore, returning AsyncCallback from within transactions is dangerous because it allows composition of both kinds of asynchronicity. To avoid this, we use this embedded language and don't publicly expose its interpretation/translation to AsyncCallback. From the call-site's point of view, a Txn[A] is completely opaque.

This also has a nice side-effect of ensuring that transaction completion is always awaited because we do it in the transaction functions right after interpretation. Otherwise, the call-sites would always need to remember to do it if live transaction access were exposed.

Type parameters:
A

The return type.

Companion:
object
class Object
trait Matchable
class Any
class Eval[A]
class FlatMap[M, A, B]
class GetStore[K, V]
class Map[M, A, B]
class StoreAdd
class StoreDelete[K, V]
class StoreGet[K, V]
class StoreGetAllKeys[K, V]
class StoreGetAllVals[K, V]
class StorePut
class Suspend[M, A]
class TailRec[M, A, B]