00001 // Copyright (C) 2001, Compaq Computer Corporation 00002 // 00003 // This file is part of Vesta. 00004 // 00005 // Vesta is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // Vesta is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with Vesta; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 // 00020 // VRConcurrency.H 00021 // Last modified on Wed Dec 17 17:27:49 EST 2003 by ken@xorian.net 00022 // modified on Mon Jul 24 13:33:06 PDT 2000 by mann 00023 // 00024 // Globals used for logging and concurrency control in the repository 00025 // server. 00026 // 00027 00028 #ifndef _VRCONCURRENCY_H_ 00029 #define _VRCONCURRENCY_H_ 00030 00031 #include "ReadersWritersLock.H" 00032 #include "VestaLog.H" 00033 00034 extern ReadersWritersLock VolatileRootLock; 00035 extern ReadersWritersLock StableLock; 00036 00037 // StableLock.write must be held to modify any stable repository 00038 // state (such as the appendable or mutable directory tree or the 00039 // log). StableLock.read must be held to read such state. 00040 // 00041 // VolatileRootLock.write allows modifying the volatile root; 00042 // VolatileRootLock.read allows reading it. The root of each subtree 00043 // immediately below the volatile root has its own readers/writers 00044 // lock, which allows reading or writing the subtree. 00045 // 00046 // A thread that is checkpointing or weeding must acquire 00047 // VolatileRootLock.write, all volatile subtree write locks, and 00048 // StableLock.write, in that order. 00049 00050 // Code throughout the repository makes use of the fact that, with the 00051 // exception of the volatile root, if you hold the appropriate lock to 00052 // manipulate a directory, then you hold the appropriate lock to 00053 // manipulate its children and its base. 00054 00055 extern VestaLog VRLog; 00056 extern int VRLogVersion; 00057 00058 // VRLog is the repository log. Write methods on VestaSource objects 00059 // internally call the start/commit methods on this log, but because 00060 // start/commit pairs may be nested, clients can group such methods 00061 // into larger atomic units by bracketing them with their own 00062 // start/commit pairs. 00063 00064 // When the semantics of some logged operation change, VRLogVersion 00065 // must change. This change is logged and checkpointed, and if 00066 // recovery begins with an older log version, operations must be 00067 // carried out with the old semantics until a log record is processed 00068 // that updates VRLogVersion to a newer version. 00069 00070 #endif