Hello,

Here follows Common Lisp code, using a datastore library named bknr.datastore

    (ql:quickload :bknr.datastore)

    (defclass userdata (bknr.datastore:store-object)
      ((email :initarg :email
     :index-type bknr.indices:unique-index
     :index-values all-users)
       (name :initarg :name))
      (:metaclass bknr.datastore:persistent-class))

    (let ((object-subsystem (make-instance 'bknr.datastore:store-object-subsystem)))
      (make-instance 'bknr.datastore:store
    :directory *default-pathname-defaults*
                     :subsystems (list object-subsystem)))

    (make-instance 'userdata :email "m@b.com" :name "Maria")
    (make-instance 'userdata :email "k@g.com" :name "Katerina")

    (setf (slot-value (first (all-users)) 'name) "Elena")
    ; Attempt to modify persistent slot NAME of #<USERDATA ID: 0> outside of a transaction
    ;   [Condition of type BKNR.DATASTORE::PERSISTENT-SLOT-MODIFIED-OUTSIDE-OF-TRANSACTION]

    (bknr.datastore:with-transaction ()
      (setf (slot-value (first (all-users)) 'name) "Elena"))
    ; runs successfully, the above wrap in with-transaction () is necessary

I use the Slime inspector to view the datastore, so in the minibuffer after C-c C-I Inspect value (evaluated):
I input
    (all-users)

I can see the data but not edit it in the slime inspector, because the same condition is thrown as above.

Can the slime inspector be customized in a way that it wraps calls to setf inside transactions?

PS: if you run the above code, a directory named "current" will be created in your lisp's working directory. It saves the datastore on disk.

Thank you,
Christos Gitsis