kccachedb.h   kccachedb.h 
skipping to change at line 100 skipping to change at line 100
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
db_->curs_.remove(this); db_->curs_.remove(this);
} }
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and othe r threads accessing * @note The operation for each record is performed atomically and othe r threads accessing
* the same record are blocked. To avoid deadlock, any database operat * the same record are blocked. To avoid deadlock, any explicit databa
ion must not be se operation must not
* performed in this function. * be performed in this function.
*/ */
bool accept(Visitor* visitor, bool writable = true, bool step = false) { bool accept(Visitor* visitor, bool writable = true, bool step = false) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
if (db_->omode_ == 0) { if (db_->omode_ == 0) {
db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); db_->set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !(db_->omode_ & OWRITER)) { if (writable && !(db_->omode_ & OWRITER)) {
db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 402 skipping to change at line 402
} }
} }
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other threads accessing the * @note The operation for each record is performed atomically and other threads accessing the
* same record are blocked. To avoid deadlock, any database operation mu * same record are blocked. To avoid deadlock, any explicit database ope
st not be performed in ration must not be
* this function. * performed in this function.
*/ */
bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) { bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && visitor); _assert_(kbuf && ksiz <= MEMMAXSIZ && visitor);
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;
} }
if (writable && !(omode_ & OWRITER)) { if (writable && !(omode_ & OWRITER)) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 433 skipping to change at line 433
slot->lock.unlock(); slot->lock.unlock();
return true; return true;
} }
/** /**
* Accept a visitor to multiple records at once. * Accept a visitor to multiple records at once.
* @param keys specifies a string vector of the keys. * @param keys specifies a string vector of the keys.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operations for specified records are performed atomically an d other threads * @note The operations for specified records are performed atomically an d other threads
* accessing the same records are blocked. To avoid deadlock, any databa * accessing the same records are blocked. To avoid deadlock, any explic
se operation must not it database operation
* be performed in this function. * must not be performed in this function.
*/ */
bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor, bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor,
bool writable = true) { bool writable = true) {
_assert_(visitor); _assert_(visitor);
size_t knum = keys.size(); size_t knum = keys.size();
if (knum < 1) return true; if (knum < 1) return 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;
skipping to change at line 498 skipping to change at line 498
delete[] rkeys; delete[] rkeys;
return true; return true;
} }
/** /**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The whole iteration is performed atomically and other threads ar e blocked. To avoid * @note The whole iteration is performed atomically and other threads ar e blocked. To avoid
* deadlock, any database operation must not be performed in this functio n. * deadlock, any explicit database operation must not be performed in thi s function.
*/ */
bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) { bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !(omode_ & OWRITER)) { if (writable && !(omode_ & OWRITER)) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 1218 skipping to change at line 1218
_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;
} }
/** /**
* Check whether the database was reorganized or not. * Check whether the database was reorganized or not.
* @return true if recovered, or false if not. * @return true if reorganized, or false if not.
*/ */
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;
} }
 End of changes. 5 change blocks. 
11 lines changed or deleted 11 lines changed or added


 kcdb.h   kcdb.h 
skipping to change at line 105 skipping to change at line 105
virtual ~Cursor() { virtual ~Cursor() {
_assert_(true); _assert_(true);
} }
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and othe r threads accessing * @note The operation for each record is performed atomically and othe r threads accessing
* the same record are blocked. To avoid deadlock, any database operat * the same record are blocked. To avoid deadlock, any explicit databa
ion must not be se operation must not
* performed in this function. * be performed in this function.
*/ */
virtual bool accept(Visitor* visitor, bool writable = true, bool step = false) = 0; virtual bool accept(Visitor* visitor, bool writable = true, bool step = false) = 0;
/** /**
* Set the value of the current record. * Set the value of the current record.
* @param vbuf the pointer to the value region. * @param vbuf the pointer to the value region.
* @param vsiz the size of the value region. * @param vsiz the size of the value region.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
virtual bool set_value(const char* vbuf, size_t vsiz, bool step = false ) = 0; virtual bool set_value(const char* vbuf, size_t vsiz, bool step = false ) = 0;
skipping to change at line 265 skipping to change at line 265
_assert_(true); _assert_(true);
} }
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other threads accessing the * @note The operation for each record is performed atomically and other threads accessing the
* same record are blocked. To avoid deadlock, any database operation mu * same record are blocked. To avoid deadlock, any explicit database ope
st not be performed in ration must not be
* this function. * performed in this function.
*/ */
virtual bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writable = true) = 0; virtual bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writable = true) = 0;
/** /**
* Set the value of a record. * Set the value of a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param vbuf the pointer to the value region. * @param vbuf the pointer to the value region.
* @param vsiz the size of the value region. * @param vsiz the size of the value region.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note If no record corresponds to the key, a new record is created. I f the corresponding * @note If no record corresponds to the key, a new record is created. I f the corresponding
skipping to change at line 1092 skipping to change at line 1092
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
virtual bool close() = 0; virtual bool close() = 0;
/** /**
* Accept a visitor to multiple records at once. * Accept a visitor to multiple records at once.
* @param keys specifies a string vector of the keys. * @param keys specifies a string vector of the keys.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operations for specified records are performed atomically an d other threads * @note The operations for specified records are performed atomically an d other threads
* accessing the same records are blocked. To avoid deadlock, any databa * accessing the same records are blocked. To avoid deadlock, any explic
se operation must not it database operation
* be performed in this function. * must not be performed in this function.
*/ */
virtual bool accept_bulk(const std::vector<std::string>& keys, Visitor* v isitor, virtual bool accept_bulk(const std::vector<std::string>& keys, Visitor* v isitor,
bool writable = true) = 0; bool writable = true) = 0;
/** /**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The whole iteration is performed atomically and other threads ar e blocked. To avoid * @note The whole iteration is performed atomically and other threads ar e blocked. To avoid
* deadlock, any database operation must not be performed in this functio n. * deadlock, any explicit database operation must not be performed in thi s function.
*/ */
virtual bool iterate(Visitor *visitor, bool writable = true, virtual bool iterate(Visitor *visitor, bool writable = true,
ProgressChecker* checker = NULL) = 0; ProgressChecker* checker = NULL) = 0;
/** /**
* Synchronize updated contents with the file and the device. * Synchronize updated contents with the file and the device.
* @param hard true for physical synchronization with the device, or fals e for logical * @param hard true for physical synchronization with the device, or fals e for logical
* synchronization with the file system. * synchronization with the file system.
* @param proc a postprocessor object. If it is NULL, no postprocessing is performed. * @param proc a postprocessor object. If it is NULL, no postprocessing is performed.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
 End of changes. 4 change blocks. 
10 lines changed or deleted 10 lines changed or added


 kcdbext.h   kcdbext.h 
skipping to change at line 202 skipping to change at line 202
_assert_(true); _assert_(true);
} }
/** /**
* Map a record data. * Map a record data.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param vbuf the pointer to the value region. * @param vbuf the pointer to the value region.
* @param vsiz the size of the value region. * @param vsiz the size of the value region.
* @param emitter the emitter object. * @param emitter the emitter object.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note To avoid deadlock, any database operation must not be performed * @note To avoid deadlock, any explicit database operation must not be p
in this function. erformed in this
* function.
*/ */
virtual bool map(const char* kbuf, size_t ksiz, const char* vbuf, size_t vsiz, virtual bool map(const char* kbuf, size_t ksiz, const char* vbuf, size_t vsiz,
MapEmitter* emitter) = 0; MapEmitter* emitter) = 0;
/** /**
* Reduce a record data. * Reduce a record data.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param iter the iterator to get the values. * @param iter the iterator to get the values.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note Database operations can be performed in this function. * @note Database operations can be performed in this function.
 End of changes. 1 change blocks. 
2 lines changed or deleted 3 lines changed or added


 kcdirdb.h   kcdirdb.h 
skipping to change at line 102 skipping to change at line 102
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
db_->curs_.remove(this); db_->curs_.remove(this);
} }
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and othe r threads accessing * @note The operation for each record is performed atomically and othe r threads accessing
* the same record are blocked. To avoid deadlock, any database operat * the same record are blocked. To avoid deadlock, any explicit databa
ion must not be se operation must not
* performed in this function. * be performed in this function.
*/ */
bool accept(Visitor* visitor, bool writable = true, bool step = false) { bool accept(Visitor* visitor, bool writable = true, bool step = false) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
if (db_->omode_ == 0) { if (db_->omode_ == 0) {
db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); db_->set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !(db_->writer_)) { if (writable && !(db_->writer_)) {
db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 406 skipping to change at line 406
} }
} }
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other threads accessing the * @note The operation for each record is performed atomically and other threads accessing the
* same record are blocked. To avoid deadlock, any database operation mu * same record are blocked. To avoid deadlock, any explicit database ope
st not be performed in ration must not be
* this function. * performed in this function.
*/ */
bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) { bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && visitor); _assert_(kbuf && ksiz <= MEMMAXSIZ && visitor);
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;
} }
if (writable && !writer_) { if (writable && !writer_) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 439 skipping to change at line 439
rlock_.unlock(lidx); rlock_.unlock(lidx);
return !err; return !err;
} }
/** /**
* Accept a visitor to multiple records at once. * Accept a visitor to multiple records at once.
* @param keys specifies a string vector of the keys. * @param keys specifies a string vector of the keys.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operations for specified records are performed atomically an d other threads * @note The operations for specified records are performed atomically an d other threads
* accessing the same records are blocked. To avoid deadlock, any databa * accessing the same records are blocked. To avoid deadlock, any explic
se operation must not it database operation
* be performed in this function. * must not be performed in this function.
*/ */
bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor, bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor,
bool writable = true) { bool writable = true) {
_assert_(visitor); _assert_(visitor);
size_t knum = keys.size(); size_t knum = keys.size();
if (knum < 1) return true; if (knum < 1) return 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;
skipping to change at line 504 skipping to change at line 504
delete[] rkeys; delete[] rkeys;
return !err; return !err;
} }
/** /**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The whole iteration is performed atomically and other threads ar e blocked. To avoid * @note The whole iteration is performed atomically and other threads ar e blocked. To avoid
* deadlock, any database operation must not be performed in this functio n. * deadlock, any explicit database operation must not be performed in thi s function.
*/ */
bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) { bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !writer_) { if (writable && !writer_) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 1350 skipping to change at line 1350
_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 recov_; return recov_;
} }
/** /**
* Check whether the database was reorganized or not. * Check whether the database was reorganized or not.
* @return true if recovered, or false if not. * @return true if reorganized, or false if not.
*/ */
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_;
} }
 End of changes. 5 change blocks. 
11 lines changed or deleted 11 lines changed or added


 kchashdb.h   kchashdb.h 
skipping to change at line 127 skipping to change at line 127
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
db_->curs_.remove(this); db_->curs_.remove(this);
} }
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and othe r threads accessing * @note The operation for each record is performed atomically and othe r threads accessing
* the same record are blocked. To avoid deadlock, any database operat * the same record are blocked. To avoid deadlock, any explicit databa
ion must not be se operation must not
* performed in this function. * be performed in this function.
*/ */
bool accept(Visitor* visitor, bool writable = true, bool step = false) { bool accept(Visitor* visitor, bool writable = true, bool step = false) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
if (db_->omode_ == 0) { if (db_->omode_ == 0) {
db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); db_->set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !(db_->writer_)) { if (writable && !(db_->writer_)) {
db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 514 skipping to change at line 514
} }
} }
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other threads accessing the * @note The operation for each record is performed atomically and other threads accessing the
* same record are blocked. To avoid deadlock, any database operation mu * same record are blocked. To avoid deadlock, any explicit database ope
st not be performed in ration must not be
* this function. * performed in this function.
*/ */
bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) { bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && visitor); _assert_(kbuf && ksiz <= MEMMAXSIZ && visitor);
mlock_.lock_reader(); mlock_.lock_reader();
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_) {
skipping to change at line 560 skipping to change at line 560
mlock_.unlock(); mlock_.unlock();
return !err; return !err;
} }
/** /**
* Accept a visitor to multiple records at once. * Accept a visitor to multiple records at once.
* @param keys specifies a string vector of the keys. * @param keys specifies a string vector of the keys.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operations for specified records are performed atomically an d other threads * @note The operations for specified records are performed atomically an d other threads
* accessing the same records are blocked. To avoid deadlock, any databa * accessing the same records are blocked. To avoid deadlock, any explic
se operation must not it database operation
* be performed in this function. * must not be performed in this function.
*/ */
bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor, bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor,
bool writable = true) { bool writable = true) {
_assert_(visitor); _assert_(visitor);
size_t knum = keys.size(); size_t knum = keys.size();
if (knum < 1) return true; if (knum < 1) return true;
mlock_.lock_reader(); mlock_.lock_reader();
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
mlock_.unlock(); mlock_.unlock();
skipping to change at line 640 skipping to change at line 640
mlock_.unlock(); mlock_.unlock();
return !err; return !err;
} }
/** /**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The whole iteration is performed atomically and other threads ar e blocked. To avoid * @note The whole iteration is performed atomically and other threads ar e blocked. To avoid
* deadlock, any database operation must not be performed in this functio n. * deadlock, any explicit database operation must not be performed in thi s function.
*/ */
bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) { bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !writer_) { if (writable && !writer_) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 1018 skipping to change at line 1018
count_ = 0; count_ = 0;
lsiz_ = roff_; lsiz_ = roff_;
psiz_ = lsiz_; psiz_ = lsiz_;
dfcur_ = roff_; dfcur_ = roff_;
std::memset(opaque_, 0, sizeof(opaque_)); std::memset(opaque_, 0, sizeof(opaque_));
if (!file_.truncate(lsiz_)) { if (!file_.truncate(lsiz_)) {
set_error(_KCCODELINE_, Error::SYSTEM, file_.error()); set_error(_KCCODELINE_, Error::SYSTEM, file_.error());
err = true; err = true;
} }
if (!dump_meta()) err = true; if (!dump_meta()) err = true;
if (!set_flag(FOPEN, true)) err = true; if (!autotran_ && !set_flag(FOPEN, true)) err = true;
trigger_meta(MetaTrigger::CLEAR, "clear"); trigger_meta(MetaTrigger::CLEAR, "clear");
return true; return true;
} }
/** /**
* Get the number of records. * Get the number of records.
* @return the number of records, or -1 on failure. * @return the number of records, or -1 on failure.
*/ */
int64_t count() { int64_t count() {
_assert_(true); _assert_(true);
ScopedSpinRWLock lock(&mlock_, false); ScopedSpinRWLock lock(&mlock_, false);
skipping to change at line 1598 skipping to change at line 1598
_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 file_.recovered(); return file_.recovered();
} }
/** /**
* Check whether the database was reorganized or not. * Check whether the database was reorganized or not.
* @return true if recovered, or false if not. * @return true if reorganized, or false if not.
*/ */
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_;
} }
 End of changes. 6 change blocks. 
12 lines changed or deleted 12 lines changed or added


 kclangc.h   kclangc.h 
skipping to change at line 47 skipping to change at line 47
#include <stdint.h> #include <stdint.h>
/** /**
* C wrapper of polymorphic database. * C wrapper of polymorphic database.
*/ */
typedef union { typedef union {
void* db; /**< dummy member */ void* db; /**< dummy member */
} KCDB; } KCDB;
/** /**
* Binary string of byte array.
*/
typedef struct {
char* buf; /**< pointer to the data region */
size_t size; /**< size of the data region */
} KCSTR;
/**
* Key-Value record.
*/
typedef struct {
KCSTR key; /**< key string */
KCSTR value; /**< value string */
} KCREC;
/**
* Error codes. * Error codes.
*/ */
enum { enum {
KCESUCCESS, /**< success */ KCESUCCESS, /**< success */
KCENOIMPL, /**< not implemented */ KCENOIMPL, /**< not implemented */
KCEINVALID, /**< invalid operation */ KCEINVALID, /**< invalid operation */
KCENOREPOS, /**< no repository */ KCENOREPOS, /**< no repository */
KCENOPERM, /**< no permission */ KCENOPERM, /**< no permission */
KCEBROKEN, /**< broken file */ KCEBROKEN, /**< broken file */
KCEDUPREC, /**< record duplication */ KCEDUPREC, /**< record duplication */
skipping to change at line 331 skipping to change at line 347
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param db a database object. * @param db a database object.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param fullproc a call back function to visit a record. * @param fullproc a call back function to visit a record.
* @param emptyproc a call back function to visit an empty record space. * @param emptyproc a call back function to visit an empty record space.
* @param opq an opaque pointer to be given to the call back functions. * @param opq an opaque pointer to be given to the call back functions.
* @param writable true for writable operation, or false for read-only oper ation. * @param writable true for writable operation, or false for read-only oper ation.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note the operation for each record is performed atomically and other th * @note The operation for each record is performed atomically and other th
reads accessing the reads accessing the
* same record are blocked. * same record are blocked. To avoid deadlock, any explicit database opera
tion must not be
* performed in this function.
*/ */
int32_t kcdbaccept(KCDB* db, const char* kbuf, size_t ksiz, int32_t kcdbaccept(KCDB* db, const char* kbuf, size_t ksiz,
KCVISITFULL fullproc, KCVISITEMPTY emptyproc, void* opq, int32_t writable); KCVISITFULL fullproc, KCVISITEMPTY emptyproc, void* opq, int32_t writable);
/** /**
* Accept a visitor to multiple records at once.
* @param db a database object.
* @param keys specifies an array of binary strings of the keys.
* @param knum specifies the number of the keys.
* @param fullproc a call back function to visit a record.
* @param emptyproc a call back function to visit an empty record space.
* @param opq an opaque pointer to be given to the call back functions.
* @param writable true for writable operation, or false for read-only oper
ation.
* @return true on success, or false on failure.
* @note The operations for specified records are performed atomically and
other threads
* accessing the same records are blocked. To avoid deadlock, any explicit
database operation
* must not be performed in this function.
*/
int32_t kcdbacceptbulk(KCDB* db, const KCSTR* keys, size_t knum,
KCVISITFULL fullproc, KCVISITEMPTY emptyproc,
void* opq, int32_t writable);
/**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param db a database object. * @param db a database object.
* @param fullproc a call back function to visit a record. * @param fullproc a call back function to visit a record.
* @param opq an opaque pointer to be given to the call back function. * @param opq an opaque pointer to be given to the call back function.
* @param writable true for writable operation, or false for read-only oper ation. * @param writable true for writable operation, or false for read-only oper ation.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note the whole iteration is performed atomically and other threads are blocked. * @note The whole iteration is performed atomically and other threads are blocked.
*/ */
int32_t kcdbiterate(KCDB* db, KCVISITFULL fullproc, void* opq, int32_t writ able); int32_t kcdbiterate(KCDB* db, KCVISITFULL fullproc, void* opq, int32_t writ able);
/** /**
* Set the value of a record. * Set the value of a record.
* @param db a database object. * @param db a database object.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param vbuf the pointer to the value region. * @param vbuf the pointer to the value region.
* @param vsiz the size of the value region. * @param vsiz the size of the value region.
skipping to change at line 472 skipping to change at line 507
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param vbuf the pointer to the buffer into which the value of the corres ponding record is * @param vbuf the pointer to the buffer into which the value of the corres ponding record is
* written. * written.
* @param max the size of the buffer. * @param max the size of the buffer.
* @return the size of the value, or -1 on failure. * @return the size of the value, or -1 on failure.
*/ */
int32_t kcdbgetbuf(KCDB* db, const char* kbuf, size_t ksiz, char* vbuf, siz e_t max); int32_t kcdbgetbuf(KCDB* db, const char* kbuf, size_t ksiz, char* vbuf, siz e_t max);
/** /**
* Store records at once.
* @param db a database object.
* @param recs the records to store.
* @param rnum specifies the number of the records.
* @param atomic true to perform all operations atomically, or false for no
n-atomic operations.
* @return the number of stored records, or -1 on failure.
*/
int64_t kcdbsetbulk(KCDB* db, const KCREC* recs, size_t rnum, int32_t atomi
c);
/**
* Remove records at once.
* @param db a database object.
* @param keys the keys of the records to remove.
* @param knum specifies the number of the keys.
* @param atomic true to perform all operations atomically, or false for no
n-atomic operations.
* @return the number of removed records, or -1 on failure.
*/
int64_t kcdbremovebulk(KCDB* db, const KCSTR* keys, size_t knum, int32_t at
omic);
/**
* Retrieve records at once.
* @param db a database object.
* @param keys the keys of the records to retrieve.
* @param knum specifies the number of the keys.
* @param recs an array to contain the result. Its size must be sufficient
.
* @param atomic true to perform all operations atomically, or false for no
n-atomic operations.
* @return the number of retrieved records, or -1 on failure.
* @note The regions of the key and the value of each element of the result
should be released
* with the kcfree function when it is no longer in use.
*/
int64_t kcdbgetbulk(KCDB* db, const KCSTR* keys, size_t knum, KCREC* recs,
int32_t atomic);
/**
* Remove all records. * Remove all records.
* @param db a database object. * @param db a database object.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
int32_t kcdbclear(KCDB* db); int32_t kcdbclear(KCDB* db);
/** /**
* Synchronize updated contents with the file and the device. * Synchronize updated contents with the file and the device.
* @param db a database object. * @param db a database object.
* @param hard true for physical synchronization with the device, or false for logical * @param hard true for physical synchronization with the device, or false for logical
skipping to change at line 583 skipping to change at line 651
/** /**
* Get keys matching a prefix string. * Get keys matching a prefix string.
* @param db a database object. * @param db a database object.
* @param prefix the prefix string. * @param prefix the prefix string.
* @param strary an array to contain the result. Its size must be sufficie nt. * @param strary an array to contain the result. Its size must be sufficie nt.
* @param max the maximum number to retrieve. * @param max the maximum number to retrieve.
* @return the number of retrieved keys or -1 on failure. * @return the number of retrieved keys or -1 on failure.
* @note The region of each element of the result should be released with t he kcfree function * @note The region of each element of the result should be released with t he kcfree function
* when it is no longer in use. * when it is no longer in use.
*/ */
int64_t kcdbmatchprefix(KCDB* db, const char* prefix, char** strary, int64_ t max); int64_t kcdbmatchprefix(KCDB* db, const char* prefix, char** strary, size_t max);
/** /**
* Get keys matching a regular expression string. * Get keys matching a regular expression string.
* @param db a database object. * @param db a database object.
* @param regex the regular expression string. * @param regex the regular expression string.
* @param strary an array to contain the result. Its size must be sufficie nt. * @param strary an array to contain the result. Its size must be sufficie nt.
* @param max the maximum number to retrieve. * @param max the maximum number to retrieve.
* @return the number of retrieved keys or -1 on failure. * @return the number of retrieved keys or -1 on failure.
* @note The region of each element of the result should be released with t he kcfree function * @note The region of each element of the result should be released with t he kcfree function
* when it is no longer in use. * when it is no longer in use.
*/ */
int64_t kcdbmatchregex(KCDB* db, const char* regex, char** strary, int64_t max); int64_t kcdbmatchregex(KCDB* db, const char* regex, char** strary, size_t m ax);
/** /**
* Merge records from other databases. * Merge records from other databases.
* @param db a database object. * @param db a database object.
* @param srcary an array of the source detabase objects. * @param srcary an array of the source detabase objects.
* @param srcnum the number of the elements of the source array. * @param srcnum the number of the elements of the source array.
* @param mode the merge mode. KCMSET to overwrite the existing value, KCM ADD to keep the * @param mode the merge mode. KCMSET to overwrite the existing value, KCM ADD to keep the
* existing value, KCMREPLACE to modify the existing record only, KCMAPPEND to append the new * existing value, KCMREPLACE to modify the existing record only, KCMAPPEND to append the new
* value. * value.
* @return true on success, or false on failure. * @return true on success, or false on failure.
skipping to change at line 632 skipping to change at line 700
void kccurdel(KCCUR* cur); void kccurdel(KCCUR* cur);
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @param cur a cursor object. * @param cur a cursor object.
* @param fullproc a call back function to visit a record. * @param fullproc a call back function to visit a record.
* @param opq an opaque pointer to be given to the call back functions. * @param opq an opaque pointer to be given to the call back functions.
* @param writable true for writable operation, or false for read-only oper ation. * @param writable true for writable operation, or false for read-only oper ation.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other th
reads accessing
* the same record are blocked. To avoid deadlock, any explicit database o
peration must not
* be performed in this function.
*/ */
int32_t kccuraccept(KCCUR* cur, KCVISITFULL fullproc, void* opq, int32_t kccuraccept(KCCUR* cur, KCVISITFULL fullproc, void* opq,
int32_t writable, int32_t step); int32_t writable, int32_t step);
/** /**
* Set the value of the current record. * Set the value of the current record.
* @param cur a cursor object. * @param cur a cursor object.
* @param vbuf the pointer to the value region. * @param vbuf the pointer to the value region.
* @param vsiz the size of the value region. * @param vsiz the size of the value region.
* @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.
 End of changes. 8 change blocks. 
6 lines changed or deleted 91 lines changed or added


 kcplantdb.h   kcplantdb.h 
skipping to change at line 128 skipping to change at line 128
if (kbuf_) clear_position(); if (kbuf_) clear_position();
db_->curs_.remove(this); db_->curs_.remove(this);
} }
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and othe r threads accessing * @note The operation for each record is performed atomically and othe r threads accessing
* the same record are blocked. To avoid deadlock, any database operat * the same record are blocked. To avoid deadlock, any explicit databa
ion must not be se operation must not
* performed in this function. * be performed in this function.
*/ */
bool accept(Visitor* visitor, bool writable = true, bool step = false) { bool accept(Visitor* visitor, bool writable = true, bool step = false) {
_assert_(visitor); _assert_(visitor);
db_->mlock_.lock_reader(); db_->mlock_.lock_reader();
if (db_->omode_ == 0) { if (db_->omode_ == 0) {
db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); db_->set_error(_KCCODELINE_, Error::INVALID, "not opened");
db_->mlock_.unlock(); db_->mlock_.unlock();
return false; return false;
} }
if (writable && !(db_->writer_)) { if (writable && !(db_->writer_)) {
skipping to change at line 950 skipping to change at line 950
} }
} }
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other threads accessing the * @note The operation for each record is performed atomically and other threads accessing the
* same record are blocked. To avoid deadlock, any database operation mu * same record are blocked. To avoid deadlock, any explicit database ope
st not be performed in ration must not be
* this function. * performed in this function.
*/ */
bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) { bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && visitor); _assert_(kbuf && ksiz <= MEMMAXSIZ && visitor);
mlock_.lock_reader(); mlock_.lock_reader();
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_) {
skipping to change at line 1056 skipping to change at line 1056
} }
return !err; return !err;
} }
/** /**
* Accept a visitor to multiple records at once. * Accept a visitor to multiple records at once.
* @param keys specifies a string vector of the keys. * @param keys specifies a string vector of the keys.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operations for specified records are performed atomically an d other threads * @note The operations for specified records are performed atomically an d other threads
* accessing the same records are blocked. To avoid deadlock, any databa * accessing the same records are blocked. To avoid deadlock, any explic
se operation must not it database operation
* be performed in this function. * must not be performed in this function.
*/ */
bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor, bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor,
bool writable = true) { bool writable = true) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !writer_) { if (writable && !writer_) {
skipping to change at line 1130 skipping to change at line 1130
} }
return !err; return !err;
} }
/** /**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The whole iteration is performed atomically and other threads ar e blocked. To avoid * @note The whole iteration is performed atomically and other threads ar e blocked. To avoid
* deadlock, any database operation must not be performed in this functio n. * deadlock, any explicit database operation must not be performed in thi s function.
*/ */
bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) { bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !writer_) { if (writable && !writer_) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
 End of changes. 4 change blocks. 
10 lines changed or deleted 10 lines changed or added


 kcpolydb.h   kcpolydb.h 
skipping to change at line 87 skipping to change at line 87
_assert_(true); _assert_(true);
delete cur_; delete cur_;
} }
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and othe r threads accessing * @note The operation for each record is performed atomically and othe r threads accessing
* the same record are blocked. To avoid deadlock, any database operat * the same record are blocked. To avoid deadlock, any explicit databa
ion must not be se operation must not
* performed in this function. * be performed in this function.
*/ */
bool accept(Visitor* visitor, bool writable = true, bool step = false) { bool accept(Visitor* visitor, bool writable = true, bool step = false) {
_assert_(visitor); _assert_(visitor);
if (db_->type_ == TYPEVOID) { if (db_->type_ == TYPEVOID) {
db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); db_->set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
return cur_->accept(visitor, writable, step); return cur_->accept(visitor, writable, step);
} }
/** /**
skipping to change at line 274 skipping to change at line 274
return true; return true;
} }
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other threads accessing the * @note The operation for each record is performed atomically and other threads accessing the
* same record are blocked. To avoid deadlock, any database operation mu * same record are blocked. To avoid deadlock, any explicit database ope
st not be performed in ration must not be
* this function. * performed in this function.
*/ */
bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) { bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && visitor); _assert_(kbuf && ksiz <= MEMMAXSIZ && visitor);
if (type_ == TYPEVOID) { if (type_ == TYPEVOID) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
return db_->accept(kbuf, ksiz, visitor, writable); return db_->accept(kbuf, ksiz, visitor, writable);
} }
/** /**
* Accept a visitor to multiple records at once. * Accept a visitor to multiple records at once.
* @param keys specifies a string vector of the keys. * @param keys specifies a string vector of the keys.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operations for specified records are performed atomically an d other threads * @note The operations for specified records are performed atomically an d other threads
* accessing the same records are blocked. To avoid deadlock, any databa * accessing the same records are blocked. To avoid deadlock, any explic
se operation must not it database operation
* be performed in this function. * must not be performed in this function.
*/ */
bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor, bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor,
bool writable = true) { bool writable = true) {
_assert_(visitor); _assert_(visitor);
if (type_ == TYPEVOID) { if (type_ == TYPEVOID) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
return db_->accept_bulk(keys, visitor, writable); return db_->accept_bulk(keys, visitor, writable);
} }
/** /**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The whole iteration is performed atomically and other threads ar e blocked. To avoid * @note The whole iteration is performed atomically and other threads ar e blocked. To avoid
* deadlock, any database operation must not be performed in this functio n. * deadlock, any explicit database operation must not be performed in thi s function.
*/ */
bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) { bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) {
_assert_(visitor); _assert_(visitor);
if (type_ == TYPEVOID) { if (type_ == TYPEVOID) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
return db_->iterate(visitor, writable, checker); return db_->iterate(visitor, writable, checker);
} }
/** /**
 End of changes. 4 change blocks. 
10 lines changed or deleted 10 lines changed or added


 kcprotodb.h   kcprotodb.h 
skipping to change at line 127 skipping to change at line 127
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
db_->curs_.remove(this); db_->curs_.remove(this);
} }
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and othe r threads accessing * @note The operation for each record is performed atomically and othe r threads accessing
* the same record are blocked. To avoid deadlock, any database operat * the same record are blocked. To avoid deadlock, any explicit databa
ion must not be se operation must not
* performed in this function. * be performed in this function.
*/ */
bool accept(Visitor* visitor, bool writable = true, bool step = false) { bool accept(Visitor* visitor, bool writable = true, bool step = false) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
if (db_->omode_ == 0) { if (db_->omode_ == 0) {
db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); db_->set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !(db_->omode_ & OWRITER)) { if (writable && !(db_->omode_ & OWRITER)) {
db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 396 skipping to change at line 396
} }
} }
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other threads accessing the * @note The operation for each record is performed atomically and other threads accessing the
* same record are blocked. To avoid deadlock, any database operation mu * same record are blocked. To avoid deadlock, any explicit database ope
st not be performed in ration must not be
* this function. * performed in this function.
*/ */
bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) { bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && visitor); _assert_(kbuf && ksiz <= MEMMAXSIZ && visitor);
if (writable) { if (writable) {
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (!(omode_ & OWRITER)) { if (!(omode_ & OWRITER)) {
skipping to change at line 489 skipping to change at line 489
} }
return true; return true;
} }
/** /**
* Accept a visitor to multiple records at once. * Accept a visitor to multiple records at once.
* @param keys specifies a string vector of the keys. * @param keys specifies a string vector of the keys.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operations for specified records are performed atomically an d other threads * @note The operations for specified records are performed atomically an d other threads
* accessing the same records are blocked. To avoid deadlock, any databa * accessing the same records are blocked. To avoid deadlock, any explic
se operation must not it database operation
* be performed in this function. * must not be performed in this function.
*/ */
bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor, bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor,
bool writable = true) { bool writable = true) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (!(omode_ & OWRITER)) { if (!(omode_ & OWRITER)) {
skipping to change at line 562 skipping to change at line 562
} }
return true; return true;
} }
/** /**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The whole iteration is performed atomically and other threads ar e blocked. To avoid * @note The whole iteration is performed atomically and other threads ar e blocked. To avoid
* deadlock, any database operation must not be performed in this functio n. * deadlock, any explicit database operation must not be performed in thi s function.
*/ */
bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) { bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !(omode_ & OWRITER)) { if (writable && !(omode_ & OWRITER)) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
 End of changes. 4 change blocks. 
10 lines changed or deleted 10 lines changed or added


 kcstashdb.h   kcstashdb.h 
skipping to change at line 94 skipping to change at line 94
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
db_->curs_.remove(this); db_->curs_.remove(this);
} }
/** /**
* Accept a visitor to the current record. * Accept a visitor to the current record.
* @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.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and othe r threads accessing * @note The operation for each record is performed atomically and othe r threads accessing
* the same record are blocked. To avoid deadlock, any database operat * the same record are blocked. To avoid deadlock, any explicit databa
ion must not be se operation must not
* performed in this function. * be performed in this function.
*/ */
bool accept(Visitor* visitor, bool writable = true, bool step = false) { bool accept(Visitor* visitor, bool writable = true, bool step = false) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&db_->mlock_, true); ScopedSpinRWLock lock(&db_->mlock_, true);
if (db_->omode_ == 0) { if (db_->omode_ == 0) {
db_->set_error(_KCCODELINE_, Error::INVALID, "not opened"); db_->set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !(db_->omode_ & OWRITER)) { if (writable && !(db_->omode_ & OWRITER)) {
db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); db_->set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 339 skipping to change at line 339
} }
} }
/** /**
* Accept a visitor to a record. * Accept a visitor to a record.
* @param kbuf the pointer to the key region. * @param kbuf the pointer to the key region.
* @param ksiz the size of the key region. * @param ksiz the size of the key region.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation for each record is performed atomically and other threads accessing the * @note The operation for each record is performed atomically and other threads accessing the
* same record are blocked. To avoid deadlock, any database operation mu * same record are blocked. To avoid deadlock, any explicit database ope
st not be performed in ration must not be
* this function. * performed in this function.
*/ */
bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) { bool accept(const char* kbuf, size_t ksiz, Visitor* visitor, bool writabl e = true) {
_assert_(kbuf && ksiz <= MEMMAXSIZ && visitor); _assert_(kbuf && ksiz <= MEMMAXSIZ && visitor);
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;
} }
if (writable && !(omode_ & OWRITER)) { if (writable && !(omode_ & OWRITER)) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
skipping to change at line 371 skipping to change at line 371
rlock_.unlock(lidx); rlock_.unlock(lidx);
return true; return true;
} }
/** /**
* Accept a visitor to multiple records at once. * Accept a visitor to multiple records at once.
* @param keys specifies a string vector of the keys. * @param keys specifies a string vector of the keys.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operations for specified records are performed atomically an d other threads * @note The operations for specified records are performed atomically an d other threads
* accessing the same records are blocked. To avoid deadlock, any databa * accessing the same records are blocked. To avoid deadlock, any explic
se operation must not it database operation
* be performed in this function. * must not be performed in this function.
*/ */
bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor, bool accept_bulk(const std::vector<std::string>& keys, Visitor* visitor,
bool writable = true) { bool writable = true) {
_assert_(visitor); _assert_(visitor);
size_t knum = keys.size(); size_t knum = keys.size();
if (knum < 1) return true; if (knum < 1) return 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;
skipping to change at line 433 skipping to change at line 433
delete[] rkeys; delete[] rkeys;
return true; return true;
} }
/** /**
* Iterate to accept a visitor for each record. * Iterate to accept a visitor for each record.
* @param visitor a visitor object. * @param visitor a visitor object.
* @param writable true for writable operation, or false for read-only op eration. * @param writable true for writable operation, or false for read-only op eration.
* @param checker a progress checker object. If it is NULL, no checking is performed. * @param checker a progress checker object. If it is NULL, no checking is performed.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The whole iteration is performed atomically and other threads ar e blocked. To avoid * @note The whole iteration is performed atomically and other threads ar e blocked. To avoid
* deadlock, any database operation must not be performed in this functio n. * deadlock, any explicit database operation must not be performed in thi s function.
*/ */
bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) { bool iterate(Visitor *visitor, bool writable = true, ProgressChecker* che cker = NULL) {
_assert_(visitor); _assert_(visitor);
ScopedSpinRWLock lock(&mlock_, true); ScopedSpinRWLock lock(&mlock_, true);
if (omode_ == 0) { if (omode_ == 0) {
set_error(_KCCODELINE_, Error::INVALID, "not opened"); set_error(_KCCODELINE_, Error::INVALID, "not opened");
return false; return false;
} }
if (writable && !(omode_ & OWRITER)) { if (writable && !(omode_ & OWRITER)) {
set_error(_KCCODELINE_, Error::NOPERM, "permission denied"); set_error(_KCCODELINE_, Error::NOPERM, "permission denied");
 End of changes. 4 change blocks. 
10 lines changed or deleted 10 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/