/* Copyright (C) 2014 InfiniDB, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // $Id: we_dctnry.h 4726 2013-08-07 03:38:36Z bwilkinson $ /** @we_dctnry.h * Defines the Dctnry class * When a signature is given, the value will be stored in dictionary and * a token will be issued. Given a token, the signature in the dictionary * can be deleted */ #ifndef _WE_DCTNRY_H_ #define _WE_DCTNRY_H_ #include #include #include #include #include "we_dbfileop.h" #include "we_type.h" #include "we_brm.h" #include "bytestream.h" #if defined(_MSC_VER) && defined(WRITEENGINE_DLLEXPORT) #define EXPORT __declspec(dllexport) #else #define EXPORT #endif /** Namespace WriteEngine */ namespace WriteEngine { //--------------------------------------------------------------------------- // Structure used to store signatures in string cache //--------------------------------------------------------------------------- typedef struct Signature { int size; unsigned char* signature; Token token; } Signature; struct sig_compare { bool operator() (const Signature& a, const Signature& b) const { if (a.size == b.size){ return memcmp(a.signature,b.signature,a.size)<0;} else if (a.size& oids); virtual int numOfBlocksInFile(); std::set m_sigArray; int m_arraySize; // num strings in m_sigArray // m_dctnryHeader used for hdr when readSubBlockEntry is used to read a blk // m_dctnryHeader2 contains filled in template used to initialize new blocks unsigned char m_dctnryHeader[DCTNRY_HEADER_SIZE]; // first 14 bytes of hdr unsigned char m_dctnryHeader2[DCTNRY_HEADER_SIZE]; // first 14 bytes of hdr uint64_t m_nextPtr; // next pointer //relate to different Dictionary file FID m_dctnryOID; // OID for the dctnry file IDBDataFile* m_dFile; // dictionary file uint32_t m_partition; // partition associated with OID uint16_t m_segment; // segment associated with OID uint16_t m_dbRoot; // DBRoot associated with OID std::string m_segFileName; // current column segment file int m_numBlocks; // num "raw" uncompressed blocks in file int m_lastFbo; HWM m_hwm; //Need to be initialized for different Dictionary file int m_newStartOffset; // start offset uint16_t m_freeSpace; // free space (bytes) within current block int m_curOp; // current ordinal pointer within m_curFbo int m_curFbo; // current "raw" (uncompressed) FBO BRM::LBID_t m_curLbid; // LBID associated with m_curFbo DataBlock m_curBlock; // current "raw" (uncompressed) data block Log* m_logger; // logger, mainly for bulk load int m_colWidth; // width of this dictionary column std::string m_defVal; // optional default string value ImportDataMode m_importDataMode; // Import data in text or binary mode };//end of class } //end of namespace #undef EXPORT #endif // _WE_DCTNRY_H_