Coverage report: /home/ati/workspace/perec/persistence/transaction.lisp
Kind | Covered | All | % |
expression | 29 | 29 | 100.0 |
branch | 4 | 6 | 66.7 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;; -*- mode: Lisp; Syntax: Common-Lisp; -*-
3
;;; Copyright (c) 2006 by the authors.
5
;;; See LICENCE for details.
9
;;; with-database, open-database, close-database, with-transaction, with-transaction*, begin, commit, rollback are all inherited from cl-rdbms
11
(defun transaction-of (object)
12
"Returns the transaction to which the object is currently attached to or nil if the object is not known to be part of any ongoing transaction."
13
(awhen (slot-value object 'transaction)
14
(weak-pointer-value it)))
16
(defun (setf transaction-of) (transaction object)
17
"Attaches the object to a different transaction."
18
(assert (or (not transaction)
19
(not (transaction-of object))))
20
(setf (slot-value object 'transaction)
22
(make-weak-pointer transaction))))
24
(defun instance-in-transaction-p (object)
25
"Returns true iff the object is attached to a transaction which is in progress."
26
(awhen (transaction-of object)
27
(transaction-in-progress-p it)))
29
(defun instance-in-current-transaction-p (object)
30
"Returns true iff the object is attached to the current transaction which is in progress."
31
(and (in-transaction-p)
32
(eq (transaction-of object) *transaction*)))