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 // DirShortId.H 00021 // Last modified on Wed Jul 21 00:39:21 EDT 2004 by ken@xorian.net 00022 // modified on Tue Dec 10 13:41:01 PST 1996 by mann 00023 // 00024 // ShortIds for immutable directories. Server side only. 00025 // 00026 00027 #ifndef _DSID_H 00028 #define _DSID_H 00029 00030 #include "SourceOrDerived.H" 00031 #include "ShortIdBlock.H" 00032 #include "FP.H" 00033 #include <fstream> 00034 00035 // Call once before calling any other procedures here. 00036 void InitDirShortId() throw(); 00037 00038 // Allocate a new directory sid (i.e., one not currently registered), 00039 // and register it as corresponding to a directory at short address 00040 // sp. The fingerprint is passed as an argument to help in making 00041 // ShortId assignment deterministic. 00042 ShortId NewDirShortId(const FP::Tag& fptag, Bit32 sp) throw(); 00043 00044 // Lookup a sid in the table. Return 0 if not found. 00045 Bit32 GetDirShortId(ShortId sid) throw(); 00046 00047 // Register or reregister an existing directory sid as being at short 00048 // address sp. 00049 void SetDirShortId(ShortId sid, Bit32 sp) throw(); 00050 00051 // Log all the ShortIds that are currently in the table. 00052 // Assumes the correct locks for log access are held. 00053 void LogAllDirShortIds(char* tag); 00054 00055 // Checkpoint the ShortIds that are currently in the table and not 00056 // checkpointed already. 00057 void CheckpointAllDirShortIds(Bit32& nextSP, std::fstream& ckpt); 00058 00059 // Delete one ShortId registration. 00060 void DeleteDirShortId(ShortId sid) throw(); 00061 00062 // Delete all ShortId registrations, in preparation for rebuilding 00063 // the registration table. 00064 void DeleteAllDirShortIds() throw(); 00065 00066 #endif // _DSID_H