Storage Engine API
mongo::FixedWidthKey< LocType > Struct Template Reference

This is the fixed width data component for storage of a key within a bucket. More...

#include <btree_ondisk.h>

Detailed Description

template<class LocType>
struct mongo::FixedWidthKey< LocType >

This is the fixed width data component for storage of a key within a bucket.

It contains an offset pointer to the variable width bson data component. This may be 'unused', please see below.

Why is this templated on Loc? Because V0 and V1 have different size DiskLoc(s) but otherwise the same layout.

Public Member Functions

short keyDataOfs () const
 
void setKeyDataOfs (short s)
 
void setKeyDataOfsSavingUse (short s)
 
void setUnused ()
 Unused keys are not returned by read operations. More...
 
void setUsed ()
 
int isUnused () const
 
int isUsed () const
 

Public Attributes

LocType prevChildBucket
 The 'left' child bucket of this key. More...
 
LocType recordLoc
 The location of the record associated with this key. More...
 
unsigned short _kdo
 Offset within current bucket of the variable width bson key for this _KeyNode. More...
 

Member Function Documentation

◆ isUnused()

template<class LocType >
int mongo::FixedWidthKey< LocType >::isUnused ( ) const
inline

◆ isUsed()

template<class LocType >
int mongo::FixedWidthKey< LocType >::isUsed ( ) const
inline

◆ keyDataOfs()

template<class LocType >
short mongo::FixedWidthKey< LocType >::keyDataOfs ( ) const
inline

◆ setKeyDataOfs()

template<class LocType >
void mongo::FixedWidthKey< LocType >::setKeyDataOfs ( short  s)
inline

◆ setKeyDataOfsSavingUse()

template<class LocType >
void mongo::FixedWidthKey< LocType >::setKeyDataOfsSavingUse ( short  s)
inline

◆ setUnused()

template<class LocType >
void mongo::FixedWidthKey< LocType >::setUnused ( )
inline

Unused keys are not returned by read operations.

Keys may be marked as unused in cases where it is difficult to delete them while maintaining the constraints required of a btree.

Setting ofs to odd is the sentinel for unused, as real recordLoc's are always even numbers. Note we need to keep its value basically the same as we use the recordLoc as part of the key in the index (to handle duplicate keys efficiently).

Flagging keys as unused is a feature that is being phased out in favor of deleting the keys outright. The current btree implementation is not expected to mark a key as unused in a non legacy btree.

◆ setUsed()

template<class LocType >
void mongo::FixedWidthKey< LocType >::setUsed ( )
inline

Member Data Documentation

◆ _kdo

template<class LocType >
unsigned short mongo::FixedWidthKey< LocType >::_kdo

Offset within current bucket of the variable width bson key for this _KeyNode.

◆ prevChildBucket

template<class LocType >
LocType mongo::FixedWidthKey< LocType >::prevChildBucket

The 'left' child bucket of this key.

If this is the i-th key, it points to the i index child bucket.

◆ recordLoc

template<class LocType >
LocType mongo::FixedWidthKey< LocType >::recordLoc

The location of the record associated with this key.


The documentation for this struct was generated from the following file: