Revision: 3538 Author: ksprotte URL: http://bknr.net/trac/changeset/3538
call invoke-store-transient-init-functions also in snapshot-subsystem U trunk/projects/bos/m2/initialization-subsystem.lisp
Modified: trunk/projects/bos/m2/initialization-subsystem.lisp =================================================================== --- trunk/projects/bos/m2/initialization-subsystem.lisp 2008-07-21 15:14:13 UTC (rev 3537) +++ trunk/projects/bos/m2/initialization-subsystem.lisp 2008-07-21 15:25:37 UTC (rev 3538) @@ -1,14 +1,14 @@ (in-package :bos.m2)
-;;; store-transient-init-functions +;;; transient-init-functions ;;; ;;; Allows for registering transient init functions that ;;; will be called after each restore of m2-store
-(defvar *store-transient-init-functions* nil) -(defvar *store-transient-init-constraints* nil) +(defvar *transient-init-functions* nil) +(defvar *transient-init-constraints* nil)
-(defun register-store-transient-init-function (init-function &rest dependencies) +(defun register-transient-init-function (init-function &rest dependencies) "Register INIT-FUNCTION (a function-name) to be called after each restore of m2-store. Optionally, names of other init-functions can be specified as DEPENDENCIES. The specified @@ -27,31 +27,31 @@ (check-type init-function symbol) (dolist (dependency dependencies) (check-type dependency symbol)) - (let (new-store-transient-init-functions - new-store-transient-init-constraints) + (let (new-transient-init-functions + new-transient-init-constraints) (let ((constraints (build-constraints)) ;; dont know yet whether we have a circular dependency - so ;; we want to be able to abort without changes - (*store-transient-init-functions* *store-transient-init-functions*) - (*store-transient-init-constraints* *store-transient-init-constraints*)) - (pushnew init-function *store-transient-init-functions*) + (*transient-init-functions* *transient-init-functions*) + (*transient-init-constraints* *transient-init-constraints*)) + (pushnew init-function *transient-init-functions*) (dolist (dependency dependencies) - (pushnew dependency *store-transient-init-functions*)) + (pushnew dependency *transient-init-functions*)) (dolist (constraint constraints) - (pushnew constraint *store-transient-init-constraints* :test #'equal)) - (setq new-store-transient-init-functions - (topological-sort *store-transient-init-functions* - *store-transient-init-constraints* + (pushnew constraint *transient-init-constraints* :test #'equal)) + (setq new-transient-init-functions + (topological-sort *transient-init-functions* + *transient-init-constraints* #'ignorant-tie-breaker) - new-store-transient-init-constraints - *store-transient-init-constraints*)) - (setq *store-transient-init-functions* - new-store-transient-init-functions - *store-transient-init-constraints* - new-store-transient-init-constraints)))) + new-transient-init-constraints + *transient-init-constraints*)) + (setq *transient-init-functions* + new-transient-init-functions + *transient-init-constraints* + new-transient-init-constraints))))
-(defun invoke-store-transient-init-functions () - (dolist (function-name *store-transient-init-functions*) +(defun invoke-transient-init-functions () + (dolist (function-name *transient-init-functions*) (with-simple-restart (skip-init-function "Skip transient-init-function ~A" function-name) (funcall function-name)))) @@ -63,8 +63,12 @@ (defmethod bknr.datastore::restore-subsystem (store (subsystem initialization-subsystem) &key until) (declare (ignore until)) - (bos.m2::invoke-store-transient-init-functions)) + (invoke-transient-init-functions))
(defmethod bknr.datastore::snapshot-subsystem (store (subsystem initialization-subsystem)) - ) + ;; We are calling the initialization functions also here, because + ;; for transactions that follow the current snapshot we want to be + ;; in the same initial state as if the store had been freshly + ;; restored. + (invoke-transient-init-functions))