Storage Engine API
mongo::FileAllocator Class Reference

#include <file_allocator.h>

Public Member Functions

void start ()
 
void requestAllocation (const std::string &name, long &size)
 May be called if file exists. More...
 
void allocateAsap (const std::string &name, unsigned long long &size)
 Returns when file has been allocated. More...
 
void waitUntilFinished () const
 

Static Public Member Functions

static void ensureLength (int fd, long size)
 
static FileAllocatorget ()
 

Private Member Functions

 MONGO_DISALLOW_COPYING (FileAllocator)
 
 FileAllocator ()
 
void checkFailure ()
 
long prevSize (const std::string &name) const
 
bool inProgress (const std::string &name) const
 
std::string makeTempFileName (boost::filesystem::path root)
 

Static Private Member Functions

static void run (FileAllocator *fa)
 called from the worked thread More...
 

Private Attributes

stdx::mutex _pendingMutex
 
stdx::condition_variable _pendingUpdated
 
std::list< std::string > _pending
 
std::map< std::string, long > _pendingSize
 
bool _failed
 

Static Private Attributes

static unsigned long long _uniqueNumber = 0
 

Constructor & Destructor Documentation

◆ FileAllocator()

mongo::FileAllocator::FileAllocator ( )
private

Member Function Documentation

◆ allocateAsap()

void mongo::FileAllocator::allocateAsap ( const std::string &  name,
unsigned long long &  size 
)

Returns when file has been allocated.

If file exists, size is updated to match existing file size.

◆ checkFailure()

void mongo::FileAllocator::checkFailure ( )
private

◆ ensureLength()

void mongo::FileAllocator::ensureLength ( int  fd,
long  size 
)
static

◆ get()

FileAllocator * mongo::FileAllocator::get ( )
static
Returns
the singleton

◆ inProgress()

bool mongo::FileAllocator::inProgress ( const std::string &  name) const
private

◆ makeTempFileName()

string mongo::FileAllocator::makeTempFileName ( boost::filesystem::path  root)
private

◆ MONGO_DISALLOW_COPYING()

mongo::FileAllocator::MONGO_DISALLOW_COPYING ( FileAllocator  )
private

◆ prevSize()

long mongo::FileAllocator::prevSize ( const std::string &  name) const
private

◆ requestAllocation()

void mongo::FileAllocator::requestAllocation ( const std::string &  name,
long &  size 
)

May be called if file exists.

If file exists, or its allocation has been requested, size is updated to match existing file size.

◆ run()

void mongo::FileAllocator::run ( FileAllocator fa)
staticprivate

called from the worked thread

◆ start()

void mongo::FileAllocator::start ( )

◆ waitUntilFinished()

void mongo::FileAllocator::waitUntilFinished ( ) const

Member Data Documentation

◆ _failed

bool mongo::FileAllocator::_failed
private

◆ _pending

std::list<std::string> mongo::FileAllocator::_pending
private

◆ _pendingMutex

stdx::mutex mongo::FileAllocator::_pendingMutex
mutableprivate

◆ _pendingSize

std::map<std::string, long> mongo::FileAllocator::_pendingSize
mutableprivate

◆ _pendingUpdated

stdx::condition_variable mongo::FileAllocator::_pendingUpdated
mutableprivate

◆ _uniqueNumber

unsigned long long mongo::FileAllocator::_uniqueNumber = 0
staticprivate

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