(okvs-in-transaction okvs proc [failure [success]])
Start a transaction against OKVS
and pass the
transaction object as argument to PROC
. When
PROC
returns, the transaction is commited and
okvs-in-transaction
applies whatever PROC
returned to the SUCCESS
procedure. If PROC
raises an exception, the transaction is rolled back and FAILURE
is called with the exception condition. By default FAILURE
is raise
and SUCCESS
is identity
.
Le ven. 26 avr. 2019 à 17:19, Amirouche Boubekki <xxxxxx@gmail.com> a écrit :Le mar. 23 avr. 2019 à 13:11, Amirouche Boubekki <xxxxxx@gmail.com> a écrit :Le lun. 22 avr. 2019 à 20:39, John Cowan <xxxxxx@ccil.org> a écrit :A more Schemey approach would be (in-transaction database proc failure success), which evaluates proc passing a newly created transaction as its argument.When proc returns, the transaction is committed and in-transaction applies whatever proc returned to the success procedure and returns its result.If proc calls "rollback" instead,How does look the definition of that "rollback"? Isn't it a raise of some sort?then the transaction is rolled back, the execution of proc is abandoned, failure is called with no arguments, and in-transaction returns its result. By default failure is "raise" and success is "identity".Alex Miller from FoundationDB made some feedback about srfi-167 and he propose something similar to in-transaction.I will think more about it but I think I will adopt in-transaction.