#include <IpcIoFile.h>

Inheritance diagram for IpcIoFile:
Collaboration diagram for IpcIoFile:

Public Types

typedef RefCount< IpcIoFilePointer
 

Public Member Functions

 IpcIoFile (char const *aDb)
 
virtual ~IpcIoFile ()
 
virtual void configure (const Config &cfg)
 notes supported configuration options; kids must call this first More...
 
virtual void open (int flags, mode_t mode, RefCount< IORequestor > callback)
 
virtual void create (int flags, mode_t mode, RefCount< IORequestor > callback)
 
virtual void read (ReadRequest *)
 
virtual void write (WriteRequest *)
 
virtual void close ()
 
virtual bool error () const
 
virtual int getFD () const
 
virtual bool canRead () const
 
virtual bool canWrite () const
 
virtual bool ioInProgress () const
 

Static Public Member Functions

static void HandleOpenResponse (const Ipc::StrandSearchResponse &response)
 handle open response from coordinator More...
 
static void HandleNotification (const Ipc::TypedMsgHdr &msg)
 handle queue push notifications from worker or disker More...
 

Public Attributes

DiskFile::Config config
 supported configuration options More...
 

Protected Member Functions

void openCompleted (const Ipc::StrandSearchResponse *const response)
 
void readCompleted (ReadRequest *readRequest, IpcIoMsg *const response)
 
void writeCompleted (WriteRequest *writeRequest, const IpcIoMsg *const response)
 
bool canWait () const
 whether we think there is enough time to complete the I/O More...
 

Private Types

typedef std::map< unsigned int,
IpcIoPendingRequest * > 
RequestMap
 maps requestId to the handleResponse callback More...
 
typedef std::list< PointerIpcIoFileList
 
typedef std::map< int,
IpcIoFile * > 
IpcIoFilesMap
 
typedef Ipc::FewToFewBiQueue Queue
 

Private Member Functions

 CBDATA_CLASS (IpcIoFile)
 
void trackPendingRequest (const unsigned int id, IpcIoPendingRequest *const pending)
 track a new pending request More...
 
void push (IpcIoPendingRequest *const pending)
 push an I/O request to disker More...
 
IpcIoPendingRequestdequeueRequest (const unsigned int requestId)
 returns and forgets the right IpcIoFile pending request More...
 
void checkTimeouts ()
 
void scheduleTimeoutCheck ()
 prepare to check for timeouts in a little while More...
 
void handleResponse (IpcIoMsg &ipcIo)
 

Static Private Member Functions

static void Notify (const int peerId)
 
static void OpenTimeout (void *const param)
 handles open request timeout More...
 
static void CheckTimeouts (void *const param)
 IpcIoFile::checkTimeouts wrapper. More...
 
static void HandleResponses (const char *const when)
 
static void DiskerHandleMoreRequests (void *)
 
static void DiskerHandleRequests ()
 
static void DiskerHandleRequest (const int workerId, IpcIoMsg &ipcIo)
 called when disker receives an I/O request More...
 
static bool WaitBeforePop ()
 

Private Attributes

const String dbName
 the name of the file we are managing More...
 
int diskId
 the process ID of the disker we talk to More...
 
RefCount< IORequestorioRequestor
 
bool error_
 whether we have seen at least one I/O error (XXX) More...
 
unsigned int lastRequestId
 last requestId used More...
 
RequestMap requestMap1
 older (or newer) pending requests More...
 
RequestMap requestMap2
 newer (or older) pending requests More...
 
RequestMapolderRequests
 older requests (map1 or map2) More...
 
RequestMapnewerRequests
 newer requests (map2 or map1) More...
 
bool timeoutCheckScheduled
 we expect a CheckTimeouts() call More...
 

Static Private Attributes

static const double Timeout = 7
 timeout value in seconds More...
 
static IpcIoFileList WaitingForOpen
 pending open requests More...
 
static IpcIoFilesMap IpcIoFiles
 
static std::unique_ptr< Queuequeue
 IPC queue. More...
 
static bool DiskerHandleMoreRequestsScheduled = false
 whether we are waiting for an event to handle still queued I/O requests More...
 

Friends

class IpcIoPendingRequest
 

Detailed Description

Definition at line 58 of file IpcIoFile.h.

Member Typedef Documentation

typedef std::list<Pointer> IpcIoFile::IpcIoFileList
private

Definition at line 135 of file IpcIoFile.h.

typedef std::map<int, IpcIoFile*> IpcIoFile::IpcIoFilesMap
private

Definition at line 139 of file IpcIoFile.h.

Definition at line 63 of file IpcIoFile.h.

Definition at line 142 of file IpcIoFile.h.

typedef std::map<unsigned int, IpcIoPendingRequest*> IpcIoFile::RequestMap
private

Definition at line 126 of file IpcIoFile.h.

Constructor & Destructor Documentation

IpcIoFile::IpcIoFile ( char const *  aDb)

Definition at line 72 of file IpcIoFile.cc.

IpcIoFile::~IpcIoFile ( )
virtual

Definition at line 79 of file IpcIoFile.cc.

References diskId, i, IpcIoFiles, and Must.

Member Function Documentation

bool IpcIoFile::canRead ( ) const
virtual

Implements DiskFile.

Definition at line 192 of file IpcIoFile.cc.

References canWait(), diskId, and error_.

bool IpcIoFile::canWait ( ) const
protected
bool IpcIoFile::canWrite ( ) const
virtual

Reimplemented from DiskFile.

Definition at line 198 of file IpcIoFile.cc.

References canWait(), diskId, and error_.

IpcIoFile::CBDATA_CLASS ( IpcIoFile  )
private
void IpcIoFile::CheckTimeouts ( void *const  param)
staticprivate

Definition at line 514 of file IpcIoFile.cc.

References debugs, diskId, HERE(), i, IpcIoFiles, and Must.

Referenced by scheduleTimeoutCheck().

void IpcIoFile::close ( )
virtual
void IpcIoFile::configure ( const Config )
virtual

Reimplemented from DiskFile.

Definition at line 91 of file IpcIoFile.cc.

References config, and DiskFile::configure().

void IpcIoFile::create ( int  flags,
mode_t  mode,
RefCount< IORequestor callback 
)
virtual

Alias for IpcIoFile::open(...)

Implements DiskFile.

Definition at line 172 of file IpcIoFile.cc.

References assert, and open().

IpcIoPendingRequest * IpcIoFile::dequeueRequest ( const unsigned int  requestId)
private

Definition at line 579 of file IpcIoFile.cc.

References i, Must, NULL, requestMap1, and requestMap2.

Referenced by handleResponse().

void IpcIoFile::DiskerHandleMoreRequests ( void *  source)
staticprivate
void IpcIoFile::DiskerHandleRequest ( const int  workerId,
IpcIoMsg ipcIo 
)
staticprivate
bool IpcIoFile::error ( ) const
virtual

Implements DiskFile.

Definition at line 204 of file IpcIoFile.cc.

References error_.

int IpcIoFile::getFD ( ) const
virtual

During migration only

Reimplemented from DiskFile.

Definition at line 603 of file IpcIoFile.cc.

References assert.

void IpcIoFile::HandleNotification ( const Ipc::TypedMsgHdr msg)
static
void IpcIoFile::HandleOpenResponse ( const Ipc::StrandSearchResponse response)
static

called when coordinator responds to worker open request

Definition at line 421 of file IpcIoFile.cc.

References debugs, HERE(), i, Ipc::StrandSearchResponse::strand, Ipc::StrandCoord::tag, and WaitingForOpen.

Referenced by Ipc::Strand::receive().

void IpcIoFile::handleResponse ( IpcIoMsg ipcIo)
private
void IpcIoFile::HandleResponses ( const char *const  when)
staticprivate

Definition at line 439 of file IpcIoFile.cc.

References debugs, diskId, HERE(), i, IpcIoFiles, Must, and queue.

Referenced by checkTimeouts(), HandleNotification(), and push().

bool IpcIoFile::ioInProgress ( ) const
virtual

Inform callers if there is IO in progress

Implements DiskFile.

Definition at line 312 of file IpcIoFile.cc.

References newerRequests, and olderRequests.

void IpcIoFile::Notify ( const int  peerId)
staticprivate
void IpcIoFile::openCompleted ( const Ipc::StrandSearchResponse *const  response)
protected
void IpcIoFile::OpenTimeout ( void *const  param)
staticprivate

Definition at line 496 of file IpcIoFile.cc.

References i, Must, NULL, openCompleted(), and WaitingForOpen.

Referenced by open().

void IpcIoFile::read ( ReadRequest readRequest)
virtual
void IpcIoFile::scheduleTimeoutCheck ( )
private

Definition at line 569 of file IpcIoFile.cc.

References CheckTimeouts(), diskId, eventAdd(), Timeout, and timeoutCheckScheduled.

Referenced by checkTimeouts(), and trackPendingRequest().

void IpcIoFile::trackPendingRequest ( const unsigned int  id,
IpcIoPendingRequest *const  pending 
)
private

Definition at line 319 of file IpcIoFile.cc.

References Must, newerRequests, scheduleTimeoutCheck(), and timeoutCheckScheduled.

Referenced by push().

bool IpcIoFile::WaitBeforePop ( )
staticprivate
void IpcIoFile::write ( WriteRequest writeRequest)
virtual
void IpcIoFile::writeCompleted ( WriteRequest writeRequest,
const IpcIoMsg *const  response 
)
protected

Friends And Related Function Documentation

friend class IpcIoPendingRequest
friend

Definition at line 90 of file IpcIoFile.h.

Referenced by read(), and write().

Member Data Documentation

DiskFile::Config IpcIoFile::config

Definition at line 87 of file IpcIoFile.h.

Referenced by canWait(), configure(), and open().

const String IpcIoFile::dbName
private

Definition at line 117 of file IpcIoFile.h.

Referenced by checkTimeouts(), close(), open(), openCompleted(), push(), readCompleted(), and writeCompleted().

bool IpcIoFile::DiskerHandleMoreRequestsScheduled = false
staticprivate

Definition at line 146 of file IpcIoFile.h.

Referenced by DiskerHandleMoreRequests(), DiskerHandleRequests(), and WaitBeforePop().

bool IpcIoFile::error_
private
RefCount<IORequestor> IpcIoFile::ioRequestor
private

Definition at line 119 of file IpcIoFile.h.

Referenced by close(), open(), openCompleted(), read(), readCompleted(), write(), and writeCompleted().

IpcIoFile::IpcIoFilesMap IpcIoFile::IpcIoFiles
staticprivate

Definition at line 140 of file IpcIoFile.h.

Referenced by CheckTimeouts(), HandleResponses(), open(), openCompleted(), and ~IpcIoFile().

unsigned int IpcIoFile::lastRequestId
private

Definition at line 123 of file IpcIoFile.h.

Referenced by push().

RequestMap* IpcIoFile::newerRequests
private

Definition at line 130 of file IpcIoFile.h.

Referenced by checkTimeouts(), ioInProgress(), and trackPendingRequest().

RequestMap* IpcIoFile::olderRequests
private

Definition at line 129 of file IpcIoFile.h.

Referenced by checkTimeouts(), and ioInProgress().

std::unique_ptr< IpcIoFile::Queue > IpcIoFile::queue
staticprivate
RequestMap IpcIoFile::requestMap1
private

Definition at line 127 of file IpcIoFile.h.

Referenced by dequeueRequest().

RequestMap IpcIoFile::requestMap2
private

Definition at line 128 of file IpcIoFile.h.

Referenced by dequeueRequest().

const double IpcIoFile::Timeout = 7
staticprivate

Definition at line 133 of file IpcIoFile.h.

Referenced by checkTimeouts(), open(), scheduleTimeoutCheck(), and WaitBeforePop().

bool IpcIoFile::timeoutCheckScheduled
private

Definition at line 131 of file IpcIoFile.h.

Referenced by checkTimeouts(), scheduleTimeoutCheck(), and trackPendingRequest().

IpcIoFile::IpcIoFileList IpcIoFile::WaitingForOpen
staticprivate

maps diskerId to IpcIoFile, cleared in destructor

Definition at line 136 of file IpcIoFile.h.

Referenced by HandleOpenResponse(), open(), and OpenTimeout().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors