本文整理汇总了C++中NamespaceDetails::capLooped方法的典型用法代码示例。如果您正苦于以下问题:C++ NamespaceDetails::capLooped方法的具体用法?C++ NamespaceDetails::capLooped怎么用?C++ NamespaceDetails::capLooped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamespaceDetails
的用法示例。
在下文中一共展示了NamespaceDetails::capLooped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validateNS
//.........这里部分代码省略.........
++nPowerOf2QuantizedSize;
}
if (full){
BSONObj obj = BSONObj::make(r);
if (!obj.isValid() || !obj.valid()){ // both fast and deep checks
valid = false;
if (nInvalid == 0) // only log once;
errors << "invalid bson object detected (see logs for more info)";
nInvalid++;
if (strcmp("_id", obj.firstElementFieldName()) == 0){
try {
obj.firstElement().validate(); // throws on error
log() << "Invalid bson detected in " << ns << " with _id: " << obj.firstElement().toString(false) << endl;
}
catch(...){
log() << "Invalid bson detected in " << ns << " with corrupt _id" << endl;
}
}
else {
log() << "Invalid bson detected in " << ns << " and couldn't find _id" << endl;
}
}
else {
bsonLen += obj.objsize();
}
}
}
if (Runner::RUNNER_EOF != state) {
// TODO: more descriptive logging.
warning() << "Internal error while reading collection " << ns << endl;
}
if ( nsd->isCapped() && !nsd->capLooped() ) {
result.append("cappedOutOfOrder", outOfOrder);
if ( outOfOrder > 1 ) {
valid = false;
errors << "too many out of order records";
}
}
result.append("objectsFound", n);
if (full) {
result.append("invalidObjects", nInvalid);
}
result.appendNumber("nQuantizedSize", nQuantizedSize);
result.appendNumber("nPowerOf2QuantizedSize", nPowerOf2QuantizedSize);
result.appendNumber("bytesWithHeaders", len);
result.appendNumber("bytesWithoutHeaders", nlen);
if (full) {
result.appendNumber("bytesBson", bsonLen);
}
}
BSONArrayBuilder deletedListArray;
for ( int i = 0; i < Buckets; i++ ) {
deletedListArray << nsd->deletedListEntry(i).isNull();
}
int ndel = 0;
long long delSize = 0;
BSONArrayBuilder delBucketSizes;
int incorrect = 0;
for ( int i = 0; i < Buckets; i++ ) {
示例2: _getNextRecord
DiskLoc CappedRecordStoreV1Iterator::getNextCapped(const DiskLoc& dl) {
invariant(!dl.isNull());
NamespaceDetails* details = _recordStore->_details;
if (CollectionScanParams::FORWARD == _direction) {
// If it's not looped, it's easy.
if (!_recordStore->details()->capLooped()) {
return _getNextRecord( dl );
}
// TODO ELABORATE
// EOF.
if (dl == _getExtent( details->capExtent() )->lastRecord) {
return DiskLoc();
}
DiskLoc ret = nextLoop(dl);
// If we become capFirstNewRecord from same extent, advance to next extent.
if (ret == details->capFirstNewRecord() && ret != _getExtent( details->capExtent() )->firstRecord) {
ret = nextLoop(_getExtent( details->capExtent() )->lastRecord);
}
// If we have just gotten to beginning of capExtent, skip to capFirstNewRecord
if (ret == _getExtent( details->capExtent() )->firstRecord) { ret = details->capFirstNewRecord(); }
return ret;
}
else {
if (!details->capLooped()) { return _getPrevRecord( dl ); }
// TODO ELABORATE
// Last record
if (details->capFirstNewRecord() == _getExtent( details->capExtent() )->firstRecord) {
if (dl == nextLoop(_getExtent( details->capExtent() )->lastRecord)) {
return DiskLoc();
}
}
else {
if (dl == _getExtent( details->capExtent() )->firstRecord) { return DiskLoc(); }
}
DiskLoc ret;
// If we are capFirstNewRecord, advance to prev extent, otherwise just get prev.
if (dl == details->capFirstNewRecord()) {
ret = prevLoop(_getExtent( details->capExtent() )->firstRecord);
}
else {
ret = prevLoop(dl);
}
// If we just became last in cap extent, advance past capFirstNewRecord
// (We know ext(capExtent)->firstRecord != capFirstNewRecord, since would
// have returned DiskLoc() earlier otherwise.)
if (ret == _getExtent( details->capExtent() )->lastRecord) {
ret = _getPrevRecord( details->capFirstNewRecord() );
}
return ret;
}
}