mongo::Database Class Reference
#include <database.h>
List of all members.
Public Member Functions |
MongoDataFile * | addAFile (int sizeNeeded, bool preallocateNextFile) |
Extent * | allocExtent (const char *ns, int size, bool capped) |
| Database (const char *nm, bool &newDb, const string &_path=dbpath) |
bool | exists (int n) const |
boost::filesystem::path | fileName (int n) const |
long long | fileSize () const |
void | finishInit () |
void | flushFiles (bool sync) const |
MongoDataFile * | getFile (int n, int sizeNeeded=0, bool preallocateOnly=false) |
bool | isEmpty () |
bool | isOk () const |
MongoDataFile * | newestFile () |
int | numFiles () const |
void | openAllFiles () |
bool | ownsNS (const string &ns) const |
void | preallocateAFile () |
bool | setProfilingLevel (int newLevel, string &errmsg) |
MongoDataFile * | suitableFile (int sizeNeeded, bool preallocate) |
Static Public Member Functions |
static void | closeDatabase (const char *db, const string &path) |
static bool | validDBName (const string &ns) |
Public Attributes |
CCByLoc | ccByLoc |
vector< MongoDataFile * > | files |
int | magic |
const string | name |
NamespaceIndex | namespaceIndex |
const string | path |
int | profile |
const string | profileName |
Static Public Attributes |
static bool | _openAllFiles |
Private Member Functions |
| ~Database () |
Detailed Description
Database represents a database database Each database database has its own set of files -- dbname.ns, dbname.0, dbname.1, ... NOT memory mapped
Definition at line 34 of file database.h.
Constructor & Destructor Documentation
mongo::Database::Database |
( |
const char * |
nm, |
|
|
bool & |
newDb, |
|
|
const string & |
_path = dbpath | |
|
) |
| | |
mongo::Database::~Database |
( |
|
) |
[private] |
Member Function Documentation
MongoDataFile* mongo::Database::addAFile |
( |
int |
sizeNeeded, |
|
|
bool |
preallocateNextFile | |
|
) |
| | |
Extent* mongo::Database::allocExtent |
( |
const char * |
ns, |
|
|
int |
size, |
|
|
bool |
capped | |
|
) |
| | |
static void mongo::Database::closeDatabase |
( |
const char * |
db, |
|
|
const string & |
path | |
|
) |
| | [static] |
bool mongo::Database::exists |
( |
int |
n |
) |
const [inline] |
boost::filesystem::path mongo::Database::fileName |
( |
int |
n |
) |
const |
returns file valid for file number n
long long mongo::Database::fileSize |
( |
|
) |
const |
void mongo::Database::finishInit |
( |
|
) |
|
void mongo::Database::flushFiles |
( |
bool |
sync |
) |
const |
MongoDataFile* mongo::Database::getFile |
( |
int |
n, |
|
|
int |
sizeNeeded = 0 , |
|
|
bool |
preallocateOnly = false | |
|
) |
| | |
return file n. if it doesn't exist, create it
bool mongo::Database::isEmpty |
( |
|
) |
[inline] |
bool mongo::Database::isOk |
( |
|
) |
const [inline] |
tries to make sure that this hasn't been deleted
Definition at line 54 of file database.h.
int mongo::Database::numFiles |
( |
|
) |
const [inline] |
void mongo::Database::openAllFiles |
( |
|
) |
|
bool mongo::Database::ownsNS |
( |
const string & |
ns |
) |
const [inline] |
- Returns:
- true if ns is part of the database ns=foo.bar, db=foo returns true
Definition at line 103 of file database.h.
void mongo::Database::preallocateAFile |
( |
|
) |
[inline] |
makes sure we have an extra file at the end that is empty safe to call this multiple times - the implementation will only preallocate one file
Definition at line 83 of file database.h.
bool mongo::Database::setProfilingLevel |
( |
int |
newLevel, |
|
|
string & |
errmsg | |
|
) |
| | |
- Returns:
- true if success. false if bad level or error creating profile ns
MongoDataFile* mongo::Database::suitableFile |
( |
int |
sizeNeeded, |
|
|
bool |
preallocate | |
|
) |
| | |
static bool mongo::Database::validDBName |
( |
const string & |
ns |
) |
[static] |
Member Data Documentation
The documentation for this class was generated from the following file: