BackupRestorePage Class Reference

Random access request binding for I/O requests issued during backup/restore. More...

#include <SegPageBackupRestoreDevice.h>

Inheritance diagram for BackupRestorePage:

RandomAccessRequestBinding List of all members.

Public Member Functions

virtual PBuffer getBuffer () const
 
Returns:
memory address where transfer should start.

virtual uint getBufferSize () const
 
Returns:
number of contiguous bytes from getBuffer() to be used for transfer.

virtual void notifyTransferCompletion (bool bSuccess)
 Receives notification when a transfer completes.
void setParent (WeakSegPageBackupRestoreDevice pParentInit)
 Sets the initiating backup/restore object.
void setBuffer (PBuffer pBuffer)
 Sets the buffer associated with this page.
void setBufferSize (uint bufferSize)
 Sets the size of the buffer.
BlockNum getPageCounter ()
 
Returns:
the counter that determines the order in which pages are written to the backup file

void setPageCounter (BlockNum counter)
 Sets the counter that determines the order in which pages are written to the backup file.
void setReadRequest (bool isRead)
 Indicates whether the request is a read request.

Private Attributes

PBuffer pBuffer
 Pointer to the scratch buffer associated with this request.
BlockNum pageCounter
 The counter that determines the order in which pages are written to the backup file.
uint bufferSize
 Size of the scratch buffer.
bool isRead
 True if this is a read request.
WeakSegPageBackupRestoreDevice pParent
 A pointer to the parent object that initiated this I/O request.

Detailed Description

Random access request binding for I/O requests issued during backup/restore.

Definition at line 44 of file SegPageBackupRestoreDevice.h.


Member Function Documentation

PBuffer BackupRestorePage::getBuffer (  )  const [virtual]

Returns:
memory address where transfer should start.

Implements RandomAccessRequestBinding.

Definition at line 37 of file SegPageBackupRestoreDevice.cpp.

References pBuffer.

Referenced by SegPageBackupRestoreDevice::notifyReadTransferCompletion(), and SegPageBackupRestoreDevice::restorePage().

00038 {
00039     return pBuffer;
00040 }

uint BackupRestorePage::getBufferSize (  )  const [virtual]

Returns:
number of contiguous bytes from getBuffer() to be used for transfer.

Implements RandomAccessRequestBinding.

Definition at line 47 of file SegPageBackupRestoreDevice.cpp.

References bufferSize.

00048 {
00049     return bufferSize;
00050 }

void BackupRestorePage::notifyTransferCompletion ( bool  bSuccess  )  [virtual]

Receives notification when a transfer completes.

Parameters:
bSuccess true if the full buffer size was successfully transferred for this binding

Implements RandomAccessRequestBinding.

Definition at line 72 of file SegPageBackupRestoreDevice.cpp.

References isRead, and pParent.

00073 {
00074     SharedSegPageBackupRestoreDevice sharedPtr = pParent.lock();
00075     StrictMutexGuard mutexGuard(sharedPtr->getMutex());
00076 
00077     if (isRead) {
00078         sharedPtr->notifyReadTransferCompletion(*this, bSuccess);
00079     } else {
00080         sharedPtr->notifyWriteTransferCompletion(*this, bSuccess);
00081     }
00082 
00083     // release the reference to the shared pointer while we're still holding
00084     // the parent mutex
00085     sharedPtr.reset();
00086 }

void BackupRestorePage::setParent ( WeakSegPageBackupRestoreDevice  pParentInit  ) 

Sets the initiating backup/restore object.

Parameters:
pParentInit a pointer to the initiating backup/restore object

Definition at line 32 of file SegPageBackupRestoreDevice.cpp.

References pParent.

00033 {
00034     pParent = pParentInit;
00035 }

void BackupRestorePage::setBuffer ( PBuffer  pBuffer  ) 

Sets the buffer associated with this page.

Parameters:
pBuffer the buffer

Definition at line 52 of file SegPageBackupRestoreDevice.cpp.

References pBuffer.

00053 {
00054     pBuffer = pBufferInit;
00055 }

void BackupRestorePage::setBufferSize ( uint  bufferSize  ) 

Sets the size of the buffer.

Parameters:
bufferSize the buffer size

Definition at line 42 of file SegPageBackupRestoreDevice.cpp.

References bufferSize.

00043 {
00044     bufferSize = bufferSizeInit;
00045 }

BlockNum BackupRestorePage::getPageCounter (  ) 

Returns:
the counter that determines the order in which pages are written to the backup file

Definition at line 57 of file SegPageBackupRestoreDevice.cpp.

References pageCounter.

Referenced by SegPageBackupRestoreDevice::notifyReadTransferCompletion().

00058 {
00059     return pageCounter;
00060 }

void BackupRestorePage::setPageCounter ( BlockNum  counter  ) 

Sets the counter that determines the order in which pages are written to the backup file.

Parameters:
counter the counter

Definition at line 62 of file SegPageBackupRestoreDevice.cpp.

References pageCounter.

Referenced by SegPageBackupRestoreDevice::backupPage(), and SegPageBackupRestoreDevice::restorePage().

00063 {
00064     pageCounter = counter;
00065 }

void BackupRestorePage::setReadRequest ( bool  isRead  ) 

Indicates whether the request is a read request.

Parameters:
isRead true if this is a read request

Definition at line 67 of file SegPageBackupRestoreDevice.cpp.

References isRead.

Referenced by SegPageBackupRestoreDevice::backupPage(), and SegPageBackupRestoreDevice::restorePage().

00068 {
00069     isRead = isReadInit;
00070 }


Member Data Documentation

PBuffer BackupRestorePage::pBuffer [private]

Pointer to the scratch buffer associated with this request.

Definition at line 50 of file SegPageBackupRestoreDevice.h.

Referenced by getBuffer(), and setBuffer().

BlockNum BackupRestorePage::pageCounter [private]

The counter that determines the order in which pages are written to the backup file.

Definition at line 56 of file SegPageBackupRestoreDevice.h.

Referenced by getPageCounter(), and setPageCounter().

uint BackupRestorePage::bufferSize [private]

Size of the scratch buffer.

Definition at line 61 of file SegPageBackupRestoreDevice.h.

Referenced by getBufferSize(), and setBufferSize().

bool BackupRestorePage::isRead [private]

True if this is a read request.

Definition at line 66 of file SegPageBackupRestoreDevice.h.

Referenced by notifyTransferCompletion(), and setReadRequest().

WeakSegPageBackupRestoreDevice BackupRestorePage::pParent [private]

A pointer to the parent object that initiated this I/O request.

Uses a weak pointer because of the circularity in the reference.

Definition at line 72 of file SegPageBackupRestoreDevice.h.

Referenced by notifyTransferCompletion(), and setParent().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:24 2009 for Fennel by  doxygen 1.5.1