00001 /*<std-header orig-src='shore' incl-file-exclusion='LID_T_H'> 00002 00003 $Id: lid_t.h,v 1.38 2010/12/08 17:37:34 nhall Exp $ 00004 00005 SHORE -- Scalable Heterogeneous Object REpository 00006 00007 Copyright (c) 1994-99 Computer Sciences Department, University of 00008 Wisconsin -- Madison 00009 All Rights Reserved. 00010 00011 Permission to use, copy, modify and distribute this software and its 00012 documentation is hereby granted, provided that both the copyright 00013 notice and this permission notice appear in all copies of the 00014 software, derivative works or modified versions, and any portions 00015 thereof, and that both notices appear in supporting documentation. 00016 00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY 00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS 00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND 00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 00021 00022 This software was developed with support by the Advanced Research 00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by 00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518. 00025 Further funding for this work was provided by DARPA through 00026 Rome Research Laboratory Contract No. F30602-97-2-0247. 00027 00028 */ 00029 00030 #ifndef LID_T_H 00031 #define LID_T_H 00032 00033 #include "w_defines.h" 00034 00035 /* -- do not edit anything above this line -- </std-header>*/ 00036 00037 #ifndef BASICS_H 00038 #include "basics.h" 00039 #endif 00040 00041 #ifdef __GNUG__ 00042 #pragma interface 00043 #endif 00044 00045 /********************************************************************* 00046 * Logical IDs 00047 * 00048 ********************************************************************/ 00049 00050 /**\addtogroup IDS 00051 * The following persistent storage structures have identifiers, not 00052 * all of which(ids) are persistent: 00053 * - Indexes: stid_t (store id) 00054 * - Files: stid_t (store id) 00055 * - Records: rid_t (record id) 00056 * - Pages: pid_t (short page id), lpid_t (long page id) 00057 * - Volumes: vid_t (short volume id), lvid_t (long volume id) 00058 * - Device 00059 */ 00060 00061 /* 00062 Physical volume IDs (vid_t) are currently used to make unique 00063 long volume IDs. This is a temporary hack which we support with 00064 this typedef: 00065 */ 00066 typedef uint2_t VID_T; 00067 00068 /**\brief long volume ID. See \ref IDS. 00069 *\ingroup IDS 00070 * 00071 * \details A long, almost-unique identifier for a volume, generated from 00072 * a clock and a network address. Written to a volume's header. 00073 * This is the only persistent identifier for a volume, and it is 00074 * used to be sure that one doesn't doubly-mount a volume via different 00075 * paths. 00076 * Thus, in certain sm methods, the long volume ID is used to identify 00077 * a volume, e.g., in destroy_vol, get_volume_quota. 00078 */ 00079 struct lvid_t { 00080 /* usually generated from net addr of creating server */ 00081 uint4_t high; 00082 /* usually generated from timeofday when created */ 00083 uint4_t low; 00084 00085 /* do not want constructors for things embeded in objects. */ 00086 lvid_t() : high(0), low(0) {} 00087 lvid_t(uint4_t hi, uint4_t lo) : high(hi), low(lo) {} 00088 00089 bool operator==(const lvid_t& s) const 00090 {return (low == s.low) && (high == s.high);} 00091 bool operator!=(const lvid_t& s) const 00092 {return (low != s.low) || (high != s.high);} 00093 00094 // in lid_t.cpp: 00095 friend ostream& operator<<(ostream&, const lvid_t&); 00096 friend istream& operator>>(istream&, lvid_t&); 00097 00098 // defined in lid_t.cpp 00099 static const lvid_t null; 00100 }; 00101 00102 00103 inline w_base_t::uint4_t w_hash(const lvid_t& lv) 00104 { 00105 return lv.high + lv.low; 00106 } 00107 #endif