mongo::dur::DurableInterface Class Reference

#include <dur.h>

Inheritance diagram for mongo::dur::DurableInterface:
Inheritance graph
[legend]

List of all members.

Public Member Functions

template<typename T >
T * alreadyDeclared (T *x)
virtual bool awaitCommit ()=0
virtual bool commitIfNeeded ()=0
virtual bool commitNow ()=0
virtual void createdFile (string filename, unsigned long long len)=0
virtual void declareWriteIntent (void *x, unsigned len)=0
virtual void setNoJournal (void *dst, void *src, unsigned len)=0
virtual void syncDataAndTruncateJournal ()=0
template<typename T >
T * writing (T *x)
virtual void * writingAtOffset (void *buf, unsigned ofs, unsigned len)=0
DiskLocwritingDiskLoc (DiskLoc &d)
int & writingInt (const int &d)
virtual void * writingPtr (void *x, unsigned len)=0
virtual void * writingRangesAtOffsets (void *buf, const vector< pair< long long, unsigned > > &ranges)=0
virtual ~DurableInterface ()

Static Public Member Functions

static DurableInterfacegetDur ()

Private Member Functions

NamespaceDetailswriting (NamespaceDetails *)
BtreeBucketwriting (BtreeBucket *)
Recordwriting (Record *r)

Static Private Member Functions

static void disableDurability ()
static void enableDurability ()

Static Private Attributes

static DurableInterface_impl

Friends

void startup ()
class TempDisableDurability

Detailed Description

Definition at line 27 of file dur.h.


Constructor & Destructor Documentation

virtual mongo::dur::DurableInterface::~DurableInterface (  )  [inline, virtual]

Definition at line 29 of file dur.h.


Member Function Documentation

template<typename T >
T* mongo::dur::DurableInterface::alreadyDeclared ( T *  x  )  [inline]

"assume i've already indicated write intent, let me write" redeclaration is fine too, but this is faster.

Definition at line 114 of file dur.h.

virtual bool mongo::dur::DurableInterface::awaitCommit (  )  [pure virtual]

Wait for acknowledgement of the next group commit.

Returns:
true if --dur is on. There will be delay.
false if --dur is off.

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

virtual bool mongo::dur::DurableInterface::commitIfNeeded (  )  [pure virtual]

Commit if enough bytes have been modified. Current threshold is 50MB

The idea is that long running write operations that dont yield (like creating an index or update with $atomic) can call this whenever the db is in a sane state and it will prevent commits from growing too large.

Returns:
true if commited

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

virtual bool mongo::dur::DurableInterface::commitNow (  )  [pure virtual]

Commit immediately.

Generally, you do not want to do this often, as highly granular committing may affect performance.

Does not return until the commit is complete.

You must be at least read locked when you call this. Ideally, you are not write locked and then read operations can occur concurrently.

Returns:
true if --dur is on.
false if --dur is off. (in which case there is action)

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

virtual void mongo::dur::DurableInterface::createdFile ( string  filename,
unsigned long long  len 
) [pure virtual]

Declare that a file has been created Normally writes are applied only after journaling, for safety. But here the file is created first, and the journal will just replay the creation if the create didn't happen because of crashing.

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

virtual void mongo::dur::DurableInterface::declareWriteIntent ( void *  x,
unsigned  len 
) [pure virtual]

declare write intent; should already be in the write view to work correctly when testIntent is true. if you aren't, use writingPtr() instead.

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

static void mongo::dur::DurableInterface::disableDurability (  )  [static, private]
static void mongo::dur::DurableInterface::enableDurability (  )  [static, private]
static DurableInterface& mongo::dur::DurableInterface::getDur (  )  [inline, static]

Definition at line 146 of file dur.h.

virtual void mongo::dur::DurableInterface::setNoJournal ( void *  dst,
void *  src,
unsigned  len 
) [pure virtual]

write something that doesn't have to be journaled, as this write is "unimportant". a good example is paddingFactor. can be thought of as memcpy(dst,src,len) the dur implementation acquires a mutex in this method, so do not assume it is faster without measuring!

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

virtual void mongo::dur::DurableInterface::syncDataAndTruncateJournal (  )  [pure virtual]

Commits pending changes, flushes all changes to main data files, then removes the journal.

This is useful as a "barrier" to ensure that writes before this call will never go through recovery and be applied to files that have had changes made after this call applied.

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

NamespaceDetails* mongo::dur::DurableInterface::writing ( NamespaceDetails  )  [private]

Intentionally unimplemented method. NamespaceDetails may be based on references to 'Extra' objects.

BtreeBucket* mongo::dur::DurableInterface::writing ( BtreeBucket  )  [private]

Intentionally unimplemented method. BtreeBuckets are allocated in buffers larger than sizeof( BtreeBucket ).

Record* mongo::dur::DurableInterface::writing ( Record r  )  [private]

Intentionally unimplemented method. It's very easy to manipulate Record::data open ended. Thus a call to writing(Record*) is suspect. This will override the templated version and yield an unresolved external.

template<typename T >
T* mongo::dur::DurableInterface::writing ( T *  x  )  [inline]

declare intent to write to x for sizeof(*x)

Definition at line 125 of file dur.h.

virtual void* mongo::dur::DurableInterface::writingAtOffset ( void *  buf,
unsigned  ofs,
unsigned  len 
) [pure virtual]

declare intent to write

Parameters:
ofs offset within buf at which we will write
len the length at ofs we will write
Returns:
new buffer pointer. this is modified when testIntent is true.

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

DiskLoc& mongo::dur::DurableInterface::writingDiskLoc ( DiskLoc d  )  [inline]

Declare write intent for a DiskLoc.

See also:
DiskLoc::writing()

Definition at line 104 of file dur.h.

int& mongo::dur::DurableInterface::writingInt ( const int &  d  )  [inline]

Declare write intent for an int

Definition at line 107 of file dur.h.

virtual void* mongo::dur::DurableInterface::writingPtr ( void *  x,
unsigned  len 
) [pure virtual]

Declarations of write intent.

Use these methods to declare "i'm about to write to x and it should be logged for redo."

Failure to call writing...() is checked in _DEBUG mode by using a read only mapped view (i.e., you'll segfault if the code is covered in that situation). The _DEBUG check doesn't verify that your length is correct though. declare intent to write to x for up to len

Returns:
pointer where to write. this is modified when testIntent is true.

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.

virtual void* mongo::dur::DurableInterface::writingRangesAtOffsets ( void *  buf,
const vector< pair< long long, unsigned > > &  ranges 
) [pure virtual]

declare intent to write

Parameters:
ranges vector of pairs representing ranges. Each pair comprises an offset from buf where a range begins, then the range length.
Returns:
new buffer pointer. this is modified when testIntent is true.

Implemented in mongo::dur::NonDurableImpl, and mongo::dur::DurableImpl.


Friends And Related Function Documentation

void startup (  )  [friend]

Call during startup so durability module can initialize Throws if fatal error Does nothing if cmdLine.dur is false

friend class TempDisableDurability [friend]

Definition at line 165 of file dur.h.


Member Data Documentation

Definition at line 159 of file dur.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


mongodb
Author(s): Nate Koenig
autogenerated on Fri Jan 11 12:15:59 2013