Storage Engine API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mongo::NamespaceHashTable Class Reference

Simple, fixed size hash table used for namespace mapping (effectively the contents of the MMAP V1 .ns file). More...

#include <hashtab.h>

Detailed Description

Simple, fixed size hash table used for namespace mapping (effectively the contents of the MMAP V1 .ns file).

Uses a contiguous block of memory, so you can put it in a memory mapped file very easily.

Classes

struct  Node
 

Public Types

typedef stdx::function< void(const Namespace &k, NamespaceDetails &v)> IteratorCallback
 

Public Member Functions

 NamespaceHashTable (void *buf, int buflen, const char *name)
 
NamespaceDetailsget (const Namespace &k) const
 
void kill (OperationContext *opCtx, const Namespace &k)
 
bool put (OperationContext *opCtx, const Namespace &k, const NamespaceDetails &value)
 returns false if too full More...
 
void iterAll (IteratorCallback callback)
 

Private Member Functions

 MONGO_DISALLOW_COPYING (NamespaceHashTable)
 
 MONGO_STATIC_ASSERT (sizeof(Node)==628)
 
int _find (const Namespace &k, bool &found) const
 
Node_nodes (int i) const
 

Private Attributes

const char * _name
 
void *const _buf
 
int n
 
int maxChain
 

Member Typedef Documentation

◆ IteratorCallback

Constructor & Destructor Documentation

◆ NamespaceHashTable()

mongo::NamespaceHashTable::NamespaceHashTable ( void buf,
int  buflen,
const char *  name 
)

Member Function Documentation

◆ _find()

int mongo::NamespaceHashTable::_find ( const Namespace k,
bool &  found 
) const
private

◆ _nodes()

Node& mongo::NamespaceHashTable::_nodes ( int  i) const
inlineprivate

◆ get()

NamespaceDetails* mongo::NamespaceHashTable::get ( const Namespace k) const
inline

◆ iterAll()

void mongo::NamespaceHashTable::iterAll ( IteratorCallback  callback)
inline

◆ kill()

void mongo::NamespaceHashTable::kill ( OperationContext *  opCtx,
const Namespace k 
)
inline

◆ MONGO_DISALLOW_COPYING()

mongo::NamespaceHashTable::MONGO_DISALLOW_COPYING ( NamespaceHashTable  )
private

◆ MONGO_STATIC_ASSERT()

mongo::NamespaceHashTable::MONGO_STATIC_ASSERT ( sizeof(Node = =628)
private

◆ put()

bool mongo::NamespaceHashTable::put ( OperationContext *  opCtx,
const Namespace k,
const NamespaceDetails value 
)
inline

returns false if too full

Member Data Documentation

◆ _buf

void* const mongo::NamespaceHashTable::_buf
private

◆ _name

const char* mongo::NamespaceHashTable::_name
private

◆ maxChain

int mongo::NamespaceHashTable::maxChain
private

◆ n

int mongo::NamespaceHashTable::n
private

The documentation for this class was generated from the following files: