Storage Engine API
mongo::dur::DurOp Class Referenceabstract

DurOp - Operations we journal that aren't just basic writes. More...

#include <durop.h>

Inheritance diagram for mongo::dur::DurOp:
mongo::dur::DropDbOp mongo::dur::FileCreatedOp

Detailed Description

DurOp - Operations we journal that aren't just basic writes.

Basic writes are logged as JEntry's, and indicated in ram temporarily as struct dur::WriteIntent. We don't make WriteIntent inherit from DurOp to keep it as lean as possible as there will be millions of them (we don't want a vtable for example there).

For each op we want to journal, we define a subclass.

Public Member Functions

 DurOp (unsigned opcode)
 
virtual ~DurOp ()
 
void serialize (AlignedBuilder &ab)
 serialize the op out to a builder which will then be written (presumably) to the journal More...
 
virtual void replay ()=0
 replay the operation (during recovery) throws More...
 
virtual std::string toString ()=0
 
virtual bool needFilesClosed ()
 if the op requires all file to be closed before doing its work, returns true. More...
 

Static Public Member Functions

static std::shared_ptr< DurOpread (unsigned opcode, BufReader &br)
 read a durop from journal file referenced by br. More...
 

Protected Member Functions

virtual void _serialize (AlignedBuilder &ab)=0
 DurOp will have already written the opcode for you. More...
 

Private Attributes

const unsigned _opcode
 

Constructor & Destructor Documentation

◆ DurOp()

mongo::dur::DurOp::DurOp ( unsigned  opcode)
inline

◆ ~DurOp()

virtual mongo::dur::DurOp::~DurOp ( )
inlinevirtual

Member Function Documentation

◆ _serialize()

virtual void mongo::dur::DurOp::_serialize ( AlignedBuilder ab)
protectedpure virtual

DurOp will have already written the opcode for you.

Implemented in mongo::dur::DropDbOp, and mongo::dur::FileCreatedOp.

◆ needFilesClosed()

virtual bool mongo::dur::DurOp::needFilesClosed ( )
inlinevirtual

if the op requires all file to be closed before doing its work, returns true.

Reimplemented in mongo::dur::DropDbOp, and mongo::dur::FileCreatedOp.

◆ read()

shared_ptr< DurOp > mongo::dur::DurOp::read ( unsigned  opcode,
BufReader &  br 
)
static

read a durop from journal file referenced by br.

Parameters
opcodethe opcode which has already been written from the bufreader

◆ replay()

virtual void mongo::dur::DurOp::replay ( )
pure virtual

replay the operation (during recovery) throws

For now, these are not replayed during the normal WRITETODATAFILES phase, since these operations are handled in other parts of the code. At some point this may change.

Implemented in mongo::dur::DropDbOp, and mongo::dur::FileCreatedOp.

◆ serialize()

void mongo::dur::DurOp::serialize ( AlignedBuilder ab)

serialize the op out to a builder which will then be written (presumably) to the journal

◆ toString()

virtual std::string mongo::dur::DurOp::toString ( )
pure virtual

Member Data Documentation

◆ _opcode

const unsigned mongo::dur::DurOp::_opcode
private

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