00001 /* 00002 // $Id: //open/dev/fennel/lucidera/colstore/LcsClusterNode.h#9 $ 00003 // Fennel is a library of data storage and processing components. 00004 // Copyright (C) 2005-2009 LucidEra, Inc. 00005 // Copyright (C) 2005-2009 The Eigenbase Project 00006 // 00007 // This program is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU General Public License as published by the Free 00009 // Software Foundation; either version 2 of the License, or (at your option) 00010 // any later version approved by The Eigenbase Project. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef Fennel_LcsClusterNode_Included 00023 #define Fennel_LcsClusterNode_Included 00024 00025 #include "fennel/segment/SegPageLock.h" 00026 #include "fennel/tuple/StandardTypeDescriptor.h" 00027 00028 FENNEL_BEGIN_NAMESPACE 00029 00033 DEFINE_OPAQUE_INTEGER(LcsRid, uint64_t); 00034 00035 // batch compression mode values 00036 00037 enum LcsBatchMode { LCS_COMPRESSED, LCS_FIXED, LCS_VARIABLE }; 00038 00042 struct LcsBatchDir 00043 { 00044 public: 00052 LcsBatchMode mode; 00053 00057 uint nRow; 00058 00064 uint nVal; 00065 00070 uint nValHighMark; 00071 00079 uint oVal; 00080 00085 uint oLastValHighMark; // value high mark before the batch 00086 00090 uint recSize; 00091 }; 00092 00093 typedef LcsBatchDir *PLcsBatchDir; 00094 00101 struct LcsClusterNode : public StoredNode 00102 { 00103 static const MagicNumber MAGIC_NUMBER = 0xa83767addb0d2f09LL; 00104 public: 00105 00109 LcsRid firstRID; 00110 00114 uint nColumn; 00115 00119 uint oBatch; 00120 00124 uint nBatch; 00125 }; 00126 00132 inline uint getClusterSubHeaderSize(uint nColumns) 00133 { 00134 return sizeof(LcsClusterNode) + (3 * sizeof(uint16_t *) * nColumns) + 00135 sizeof(uint) * nColumns; 00136 } 00137 00138 typedef LcsClusterNode *PLcsClusterNode; 00139 typedef const LcsClusterNode *PConstLcsClusterNode; 00140 typedef SegNodeLock<LcsClusterNode> ClusterPageLock; 00141 00142 FENNEL_END_NAMESPACE 00143 00144 #endif 00145 00146 // End LcsClusterNode.h