#include <UFSStoreState.h>

Inheritance diagram for Fs::Ufs::UFSStoreState:
Collaboration diagram for Fs::Ufs::UFSStoreState:

Classes

class  _queued_read
 
class  _queued_write
 

Public Types

enum  CloseHow {
  wroteAll,
  writerGone,
  readerDone
}
 
typedef RefCount< StoreIOStatePointer
 
typedef void STRCB (void *their_data, const char *buf, ssize_t len, StoreIOState::Pointer self)
 
typedef void STFNCB (void *their_data, int errflag, StoreIOState::Pointer self)
 
typedef void STIOCB (void *their_data, int errflag, StoreIOState::Pointer self)
 
typedef RefCount< IORequestorPointer
 

Public Member Functions

 UFSStoreState (SwapDir *SD, StoreEntry *anEntry, STIOCB *callback_, void *callback_data_)
 
 ~UFSStoreState ()
 
virtual void close (int how)
 finish or abort swapping per CloseHow More...
 
virtual void closeCompleted ()
 
virtual void ioCompletedNotification ()
 
virtual void readCompleted (const char *buf, int len, int errflag, RefCount< ReadRequest >)
 
virtual void writeCompleted (int errflag, size_t len, RefCount< WriteRequest >)
 
void read_ (char *buf, size_t size, off_t offset, STRCB *callback, void *callback_data)
 
virtual bool write (char const *buf, size_t size, off_t offset, FREE *free_func)
 
void * operator new (size_t amount)
 
void operator delete (void *address)
 
off_t offset () const
 
bool touchingStoreEntry () const
 

Public Attributes

RefCount< DiskFiletheFile
 
bool opening
 
bool creating
 
bool closing
 
bool reading
 
bool writing
 
sdirno swap_dirn
 
sfileno swap_filen
 
StoreEntrye
 
mode_t mode
 
off_t offset_
 number of bytes written or read for this entry so far More...
 
STFNCBfile_callback
 
STIOCBcallback
 
void * callback_data
 
struct {
   STRCB *   callback
 
   void *   callback_data
 
read
 
bool write_draining
 
bool try_closing
 

Protected Member Functions

virtual void doCloseCallback (int errflag)
 
bool kickReadQueue ()
 
void drainWriteQueue ()
 
void tryClosing ()
 

Protected Attributes

std::queue
< Ufs::UFSStoreState::_queued_read
pending_reads
 
std::queue
< Ufs::UFSStoreState::_queued_write
pending_writes
 
struct {
   bool   write_draining
 
   bool   try_closing
 
flags
 
char * read_buf
 

Private Member Functions

 CBDATA_CLASS (UFSStoreState)
 
void openDone ()
 
void freePending ()
 
void doWrite ()
 

Detailed Description

Definition at line 22 of file UFSStoreState.h.

Member Typedef Documentation

Definition at line 21 of file StoreIOState.h.

Definition at line 22 of file IORequestor.h.

typedef void StoreIOState::STFNCB(void *their_data, int errflag, StoreIOState::Pointer self)
inherited

Definition at line 41 of file StoreIOState.h.

typedef void StoreIOState::STIOCB(void *their_data, int errflag, StoreIOState::Pointer self)
inherited

Definition at line 51 of file StoreIOState.h.

typedef void StoreIOState::STRCB(void *their_data, const char *buf, ssize_t len, StoreIOState::Pointer self)
inherited

Definition at line 29 of file StoreIOState.h.

Member Enumeration Documentation

enum StoreIOState::CloseHow
inherited
Enumerator
wroteAll 

success: caller supplied all data it wanted to swap out

writerGone 

failure: caller left before swapping out everything

readerDone 

success or failure: either way, stop swapping in

Definition at line 69 of file StoreIOState.h.

Constructor & Destructor Documentation

Fs::Ufs::UFSStoreState::UFSStoreState ( SwapDir SD,
StoreEntry anEntry,
STIOCB callback_,
void *  callback_data_ 
)
Fs::Ufs::UFSStoreState::~UFSStoreState ( )

Definition at line 347 of file UFSStoreState.cc.

References assert.

Member Function Documentation

Fs::Ufs::UFSStoreState::CBDATA_CLASS ( UFSStoreState  )
private
void Fs::Ufs::UFSStoreState::close ( int  how)
virtual

Implements StoreIOState.

Definition at line 117 of file UFSStoreState.cc.

References debugs.

void Fs::Ufs::UFSStoreState::closeCompleted ( )
virtual

Implements IORequestor.

Definition at line 89 of file UFSStoreState.cc.

References assert, debugs, DISK_ERROR, DISK_OK, and HERE().

void Fs::Ufs::UFSStoreState::doCloseCallback ( int  errflag)
protectedvirtual

Definition at line 299 of file UFSStoreState.cc.

References callback, cbdataReferenceValidDone, debugs, and NULL.

void Fs::Ufs::UFSStoreState::doWrite ( )
private

Definition at line 193 of file UFSStoreState.cc.

References assert, DBG_IMPORTANT, debugs, and MYNAME.

void Fs::Ufs::UFSStoreState::drainWriteQueue ( )
protected

Definition at line 394 of file UFSStoreState.cc.

void Fs::Ufs::UFSStoreState::freePending ( )
private

Definition at line 354 of file UFSStoreState.cc.

References debugs.

void Fs::Ufs::UFSStoreState::ioCompletedNotification ( )
virtual
bool Fs::Ufs::UFSStoreState::kickReadQueue ( )
protected

Definition at line 366 of file UFSStoreState.cc.

References cbdataReferenceValidDone, and debugs.

off_t StoreIOState::offset ( ) const
inlineinherited
void Fs::Ufs::UFSStoreState::openDone ( )
private

Definition at line 64 of file UFSStoreState.cc.

References DBG_CRITICAL, debugs, FILE_MODE, and HERE().

Referenced by ioCompletedNotification().

void StoreIOState::operator delete ( void *  address)
inherited

Definition at line 25 of file StoreIOState.cc.

References assert.

void * StoreIOState::operator new ( size_t  amount)
inherited

Definition at line 18 of file StoreIOState.cc.

References assert.

void Fs::Ufs::UFSStoreState::read_ ( char *  buf,
size_t  size,
off_t  offset,
STRCB callback,
void *  callback_data 
)
virtual

Implements StoreIOState.

Definition at line 125 of file UFSStoreState.cc.

References assert, buf, cbdataReference, debugs, and NULL.

void Fs::Ufs::UFSStoreState::readCompleted ( const char *  buf,
int  len,
int  errflag,
RefCount< ReadRequest result 
)
virtual

Implements IORequestor.

Definition at line 230 of file UFSStoreState.cc.

References assert, cbdataReferenceValidDone, debugs, RefCount< C >::getRaw(), len, and NULL.

bool StoreIOState::touchingStoreEntry ( ) const
inherited
void Fs::Ufs::UFSStoreState::tryClosing ( )
protected

Definition at line 430 of file UFSStoreState.cc.

References debugs, and HERE().

Referenced by ioCompletedNotification().

bool Fs::Ufs::UFSStoreState::write ( char const *  buf,
size_t  size,
off_t  offset,
FREE free_func 
)
virtual

write the given buffer and free it when it is no longer needed

Parameters
offsetzero for the very first write and -1 for all other writes
Return values
falseif write failed (callback has been or will be called)

Implements StoreIOState.

Definition at line 159 of file UFSStoreState.cc.

References DBG_IMPORTANT, debugs, HERE(), INDEXSD, and Store::Disk::maxObjectSize().

void Fs::Ufs::UFSStoreState::writeCompleted ( int  errflag,
size_t  len,
RefCount< WriteRequest  
)
virtual

Implements IORequestor.

Definition at line 273 of file UFSStoreState.cc.

References debugs, HERE(), and len.

Member Data Documentation

STIOCB* StoreIOState::callback
inherited

Definition at line 89 of file StoreIOState.h.

STRCB* StoreIOState::callback
inherited

Definition at line 93 of file StoreIOState.h.

void* StoreIOState::callback_data
inherited

Definition at line 90 of file StoreIOState.h.

Referenced by StoreIOState::~StoreIOState().

bool Fs::Ufs::UFSStoreState::closing

Definition at line 38 of file UFSStoreState.h.

Referenced by ioCompletedNotification().

bool Fs::Ufs::UFSStoreState::creating

Definition at line 37 of file UFSStoreState.h.

Referenced by Fs::Ufs::UFSStrategy::create(), and ioCompletedNotification().

STFNCB* StoreIOState::file_callback
inherited

Definition at line 88 of file StoreIOState.h.

struct { ... } Fs::Ufs::UFSStoreState::flags
Todo:
These should be in the IO strategy

Referenced by UFSStoreState().

mode_t StoreIOState::mode
inherited
off_t StoreIOState::offset_
inherited
bool Fs::Ufs::UFSStoreState::opening

Definition at line 36 of file UFSStoreState.h.

Referenced by ioCompletedNotification(), and Fs::Ufs::UFSStrategy::open().

std::queue<Ufs::UFSStoreState::_queued_read> Fs::Ufs::UFSStoreState::pending_reads
protected

Definition at line 71 of file UFSStoreState.h.

std::queue<Ufs::UFSStoreState::_queued_write> Fs::Ufs::UFSStoreState::pending_writes
protected

Definition at line 101 of file UFSStoreState.h.

struct { ... } StoreIOState::read
char* Fs::Ufs::UFSStoreState::read_buf
protected

Definition at line 125 of file UFSStoreState.h.

bool Fs::Ufs::UFSStoreState::reading

Definition at line 39 of file UFSStoreState.h.

sdirno StoreIOState::swap_dirn
inherited
RefCount<DiskFile> Fs::Ufs::UFSStoreState::theFile
bool Fs::Ufs::UFSStoreState::try_closing

DPW 2006-05-24 The try_closing flag is set by UFSStoreState::tryClosing() when UFSStoreState wants to close the file, but cannot because of pending I/Os. If set, UFSStoreState will try to close again in the I/O callbacks.

Definition at line 119 of file UFSStoreState.h.

bool Fs::Ufs::UFSStoreState::write_draining

DPW 2006-05-24 the write_draining flag is used to avoid recursion inside the UFSStoreState::drainWriteQueue() method.

Definition at line 111 of file UFSStoreState.h.

bool Fs::Ufs::UFSStoreState::writing

Definition at line 40 of file UFSStoreState.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors