Async transactions #
Driver.run returns a Std.Async.EAsync TypeDBError α. The driver's calls block their thread,
so each transaction runs on a thread of its own (Task.Priority.dedicated) and never occupies
one of the task pool's workers. Combine transactions with Std.Async combinators such as
EAsync.concurrently, EAsync.race and EAsync.concurrentlyAll, and wait for the result with
EAsync.wait or EAsync.block.
Runs a blocking TypeDB action on a dedicated thread, as an EAsync computation.
Equations
- TypeDB.blocking x = do let task ← Std.Async.EAsync.lift (x.asTask Task.Priority.dedicated).toEIO Std.Async.EAsync.await (ExceptT.mk task)
Instances For
def
TypeDB.Driver.run
{α : Type}
(d : Driver)
(db : String)
(mode : TxMode)
(body : Tx mode α)
(retry : RetryPolicy := RetryPolicy.never)
(opts : TxOptions := { })
:
Runs a transaction on a dedicated thread. Same commit, rollback and retry semantics as
runSync.
Equations
- d.run db mode body retry opts = TypeDB.blocking (d.runSync db mode body retry opts)