kccachedb.h   kccachedb.h 
skipping to change at line 57 skipping to change at line 57
struct TranLog; struct TranLog;
struct Slot; struct Slot;
class Repeater; class Repeater;
class Setter; class Setter;
class Remover; class Remover;
class ScopedVisitor; class ScopedVisitor;
/** An alias of list of cursors. */ /** An alias of list of cursors. */
typedef std::list<Cursor*> CursorList; typedef std::list<Cursor*> CursorList;
/** An alias of list of transaction logs. */ /** An alias of list of transaction logs. */
typedef std::list<TranLog> TranLogList; typedef std::list<TranLog> TranLogList;
/** The number of slot tables. */
static const int32_t SLOTNUM = 16;
/** The default bucket number. */
static const size_t DEFBNUM = 1048583LL;
/** The mininum number of buckets to use mmap. */
static const size_t ZMAPBNUM = 32768;
/** The maximum size of each key. */
static const uint32_t KSIZMAX = 0xfffff;
/** The size of the record buffer. */
static const size_t RECBUFSIZ = 48;
/** The size of the opaque buffer. */
static const size_t OPAQUESIZ = 16;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
public: public:
/** /**
* Cursor to indicate a record. * Cursor to indicate a record.
*/ */
class Cursor : public BasicDB::Cursor { class Cursor : public BasicDB::Cursor {
friend class CacheDB; friend class CacheDB;
public: public:
/** /**
* Constructor. * Constructor.
* @param db the container database object. * @param db the container database object.
skipping to change at line 1226 skipping to change at line 1240
bool reorganized() { bool reorganized() {
_assert_(true); _assert_(true);
ScopedSpinRWLock lock(&mlock_, false); ScopedSpinRWLock lock(&mlock_, false);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
return false; return false;
} }
private: private:
/** The number of slot tables. */
static const int32_t SLOTNUM = 16;
/** The default bucket number. */
static const size_t DEFBNUM = 1048583LL;
/** The mininum number of buckets to use mmap. */
static const size_t ZMAPBNUM = 32768;
/** The maximum size of each key. */
static const uint32_t KSIZMAX = 0xfffff;
/** The size of the record buffer. */
static const size_t RECBUFSIZ = 48;
/** The size of the opaque buffer. */
static const size_t OPAQUESIZ = 16;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
/** /**
* Set the power of the alignment of record size. * Set the power of the alignment of record size.
* @note This is a dummy implementation for compatibility. * @note This is a dummy implementation for compatibility.
*/ */
bool tune_alignment(int8_t apow) { bool tune_alignment(int8_t apow) {
return true; return true;
} }
/** /**
* Set the power of the capacity of the free block pool. * Set the power of the capacity of the free block pool.
* @note This is a dummy implementation for compatibility. * @note This is a dummy implementation for compatibility.
 End of changes. 2 change blocks. 
14 lines changed or deleted 14 lines changed or added


 kccommon.h   kccommon.h 
skipping to change at line 108 skipping to change at line 108
#endif #endif
#undef VERSION #undef VERSION
#undef LIBVER #undef LIBVER
#undef LIBREV #undef LIBREV
#undef SYSNAME #undef SYSNAME
#undef BIGEND #undef BIGEND
#undef CLOCKTICK #undef CLOCKTICK
#undef PAGESIZE #undef PAGESIZE
#undef FEATURES
#undef NUMBUFSIZ
#undef MEMMAXSIZ
#undef IOBUFSIZ
#undef SUCCESS #undef SUCCESS
#undef NOIMPL #undef NOIMPL
#undef INVALID #undef INVALID
#undef NOREPOS #undef NOREPOS
#undef NOPERM #undef NOPERM
#undef BROKEN #undef BROKEN
#undef DUPREC #undef DUPREC
#undef NOREC #undef NOREC
#undef LOGIC #undef LOGIC
#undef SYSTEM #undef SYSTEM
skipping to change at line 134 skipping to change at line 138
#undef ERROR #undef ERROR
#undef OPEN #undef OPEN
#undef CLOSE #undef CLOSE
#undef CLEAR #undef CLEAR
#undef ITERATE #undef ITERATE
#undef SYNCHRONIZE #undef SYNCHRONIZE
#undef BEGINTRAN #undef BEGINTRAN
#undef COMMITTRAN #undef COMMITTRAN
#undef ABORTTRAN #undef ABORTTRAN
#undef INT8MAX
#undef INT16MAX
#undef INT32MAX
#undef INT64MAX
#undef INT8MIN
#undef INT16MIN
#undef INT32MIN
#undef INT64MIN
#undef UINT8MAX
#undef UINT16MAX
#undef UINT32MAX
#undef UINT64MAX
#undef SIZEMAX
#undef FLTMAX
#undef DBLMAX
#if defined(_KCUYIELD) #if defined(_KCUYIELD)
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include <windows.h> #include <windows.h>
#define _yield_() ::Sleep(0) #define _yield_() ::Sleep(0)
#else #else
#include <sched.h> #include <sched.h>
#define _yield_() ::sched_yield() #define _yield_() ::sched_yield()
#endif #endif
#define _testyield_() \ #define _testyield_() \
do { \ do { \
skipping to change at line 175 skipping to change at line 195
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define __KCFUNC__ __FUNCTION__ ///< for debugging #define __KCFUNC__ __FUNCTION__ ///< for debugging
#else #else
#define __KCFUNC__ "-" ///< for debugging #define __KCFUNC__ "-" ///< for debugging
#endif #endif
#define _KCCODELINE_ __FILE__, __LINE__, __KCFUNC__ ///< for debugging #define _KCCODELINE_ __FILE__, __LINE__, __KCFUNC__ ///< for debugging
/** /**
* All symbols of Kyoto Cabinet. * All symbols of Kyoto Cabinet.
*/ */
namespace kyotocabinet { namespace kyotocabinet {}
const int8_t INT8MAX = (std::numeric_limits<int8_t>::max)(); ///< max
imum value of int8_t
const int16_t INT16MAX = (std::numeric_limits<int16_t>::max)(); ///< max
imum value of int16_t
const int32_t INT32MAX = (std::numeric_limits<int32_t>::max)(); ///< max
imum value of int32_t
const int64_t INT64MAX = (std::numeric_limits<int64_t>::max)(); ///< max
imum value of int64_t
const int8_t INT8MIN = (std::numeric_limits<int8_t>::min)(); ///< min
imum value of int8_t
const int16_t INT16MIN = (std::numeric_limits<int16_t>::min)(); ///< min
imum value of int16_t
const int32_t INT32MIN = (std::numeric_limits<int32_t>::min)(); ///< min
imum value of int32_t
const int64_t INT64MIN = (std::numeric_limits<int64_t>::min)(); ///< min
imum value of int64_t
const uint8_t UINT8MAX = (std::numeric_limits<uint8_t>::max)(); ///< max
imum value of uint8_t
const uint16_t UINT16MAX = (std::numeric_limits<uint16_t>::max)(); ///< max
imum value of uint16_t
const uint32_t UINT32MAX = (std::numeric_limits<uint32_t>::max)(); ///< max
imum value of uint32_t
const uint64_t UINT64MAX = (std::numeric_limits<uint64_t>::max)(); ///< max
imum value of uint64_t
}
#endif // duplication check #endif // duplication check
// END OF FILE // END OF FILE
 End of changes. 4 change blocks. 
26 lines changed or deleted 21 lines changed or added


 kcdb.h   kcdb.h 
skipping to change at line 470 skipping to change at line 470
* child processes. * child processes.
*/ */
class BasicDB : public DB { class BasicDB : public DB {
public: public:
class Cursor; class Cursor;
class Error; class Error;
class ProgressChecker; class ProgressChecker;
class FileProcessor; class FileProcessor;
class Logger; class Logger;
class MetaTrigger; class MetaTrigger;
private:
/** The size of the IO buffer. */
static const size_t IOBUFSIZ = 8192;
public: public:
/** /**
* Database types. * Database types.
*/ */
enum Type { enum Type {
TYPEVOID = 0x00, ///< void database TYPEVOID = 0x00, ///< void database
TYPEPHASH = 0x10, ///< prototype hash database TYPEPHASH = 0x10, ///< prototype hash database
TYPEPTREE = 0x11, ///< prototype tree database TYPEPTREE = 0x11, ///< prototype tree database
TYPESTASH = 0x18, ///< stash database TYPESTASH = 0x18, ///< stash database
TYPECACHE = 0x20, ///< cache hash database TYPECACHE = 0x20, ///< cache hash database
skipping to change at line 2204 skipping to change at line 2207
case TYPECACHE: return "cache hash database"; case TYPECACHE: return "cache hash database";
case TYPEGRASS: return "cache tree database"; case TYPEGRASS: return "cache tree database";
case TYPEHASH: return "file hash database"; case TYPEHASH: return "file hash database";
case TYPETREE: return "file tree database"; case TYPETREE: return "file tree database";
case TYPEDIR: return "directory hash database"; case TYPEDIR: return "directory hash database";
case TYPEFOREST: return "directory tree database"; case TYPEFOREST: return "directory tree database";
case TYPEMISC: return "miscellaneous database"; case TYPEMISC: return "miscellaneous database";
} }
return "unknown"; return "unknown";
} }
private:
/** The size of the IO buffer. */
static const size_t IOBUFSIZ = 8192;
}; };
} // common namespace } // common namespace
#endif // duplication check #endif // duplication check
// END OF FILE // END OF FILE
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 kcdbext.h   kcdbext.h 
skipping to change at line 51 skipping to change at line 51
*/ */
class MapReduce { class MapReduce {
public: public:
class MapEmitter; class MapEmitter;
class ValueIterator; class ValueIterator;
private: private:
class MapVisitor; class MapVisitor;
struct MergeLine; struct MergeLine;
/** An alias of vector of loaded values. */ /** An alias of vector of loaded values. */
typedef std::vector<std::string> Values; typedef std::vector<std::string> Values;
/** The default number of temporary databases. */
static const size_t MRDEFDBNUM = 8;
/** The maxinum number of temporary databases. */
static const size_t MRMAXDBNUM = 256;
/** The default cache limit. */
static const int64_t MRDEFCLIM = 512LL << 20;
/** The default cache bucket numer. */
static const int64_t MRDEFCBNUM = 1048583LL;
/** The bucket number of temprary databases. */
static const int64_t MRDBBNUM = 512LL << 10;
/** The page size of temprary databases. */
static const int32_t MRDBPSIZ = 32768;
/** The mapped size of temprary databases. */
static const int64_t MRDBMSIZ = 516LL * 4096;
/** The page cache capacity of temprary databases. */
static const int64_t MRDBPCCAP = 16LL << 20;
public: public:
/** /**
* Data emitter for the mapper. * Data emitter for the mapper.
*/ */
class MapEmitter { class MapEmitter {
friend class MapReduce; friend class MapReduce;
friend class MapReduce::MapVisitor; friend class MapReduce::MapVisitor;
public: public:
/** /**
* Emit a record from the mapper. * Emit a record from the mapper.
skipping to change at line 398 skipping to change at line 414
*/ */
void tune_storage(int32_t dbnum, int64_t clim, int64_t cbnum) { void tune_storage(int32_t dbnum, int64_t clim, int64_t cbnum) {
_assert_(true); _assert_(true);
dbnum_ = dbnum > 0 ? dbnum : MRDEFDBNUM; dbnum_ = dbnum > 0 ? dbnum : MRDEFDBNUM;
if (dbnum_ > MRMAXDBNUM) dbnum_ = MRMAXDBNUM; if (dbnum_ > MRMAXDBNUM) dbnum_ = MRMAXDBNUM;
clim_ = clim > 0 ? clim : MRDEFCLIM; clim_ = clim > 0 ? clim : MRDEFCLIM;
cbnum_ = cbnum > 0 ? cbnum : MRDEFCBNUM; cbnum_ = cbnum > 0 ? cbnum : MRDEFCBNUM;
if (cbnum_ > INT16MAX) cbnum_ = nearbyprime(cbnum_); if (cbnum_ > INT16MAX) cbnum_ = nearbyprime(cbnum_);
} }
private: private:
/** The default number of temporary databases. */
static const size_t MRDEFDBNUM = 8;
/** The maxinum number of temporary databases. */
static const size_t MRMAXDBNUM = 256;
/** The default cache limit. */
static const int64_t MRDEFCLIM = 512LL << 20;
/** The default cache bucket numer. */
static const int64_t MRDEFCBNUM = 1048583LL;
/** The bucket number of temprary databases. */
static const int64_t MRDBBNUM = 512LL << 10;
/** The page size of temprary databases. */
static const int32_t MRDBPSIZ = 32768;
/** The mapped size of temprary databases. */
static const int64_t MRDBMSIZ = 516LL * 4096;
/** The page cache capacity of temprary databases. */
static const int64_t MRDBPCCAP = 16LL << 20;
/** /**
* Checker for the map process. * Checker for the map process.
*/ */
class MapChecker : public BasicDB::ProgressChecker { class MapChecker : public BasicDB::ProgressChecker {
public: public:
/** constructor */ /** constructor */
explicit MapChecker() : stop_(false) {} explicit MapChecker() : stop_(false) {}
/** stop the process */ /** stop the process */
void stop() { void stop() {
stop_ = true; stop_ = true;
 End of changes. 2 change blocks. 
16 lines changed or deleted 16 lines changed or added


 kcdirdb.h   kcdirdb.h 
skipping to change at line 61 skipping to change at line 61
friend class PlantDB<DirDB, BasicDB::TYPEFOREST>; friend class PlantDB<DirDB, BasicDB::TYPEFOREST>;
public: public:
class Cursor; class Cursor;
private: private:
struct Record; struct Record;
class ScopedVisitor; class ScopedVisitor;
/** An alias of list of cursors. */ /** An alias of list of cursors. */
typedef std::list<Cursor*> CursorList; typedef std::list<Cursor*> CursorList;
/** An alias of vector of strings. */ /** An alias of vector of strings. */
typedef std::vector<std::string> StringVector; typedef std::vector<std::string> StringVector;
/** The size of the meta data buffer. */
static const int64_t METABUFSIZ = 128;
/** The magic data for record. */
static const uint8_t RECMAGIC = 0xcc;
/** The number of slots of the record lock. */
static const int32_t RLOCKSLOT = 2048;
/** The unit size of a record. */
static const int32_t RECUNITSIZ = 32;
/** The size of the opaque buffer. */
static const size_t OPAQUESIZ = 16;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
public: public:
/** /**
* Cursor to indicate a record. * Cursor to indicate a record.
*/ */
class Cursor : public BasicDB::Cursor { class Cursor : public BasicDB::Cursor {
friend class DirDB; friend class DirDB;
public: public:
/** /**
* Constructor. * Constructor.
* @param db the container database object. * @param db the container database object.
skipping to change at line 1360 skipping to change at line 1372
bool reorganized() { bool reorganized() {
_assert_(true); _assert_(true);
ScopedSpinRWLock lock(&mlock_, false); ScopedSpinRWLock lock(&mlock_, false);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
return reorg_; return reorg_;
} }
private: private:
/** The size of the meta data buffer. */
static const int64_t METABUFSIZ = 128;
/** The magic data for record. */
static const uint8_t RECMAGIC = 0xcc;
/** The number of slots of the record lock. */
static const int32_t RLOCKSLOT = 2048;
/** The unit size of a record. */
static const int32_t RECUNITSIZ = 32;
/** The size of the opaque buffer. */
static const size_t OPAQUESIZ = 16;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
/** /**
* Set the power of the alignment of record size. * Set the power of the alignment of record size.
* @note This is a dummy implementation for compatibility. * @note This is a dummy implementation for compatibility.
*/ */
bool tune_alignment(int8_t apow) { bool tune_alignment(int8_t apow) {
return true; return true;
} }
/** /**
* Set the power of the capacity of the free block pool. * Set the power of the capacity of the free block pool.
* @note This is a dummy implementation for compatibility. * @note This is a dummy implementation for compatibility.
 End of changes. 2 change blocks. 
12 lines changed or deleted 12 lines changed or added


 kchashdb.h   kchashdb.h 
skipping to change at line 59 skipping to change at line 59
private: private:
struct Record; struct Record;
struct FreeBlock; struct FreeBlock;
struct FreeBlockComparator; struct FreeBlockComparator;
class Repeater; class Repeater;
class ScopedVisitor; class ScopedVisitor;
/** An alias of set of free blocks. */ /** An alias of set of free blocks. */
typedef std::set<FreeBlock> FBP; typedef std::set<FreeBlock> FBP;
/** An alias of list of cursors. */ /** An alias of list of cursors. */
typedef std::list<Cursor*> CursorList; typedef std::list<Cursor*> CursorList;
/** The offset of the library version. */
static const int64_t MOFFLIBVER = 4;
/** The offset of the library revision. */
static const int64_t MOFFLIBREV = 5;
/** The offset of the format revision. */
static const int64_t MOFFFMTVER = 6;
/** The offset of the module checksum. */
static const int64_t MOFFCHKSUM = 7;
/** The offset of the database type. */
static const int64_t MOFFTYPE = 8;
/** The offset of the alignment power. */
static const int64_t MOFFAPOW = 9;
/** The offset of the free block pool power. */
static const int64_t MOFFFPOW = 10;
/** The offset of the options. */
static const int64_t MOFFOPTS = 11;
/** The offset of the bucket number. */
static const int64_t MOFFBNUM = 16;
/** The offset of the status flags. */
static const int64_t MOFFFLAGS = 24;
/** The offset of the record number. */
static const int64_t MOFFCOUNT = 32;
/** The offset of the file size. */
static const int64_t MOFFSIZE = 40;
/** The offset of the opaque data. */
static const int64_t MOFFOPAQUE = 48;
/** The size of the header. */
static const int64_t HEADSIZ = 64;
/** The width of the free block. */
static const int32_t FBPWIDTH = 6;
/** The large width of the record address. */
static const int32_t WIDTHLARGE = 6;
/** The small width of the record address. */
static const int32_t WIDTHSMALL = 4;
/** The size of the record buffer. */
static const size_t RECBUFSIZ = 48;
/** The size of the IO buffer. */
static const size_t IOBUFSIZ = 1024;
/** The number of slots of the record lock. */
static const int32_t RLOCKSLOT = 1024;
/** The default alignment power. */
static const uint8_t DEFAPOW = 3;
/** The maximum alignment power. */
static const uint8_t MAXAPOW = 15;
/** The default free block pool power. */
static const uint8_t DEFFPOW = 10;
/** The maximum free block pool power. */
static const uint8_t MAXFPOW = 20;
/** The default bucket number. */
static const int64_t DEFBNUM = 1048583LL;
/** The default size of the memory-mapped region. */
static const int64_t DEFMSIZ = 64LL << 20;
/** The magic data for record. */
static const uint8_t RECMAGIC = 0xcc;
/** The magic data for padding. */
static const uint8_t PADMAGIC = 0xee;
/** The magic data for free block. */
static const uint8_t FBMAGIC = 0xdd;
/** The maximum unit of auto defragmentation. */
static const int32_t DFRGMAX = 512;
/** The coefficient of auto defragmentation. */
static const int32_t DFRGCEF = 2;
/** The checking width for record salvage. */
static const int64_t SLVGWIDTH = 1LL << 20;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
public: public:
/** /**
* Cursor to indicate a record. * Cursor to indicate a record.
*/ */
class Cursor : public BasicDB::Cursor { class Cursor : public BasicDB::Cursor {
friend class HashDB; friend class HashDB;
public: public:
/** /**
* Constructor. * Constructor.
* @param db the container database object. * @param db the container database object.
skipping to change at line 1610 skipping to change at line 1676
bool reorganized() { bool reorganized() {
_assert_(true); _assert_(true);
ScopedSpinRWLock lock(&mlock_, false); ScopedSpinRWLock lock(&mlock_, false);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
return reorg_; return reorg_;
} }
private: private:
/** The offset of the library version. */
static const int64_t MOFFLIBVER = 4;
/** The offset of the library revision. */
static const int64_t MOFFLIBREV = 5;
/** The offset of the format revision. */
static const int64_t MOFFFMTVER = 6;
/** The offset of the module checksum. */
static const int64_t MOFFCHKSUM = 7;
/** The offset of the database type. */
static const int64_t MOFFTYPE = 8;
/** The offset of the alignment power. */
static const int64_t MOFFAPOW = 9;
/** The offset of the free block pool power. */
static const int64_t MOFFFPOW = 10;
/** The offset of the options. */
static const int64_t MOFFOPTS = 11;
/** The offset of the bucket number. */
static const int64_t MOFFBNUM = 16;
/** The offset of the status flags. */
static const int64_t MOFFFLAGS = 24;
/** The offset of the record number. */
static const int64_t MOFFCOUNT = 32;
/** The offset of the file size. */
static const int64_t MOFFSIZE = 40;
/** The offset of the opaque data. */
static const int64_t MOFFOPAQUE = 48;
/** The size of the header. */
static const int64_t HEADSIZ = 64;
/** The width of the free block. */
static const int32_t FBPWIDTH = 6;
/** The large width of the record address. */
static const int32_t WIDTHLARGE = 6;
/** The small width of the record address. */
static const int32_t WIDTHSMALL = 4;
/** The size of the record buffer. */
static const size_t RECBUFSIZ = 48;
/** The size of the IO buffer. */
static const size_t IOBUFSIZ = 1024;
/** The number of slots of the record lock. */
static const int32_t RLOCKSLOT = 1024;
/** The default alignment power. */
static const uint8_t DEFAPOW = 3;
/** The maximum alignment power. */
static const uint8_t MAXAPOW = 15;
/** The default free block pool power. */
static const uint8_t DEFFPOW = 10;
/** The maximum free block pool power. */
static const uint8_t MAXFPOW = 20;
/** The default bucket number. */
static const int64_t DEFBNUM = 1048583LL;
/** The default size of the memory-mapped region. */
static const int64_t DEFMSIZ = 64LL << 20;
/** The magic data for record. */
static const uint8_t RECMAGIC = 0xcc;
/** The magic data for padding. */
static const uint8_t PADMAGIC = 0xee;
/** The magic data for free block. */
static const uint8_t FBMAGIC = 0xdd;
/** The maximum unit of auto defragmentation. */
static const int32_t DFRGMAX = 512;
/** The coefficient of auto defragmentation. */
static const int32_t DFRGCEF = 2;
/** The checking width for record salvage. */
static const int64_t SLVGWIDTH = 1LL << 20;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
/** /**
* Record data. * Record data.
*/ */
struct Record { struct Record {
int64_t off; ///< offset int64_t off; ///< offset
size_t rsiz; ///< whole size size_t rsiz; ///< whole size
size_t psiz; ///< size of the padding size_t psiz; ///< size of the padding
size_t ksiz; ///< size of the key size_t ksiz; ///< size of the key
size_t vsiz; ///< size of the value size_t vsiz; ///< size of the value
int64_t left; ///< address of the left child rec ord int64_t left; ///< address of the left child rec ord
 End of changes. 2 change blocks. 
66 lines changed or deleted 66 lines changed or added


 kcmap.h   kcmap.h 
skipping to change at line 32 skipping to change at line 32
/** /**
* Memory-saving hash map. * Memory-saving hash map.
*/ */
class TinyHashMap { class TinyHashMap {
public: public:
class Iterator; class Iterator;
private: private:
struct Record; struct Record;
struct RecordComparator; struct RecordComparator;
/** The default bucket number of hash table. */
static const size_t MAPDEFBNUM = 31;
/** The mininum number of buckets to use mmap. */
static const size_t MAPZMAPBNUM = 32768;
public: public:
/** /**
* Iterator of records. * Iterator of records.
*/ */
class Iterator { class Iterator {
friend class TinyHashMap; friend class TinyHashMap;
public: public:
/** /**
* Constructor. * Constructor.
* @param map the container. * @param map the container.
skipping to change at line 479 skipping to change at line 483
} }
/** /**
* Get the number of records. * Get the number of records.
* @return the number of records. * @return the number of records.
*/ */
size_t count() { size_t count() {
_assert_(true); _assert_(true);
return count_; return count_;
} }
private: private:
/** The default bucket number of hash table. */
static const size_t MAPDEFBNUM = 31;
/** The mininum number of buckets to use mmap. */
static const size_t MAPZMAPBNUM = 32768;
/** /**
* Record data. * Record data.
*/ */
struct Record { struct Record {
/** constructor */ /** constructor */
Record(char* child, const char* kbuf, uint64_t ksiz, Record(char* child, const char* kbuf, uint64_t ksiz,
const char* vbuf, uint64_t vsiz, uint64_t psiz) : const char* vbuf, uint64_t vsiz, uint64_t psiz) :
child_(child), kbuf_(kbuf), ksiz_(ksiz), vbuf_(vbuf), vsiz_(vsiz), ps iz_(psiz) { child_(child), kbuf_(kbuf), ksiz_(ksiz), vbuf_(vbuf), vsiz_(vsiz), ps iz_(psiz) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && vbuf && vsiz <= MEMMAXSIZ && ps iz <= MEMMAXSIZ); _assert_(kbuf && ksiz <= MEMMAXSIZ && vbuf && vsiz <= MEMMAXSIZ && ps iz <= MEMMAXSIZ);
} }
skipping to change at line 666 skipping to change at line 666
* @param HASH the hash functor. * @param HASH the hash functor.
* @param EQUALTO the equality checking functor. * @param EQUALTO the equality checking functor.
*/ */
template <class KEY, class VALUE, template <class KEY, class VALUE,
class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY> > class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY> >
class LinkedHashMap { class LinkedHashMap {
public: public:
class Iterator; class Iterator;
private: private:
struct Record; struct Record;
/** The default bucket number of hash table. */
static const size_t MAPDEFBNUM = 31;
/** The mininum number of buckets to use mmap. */
static const size_t MAPZMAPBNUM = 32768;
public: public:
/** /**
* Iterator of records. * Iterator of records.
*/ */
class Iterator { class Iterator {
friend class LinkedHashMap; friend class LinkedHashMap;
public: public:
/** /**
* Copy constructor. * Copy constructor.
* @param src the source object. * @param src the source object.
skipping to change at line 1157 skipping to change at line 1161
} }
/** /**
* Get the reference of the value of the last record. * Get the reference of the value of the last record.
* @return the reference of the value of the last record. * @return the reference of the value of the last record.
*/ */
VALUE& last_value() { VALUE& last_value() {
_assert_(true); _assert_(true);
return last_->value; return last_->value;
} }
private: private:
/** The default bucket number of hash table. */
static const size_t MAPDEFBNUM = 31;
/** The mininum number of buckets to use mmap. */
static const size_t MAPZMAPBNUM = 32768;
/** /**
* Record data. * Record data.
*/ */
struct Record { struct Record {
KEY key; ///< key KEY key; ///< key
VALUE value; ///< value VALUE value; ///< value
Record* child; ///< child record Record* child; ///< child record
Record* prev; ///< previous record Record* prev; ///< previous record
Record* next; ///< next record Record* next; ///< next record
/** constructor */ /** constructor */
 End of changes. 4 change blocks. 
8 lines changed or deleted 8 lines changed or added


 kcplantdb.h   kcplantdb.h 
skipping to change at line 30 skipping to change at line 30
#include <kcthread.h> #include <kcthread.h>
#include <kcfile.h> #include <kcfile.h>
#include <kccompress.h> #include <kccompress.h>
#include <kccompare.h> #include <kccompare.h>
#include <kcmap.h> #include <kcmap.h>
#include <kcregex.h> #include <kcregex.h>
#include <kcdb.h> #include <kcdb.h>
#define KCPDBMETAKEY "@" ///< key of the record for meta da ta #define KCPDBMETAKEY "@" ///< key of the record for meta da ta
#define KCPDBTMPPATHEXT "tmpkct" ///< extension of the temporary fi le #define KCPDBTMPPATHEXT "tmpkct" ///< extension of the temporary fi le
#define KCPDRECBUFSIZ 128 ///< size of the record buffer
namespace kyotocabinet { // common namespace namespace kyotocabinet { // common namespace
/** /**
* Plant database. * Plant database.
* @param BASEDB a class compatible with the file hash database class. * @param BASEDB a class compatible with the file hash database class.
* @param DBTYPE the database type number of the class. * @param DBTYPE the database type number of the class.
* @note This class template is a template for concrete classes to operate tree databases. * @note This class template is a template for concrete classes to operate tree databases.
* Template instance classes can be inherited but overwriting methods is fo rbidden. The class * Template instance classes can be inherited but overwriting methods is fo rbidden. The class
* TreeDB is the instance of the file tree database. The class ForestDB is the instance of the * TreeDB is the instance of the file tree database. The class ForestDB is the instance of the
skipping to change at line 71 skipping to change at line 72
/** An alias of array of records. */ /** An alias of array of records. */
typedef std::vector<Record*> RecordArray; typedef std::vector<Record*> RecordArray;
/** An alias of array of records. */ /** An alias of array of records. */
typedef std::vector<Link*> LinkArray; typedef std::vector<Link*> LinkArray;
/** An alias of leaf node cache. */ /** An alias of leaf node cache. */
typedef LinkedHashMap<int64_t, LeafNode*> LeafCache; typedef LinkedHashMap<int64_t, LeafNode*> LeafCache;
/** An alias of inner node cache. */ /** An alias of inner node cache. */
typedef LinkedHashMap<int64_t, InnerNode*> InnerCache; typedef LinkedHashMap<int64_t, InnerNode*> InnerCache;
/** An alias of list of cursors. */ /** An alias of list of cursors. */
typedef std::list<Cursor*> CursorList; typedef std::list<Cursor*> CursorList;
/** The number of cache slots. */
static const int32_t SLOTNUM = 16;
/** The default alignment power. */
static const uint8_t DEFAPOW = 8;
/** The default free block pool power. */
static const uint8_t DEFFPOW = 10;
/** The default bucket number. */
static const int64_t DEFBNUM = 64LL << 10;
/** The default page size. */
static const int32_t DEFPSIZ = 8192;
/** The default capacity size of the page cache. */
static const int64_t DEFPCCAP = 64LL << 20;
/** The size of the header. */
static const int64_t HEADSIZ = 80;
/** The offset of the numbers. */
static const int64_t MOFFNUMS = 8;
/** The prefix of leaf nodes. */
static const char LNPREFIX = 'L';
/** The prefix of inner nodes. */
static const char INPREFIX = 'I';
/** The average number of ways of each node. */
static const size_t AVGWAY = 16;
/** The ratio of the warm cache. */
static const size_t WARMRATIO = 4;
/** The ratio of flushing inner nodes. */
static const size_t INFLRATIO = 32;
/** The default number of items in each leaf node. */
static const size_t DEFLINUM = 64;
/** The default number of items in each inner node. */
static const size_t DEFIINUM = 128;
/** The base ID number for inner nodes. */
static const int64_t INIDBASE = 1LL << 48;
/** The minimum number of links in each inner node. */
static const size_t INLINKMIN = 8;
/** The maximum level of B+ tree. */
static const int32_t LEVELMAX = 16;
/** The number of cached nodes for auto transaction. */
static const int32_t ATRANCNUM = 256;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
public: public:
/** /**
* Cursor to indicate a record. * Cursor to indicate a record.
*/ */
class Cursor : public BasicDB::Cursor { class Cursor : public BasicDB::Cursor {
friend class PlantDB; friend class PlantDB;
public: public:
/** /**
* Constructor. * Constructor.
* @param db the container database object. * @param db the container database object.
skipping to change at line 412 skipping to change at line 453
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only operation. * @param writable true for writable operation, or false for read-only operation.
* @param step true to move the cursor to the next record, or false for no move. * @param step true to move the cursor to the next record, or false for no move.
* @param hitp the pointer to the variable for the hit flag. * @param hitp the pointer to the variable for the hit flag.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
bool accept_spec(Visitor* visitor, bool writable, bool step, bool* hitp ) { bool accept_spec(Visitor* visitor, bool writable, bool step, bool* hitp ) {
_assert_(visitor && hitp); _assert_(visitor && hitp);
bool err = false; bool err = false;
bool hit = false; bool hit = false;
char rstack[PlantDB::RECBUFSIZ]; char rstack[KCPDRECBUFSIZ];
size_t rsiz = sizeof(Record) + ksiz_; size_t rsiz = sizeof(Record) + ksiz_;
char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack; char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack;
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz_; rec->ksiz = ksiz_;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_); std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_);
LeafNode* node = db_->load_leaf_node(lid_, false); LeafNode* node = db_->load_leaf_node(lid_, false);
if (node) { if (node) {
char lstack[PlantDB::RECBUFSIZ]; char lstack[KCPDRECBUFSIZ];
char* lbuf = NULL; char* lbuf = NULL;
size_t lsiz = 0; size_t lsiz = 0;
Link* link = NULL; Link* link = NULL;
int64_t hist[LEVELMAX]; int64_t hist[LEVELMAX];
int32_t hnum = 0; int32_t hnum = 0;
if (writable) { if (writable) {
node->lock.lock_writer(); node->lock.lock_writer();
} else { } else {
node->lock.lock_reader(); node->lock.lock_reader();
} }
skipping to change at line 524 skipping to change at line 565
bool async = db_->autosync_ && !db_->autotran_ && !db_->tran_ && no de->dirty; bool async = db_->autosync_ && !db_->autotran_ && !db_->tran_ && no de->dirty;
node->lock.unlock(); node->lock.unlock();
if (hit && step) { if (hit && step) {
clear_position(); clear_position();
set_position(node->next); set_position(node->next);
} }
if (hit) { if (hit) {
bool flush = db_->cusage_ > db_->pccap_; bool flush = db_->cusage_ > db_->pccap_;
if (link || flush || async) { if (link || flush || async) {
int64_t id = node->id; int64_t id = node->id;
if (atran && !link && !db_->fix_auto_transaction_leaf(node)) if (atran && !link && !db_->fix_auto_transaction_leaf(node)) er
err = true; r = true;
if (!db_->mlock_.promote()) { if (!db_->mlock_.promote()) {
db_->mlock_.unlock(); db_->mlock_.unlock();
db_->mlock_.lock_writer(); db_->mlock_.lock_writer();
} }
if (link) { if (link) {
node = db_->search_tree(link, true, hist, &hnum); node = db_->search_tree(link, true, hist, &hnum);
if (node) { if (node) {
if (!db_->reorganize_tree(node, hist, hnum)) err = true; if (!db_->reorganize_tree(node, hist, hnum)) err = true;
if (atran && !db_->tran_ && !db_->fix_auto_transaction_tree ()) err = true; if (atran && !db_->tran_ && !db_->fix_auto_transaction_tree ()) err = true;
} else { } else {
skipping to change at line 548 skipping to change at line 588
} }
} else if (flush) { } else if (flush) {
int32_t idx = id % SLOTNUM; int32_t idx = id % SLOTNUM;
LeafSlot* lslot = db_->lslots_ + idx; LeafSlot* lslot = db_->lslots_ + idx;
if (!db_->flush_leaf_cache_part(lslot)) err = true; if (!db_->flush_leaf_cache_part(lslot)) err = true;
InnerSlot* islot = db_->islots_ + idx; InnerSlot* islot = db_->islots_ + idx;
if (islot->warm->count() > lslot->warm->count() + lslot->hot- >count() + 1 && if (islot->warm->count() > lslot->warm->count() + lslot->hot- >count() + 1 &&
!db_->flush_inner_cache_part(islot)) err = true; !db_->flush_inner_cache_part(islot)) err = true;
} }
if (async && !db_->fix_auto_synchronization()) err = true; if (async && !db_->fix_auto_synchronization()) err = true;
} else {
if (!db_->fix_auto_transaction_leaf(node)) err = true;
} }
} }
if (lbuf != lstack) delete[] lbuf; if (lbuf != lstack) delete[] lbuf;
} }
if (rbuf != rstack) delete[] rbuf; if (rbuf != rstack) delete[] rbuf;
*hitp = hit; *hitp = hit;
return !err; return !err;
} }
/** /**
* Accept a visitor to the current record atomically. * Accept a visitor to the current record atomically.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param step true to move the cursor to the next record, or false for no move. * @param step true to move the cursor to the next record, or false for no move.
* @param retryp the pointer to the variable for the retry flag. * @param retryp the pointer to the variable for the retry flag.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
bool accept_atom(Visitor* visitor, bool step, bool *retryp) { bool accept_atom(Visitor* visitor, bool step, bool *retryp) {
_assert_(visitor && retryp); _assert_(visitor && retryp);
bool err = false; bool err = false;
bool reorg = false; bool reorg = false;
*retryp = false; *retryp = false;
char lstack[PlantDB::RECBUFSIZ]; char lstack[KCPDRECBUFSIZ];
size_t lsiz = sizeof(Link) + ksiz_; size_t lsiz = sizeof(Link) + ksiz_;
char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack; char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack;
Link* link = (Link*)lbuf; Link* link = (Link*)lbuf;
link->child = 0; link->child = 0;
link->ksiz = ksiz_; link->ksiz = ksiz_;
std::memcpy(lbuf + sizeof(*link), kbuf_, ksiz_); std::memcpy(lbuf + sizeof(*link), kbuf_, ksiz_);
int64_t hist[LEVELMAX]; int64_t hist[LEVELMAX];
int32_t hnum = 0; int32_t hnum = 0;
LeafNode* node = db_->search_tree(link, true, hist, &hnum); LeafNode* node = db_->search_tree(link, true, hist, &hnum);
if (!node) { if (!node) {
skipping to change at line 605 skipping to change at line 647
link->child = 0; link->child = 0;
link->ksiz = ksiz_; link->ksiz = ksiz_;
std::memcpy(lbuf + sizeof(*link), kbuf_, ksiz_); std::memcpy(lbuf + sizeof(*link), kbuf_, ksiz_);
node = db_->search_tree(link, true, hist, &hnum); node = db_->search_tree(link, true, hist, &hnum);
if (node->id != lid_) { if (node->id != lid_) {
db_->set_error(_KCCODELINE_, Error::BROKEN, "invalid tree"); db_->set_error(_KCCODELINE_, Error::BROKEN, "invalid tree");
if (lbuf != lstack) delete[] lbuf; if (lbuf != lstack) delete[] lbuf;
return false; return false;
} }
} }
char rstack[PlantDB::RECBUFSIZ]; char rstack[KCPDRECBUFSIZ];
size_t rsiz = sizeof(Record) + ksiz_; size_t rsiz = sizeof(Record) + ksiz_;
char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack; char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack;
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz_; rec->ksiz = ksiz_;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_); std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_);
RecordArray& recs = node->recs; RecordArray& recs = node->recs;
typename RecordArray::iterator ritend = recs.end(); typename RecordArray::iterator ritend = recs.end();
typename RecordArray::iterator rit = std::lower_bound(recs.begin(), r itend, typename RecordArray::iterator rit = std::lower_bound(recs.begin(), r itend,
rec, db_->recco mp_); rec, db_->recco mp_);
skipping to change at line 713 skipping to change at line 755
if (rbuf != rstack) delete[] rbuf; if (rbuf != rstack) delete[] rbuf;
if (lbuf != lstack) delete[] lbuf; if (lbuf != lstack) delete[] lbuf;
return !err; return !err;
} }
/** /**
* Adjust the position to an existing record. * Adjust the position to an existing record.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
bool adjust_position() { bool adjust_position() {
_assert_(true); _assert_(true);
char lstack[PlantDB::RECBUFSIZ]; char lstack[KCPDRECBUFSIZ];
size_t lsiz = sizeof(Link) + ksiz_; size_t lsiz = sizeof(Link) + ksiz_;
char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack; char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack;
Link* link = (Link*)lbuf; Link* link = (Link*)lbuf;
link->child = 0; link->child = 0;
link->ksiz = ksiz_; link->ksiz = ksiz_;
std::memcpy(lbuf + sizeof(*link), kbuf_, ksiz_); std::memcpy(lbuf + sizeof(*link), kbuf_, ksiz_);
int64_t hist[LEVELMAX]; int64_t hist[LEVELMAX];
int32_t hnum = 0; int32_t hnum = 0;
LeafNode* node = db_->search_tree(link, true, hist, &hnum); LeafNode* node = db_->search_tree(link, true, hist, &hnum);
if (!node) { if (!node) {
db_->set_error(_KCCODELINE_, Error::BROKEN, "search failed"); db_->set_error(_KCCODELINE_, Error::BROKEN, "search failed");
if (lbuf != lstack) delete[] lbuf; if (lbuf != lstack) delete[] lbuf;
return false; return false;
} }
char rstack[PlantDB::RECBUFSIZ]; char rstack[KCPDRECBUFSIZ];
size_t rsiz = sizeof(Record) + ksiz_; size_t rsiz = sizeof(Record) + ksiz_;
char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack; char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack;
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz_; rec->ksiz = ksiz_;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_); std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_);
bool err = false; bool err = false;
node->lock.lock_reader(); node->lock.lock_reader();
const RecordArray& recs = node->recs; const RecordArray& recs = node->recs;
typename RecordArray::const_iterator ritend = node->recs.end(); typename RecordArray::const_iterator ritend = node->recs.end();
skipping to change at line 762 skipping to change at line 804
} }
/** /**
* Back the position to the previous record speculatively. * Back the position to the previous record speculatively.
* @param hitp the pointer to the variable for the hit flag. * @param hitp the pointer to the variable for the hit flag.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
bool back_position_spec(bool* hitp) { bool back_position_spec(bool* hitp) {
_assert_(hitp); _assert_(hitp);
bool err = false; bool err = false;
bool hit = false; bool hit = false;
char rstack[PlantDB::RECBUFSIZ]; char rstack[KCPDRECBUFSIZ];
size_t rsiz = sizeof(Record) + ksiz_; size_t rsiz = sizeof(Record) + ksiz_;
char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack; char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack;
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz_; rec->ksiz = ksiz_;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_); std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_);
LeafNode* node = db_->load_leaf_node(lid_, false); LeafNode* node = db_->load_leaf_node(lid_, false);
if (node) { if (node) {
node->lock.lock_reader(); node->lock.lock_reader();
RecordArray& recs = node->recs; RecordArray& recs = node->recs;
skipping to change at line 813 skipping to change at line 855
if (rbuf != rstack) delete[] rbuf; if (rbuf != rstack) delete[] rbuf;
*hitp = hit; *hitp = hit;
return !err; return !err;
} }
/** /**
* Back the position to the previous record atomically. * Back the position to the previous record atomically.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
bool back_position_atom() { bool back_position_atom() {
_assert_(true); _assert_(true);
char lstack[PlantDB::RECBUFSIZ]; char lstack[KCPDRECBUFSIZ];
size_t lsiz = sizeof(Link) + ksiz_; size_t lsiz = sizeof(Link) + ksiz_;
char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack; char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack;
Link* link = (Link*)lbuf; Link* link = (Link*)lbuf;
link->child = 0; link->child = 0;
link->ksiz = ksiz_; link->ksiz = ksiz_;
std::memcpy(lbuf + sizeof(*link), kbuf_, ksiz_); std::memcpy(lbuf + sizeof(*link), kbuf_, ksiz_);
int64_t hist[LEVELMAX]; int64_t hist[LEVELMAX];
int32_t hnum = 0; int32_t hnum = 0;
LeafNode* node = db_->search_tree(link, true, hist, &hnum); LeafNode* node = db_->search_tree(link, true, hist, &hnum);
if (!node) { if (!node) {
db_->set_error(_KCCODELINE_, Error::BROKEN, "search failed"); db_->set_error(_KCCODELINE_, Error::BROKEN, "search failed");
if (lbuf != lstack) delete[] lbuf; if (lbuf != lstack) delete[] lbuf;
return false; return false;
} }
char rstack[PlantDB::RECBUFSIZ]; char rstack[KCPDRECBUFSIZ];
size_t rsiz = sizeof(Record) + ksiz_; size_t rsiz = sizeof(Record) + ksiz_;
char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack; char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack;
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz_; rec->ksiz = ksiz_;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_); std::memcpy(rbuf + sizeof(*rec), kbuf_, ksiz_);
bool err = false; bool err = false;
node->lock.lock_reader(); node->lock.lock_reader();
const RecordArray& recs = node->recs; const RecordArray& recs = node->recs;
typename RecordArray::const_iterator ritbeg = node->recs.begin(); typename RecordArray::const_iterator ritbeg = node->recs.begin();
skipping to change at line 866 skipping to change at line 908
if (lbuf != lstack) delete[] lbuf; if (lbuf != lstack) delete[] lbuf;
return !err; return !err;
} }
/** Dummy constructor to forbid the use. */ /** Dummy constructor to forbid the use. */
Cursor(const Cursor&); Cursor(const Cursor&);
/** Dummy Operator to forbid the use. */ /** Dummy Operator to forbid the use. */
Cursor& operator =(const Cursor&); Cursor& operator =(const Cursor&);
/** The inner database. */ /** The inner database. */
PlantDB* db_; PlantDB* db_;
/** The stack buffer for the key. */ /** The stack buffer for the key. */
char stack_[PlantDB::RECBUFSIZ]; char stack_[KCPDRECBUFSIZ];
/** The pointer to the key region. */ /** The pointer to the key region. */
char* kbuf_; char* kbuf_;
/** The size of the key region. */ /** The size of the key region. */
size_t ksiz_; size_t ksiz_;
/** The last visited leaf. */ /** The last visited leaf. */
int64_t lid_; int64_t lid_;
}; };
/** /**
* Tuning options. * Tuning options.
*/ */
skipping to change at line 942 skipping to change at line 984
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
mlock_.unlock(); mlock_.unlock();
return false; return false;
} }
if (writable && !writer_) { if (writable && !writer_) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
mlock_.unlock(); mlock_.unlock();
return false; return false;
} }
char lstack[RECBUFSIZ]; char lstack[KCPDRECBUFSIZ];
size_t lsiz = sizeof(Link) + ksiz; size_t lsiz = sizeof(Link) + ksiz;
char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack; char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack;
Link* link = (Link*)lbuf; Link* link = (Link*)lbuf;
link->child = 0; link->child = 0;
link->ksiz = ksiz; link->ksiz = ksiz;
std::memcpy(lbuf + sizeof(*link), kbuf, ksiz); std::memcpy(lbuf + sizeof(*link), kbuf, ksiz);
int64_t hist[LEVELMAX]; int64_t hist[LEVELMAX];
int32_t hnum = 0; int32_t hnum = 0;
LeafNode* node = search_tree(link, true, hist, &hnum); LeafNode* node = search_tree(link, true, hist, &hnum);
if (!node) { if (!node) {
set_error(_KCCODELINE_, Error::BROKEN, "search failed"); set_error(_KCCODELINE_, Error::BROKEN, "search failed");
if (lbuf != lstack) delete[] lbuf; if (lbuf != lstack) delete[] lbuf;
mlock_.unlock(); mlock_.unlock();
return false; return false;
} }
char rstack[RECBUFSIZ]; char rstack[KCPDRECBUFSIZ];
size_t rsiz = sizeof(Record) + ksiz; size_t rsiz = sizeof(Record) + ksiz;
char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack; char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack;
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz; rec->ksiz = ksiz;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf, ksiz); std::memcpy(rbuf + sizeof(*rec), kbuf, ksiz);
if (writable) { if (writable) {
node->lock.lock_writer(); node->lock.lock_writer();
} else { } else {
node->lock.lock_reader(); node->lock.lock_reader();
skipping to change at line 1053 skipping to change at line 1095
return false; return false;
} }
ScopedVisitor svis(visitor); ScopedVisitor svis(visitor);
if (keys.empty()) return true; if (keys.empty()) return true;
bool err = false; bool err = false;
std::vector<std::string>::const_iterator kit = keys.begin(); std::vector<std::string>::const_iterator kit = keys.begin();
std::vector<std::string>::const_iterator kitend = keys.end(); std::vector<std::string>::const_iterator kitend = keys.end();
while (!err && kit != kitend) { while (!err && kit != kitend) {
const char* kbuf = kit->data(); const char* kbuf = kit->data();
size_t ksiz = kit->size(); size_t ksiz = kit->size();
char lstack[RECBUFSIZ]; char lstack[KCPDRECBUFSIZ];
size_t lsiz = sizeof(Link) + ksiz; size_t lsiz = sizeof(Link) + ksiz;
char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack; char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack;
Link* link = (Link*)lbuf; Link* link = (Link*)lbuf;
link->child = 0; link->child = 0;
link->ksiz = ksiz; link->ksiz = ksiz;
std::memcpy(lbuf + sizeof(*link), kbuf, ksiz); std::memcpy(lbuf + sizeof(*link), kbuf, ksiz);
int64_t hist[LEVELMAX]; int64_t hist[LEVELMAX];
int32_t hnum = 0; int32_t hnum = 0;
LeafNode* node = search_tree(link, true, hist, &hnum); LeafNode* node = search_tree(link, true, hist, &hnum);
if (!node) { if (!node) {
set_error(_KCCODELINE_, Error::BROKEN, "search failed"); set_error(_KCCODELINE_, Error::BROKEN, "search failed");
if (lbuf != lstack) delete[] lbuf; if (lbuf != lstack) delete[] lbuf;
err = true; err = true;
break; break;
} }
char rstack[RECBUFSIZ]; char rstack[KCPDRECBUFSIZ];
size_t rsiz = sizeof(Record) + ksiz; size_t rsiz = sizeof(Record) + ksiz;
char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack; char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack;
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz; rec->ksiz = ksiz;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf, ksiz); std::memcpy(rbuf + sizeof(*rec), kbuf, ksiz);
bool reorg = accept_impl(node, rec, visitor); bool reorg = accept_impl(node, rec, visitor);
bool atran = autotran_ && !tran_ && node->dirty; bool atran = autotran_ && !tran_ && node->dirty;
bool async = autosync_ && !autotran_ && !tran_ && node->dirty; bool async = autosync_ && !autotran_ && !tran_ && node->dirty;
if (atran && !reorg && !fix_auto_transaction_leaf(node)) err = true; if (atran && !reorg && !fix_auto_transaction_leaf(node)) err = true;
skipping to change at line 1179 skipping to change at line 1221
if (checker && !checker->check("iterate", "processing", curcnt, all cnt)) { if (checker && !checker->check("iterate", "processing", curcnt, all cnt)) {
set_error(_KCCODELINE_, Error::LOGIC, "checker failed"); set_error(_KCCODELINE_, Error::LOGIC, "checker failed");
err = true; err = true;
break; break;
} }
++kit; ++kit;
} }
if (reorg) { if (reorg) {
Record* rec = keys.front(); Record* rec = keys.front();
char* dbuf = (char*)rec + sizeof(*rec); char* dbuf = (char*)rec + sizeof(*rec);
char lstack[RECBUFSIZ]; char lstack[KCPDRECBUFSIZ];
size_t lsiz = sizeof(Link) + rec->ksiz; size_t lsiz = sizeof(Link) + rec->ksiz;
char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack; char* lbuf = lsiz > sizeof(lstack) ? new char[lsiz] : lstack;
Link* link = (Link*)lbuf; Link* link = (Link*)lbuf;
link->child = 0; link->child = 0;
link->ksiz = rec->ksiz; link->ksiz = rec->ksiz;
std::memcpy(lbuf + sizeof(*link), dbuf, rec->ksiz); std::memcpy(lbuf + sizeof(*link), dbuf, rec->ksiz);
int64_t hist[LEVELMAX]; int64_t hist[LEVELMAX];
int32_t hnum = 0; int32_t hnum = 0;
node = search_tree(link, false, hist, &hnum); node = search_tree(link, false, hist, &hnum);
if (node) { if (node) {
skipping to change at line 1292 skipping to change at line 1334
if (!db_.tune_fbp(fpow_)) return false; if (!db_.tune_fbp(fpow_)) return false;
if (!db_.tune_options(opts_)) return false; if (!db_.tune_options(opts_)) return false;
if (!db_.tune_buckets(bnum_)) return false; if (!db_.tune_buckets(bnum_)) return false;
if (!db_.open(path, mode)) return false; if (!db_.open(path, mode)) return false;
if (db_.type() != DBTYPE) { if (db_.type() != DBTYPE) {
set_error(_KCCODELINE_, Error::INVALID, "invalid database type"); set_error(_KCCODELINE_, Error::INVALID, "invalid database type");
db_.close(); db_.close();
return false; return false;
} }
if (db_.reorganized()) { if (db_.reorganized()) {
if (!reorganize_file(mode)) return false;
} else if (db_.recovered()) {
if (!writer_) { if (!writer_) {
if (!db_.close()) return false; if (!db_.close()) return false;
mode &= ~OREADER; uint32_t tmode = (mode & ~OREADER) | OWRITER;
mode |= OWRITER; if (!db_.open(path, tmode)) return false;
if (!db_.open(path, mode)) return false;
} }
if (!reorganize_file(mode)) return false; if (!recalc_count()) return false;
} else if (db_.recovered()) {
if (!writer_) { if (!writer_) {
if (!db_.close()) return false; if (!db_.close()) return false;
mode &= ~OREADER;
mode |= OWRITER;
if (!db_.open(path, mode)) return false; if (!db_.open(path, mode)) return false;
} }
if (!recalc_count()) return false;
} }
if (writer_ && db_.count() < 1) { if (writer_ && db_.count() < 1) {
root_ = 0; root_ = 0;
first_ = 0; first_ = 0;
last_ = 0; last_ = 0;
count_ = 0; count_ = 0;
create_leaf_cache(); create_leaf_cache();
create_inner_cache(); create_inner_cache();
lcnt_ = 0; lcnt_ = 0;
create_leaf_node(0, 0); create_leaf_node(0, 0);
skipping to change at line 2020 skipping to change at line 2059
* MetaTrigger::SYNCHRONIZE for synchronization, MetaTrigger::BEGINTRAN f or beginning * MetaTrigger::SYNCHRONIZE for synchronization, MetaTrigger::BEGINTRAN f or beginning
* transaction, MetaTrigger::COMMITTRAN for committing transaction, MetaT rigger::ABORTTRAN * transaction, MetaTrigger::COMMITTRAN for committing transaction, MetaT rigger::ABORTTRAN
* for aborting transaction, and MetaTrigger::MISC for miscellaneous oper ations. * for aborting transaction, and MetaTrigger::MISC for miscellaneous oper ations.
* @param message the supplement message. * @param message the supplement message.
*/ */
void trigger_meta(MetaTrigger::Kind kind, const char* message) { void trigger_meta(MetaTrigger::Kind kind, const char* message) {
_assert_(message); _assert_(message);
if (mtrigger_) mtrigger_->trigger(kind, message); if (mtrigger_) mtrigger_->trigger(kind, message);
} }
private: private:
/** The number of cache slots. */
static const int32_t SLOTNUM = 16;
/** The default alignment power. */
static const uint8_t DEFAPOW = 8;
/** The default free block pool power. */
static const uint8_t DEFFPOW = 10;
/** The default bucket number. */
static const int64_t DEFBNUM = 64LL << 10;
/** The default page size. */
static const int32_t DEFPSIZ = 8192;
/** The default capacity size of the page cache. */
static const int64_t DEFPCCAP = 64LL << 20;
/** The size of the header. */
static const int64_t HEADSIZ = 80;
/** The offset of the numbers. */
static const int64_t MOFFNUMS = 8;
/** The prefix of leaf nodes. */
static const char LNPREFIX = 'L';
/** The prefix of inner nodes. */
static const char INPREFIX = 'I';
/** The average number of ways of each node. */
static const size_t AVGWAY = 16;
/** The ratio of the warm cache. */
static const size_t WARMRATIO = 4;
/** The ratio of flushing inner nodes. */
static const size_t INFLRATIO = 32;
/** The default number of items in each leaf node. */
static const size_t DEFLINUM = 64;
/** The default number of items in each inner node. */
static const size_t DEFIINUM = 128;
/** The size of the record buffer. */
static const size_t RECBUFSIZ = 64;
/** The base ID number for inner nodes. */
static const int64_t INIDBASE = 1LL << 48;
/** The minimum number of links in each inner node. */
static const size_t INLINKMIN = 8;
/** The maximum level of B+ tree. */
static const int32_t LEVELMAX = 16;
/** The number of cached nodes for auto transaction. */
static const int32_t ATRANCNUM = 256;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
/** /**
* Record data. * Record data.
*/ */
struct Record { struct Record {
uint32_t ksiz; ///< size of the key uint32_t ksiz; ///< size of the key
uint32_t vsiz; ///< size of the value uint32_t vsiz; ///< size of the value
}; };
/** /**
* Comparator for records. * Comparator for records.
*/ */
skipping to change at line 3449 skipping to change at line 3446
} }
} else { } else {
set_error(_KCCODELINE_, Error::SYSTEM, "renaming the source failed" ); set_error(_KCCODELINE_, Error::SYSTEM, "renaming the source failed" );
err = true; err = true;
} }
File::remove_recursively(tpath); File::remove_recursively(tpath);
File::remove_recursively(npath); File::remove_recursively(npath);
} else { } else {
BASEDB udb; BASEDB udb;
if (!err && udb.open(npath, OREADER)) { if (!err && udb.open(npath, OREADER)) {
if (!db_.clear()) err = true; if (writer_) {
if (!db_.clear()) err = true;
} else {
if (!db_.close()) err = true;
uint32_t tmode = (mode & ~OREADER) | OWRITER | OCREATE | OTRUNCAT
E;
if (!db_.open(path, tmode)) err = true;
}
cur = udb.cursor(); cur = udb.cursor();
cur->jump(); cur->jump();
const char* vbuf; const char* vbuf;
size_t vsiz; size_t vsiz;
while (!err && (kbuf = cur->get(&ksiz, &vbuf, &vsiz)) != NULL) { while (!err && (kbuf = cur->get(&ksiz, &vbuf, &vsiz)) != NULL) {
if (!db_.set(kbuf, ksiz, vbuf, vsiz)) err = true; if (!db_.set(kbuf, ksiz, vbuf, vsiz)) err = true;
delete[] kbuf; delete[] kbuf;
cur->step(); cur->step();
} }
delete cur; delete cur;
if (!db_.synchronize(false, NULL)) err = true; if (writer_) {
if (!db_.synchronize(false, NULL)) err = true;
} else {
if (!db_.close()) err = true;
if (!db_.open(path, mode)) err = true;
}
if (!udb.close()) { if (!udb.close()) {
set_error(_KCCODELINE_, udb.error().code(), "closing the destinat ion failed"); set_error(_KCCODELINE_, udb.error().code(), "closing the destinat ion failed");
err = true; err = true;
} }
} else { } else {
set_error(_KCCODELINE_, udb.error().code(), "opening the destinatio n failed"); set_error(_KCCODELINE_, udb.error().code(), "opening the destinatio n failed");
err = true; err = true;
} }
File::remove_recursively(npath); File::remove_recursively(npath);
} }
 End of changes. 27 change blocks. 
69 lines changed or deleted 79 lines changed or added


 kcprotodb.h   kcprotodb.h 
skipping to change at line 56 skipping to change at line 56
class ProtoDB : public BasicDB { class ProtoDB : public BasicDB {
public: public:
class Cursor; class Cursor;
private: private:
struct TranLog; struct TranLog;
class ScopedVisitor; class ScopedVisitor;
/** An alias of list of cursors. */ /** An alias of list of cursors. */
typedef std::list<Cursor*> CursorList; typedef std::list<Cursor*> CursorList;
/** An alias of list of transaction logs. */ /** An alias of list of transaction logs. */
typedef std::list<TranLog> TranLogList; typedef std::list<TranLog> TranLogList;
/** The size of the opaque buffer. */
static const size_t OPAQUESIZ = 16;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
public: public:
/** /**
* Cursor to indicate a record. * Cursor to indicate a record.
*/ */
class Cursor : public BasicDB::Cursor { class Cursor : public BasicDB::Cursor {
friend class ProtoDB; friend class ProtoDB;
public: public:
/** /**
* Constructor. * Constructor.
* @param db the container database object. * @param db the container database object.
skipping to change at line 1055 skipping to change at line 1059
* MetaTrigger::SYNCHRONIZE for synchronization, MetaTrigger::BEGINTRAN f or beginning * MetaTrigger::SYNCHRONIZE for synchronization, MetaTrigger::BEGINTRAN f or beginning
* transaction, MetaTrigger::COMMITTRAN for committing transaction, MetaT rigger::ABORTTRAN * transaction, MetaTrigger::COMMITTRAN for committing transaction, MetaT rigger::ABORTTRAN
* for aborting transaction, and MetaTrigger::MISC for miscellaneous oper ations. * for aborting transaction, and MetaTrigger::MISC for miscellaneous oper ations.
* @param message the supplement message. * @param message the supplement message.
*/ */
void trigger_meta(MetaTrigger::Kind kind, const char* message) { void trigger_meta(MetaTrigger::Kind kind, const char* message) {
_assert_(message); _assert_(message);
if (mtrigger_) mtrigger_->trigger(kind, message); if (mtrigger_) mtrigger_->trigger(kind, message);
} }
private: private:
/** The size of the opaque buffer. */
static const size_t OPAQUESIZ = 16;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
/** /**
* Transaction log. * Transaction log.
*/ */
struct TranLog { struct TranLog {
bool full; ///< flag whether full bool full; ///< flag whether full
std::string key; ///< old key std::string key; ///< old key
std::string value; ///< old value std::string value; ///< old value
/** constructor for a full record */ /** constructor for a full record */
explicit TranLog(const std::string& pkey, const std::string& pvalue) : explicit TranLog(const std::string& pkey, const std::string& pvalue) :
full(true), key(pkey), value(pvalue) { full(true), key(pkey), value(pvalue) {
skipping to change at line 1184 skipping to change at line 1184
_assert_(true); _assert_(true);
} }
/** /**
* Tune the internal map object. * Tune the internal map object.
*/ */
template <> template <>
inline void ProtoDB<StringHashMap, BasicDB::TYPEPHASH>::map_tune() { inline void ProtoDB<StringHashMap, BasicDB::TYPEPHASH>::map_tune() {
_assert_(true); _assert_(true);
recs_.rehash(1048583LL); recs_.rehash(1048583LL);
recs_.max_load_factor(FLT_MAX); recs_.max_load_factor(FLTMAX);
} }
/** An alias of the prototype hash database. */ /** An alias of the prototype hash database. */
typedef ProtoDB<StringHashMap, BasicDB::TYPEPHASH> ProtoHashDB; typedef ProtoDB<StringHashMap, BasicDB::TYPEPHASH> ProtoHashDB;
/** An alias of the prototype tree database. */ /** An alias of the prototype tree database. */
typedef ProtoDB<StringTreeMap, BasicDB::TYPEPTREE> ProtoTreeDB; typedef ProtoDB<StringTreeMap, BasicDB::TYPEPTREE> ProtoTreeDB;
} // common namespace } // common namespace
 End of changes. 3 change blocks. 
5 lines changed or deleted 5 lines changed or added


 kcstashdb.h   kcstashdb.h 
skipping to change at line 55 skipping to change at line 55
struct Record; struct Record;
struct TranLog; struct TranLog;
class Repeater; class Repeater;
class Setter; class Setter;
class Remover; class Remover;
class ScopedVisitor; class ScopedVisitor;
/** An alias of list of cursors. */ /** An alias of list of cursors. */
typedef std::list<Cursor*> CursorList; typedef std::list<Cursor*> CursorList;
/** An alias of list of transaction logs. */ /** An alias of list of transaction logs. */
typedef std::list<TranLog> TranLogList; typedef std::list<TranLog> TranLogList;
/** The number of slots of the record lock. */
static const int32_t RLOCKSLOT = 1024;
/** The default bucket number. */
static const size_t DEFBNUM = 1048583LL;
/** The size of the opaque buffer. */
static const size_t OPAQUESIZ = 16;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
/** The mininum number of buckets to use mmap. */
static const size_t MAPZMAPBNUM = 32768;
public: public:
/** /**
* Cursor to indicate a record. * Cursor to indicate a record.
*/ */
class Cursor : public BasicDB::Cursor { class Cursor : public BasicDB::Cursor {
friend class StashDB; friend class StashDB;
public: public:
/** /**
* Constructor. * Constructor.
* @param db the container database object. * @param db the container database object.
skipping to change at line 970 skipping to change at line 980
* MetaTrigger::SYNCHRONIZE for synchronization, MetaTrigger::BEGINTRAN f or beginning * MetaTrigger::SYNCHRONIZE for synchronization, MetaTrigger::BEGINTRAN f or beginning
* transaction, MetaTrigger::COMMITTRAN for committing transaction, MetaT rigger::ABORTTRAN * transaction, MetaTrigger::COMMITTRAN for committing transaction, MetaT rigger::ABORTTRAN
* for aborting transaction, and MetaTrigger::MISC for miscellaneous oper ations. * for aborting transaction, and MetaTrigger::MISC for miscellaneous oper ations.
* @param message the supplement message. * @param message the supplement message.
*/ */
void trigger_meta(MetaTrigger::Kind kind, const char* message) { void trigger_meta(MetaTrigger::Kind kind, const char* message) {
_assert_(message); _assert_(message);
if (mtrigger_) mtrigger_->trigger(kind, message); if (mtrigger_) mtrigger_->trigger(kind, message);
} }
private: private:
/** The number of slots of the record lock. */
static const int32_t RLOCKSLOT = 1024;
/** The default bucket number. */
static const size_t DEFBNUM = 1048583LL;
/** The size of the opaque buffer. */
static const size_t OPAQUESIZ = 16;
/** The threshold of busy loop and sleep for locking. */
static const uint32_t LOCKBUSYLOOP = 8192;
/** The mininum number of buckets to use mmap. */
static const size_t MAPZMAPBNUM = 32768;
/** /**
* Record data. * Record data.
*/ */
struct Record { struct Record {
/** constructor */ /** constructor */
Record(char* child, const char* kbuf, uint64_t ksiz, const char* vbuf, uint64_t vsiz) : Record(char* child, const char* kbuf, uint64_t ksiz, const char* vbuf, uint64_t vsiz) :
child_(child), kbuf_(kbuf), ksiz_(ksiz), vbuf_(vbuf), vsiz_(vsiz) { child_(child), kbuf_(kbuf), ksiz_(ksiz), vbuf_(vbuf), vsiz_(vsiz) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && vbuf && vsiz <= MEMMAXSIZ); _assert_(kbuf && ksiz <= MEMMAXSIZ && vbuf && vsiz <= MEMMAXSIZ);
} }
/** constructor */ /** constructor */
 End of changes. 2 change blocks. 
10 lines changed or deleted 10 lines changed or added


 kcutil.h   kcutil.h 
skipping to change at line 22 skipping to change at line 22
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
************************************************************************** ***********************/ ************************************************************************** ***********************/
#ifndef _KCUTIL_H // duplication check #ifndef _KCUTIL_H // duplication check
#define _KCUTIL_H #define _KCUTIL_H
#include <kccommon.h> #include <kccommon.h>
namespace kyotocabinet { // common namespace namespace kyotocabinet { // common namespace
/** The maximum value of int8_t. */
const int8_t INT8MAX = (std::numeric_limits<int8_t>::max)();
/** The maximum value of int16_t. */
const int16_t INT16MAX = (std::numeric_limits<int16_t>::max)();
/** The maximum value of int32_t. */
const int32_t INT32MAX = (std::numeric_limits<int32_t>::max)();
/** The maximum value of int64_t. */
const int64_t INT64MAX = (std::numeric_limits<int64_t>::max)();
/** The minimum value of int8_t. */
const int8_t INT8MIN = (std::numeric_limits<int8_t>::min)();
/** The minimum value of int16_t. */
const int16_t INT16MIN = (std::numeric_limits<int16_t>::min)();
/** The minimum value of int32_t. */
const int32_t INT32MIN = (std::numeric_limits<int32_t>::min)();
/** The minimum value of int64_t. */
const int64_t INT64MIN = (std::numeric_limits<int64_t>::min)();
/** The maximum value of uint8_t. */
const uint8_t UINT8MAX = (std::numeric_limits<uint8_t>::max)();
/** The maximum value of uint16_t. */
const uint16_t UINT16MAX = (std::numeric_limits<uint16_t>::max)();
/** The maximum value of uint32_t. */
const uint32_t UINT32MAX = (std::numeric_limits<uint32_t>::max)();
/** The maximum value of uint64_t. */
const uint64_t UINT64MAX = (std::numeric_limits<uint64_t>::max)();
/** The maximum value of size_t. */
const size_t SIZEMAX = (std::numeric_limits<size_t>::max)();
/** The maximum value of float. */
const float FLTMAX = (std::numeric_limits<float>::max)();
/** The maximum value of double. */
const double DBLMAX = (std::numeric_limits<double>::max)();
/** An alias of hash map of strings. */ /** An alias of hash map of strings. */
typedef std::unordered_map<std::string, std::string> StringHashMap; typedef std::unordered_map<std::string, std::string> StringHashMap;
/** An alias of tree map of strings. */ /** An alias of tree map of strings. */
typedef std::map<std::string, std::string> StringTreeMap; typedef std::map<std::string, std::string> StringTreeMap;
/** The package version. */ /** The package version. */
extern const char* const VERSION; extern const char* const VERSION;
/** The library version. */ /** The library version. */
skipping to change at line 2094 skipping to change at line 2139
/** /**
* Dummy test driver. * Dummy test driver.
*/ */
inline bool _dummytest() { inline bool _dummytest() {
_assert_(true); _assert_(true);
std::ostringstream oss; std::ostringstream oss;
oss << INT8MAX << INT16MAX << INT32MAX << INT64MAX; oss << INT8MAX << INT16MAX << INT32MAX << INT64MAX;
oss << INT8MIN << INT16MIN << INT32MIN << INT64MIN; oss << INT8MIN << INT16MIN << INT32MIN << INT64MIN;
oss << UINT8MAX << UINT16MAX << UINT32MAX << UINT64MAX; oss << UINT8MAX << UINT16MAX << UINT32MAX << UINT64MAX;
oss << SIZEMAX << FLTMAX << DBLMAX;
oss << VERSION << LIBVER << LIBREV << FMTVER << SYSNAME; oss << VERSION << LIBVER << LIBREV << FMTVER << SYSNAME;
oss << BIGEND << CLOCKTICK << PAGESIZE << FEATURES; oss << BIGEND << CLOCKTICK << PAGESIZE << FEATURES;
oss << NUMBUFSIZ << MEMMAXSIZ; oss << NUMBUFSIZ << MEMMAXSIZ;
return oss.tellp() > 0; return oss.tellp() > 0;
} }
} // common namespace } // common namespace
#endif // duplication check #endif // duplication check
 End of changes. 2 change blocks. 
0 lines changed or deleted 46 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/