#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_readpending_reads
 
std::queue< Ufs::UFSStoreState::_queued_writepending_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

◆ Pointer [1/2]

Definition at line 21 of file StoreIOState.h.

◆ Pointer [2/2]

Definition at line 22 of file IORequestor.h.

◆ STFNCB

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

Definition at line 41 of file StoreIOState.h.

◆ STIOCB

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

Definition at line 51 of file StoreIOState.h.

◆ STRCB

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

◆ CloseHow

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

◆ UFSStoreState()

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

◆ ~UFSStoreState()

Fs::Ufs::UFSStoreState::~UFSStoreState ( )

Definition at line 347 of file UFSStoreState.cc.

References assert, pending_reads, and pending_writes.

Member Function Documentation

◆ CBDATA_CLASS()

Fs::Ufs::UFSStoreState::CBDATA_CLASS ( UFSStoreState  )
private

◆ close()

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

Implements StoreIOState.

Definition at line 117 of file UFSStoreState.cc.

References debugs, StoreIOState::swap_dirn, StoreIOState::swap_filen, and tryClosing().

◆ closeCompleted()

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

◆ doCloseCallback()

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

◆ doWrite()

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

◆ drainWriteQueue()

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

Definition at line 394 of file UFSStoreState.cc.

References DiskFile::canWrite(), doWrite(), flags, pending_writes, theFile, and tryClosing().

Referenced by openDone(), write(), and writeCompleted().

◆ freePending()

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

Definition at line 354 of file UFSStoreState.cc.

References debugs, pending_reads, and pending_writes.

Referenced by doCloseCallback().

◆ ioCompletedNotification()

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

◆ kickReadQueue()

bool Fs::Ufs::UFSStoreState::kickReadQueue ( )
protected

Definition at line 366 of file UFSStoreState.cc.

References cbdataReferenceValidDone, closing, debugs, flags, pending_reads, and read_().

Referenced by openDone().

◆ offset()

◆ openDone()

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

◆ operator delete()

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

Definition at line 25 of file StoreIOState.cc.

References assert.

◆ operator new()

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

Definition at line 18 of file StoreIOState.cc.

References assert.

◆ read_()

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

◆ readCompleted()

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

◆ touchingStoreEntry()

bool StoreIOState::touchingStoreEntry ( ) const
inherited

◆ tryClosing()

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

◆ write()

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, drainWriteQueue(), DiskFile::error(), HERE(), INDEXSD, Store::Disk::maxObjectSize(), StoreIOState::offset_, pending_writes, StoreIOState::swap_dirn, StoreIOState::swap_filen, theFile, and tryClosing().

◆ writeCompleted()

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

Member Data Documentation

◆ callback [1/2]

◆ callback [2/2]

STRCB* StoreIOState::callback
inherited

Definition at line 93 of file StoreIOState.h.

◆ callback_data

◆ closing

bool Fs::Ufs::UFSStoreState::closing

◆ creating

bool Fs::Ufs::UFSStoreState::creating

Definition at line 37 of file UFSStoreState.h.

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

◆ e

◆ file_callback

STFNCB* StoreIOState::file_callback
inherited

Definition at line 88 of file StoreIOState.h.

◆ flags

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

Referenced by drainWriteQueue(), kickReadQueue(), openDone(), readCompleted(), tryClosing(), and UFSStoreState().

◆ mode

mode_t StoreIOState::mode
inherited

◆ offset_

◆ opening

bool Fs::Ufs::UFSStoreState::opening

Definition at line 36 of file UFSStoreState.h.

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

◆ pending_reads

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

Definition at line 71 of file UFSStoreState.h.

Referenced by freePending(), kickReadQueue(), read_(), and ~UFSStoreState().

◆ pending_writes

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

Definition at line 101 of file UFSStoreState.h.

Referenced by doWrite(), drainWriteQueue(), freePending(), write(), and ~UFSStoreState().

◆ read

◆ read_buf

char* Fs::Ufs::UFSStoreState::read_buf
protected

Definition at line 125 of file UFSStoreState.h.

Referenced by read_(), and readCompleted().

◆ reading

bool Fs::Ufs::UFSStoreState::reading

Definition at line 39 of file UFSStoreState.h.

Referenced by read_(), and readCompleted().

◆ swap_dirn

◆ swap_filen

◆ theFile

◆ try_closing

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.

◆ write_draining

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.

◆ writing

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