#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 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 () override
 
void close (int how) override
 finish or abort swapping per CloseHow More...
 
void closeCompleted () override
 
void ioCompletedNotification () override
 
void readCompleted (const char *buf, int len, int errflag, RefCount< ReadRequest >) override
 
void writeCompleted (int errflag, size_t len, RefCount< WriteRequest >) override
 
void read_ (char *buf, size_t size, off_t offset, STRCB *callback, void *callback_data) override
 
bool write (char const *buf, size_t size, off_t offset, FREE *free_func) override
 
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...
 
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 23 of file UFSStoreState.h.

Member Typedef Documentation

◆ Pointer [1/2]

Definition at line 22 of file IORequestor.h.

◆ Pointer [2/2]

Definition at line 21 of file StoreIOState.h.

◆ STIOCB

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

Definition at line 39 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 57 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 ( )
override

Definition at line 347 of file UFSStoreState.cc.

References assert.

Member Function Documentation

◆ CBDATA_CLASS()

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

◆ close()

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

Implements StoreIOState.

Definition at line 117 of file UFSStoreState.cc.

References debugs.

◆ closeCompleted()

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

Implements IORequestor.

Definition at line 89 of file UFSStoreState.cc.

References assert, debugs, DISK_ERROR, and DISK_OK.

◆ doCloseCallback()

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

Definition at line 299 of file UFSStoreState.cc.

References cbdataReferenceValidDone, and debugs.

◆ doWrite()

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

Definition at line 193 of file UFSStoreState.cc.

References assert, DBG_IMPORTANT, debugs, and MYNAME.

◆ drainWriteQueue()

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

Definition at line 394 of file UFSStoreState.cc.

◆ freePending()

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

Definition at line 354 of file UFSStoreState.cc.

References debugs.

◆ ioCompletedNotification()

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

◆ kickReadQueue()

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

Definition at line 366 of file UFSStoreState.cc.

References cbdataReferenceValidDone, and debugs.

◆ offset()

off_t StoreIOState::offset ( ) const
inlineinherited

◆ openDone()

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

Definition at line 64 of file UFSStoreState.cc.

References DBG_CRITICAL, debugs, and FILE_MODE.

Referenced by ioCompletedNotification().

◆ 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 
)
overridevirtual

Implements StoreIOState.

Definition at line 125 of file UFSStoreState.cc.

References assert, cbdataReference, debugs, and size.

◆ readCompleted()

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

Implements IORequestor.

Definition at line 230 of file UFSStoreState.cc.

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

◆ touchingStoreEntry()

bool StoreIOState::touchingStoreEntry ( ) const
inherited

◆ tryClosing()

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

Definition at line 430 of file UFSStoreState.cc.

References debugs.

Referenced by ioCompletedNotification().

◆ write()

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

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, INDEXSD, Store::Disk::maxObjectSize(), and size.

◆ writeCompleted()

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

Implements IORequestor.

Definition at line 273 of file UFSStoreState.cc.

References debugs.

Member Data Documentation

◆ callback [1/2]

STIOCB* StoreIOState::callback
inherited

Definition at line 76 of file StoreIOState.h.

◆ callback [2/2]

STRCB* StoreIOState::callback
inherited

Definition at line 80 of file StoreIOState.h.

◆ callback_data

void* StoreIOState::callback_data
inherited

Definition at line 77 of file StoreIOState.h.

Referenced by StoreIOState::~StoreIOState().

◆ closing

bool Fs::Ufs::UFSStoreState::closing

Definition at line 39 of file UFSStoreState.h.

Referenced by ioCompletedNotification().

◆ creating

bool Fs::Ufs::UFSStoreState::creating

Definition at line 38 of file UFSStoreState.h.

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

◆ e

◆ 

struct { ... } Fs::Ufs::UFSStoreState::flags

Referenced by UFSStoreState().

◆ mode

mode_t StoreIOState::mode
inherited

◆ offset_

off_t StoreIOState::offset_
inherited

Definition at line 75 of file StoreIOState.h.

Referenced by StoreIOState::offset().

◆ opening

bool Fs::Ufs::UFSStoreState::opening

Definition at line 37 of file UFSStoreState.h.

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

◆ pending_reads

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

Definition at line 72 of file UFSStoreState.h.

◆ pending_writes

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

Definition at line 102 of file UFSStoreState.h.

◆ 

struct { ... } StoreIOState::read

◆ read_buf

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

Definition at line 126 of file UFSStoreState.h.

◆ reading

bool Fs::Ufs::UFSStoreState::reading

Definition at line 40 of file UFSStoreState.h.

◆ swap_dirn

◆ swap_filen

◆ theFile

RefCount<DiskFile> Fs::Ufs::UFSStoreState::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 120 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 112 of file UFSStoreState.h.

◆ writing

bool Fs::Ufs::UFSStoreState::writing

Definition at line 41 of file UFSStoreState.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors