| kcdbext.h | | kcdbext.h | |
| | | | |
| skipping to change at line 231 | | skipping to change at line 231 | |
| * @param tmppath the path of a directory for the temporary data storage.
If it is an empty | | * @param tmppath the path of a directory for the temporary data storage.
If it is an empty | |
| * string, temporary data are handled on memory. | | * string, temporary data are handled on memory. | |
| * @param opts the optional features by bitwise-or: MapReduce::XNOLOCK to
avoid locking | | * @param opts the optional features by bitwise-or: MapReduce::XNOLOCK to
avoid locking | |
| * against update operations by other threads, MapReduce::XPARAMAP to run
the mapper in | | * against update operations by other threads, MapReduce::XPARAMAP to run
the mapper in | |
| * parallel, MapReduce::XPARARED to run the reducer in parallel, MapReduc
e::XNOCOMP to avoid | | * parallel, MapReduce::XPARARED to run the reducer in parallel, MapReduc
e::XNOCOMP to avoid | |
| * compression of temporary databases. | | * compression of temporary databases. | |
| * @return true on success, or false on failure. | | * @return true on success, or false on failure. | |
| */ | | */ | |
| bool execute(BasicDB* db, const std::string& tmppath = "", uint32_t opts
= 0) { | | bool execute(BasicDB* db, const std::string& tmppath = "", uint32_t opts
= 0) { | |
| int64_t count = db->count(); | | int64_t count = db->count(); | |
|
| if (count < 0) return false; | | if (count < 0) { | |
| | | if (db->error() != BasicDB::Error::NOIMPL) return false; | |
| | | count = 0; | |
| | | } | |
| bool err = false; | | bool err = false; | |
| double stime, etime; | | double stime, etime; | |
| db_ = db; | | db_ = db; | |
| rcomp_ = LEXICALCOMP; | | rcomp_ = LEXICALCOMP; | |
| BasicDB* idb = db; | | BasicDB* idb = db; | |
| if (typeid(*db) == typeid(PolyDB)) { | | if (typeid(*db) == typeid(PolyDB)) { | |
| PolyDB* pdb = (PolyDB*)idb; | | PolyDB* pdb = (PolyDB*)idb; | |
| idb = pdb->reveal_inner_db(); | | idb = pdb->reveal_inner_db(); | |
| } | | } | |
| const std::type_info& info = typeid(*idb); | | const std::type_info& info = typeid(*idb); | |
| | | | |
| skipping to change at line 323 | | skipping to change at line 326 | |
| delete tmpdbs_[i]; | | delete tmpdbs_[i]; | |
| } | | } | |
| delete[] tmpdbs_; | | delete[] tmpdbs_; | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| if (opts & XPARARED) redtasks_ = new ReduceTaskQueue; | | if (opts & XPARARED) redtasks_ = new ReduceTaskQueue; | |
| if (opts & XPARAFLS) flsths_ = new std::deque<FlushThread*>; | | if (opts & XPARAFLS) flsths_ = new std::deque<FlushThread*>; | |
| if (opts & XNOLOCK) { | | if (opts & XNOLOCK) { | |
| MapChecker mapchecker; | | MapChecker mapchecker; | |
|
| MapVisitor mapvisitor(this, &mapchecker, db->count()); | | MapVisitor mapvisitor(this, &mapchecker, count); | |
| mapvisitor.visit_before(); | | mapvisitor.visit_before(); | |
| if (!err) { | | if (!err) { | |
| BasicDB::Cursor* cur = db->cursor(); | | BasicDB::Cursor* cur = db->cursor(); | |
| if (!cur->jump() && cur->error() != BasicDB::Error::NOREC) err = tr
ue; | | if (!cur->jump() && cur->error() != BasicDB::Error::NOREC) err = tr
ue; | |
| while (!err) { | | while (!err) { | |
| if (!cur->accept(&mapvisitor, false, true)) { | | if (!cur->accept(&mapvisitor, false, true)) { | |
| if (cur->error() != BasicDB::Error::NOREC) err = true; | | if (cur->error() != BasicDB::Error::NOREC) err = true; | |
| break; | | break; | |
| } | | } | |
| } | | } | |
| delete cur; | | delete cur; | |
| } | | } | |
| if (mapvisitor.error()) { | | if (mapvisitor.error()) { | |
| db_->set_error(_KCCODELINE_, BasicDB::Error::LOGIC, "mapper failed"
); | | db_->set_error(_KCCODELINE_, BasicDB::Error::LOGIC, "mapper failed"
); | |
| err = true; | | err = true; | |
| } | | } | |
| mapvisitor.visit_after(); | | mapvisitor.visit_after(); | |
| } else if (opts & XPARAMAP) { | | } else if (opts & XPARAMAP) { | |
| MapChecker mapchecker; | | MapChecker mapchecker; | |
|
| MapVisitor mapvisitor(this, &mapchecker, db->count()); | | MapVisitor mapvisitor(this, &mapchecker, count); | |
| rlocks_ = new SlottedMutex(RLOCKSLOT); | | rlocks_ = new SlottedMutex(RLOCKSLOT); | |
| if (!err && !db->scan_parallel(&mapvisitor, mapthnum_, &mapchecker))
{ | | if (!err && !db->scan_parallel(&mapvisitor, mapthnum_, &mapchecker))
{ | |
| db_->set_error(_KCCODELINE_, BasicDB::Error::LOGIC, "mapper failed"
); | | db_->set_error(_KCCODELINE_, BasicDB::Error::LOGIC, "mapper failed"
); | |
| err = true; | | err = true; | |
| } | | } | |
| delete rlocks_; | | delete rlocks_; | |
| rlocks_ = NULL; | | rlocks_ = NULL; | |
| if (mapvisitor.error()) err = true; | | if (mapvisitor.error()) err = true; | |
| } else { | | } else { | |
| MapChecker mapchecker; | | MapChecker mapchecker; | |
|
| MapVisitor mapvisitor(this, &mapchecker, db->count()); | | MapVisitor mapvisitor(this, &mapchecker, count); | |
| if (!err && !db->iterate(&mapvisitor, false, &mapchecker)) err = true
; | | if (!err && !db->iterate(&mapvisitor, false, &mapchecker)) err = true
; | |
| if (mapvisitor.error()) { | | if (mapvisitor.error()) { | |
| db_->set_error(_KCCODELINE_, BasicDB::Error::LOGIC, "mapper failed"
); | | db_->set_error(_KCCODELINE_, BasicDB::Error::LOGIC, "mapper failed"
); | |
| err = true; | | err = true; | |
| } | | } | |
| } | | } | |
| if (flsths_) { | | if (flsths_) { | |
| delete flsths_; | | delete flsths_; | |
| flsths_ = NULL; | | flsths_ = NULL; | |
| } | | } | |
| | | | |
| skipping to change at line 446 | | skipping to change at line 449 | |
| if (rlocks_) { | | if (rlocks_) { | |
| size_t bidx = TinyHashMap::hash_record(kbuf, ksiz) % cbnum_; | | size_t bidx = TinyHashMap::hash_record(kbuf, ksiz) % cbnum_; | |
| size_t lidx = bidx % RLOCKSLOT; | | size_t lidx = bidx % RLOCKSLOT; | |
| rlocks_->lock(lidx); | | rlocks_->lock(lidx); | |
| cache_->append(kbuf, ksiz, rbuf, rsiz); | | cache_->append(kbuf, ksiz, rbuf, rsiz); | |
| rlocks_->unlock(lidx); | | rlocks_->unlock(lidx); | |
| } else { | | } else { | |
| cache_->append(kbuf, ksiz, rbuf, rsiz); | | cache_->append(kbuf, ksiz, rbuf, rsiz); | |
| } | | } | |
| if (rbuf != stack) delete[] rbuf; | | if (rbuf != stack) delete[] rbuf; | |
|
| csiz_ += rsiz; | | csiz_ += sizevarnum(ksiz) + ksiz + rsiz; | |
| return !err; | | return !err; | |
| } | | } | |
| private: | | private: | |
| /** | | /** | |
| * Cache flusher. | | * Cache flusher. | |
| */ | | */ | |
| class FlushThread : public Thread { | | class FlushThread : public Thread { | |
| public: | | public: | |
| /** constructor */ | | /** constructor */ | |
| explicit FlushThread(MapReduce* mr, BasicDB* tmpdb, | | explicit FlushThread(MapReduce* mr, BasicDB* tmpdb, | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 8 lines changed or added | |
|
| kclangc.h | | kclangc.h | |
| | | | |
| skipping to change at line 271 | | skipping to change at line 271 | |
| /** | | /** | |
| * Destroy a database object. | | * Destroy a database object. | |
| * @param db the database object. | | * @param db the database object. | |
| */ | | */ | |
| void kcdbdel(KCDB* db); | | void kcdbdel(KCDB* db); | |
| | | | |
| /** | | /** | |
| * Open a database file. | | * Open a database file. | |
| * @param db a database object. | | * @param db a database object. | |
| * @param path the path of a database file. If it is "-", the database wil
l be a prototype | | * @param path the path of a database file. If it is "-", the database wil
l be a prototype | |
|
| * hash database. If it is "+", the database will be a prototype tree data | | * hash database. If it is "+", the database will be a prototype tree data | |
| base. If it is | | base. If it is ":", | |
| * "*", the database will be a cache hash database. If it is "%", the data | | * the database will be a stash database. If it is "*", the database will | |
| base will be a | | be a cache hash | |
| * cache tree database. If its suffix is ".kch", the database will be a fi | | * database. If it is "%", the database will be a cache tree database. If | |
| le hash database. | | its suffix is | |
| * If its suffix is ".kct", the database will be a file tree database. If | | * ".kch", the database will be a file hash database. If its suffix is ".k | |
| its suffix is | | ct", the database | |
| * ".kcd", the database will be a directory hash database. If its suffix i | | * will be a file tree database. If its suffix is ".kcd", the database wil | |
| s ".kcf", the | | l be a directory | |
| * database will be a directory tree database. Otherwise, this function fa | | * hash database. If its suffix is ".kcf", the database will be a director | |
| ils. Tuning | | y tree database. | |
| * parameters can trail the name, separated by "#". Each parameter is comp | | * If its suffix is ".kcx", the database will be a plain text database. Ot | |
| osed of the name | | herwise, this | |
| * and the value, separated by "=". If the "type" parameter is specified, | | * function fails. Tuning parameters can trail the name, separated by "#". | |
| the database type | | Each parameter is | |
| * is determined by the value in "-", "+", "*", "%", "kch", "kct", "kcd", a | | * composed of the name and the value, separated by "=". If the "type" par | |
| nd "kcf". All | | ameter is specified, | |
| * database types support the logging parameters of "log", "logkinds", and | | * the database type is determined by the value in "-", "+", ":", "*", "%", | |
| "logpx". The | | "kch", "kct", | |
| * prototype hash database and the prototype tree database do not support a | | * "kcd", kcf", and "kcx". All database types support the logging paramete | |
| ny other tuning | | rs of "log", | |
| * parameter. The cache hash database supports "opts", "bnum", "zcomp", "c | | * "logkinds", and "logpx". The prototype hash database and the prototype | |
| apcount", "capsize", | | tree database do | |
| * and "zkey". The cache tree database supports all parameters of the cach | | * not support any other tuning parameter. The stash database supports "bn | |
| e hash database | | um". The cache | |
| * except for capacity limitation, and supports "psiz", "rcomp", "pccap" in | | * hash database supports "opts", "bnum", "zcomp", "capcnt", "capsiz", and | |
| addition. The | | "zkey". The cache | |
| * file hash database supports "apow", "fpow", "opts", "bnum", "msiz", "dfu | | * tree database supports all parameters of the cache hash database except | |
| nit", "zcomp", and | | for capacity | |
| * "zkey". The file tree database supports all parameters of the file hash | | * limitation, and supports "psiz", "rcomp", "pccap" in addition. The file | |
| database and | | hash database | |
| * "psiz", "rcomp", "pccap" in addition. The directory hash database suppo | | * supports "apow", "fpow", "opts", "bnum", "msiz", "dfunit", "zcomp", and | |
| rts "opts", "zcomp", | | "zkey". The file | |
| * and "zkey". The directory tree database supports all parameters of the | | * tree database supports all parameters of the file hash database and "psi | |
| directory hash | | z", "rcomp", | |
| * database and "psiz", "rcomp", "pccap" in addition. | | * "pccap" in addition. The directory hash database supports "opts", "zcom | |
| | | p", and "zkey". | |
| | | * The directory tree database supports all parameters of the directory has | |
| | | h database and | |
| | | * "psiz", "rcomp", "pccap" in addition. The plain text database does not | |
| | | support any other | |
| | | * tuning parameter. | |
| * @param mode the connection mode. KCOWRITER as a writer, KCOREADER as a
reader. | | * @param mode the connection mode. KCOWRITER as a writer, KCOREADER as a
reader. | |
| * The following may be added to the writer mode by bitwise-or: KCOCREATE,
which means | | * The following may be added to the writer mode by bitwise-or: KCOCREATE,
which means | |
| * it creates a new database if the file does not exist, KCOTRUNCATE, which
means it | | * it creates a new database if the file does not exist, KCOTRUNCATE, which
means it | |
| * creates a new database regardless if the file exists, KCOAUTOTRAN, which
means each | | * creates a new database regardless if the file exists, KCOAUTOTRAN, which
means each | |
| * updating operation is performed in implicit transaction, KCOAUTOSYNC, wh
ich means | | * updating operation is performed in implicit transaction, KCOAUTOSYNC, wh
ich means | |
| * each updating operation is followed by implicit synchronization with the
file system. The | | * each updating operation is followed by implicit synchronization with the
file system. The | |
| * following may be added to both of the reader mode and the writer mode by
bitwise-or: | | * following may be added to both of the reader mode and the writer mode by
bitwise-or: | |
| * KCONOLOCK, which means it opens the database file without file locking, | | * KCONOLOCK, which means it opens the database file without file locking, | |
| * KCOTRYLOCK, which means locking is performed without blocking, KCONOREPA
IR, which | | * KCOTRYLOCK, which means locking is performed without blocking, KCONOREPA
IR, which | |
| * means the database file is not repaired implicitly even if file destruct
ion is detected. | | * means the database file is not repaired implicitly even if file destruct
ion is detected. | |
| | | | |
End of changes. 1 change blocks. |
| 37 lines changed or deleted | | 43 lines changed or added | |
|
| kcpolydb.h | | kcpolydb.h | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| #include <kccompare.h> | | #include <kccompare.h> | |
| #include <kcmap.h> | | #include <kcmap.h> | |
| #include <kcregex.h> | | #include <kcregex.h> | |
| #include <kcdb.h> | | #include <kcdb.h> | |
| #include <kcplantdb.h> | | #include <kcplantdb.h> | |
| #include <kcprotodb.h> | | #include <kcprotodb.h> | |
| #include <kcstashdb.h> | | #include <kcstashdb.h> | |
| #include <kccachedb.h> | | #include <kccachedb.h> | |
| #include <kchashdb.h> | | #include <kchashdb.h> | |
| #include <kcdirdb.h> | | #include <kcdirdb.h> | |
|
| | | #include <kctextdb.h> | |
| | | | |
| namespace kyotocabinet { // common namespace | | namespace kyotocabinet { // common namespace | |
| | | | |
| /** | | /** | |
| * Polymorphic database. | | * Polymorphic database. | |
| * @note This class is a concrete class to operate an arbitrary database wh
ose type is determined | | * @note This class is a concrete class to operate an arbitrary database wh
ose type is determined | |
| * in runtime. This class can be inherited but overwriting methods is forb
idden. Before every | | * in runtime. This class can be inherited but overwriting methods is forb
idden. Before every | |
| * database operation, it is necessary to call the PolyDB::open method in o
rder to open a | | * database operation, it is necessary to call the PolyDB::open method in o
rder to open a | |
| * database file and connect the database object to it. To avoid data miss
ing or corruption, it | | * database file and connect the database object to it. To avoid data miss
ing or corruption, it | |
| * is important to close every database file by the PolyDB::close method wh
en the database is no | | * is important to close every database file by the PolyDB::close method wh
en the database is no | |
| | | | |
| skipping to change at line 387 | | skipping to change at line 388 | |
| } | | } | |
| /** | | /** | |
| * Open a database file. | | * Open a database file. | |
| * @param path the path of a database file. If it is "-", the database w
ill be a prototype | | * @param path the path of a database file. If it is "-", the database w
ill be a prototype | |
| * hash database. If it is "+", the database will be a prototype tree da
tabase. If it is ":", | | * hash database. If it is "+", the database will be a prototype tree da
tabase. If it is ":", | |
| * the database will be a stash database. If it is "*", the database wil
l be a cache hash | | * the database will be a stash database. If it is "*", the database wil
l be a cache hash | |
| * database. If it is "%", the database will be a cache tree database.
If its suffix is | | * database. If it is "%", the database will be a cache tree database.
If its suffix is | |
| * ".kch", the database will be a file hash database. If its suffix is "
.kct", the database | | * ".kch", the database will be a file hash database. If its suffix is "
.kct", the database | |
| * will be a file tree database. If its suffix is ".kcd", the database w
ill be a directory | | * will be a file tree database. If its suffix is ".kcd", the database w
ill be a directory | |
| * hash database. If its suffix is ".kcf", the database will be a direct
ory tree database. | | * hash database. If its suffix is ".kcf", the database will be a direct
ory tree database. | |
|
| * Otherwise, this function fails. Tuning parameters can trail the name, | | * If its suffix is ".kcx", the database will be a plain text database. | |
| separated by "#". | | Otherwise, this | |
| * Each parameter is composed of the name and the value, separated by "=" | | * function fails. Tuning parameters can trail the name, separated by "# | |
| . If the "type" | | ". Each parameter is | |
| * parameter is specified, the database type is determined by the value i | | * composed of the name and the value, separated by "=". If the "type" p | |
| n "-", "+", ":", "*", | | arameter is specified, | |
| * "%", "kch", "kct", "kcd", and "kcf". All database types support the l | | * the database type is determined by the value in "-", "+", ":", "*", "% | |
| ogging parameters of | | ", "kch", "kct", | |
| * "log", "logkinds", and "logpx". The prototype hash database and the p | | * "kcd", kcf", and "kcx". All database types support the logging parame | |
| rototype tree | | ters of "log", | |
| * database do not support any other tuning parameter. The stash databas | | * "logkinds", and "logpx". The prototype hash database and the prototyp | |
| e supports "bnum". | | e tree database do | |
| * The cache hash database supports "opts", "bnum", "zcomp", "capcnt", "c | | * not support any other tuning parameter. The stash database supports " | |
| apsiz", and "zkey". | | bnum". The cache | |
| * The cache tree database supports all parameters of the cache hash data | | * hash database supports "opts", "bnum", "zcomp", "capcnt", "capsiz", an | |
| base except for | | d "zkey". The cache | |
| * capacity limitation, and supports "psiz", "rcomp", "pccap" in addition | | * tree database supports all parameters of the cache hash database excep | |
| . The file hash | | t for capacity | |
| * database supports "apow", "fpow", "opts", "bnum", "msiz", "dfunit", "z | | * limitation, and supports "psiz", "rcomp", "pccap" in addition. The fi | |
| comp", and "zkey". | | le hash database | |
| * The file tree database supports all parameters of the file hash databa | | * supports "apow", "fpow", "opts", "bnum", "msiz", "dfunit", "zcomp", an | |
| se and "psiz", | | d "zkey". The file | |
| * "rcomp", "pccap" in addition. The directory hash database supports "o | | * tree database supports all parameters of the file hash database and "p | |
| pts", "zcomp", and | | siz", "rcomp", | |
| * "zkey". The directory tree database supports all parameters of the di | | * "pccap" in addition. The directory hash database supports "opts", "zc | |
| rectory hash database | | omp", and "zkey". | |
| * and "psiz", "rcomp", "pccap" in addition. | | * The directory tree database supports all parameters of the directory h | |
| | | ash database and | |
| | | * "psiz", "rcomp", "pccap" in addition. The plain text database does no | |
| | | t support any other | |
| | | * tuning parameter. | |
| * @param mode the connection mode. PolyDB::OWRITER as a writer, PolyDB:
:OREADER as a | | * @param mode the connection mode. PolyDB::OWRITER as a writer, PolyDB:
:OREADER as a | |
| * reader. The following may be added to the writer mode by bitwise-or:
PolyDB::OCREATE, | | * reader. The following may be added to the writer mode by bitwise-or:
PolyDB::OCREATE, | |
| * which means it creates a new database if the file does not exist, Poly
DB::OTRUNCATE, which | | * which means it creates a new database if the file does not exist, Poly
DB::OTRUNCATE, which | |
| * means it creates a new database regardless if the file exists, PolyDB:
:OAUTOTRAN, which | | * means it creates a new database regardless if the file exists, PolyDB:
:OAUTOTRAN, which | |
| * means each updating operation is performed in implicit transaction, Po
lyDB::OAUTOSYNC, | | * means each updating operation is performed in implicit transaction, Po
lyDB::OAUTOSYNC, | |
| * which means each updating operation is followed by implicit synchroniz
ation with the file | | * which means each updating operation is followed by implicit synchroniz
ation with the file | |
| * system. The following may be added to both of the reader mode and the
writer mode by | | * system. The following may be added to both of the reader mode and the
writer mode by | |
| * bitwise-or: PolyDB::ONOLOCK, which means it opens the database file wi
thout file locking, | | * bitwise-or: PolyDB::ONOLOCK, which means it opens the database file wi
thout file locking, | |
| * PolyDB::OTRYLOCK, which means locking is performed without blocking, P
olyDB::ONOREPAIR, | | * PolyDB::OTRYLOCK, which means locking is performed without blocking, P
olyDB::ONOREPAIR, | |
| * which means the database file is not repaired implicitly even if file
destruction is | | * which means the database file is not repaired implicitly even if file
destruction is | |
| | | | |
| skipping to change at line 508 | | skipping to change at line 511 | |
| } else if (!std::strcmp(pv, "kcg") || !std::strcmp(pv, "gdb")) { | | } else if (!std::strcmp(pv, "kcg") || !std::strcmp(pv, "gdb")) { | |
| type = TYPEGRASS; | | type = TYPEGRASS; | |
| } else if (!std::strcmp(pv, "kch") || !std::strcmp(pv, "hdb")) { | | } else if (!std::strcmp(pv, "kch") || !std::strcmp(pv, "hdb")) { | |
| type = TYPEHASH; | | type = TYPEHASH; | |
| } else if (!std::strcmp(pv, "kct") || !std::strcmp(pv, "tdb")) { | | } else if (!std::strcmp(pv, "kct") || !std::strcmp(pv, "tdb")) { | |
| type = TYPETREE; | | type = TYPETREE; | |
| } else if (!std::strcmp(pv, "kcd") || !std::strcmp(pv, "ddb")) { | | } else if (!std::strcmp(pv, "kcd") || !std::strcmp(pv, "ddb")) { | |
| type = TYPEDIR; | | type = TYPEDIR; | |
| } else if (!std::strcmp(pv, "kcf") || !std::strcmp(pv, "fdb")) { | | } else if (!std::strcmp(pv, "kcf") || !std::strcmp(pv, "fdb")) { | |
| type = TYPEFOREST; | | type = TYPEFOREST; | |
|
| | | } else if (!std::strcmp(pv, "kcx") || !std::strcmp(pv, "xdb") || | |
| | | !std::strcmp(pv, "txt") || !std::strcmp(pv, "text") || | |
| | | !std::strcmp(pv, "tsv") || !std::strcmp(pv, "csv")) { | |
| | | type = TYPETEXT; | |
| } | | } | |
| } | | } | |
| } | | } | |
| while (it != itend) { | | while (it != itend) { | |
| std::vector<std::string> fields; | | std::vector<std::string> fields; | |
| if (strsplit(*it, '=', &fields) > 1) { | | if (strsplit(*it, '=', &fields) > 1) { | |
| const char* key = fields[0].c_str(); | | const char* key = fields[0].c_str(); | |
| const char* value = fields[1].c_str(); | | const char* value = fields[1].c_str(); | |
| if (!std::strcmp(key, "type")) { | | if (!std::strcmp(key, "type")) { | |
| if (!std::strcmp(value, "-") || !std::strcmp(value, "kcph") || | | if (!std::strcmp(value, "-") || !std::strcmp(value, "kcph") || | |
| | | | |
| skipping to change at line 544 | | skipping to change at line 551 | |
| type = TYPEHASH; | | type = TYPEHASH; | |
| } else if (!std::strcmp(value, "kct") || !std::strcmp(value, "tdb
") || | | } else if (!std::strcmp(value, "kct") || !std::strcmp(value, "tdb
") || | |
| !std::strcmp(value, "tree")) { | | !std::strcmp(value, "tree")) { | |
| type = TYPETREE; | | type = TYPETREE; | |
| } else if (!std::strcmp(value, "kcd") || !std::strcmp(value, "ddb
") || | | } else if (!std::strcmp(value, "kcd") || !std::strcmp(value, "ddb
") || | |
| !std::strcmp(value, "dir") || !std::strcmp(value, "dir
ectory")) { | | !std::strcmp(value, "dir") || !std::strcmp(value, "dir
ectory")) { | |
| type = TYPEDIR; | | type = TYPEDIR; | |
| } else if (!std::strcmp(value, "kcf") || !std::strcmp(value, "fdb
") || | | } else if (!std::strcmp(value, "kcf") || !std::strcmp(value, "fdb
") || | |
| !std::strcmp(value, "for") || !std::strcmp(value, "for
est")) { | | !std::strcmp(value, "for") || !std::strcmp(value, "for
est")) { | |
| type = TYPEFOREST; | | type = TYPEFOREST; | |
|
| | | } else if (!std::strcmp(value, "kcx") || !std::strcmp(value, "xdb | |
| | | ") || | |
| | | !std::strcmp(value, "txt") || !std::strcmp(value, "tex | |
| | | t")) { | |
| | | type = TYPETEXT; | |
| } | | } | |
| } else if (!std::strcmp(key, "log") || !std::strcmp(key, "logger"))
{ | | } else if (!std::strcmp(key, "log") || !std::strcmp(key, "logger"))
{ | |
| logname = value; | | logname = value; | |
| } else if (!std::strcmp(key, "logkinds") || !std::strcmp(key, "logk
ind")) { | | } else if (!std::strcmp(key, "logkinds") || !std::strcmp(key, "logk
ind")) { | |
| if (!std::strcmp(value, "debug") || !std::strcmp(value, "debuggin
g")) { | | if (!std::strcmp(value, "debug") || !std::strcmp(value, "debuggin
g")) { | |
| logkinds = Logger::DEBUG | Logger::INFO | Logger::WARN | Logger
::ERROR; | | logkinds = Logger::DEBUG | Logger::INFO | Logger::WARN | Logger
::ERROR; | |
| } else if (!std::strcmp(value, "info") || !std::strcmp(value, "in
formation")) { | | } else if (!std::strcmp(value, "info") || !std::strcmp(value, "in
formation")) { | |
| logkinds = Logger::INFO | Logger::WARN | Logger::ERROR; | | logkinds = Logger::INFO | Logger::WARN | Logger::ERROR; | |
| } else if (!std::strcmp(value, "warn") || !std::strcmp(value, "wa
rning")) { | | } else if (!std::strcmp(value, "warn") || !std::strcmp(value, "wa
rning")) { | |
| logkinds = Logger::WARN | Logger::ERROR; | | logkinds = Logger::WARN | Logger::ERROR; | |
| | | | |
| skipping to change at line 880 | | skipping to change at line 890 | |
| } | | } | |
| if (opts > 0) fdb->tune_options(opts); | | if (opts > 0) fdb->tune_options(opts); | |
| if (bnum > 0) fdb->tune_buckets(bnum); | | if (bnum > 0) fdb->tune_buckets(bnum); | |
| if (psiz > 0) fdb->tune_page(psiz); | | if (psiz > 0) fdb->tune_page(psiz); | |
| if (zcomp_) fdb->tune_compressor(zcomp_); | | if (zcomp_) fdb->tune_compressor(zcomp_); | |
| if (pccap > 0) fdb->tune_page_cache(pccap); | | if (pccap > 0) fdb->tune_page_cache(pccap); | |
| if (rcomp) fdb->tune_comparator(rcomp); | | if (rcomp) fdb->tune_comparator(rcomp); | |
| db = fdb; | | db = fdb; | |
| break; | | break; | |
| } | | } | |
|
| | | case TYPETEXT: { | |
| | | TextDB* xdb = new TextDB(); | |
| | | if (stdlogger_) { | |
| | | xdb->tune_logger(stdlogger_, logkinds); | |
| | | } else if (logger_) { | |
| | | xdb->tune_logger(logger_, logkinds_); | |
| | | } | |
| | | if (stdmtrigger_) { | |
| | | xdb->tune_meta_trigger(stdmtrigger_); | |
| | | } else if (mtrigger_) { | |
| | | xdb->tune_meta_trigger(mtrigger_); | |
| | | } | |
| | | db = xdb; | |
| | | break; | |
| | | } | |
| } | | } | |
| if (arccomp) arccomp->set_key(zkey.c_str(), zkey.size()); | | if (arccomp) arccomp->set_key(zkey.c_str(), zkey.size()); | |
| if (!db->open(fpath, mode)) { | | if (!db->open(fpath, mode)) { | |
| const Error& error = db->error(); | | const Error& error = db->error(); | |
| set_error(_KCCODELINE_, error.code(), error.message()); | | set_error(_KCCODELINE_, error.code(), error.message()); | |
| delete db; | | delete db; | |
| return false; | | return false; | |
| } | | } | |
| if (arccomp) { | | if (arccomp) { | |
| const std::string& apath = File::absolute_path(fpath); | | const std::string& apath = File::absolute_path(fpath); | |
| | | | |
End of changes. 5 change blocks. |
| 27 lines changed or deleted | | 56 lines changed or added | |
|