LcsClusterAccessBase Class Reference

LcsClusterAccessBase is a base for classes which access cluster pages. More...

#include <LcsClusterAccessBase.h>

Inheritance diagram for LcsClusterAccessBase:

LcsClusterDump LcsClusterNodeWriter LcsClusterReader LcsClusterVerifier List of all members.

Public Member Functions

 LcsClusterAccessBase (BTreeDescriptor const &treeDescriptor)
uint getNumClusterCols ()
 Returns number of columns in cluster.
void setNumClusterCols (uint nCols)
 Sets number of columns in cluster.
void unlockClusterPage ()
 Unlocks cluster page.

Protected Member Functions

LcsRid readRid ()
 Returns RID from btree tuple.
PageId readClusterPageId ()
 Returns cluster pageid from btree tuple.
void setHdrOffsets (PConstLcsClusterNode pHdr)
 Sets pointers to offset arrays in cluster page header.

Protected Attributes

TupleData bTreeTupleData
 Tuple data representing the btree key corresponding to the cluster page.
SegmentAccessor segmentAccessor
 Accessor for segment storing both btree and cluster pages.
ClusterPageLock clusterLock
 Buffer lock for the actual cluster node pages.
PageId clusterPageId
 Current cluster pageid.
LcsRid bTreeRid
 Current rid in btree used to access current cluster page.
uint nClusterCols
 Number of columns in cluster.
uint16_tlastVal
 Offsets to the last value stored on the page for each column in cluster.
uint16_tfirstVal
 Offsets to the first value stored on the page for each column in cluster.
uintnVal
 Number of distinct values in the page for each column in cluster.
uint16_tdelta
 For each column in the cluster, offset used to get the real offset within the page.

Detailed Description

LcsClusterAccessBase is a base for classes which access cluster pages.

Definition at line 34 of file LcsClusterAccessBase.h.


Constructor & Destructor Documentation

LcsClusterAccessBase::LcsClusterAccessBase ( BTreeDescriptor const &  treeDescriptor  )  [explicit]

Definition at line 29 of file LcsClusterAccessBase.cpp.

References SegPageLock::accessSegment(), bTreeTupleData, clusterLock, TupleData::compute(), BTreeDescriptor::segmentAccessor, segmentAccessor, and BTreeDescriptor::tupleDescriptor.

00031 {
00032     segmentAccessor = treeDescriptor.segmentAccessor;
00033     clusterLock.accessSegment(segmentAccessor);
00034     bTreeTupleData.compute(treeDescriptor.tupleDescriptor);
00035 }


Member Function Documentation

LcsRid LcsClusterAccessBase::readRid (  )  [protected]

Returns RID from btree tuple.

Definition at line 37 of file LcsClusterAccessBase.cpp.

References bTreeTupleData.

Referenced by LcsClusterReader::getNextBTreeEntry(), LcsClusterReader::getNextPageForPrefetch(), LcsClusterReader::readClusterPage(), and LcsClusterReader::searchForRid().

00038 {
00039     return *reinterpret_cast<LcsRid const *> (bTreeTupleData[0].pData);
00040 }

PageId LcsClusterAccessBase::readClusterPageId (  )  [protected]

Returns cluster pageid from btree tuple.

Definition at line 42 of file LcsClusterAccessBase.cpp.

References bTreeTupleData.

Referenced by LcsClusterNodeWriter::getLastClusterPageForWrite(), LcsClusterReader::getNextBTreeEntry(), LcsClusterReader::getNextPageForPrefetch(), LcsClusterReader::position(), and LcsClusterReader::readClusterPage().

00043 {
00044     return *reinterpret_cast<PageId const *> (bTreeTupleData[1].pData);
00045 }

void LcsClusterAccessBase::setHdrOffsets ( PConstLcsClusterNode  pHdr  )  [protected]

Sets pointers to offset arrays in cluster page header.

Parameters:
pHdr pointer to cluster node header

Definition at line 47 of file LcsClusterAccessBase.cpp.

References delta, firstVal, lastVal, nClusterCols, and nVal.

Referenced by LcsClusterDump::dump(), LcsClusterNodeWriter::init(), and LcsClusterReader::setUpBlock().

00048 {
00049     PBuffer p = (PBuffer) pHdr;
00050 
00051     lastVal = (uint16_t *) (p += sizeof(LcsClusterNode));
00052     firstVal = (uint16_t *) (p += sizeof(uint16_t) * nClusterCols);
00053     nVal = (uint *) (p += sizeof(uint16_t) * nClusterCols);
00054     delta = (uint16_t *) (p += sizeof(uint) * nClusterCols);
00055 }

uint LcsClusterAccessBase::getNumClusterCols (  )  [inline]

Returns number of columns in cluster.

Definition at line 118 of file LcsClusterAccessBase.h.

00119     {
00120         return nClusterCols;
00121     }

void LcsClusterAccessBase::setNumClusterCols ( uint  nCols  )  [inline]

Sets number of columns in cluster.

Definition at line 126 of file LcsClusterAccessBase.h.

00127     {
00128         nClusterCols = nCols;
00129     }

void LcsClusterAccessBase::unlockClusterPage (  ) 

Unlocks cluster page.

Definition at line 57 of file LcsClusterAccessBase.cpp.

References clusterLock, and SegPageLock::unlock().

Referenced by LcsClusterReader::close().

00058 {
00059     clusterLock.unlock();
00060 }


Member Data Documentation

TupleData LcsClusterAccessBase::bTreeTupleData [protected]

Tuple data representing the btree key corresponding to the cluster page.

Definition at line 42 of file LcsClusterAccessBase.h.

Referenced by LcsClusterNodeWriter::allocateClusterPage(), LcsClusterNodeWriter::getLastClusterPageForWrite(), LcsClusterReader::getNextBTreeEntry(), LcsClusterReader::getNumRows(), LcsClusterAccessBase(), LcsClusterReader::readClusterPage(), readClusterPageId(), readRid(), and LcsClusterReader::searchForRid().

SegmentAccessor LcsClusterAccessBase::segmentAccessor [protected]

Accessor for segment storing both btree and cluster pages.

Definition at line 47 of file LcsClusterAccessBase.h.

Referenced by LcsClusterNodeWriter::allocateClusterPage(), LcsClusterAccessBase(), and LcsClusterReader::position().

ClusterPageLock LcsClusterAccessBase::clusterLock [protected]

Buffer lock for the actual cluster node pages.

Shares the same segment as the btree corresponding to the cluster.

Definition at line 53 of file LcsClusterAccessBase.h.

Referenced by LcsClusterNodeWriter::allocateClusterPage(), LcsClusterNodeWriter::close(), LcsClusterNodeWriter::getLastClusterPageForWrite(), LcsClusterAccessBase(), LcsClusterReader::moveToBlock(), LcsClusterReader::moveToBlockWithRid(), LcsClusterReader::readClusterPage(), and unlockClusterPage().

PageId LcsClusterAccessBase::clusterPageId [protected]

Current cluster pageid.

Definition at line 58 of file LcsClusterAccessBase.h.

Referenced by LcsClusterNodeWriter::allocateClusterPage(), LcsClusterNodeWriter::getLastClusterPageForWrite(), LcsClusterVerifier::getPageData(), LcsClusterNodeWriter::moveFromTempToIndex(), LcsClusterReader::moveToBlockWithRid(), and LcsClusterReader::readClusterPage().

LcsRid LcsClusterAccessBase::bTreeRid [protected]

Current rid in btree used to access current cluster page.

Definition at line 63 of file LcsClusterAccessBase.h.

Referenced by LcsClusterNodeWriter::allocateClusterPage(), LcsClusterVerifier::getPageData(), and LcsClusterReader::readClusterPage().

uint LcsClusterAccessBase::nClusterCols [protected]

Number of columns in cluster.

Definition at line 68 of file LcsClusterAccessBase.h.

Referenced by LcsClusterNodeWriter::addValue(), LcsClusterNodeWriter::allocArrays(), LcsClusterDump::dump(), LcsClusterReader::getNumRows(), LcsClusterNodeWriter::init(), LcsClusterReader::initColumnReaders(), LcsClusterNodeWriter::LcsClusterNodeWriter(), LcsClusterNodeWriter::moveFromIndexToTemp(), LcsClusterNodeWriter::moveFromTempToIndex(), LcsClusterNodeWriter::openAppend(), LcsClusterNodeWriter::openNew(), LcsClusterReader::positionInBlock(), and setHdrOffsets().

uint16_t* LcsClusterAccessBase::lastVal [protected]

Offsets to the last value stored on the page for each column in cluster.

Definition at line 74 of file LcsClusterAccessBase.h.

Referenced by LcsClusterNodeWriter::addValue(), LcsClusterDump::dump(), LcsClusterNodeWriter::moveFromIndexToTemp(), LcsClusterNodeWriter::moveFromTempToIndex(), LcsClusterNodeWriter::openAppend(), LcsClusterNodeWriter::openNew(), LcsClusterNodeWriter::pickCompressionMode(), LcsClusterNodeWriter::putCompressedBatch(), LcsClusterNodeWriter::putFixedVarBatch(), LcsClusterNodeWriter::rollBackLastBatch(), setHdrOffsets(), and LcsClusterNodeWriter::undoValue().

uint16_t* LcsClusterAccessBase::firstVal [protected]

Offsets to the first value stored on the page for each column in cluster.

Points to the end of the firstVal, so subtracting lastVal from firstVal will tell you the number of bytes taken up by values for a column, since lastVals are appended in front of firstVal

Definition at line 82 of file LcsClusterAccessBase.h.

Referenced by LcsClusterDump::dump(), LcsClusterNodeWriter::moveFromIndexToTemp(), LcsClusterNodeWriter::moveFromTempToIndex(), LcsClusterNodeWriter::openNew(), and setHdrOffsets().

uint* LcsClusterAccessBase::nVal [protected]

Number of distinct values in the page for each column in cluster.

Definition at line 87 of file LcsClusterAccessBase.h.

Referenced by LcsClusterNodeWriter::addValue(), LcsClusterDump::dump(), LcsClusterNodeWriter::moveFromIndexToTemp(), LcsClusterNodeWriter::moveFromTempToIndex(), LcsClusterNodeWriter::openAppend(), LcsClusterNodeWriter::openNew(), LcsClusterNodeWriter::pickCompressionMode(), LcsClusterNodeWriter::putCompressedBatch(), LcsClusterNodeWriter::putFixedVarBatch(), LcsClusterNodeWriter::rollBackLastBatch(), setHdrOffsets(), and LcsClusterNodeWriter::undoValue().

uint16_t* LcsClusterAccessBase::delta [protected]

For each column in the cluster, offset used to get the real offset within the page.

Definition at line 93 of file LcsClusterAccessBase.h.

Referenced by LcsClusterDump::dump(), LcsClusterNodeWriter::moveFromTempToIndex(), LcsClusterNodeWriter::openNew(), setHdrOffsets(), and LcsColumnReader::sync().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:36 2009 for Fennel by  doxygen 1.5.1