31 #include "mongo/base/static_assert.h" 32 #include "mongo/db/jsobj.h" 53 template <
class LocType>
80 return static_cast<short>(
_kdo);
108 recordLoc.GETOFS() |= 1;
112 recordLoc.GETOFS() &= ~1;
116 return recordLoc.getOfs() & 1;
181 enum { HeaderSize = 40 };
222 unsigned long long result =
ofs;
223 char* cursor =
reinterpret_cast<char*
>(&result);
224 *
reinterpret_cast<uint16_t*
>(cursor + 4) = *reinterpret_cast<const uint16_t*>(&_a[0]);
225 *
reinterpret_cast<uint8_t*
>(cursor + 6) = *reinterpret_cast<const uint8_t*>(&_a[2]);
226 *
reinterpret_cast<uint8_t*
>(cursor + 7) = uint8_t(0);
238 unsigned long long a = toLongLong();
243 return a == b ? 0 : 1;
260 return !(*
this == rhs);
274 _a[0] = _a[1] = _a[2] = 0;
277 void operator=(
const DiskLoc& loc);
291 unsigned a = *((
unsigned*)(_a - 1));
322 enum { HeaderSize = 22 };
338 enum { BucketSize = 8192, BucketBodySize = BucketSize - BucketType::HeaderSize };
343 static const int KeyMax = OldBucketSize / 10;
346 static const int INVALID_N_SENTINEL = -1;
363 BucketSize = 8192 - 16,
364 BucketBodySize = BucketSize - BucketType::HeaderSize
367 static const int KeyMax = 1024;
370 static const unsigned short INVALID_N_SENTINEL = 0xffff;
void setUsed()
Definition: btree_ondisk.h:111
int topSize
Size used for bson storage, including storage of old keys.
Definition: btree_ondisk.h:170
bool operator<(const DiskLoc56Bit &rhs) const
Definition: btree_ondisk.h:230
unsigned short _wasSize
Can be reused, value is 8192 in current pdfile version Apr2010.
Definition: btree_ondisk.h:155
unsigned short _reserved1
zero
Definition: btree_ondisk.h:160
int ofs
Definition: btree_interface.cpp:337
LocType prevChildBucket
The 'left' child bucket of this key.
Definition: btree_ondisk.h:63
int ofs
Definition: btree_ondisk.h:196
int compare(const DiskLoc56Bit &rhs) const
Definition: btree_ondisk.h:237
Definition: btree_ondisk.h:331
FixedWidthKey< DiskLoc56Bit > FixedWidthKeyType
Definition: btree_ondisk.h:356
BtreeBucketV1 BucketType
Definition: btree_ondisk.h:360
Definition: btree_ondisk.h:329
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
LocType recordLoc
The location of the record associated with this key.
Definition: btree_ondisk.h:68
int n
Definition: btree_ondisk.h:173
int isUnused() const
Definition: btree_ondisk.h:115
RecordId toRecordId() const
Definition: btree_ondisk.h:283
void setUnused()
Unused keys are not returned by read operations.
Definition: btree_ondisk.h:107
void setKeyDataOfs(short s)
Definition: btree_ondisk.h:83
int emptySize
basicInsert() assumes the next three members are consecutive and in this order:
Definition: btree_ondisk.h:167
int reserved
Definition: btree_ondisk.h:175
unsigned long long toLongLong() const
Definition: btree_ondisk.h:220
BtreeBucketV0 BucketType
Definition: btree_ondisk.h:336
int & GETOFS()
Definition: btree_ondisk.h:204
KeyBson KeyType
Definition: btree_ondisk.h:334
KeyV1 KeyType
Definition: btree_ondisk.h:357
unsigned short flags
Definition: btree_ondisk.h:307
MONGO_STATIC_ASSERT(sizeof(void *)==sizeof(size_t))
FixedWidthKey< DiskLoc > FixedWidthKeyType
Definition: btree_ondisk.h:332
int isUsed() const
Definition: btree_ondisk.h:119
represents a disk location/offset on disk in a database.
Definition: diskloc.h:53
This structure represents header data for a btree bucket.
Definition: btree_ondisk.h:141
RecordId toRecordId() const
Definition: diskloc.h:185
unsigned short topSize
Size used for bson storage, including storage of old keys.
Definition: btree_ondisk.h:313
void setKeyDataOfsSavingUse(short s)
Definition: btree_ondisk.h:88
This is the fixed width data component for storage of a key within a bucket.
Definition: btree_ondisk.h:54
static void initBucket(BucketType *bucket)
Definition: btree_ondisk.h:372
DiskLoc56Bit nextChild
Given that there are n keys, this is the n index child.
Definition: btree_ondisk.h:305
const int OldBucketSize
Definition: btree_ondisk.h:38
std::shared_ptr< void > data
Definition: ephemeral_for_test_record_store_test.cpp:74
Key class for precomputing a small format index key that is denser than a traditional BSONObj...
Definition: key.h:44
short keyDataOfs() const
Definition: btree_ondisk.h:79
bool operator!=(const DiskLoc &rhs) const
Definition: btree_ondisk.h:259
A variant of DiskLoc Used by the V1 bucket type.
Definition: btree_ondisk.h:191
std::string toString() const
Definition: diskloc.h:119
DiskLoc bucket
Definition: btree_interface.cpp:336
unsigned short emptySize
Size of the empty region.
Definition: btree_ondisk.h:310
KeyV1Owned KeyOwnedType
Definition: btree_ondisk.h:358
bool isNull() const
Definition: btree_ondisk.h:216
Flags
Definition: btree_ondisk.h:329
Definition: btree_ondisk.h:300
DiskLoc nextChild
Given that there are n keys, this is the n index child.
Definition: btree_ondisk.h:150
int flags
Definition: btree_ondisk.h:162
Definition: btree_ondisk.h:355
unsigned short _kdo
Offset within current bucket of the variable width bson key for this _KeyNode.
Definition: btree_ondisk.h:73
bool operator==(const DiskLoc56Bit &rhs) const
Definition: btree_ondisk.h:247
unsigned short n
Definition: btree_ondisk.h:316
static void initBucket(BucketType *bucket)
Definition: btree_ondisk.h:348
Definition: btree_ondisk.h:181
DiskLoc LocType
Definition: btree_ondisk.h:333
std::string toString() const
Definition: btree_ondisk.h:295
KeyBson KeyOwnedType
Definition: btree_ondisk.h:335
DiskLoc56Bit parent
Parent bucket of this bucket, which isNull() for the root bucket.
Definition: btree_ondisk.h:302
bool operator!=(const DiskLoc56Bit &rhs) const
Definition: btree_ondisk.h:251
int getOfs() const
Definition: btree_ondisk.h:208
bool operator==(const DiskLoc &rhs) const
Definition: btree_ondisk.h:255
DiskLoc parent
Parent bucket of this bucket, which isNull() for the root bucket.
Definition: btree_ondisk.h:145
DiskLoc56Bit LocType
Definition: btree_ondisk.h:359
Definition: btree_ondisk.h:322
void Null()
Definition: btree_ondisk.h:272