MappedPageListener Class Reference

MappedPageListener defines an interface which allows a derived class to receive notifications of events on mapped pages. More...

#include <MappedPageListener.h>

Inheritance diagram for MappedPageListener:

Segment DelegatingSegment DynamicDelegatingSegment LinearDeviceSegment ScratchSegment CircularSegment LinearViewSegment RandomAllocationSegmentBase SnapshotRandomAllocationSegment TracingSegment VersionedSegment WALSegment RandomAllocationSegment VersionedRandomAllocationSegment List of all members.

Public Member Functions

virtual ~MappedPageListener ()
virtual void notifyPageMap (CachePage &page)
 Receives notification from CacheImpl as soon as a page is mapped, before any I/O is initiated to retrieve the page contents.
virtual void notifyPageUnmap (CachePage &page)
 Receives notification from CacheImpl just before a page is unmapped.
virtual void notifyAfterPageRead (CachePage &page)
 Receives notification from CacheImpl after a page read completes.
virtual void notifyPageDirty (CachePage &page, bool bDataValid)
 Receives notification from CacheImpl the first time a page becomes dirty after it has been mapped (but before the contents have changed).
virtual bool canFlushPage (CachePage &page)
 Informs CacheImpl whether a dirty page can safely be flushed to disk.
virtual void notifyBeforePageFlush (CachePage &page)
 Receives notification from CacheImpl just before a dirty page is flushed to disk.
virtual void notifyAfterPageFlush (CachePage &page)
 Receives notification from CacheImpl when a page flush completes successfully.
virtual MappedPageListenernotifyAfterPageCheckpointFlush (CachePage &page)
 Receives notification that a page has been flushed during a checkpoint.
virtual MappedPageListenergetTracingListener ()=0
 Retrieves the tracing wrapper corresponding to this listener if tracing is turned on.

Detailed Description

MappedPageListener defines an interface which allows a derived class to receive notifications of events on mapped pages.

All methods have dummy implementations (not pure virtual) so derived classes only need to override those of interest.

Definition at line 37 of file MappedPageListener.h.


Constructor & Destructor Documentation

MappedPageListener::~MappedPageListener (  )  [virtual]

Definition at line 58 of file MappedPageListener.cpp.

00059 {
00060 }


Member Function Documentation

void MappedPageListener::notifyPageMap ( CachePage page  )  [virtual]

Receives notification from CacheImpl as soon as a page is mapped, before any I/O is initiated to retrieve the page contents.

Called with the page mutex held, so the implementation must take care to avoid deadlock.

Parameters:
page the page being mapped

Reimplemented in DelegatingSegment, DynamicDelegatingSegment, and TracingSegment.

Definition at line 29 of file MappedPageListener.cpp.

Referenced by CacheImpl< PageT, VictimPolicyT >::mapPage().

00030 {
00031 }

void MappedPageListener::notifyPageUnmap ( CachePage page  )  [virtual]

Receives notification from CacheImpl just before a page is unmapped.

Called with the page mutex held, so the implementation must take care to avoid deadlock.

Parameters:
page the page being unmapped

Reimplemented in DelegatingSegment, DynamicDelegatingSegment, TracingSegment, and WALSegment.

Definition at line 33 of file MappedPageListener.cpp.

00034 {
00035 }

void MappedPageListener::notifyAfterPageRead ( CachePage page  )  [virtual]

Receives notification from CacheImpl after a page read completes.

Called with the page mutex held, so the implementation must take care to avoid deadlock.

Parameters:
page the page read

Reimplemented in DelegatingSegment, DynamicDelegatingSegment, and TracingSegment.

Definition at line 37 of file MappedPageListener.cpp.

Referenced by CacheImpl< PageT, VictimPolicyT >::notifyTransferCompletion().

00038 {
00039 }

void MappedPageListener::notifyPageDirty ( CachePage page,
bool  bDataValid 
) [virtual]

Receives notification from CacheImpl the first time a page becomes dirty after it has been mapped (but before the contents have changed).

Allows some logging action to be taken; for example, making a backup copy of the unmodified page contents. Note that when called for a newly allocated page, the page contents are invalid. Because it is implied that the calling thread already has an exclusive lock on the page, no cache locks are held when called.

Parameters:
page the page being modified
bDataValid if true, the page data was already valid; if false, the data was invalid, but has now been marked valid since it's about to be written

Reimplemented in DelegatingSegment, DynamicDelegatingSegment, SnapshotRandomAllocationSegment, TracingSegment, VersionedSegment, and WALSegment.

Definition at line 41 of file MappedPageListener.cpp.

00042 {
00043 }

bool MappedPageListener::canFlushPage ( CachePage page  )  [virtual]

Informs CacheImpl whether a dirty page can safely be flushed to disk.

Called with the page mutex held, so the implementation must take care to avoid deadlock.

Parameters:
page the page to be flushed

Reimplemented in DelegatingSegment, DynamicDelegatingSegment, SnapshotRandomAllocationSegment, and VersionedSegment.

Definition at line 53 of file MappedPageListener.cpp.

Referenced by CacheImpl< PageT, VictimPolicyT >::flushPage().

00054 {
00055     return true;
00056 }

void MappedPageListener::notifyBeforePageFlush ( CachePage page  )  [virtual]

Receives notification from CacheImpl just before a dirty page is flushed to disk.

Allows some logging action to be taken; for example, flushing corresponding write-ahead log pages, or storing a checksum in the page header. Called with the page mutex held, so the implementation must take care to avoid deadlock.

Parameters:
page the page to be flushed

Reimplemented in DelegatingSegment, DynamicDelegatingSegment, and TracingSegment.

Definition at line 45 of file MappedPageListener.cpp.

00046 {
00047 }

void MappedPageListener::notifyAfterPageFlush ( CachePage page  )  [virtual]

Receives notification from CacheImpl when a page flush completes successfully.

Called with the page mutex held, so the implementation must take care to avoid deadlock.

Parameters:
page the page that was flushed

Reimplemented in DelegatingSegment, DynamicDelegatingSegment, TracingSegment, and WALSegment.

Definition at line 49 of file MappedPageListener.cpp.

Referenced by CacheImpl< PageT, VictimPolicyT >::notifyTransferCompletion().

00050 {
00051 }

MappedPageListener * MappedPageListener::notifyAfterPageCheckpointFlush ( CachePage page  )  [virtual]

Receives notification that a page has been flushed during a checkpoint.

Also determines if the listener on the page needs to be reset.

Note that if the page listener is reset, that page may not be unmapped during a CHECKPOINT_FLUSH_AND_UNMAP checkpoint call.

This method should be called immediately after the page flush has completed while the checkpoint is still in progress.

Parameters:
page the page that was flushed
Returns:
NULL if the listener on the page does not need to be reset; otherwise, returns the listener that the page should be reset to

Reimplemented in SnapshotRandomAllocationSegment, and TracingSegment.

Definition at line 62 of file MappedPageListener.cpp.

00064 {
00065     return NULL;
00066 }

virtual MappedPageListener* MappedPageListener::getTracingListener (  )  [pure virtual]

Retrieves the tracing wrapper corresponding to this listener if tracing is turned on.

Otherwise, returns this listener itself.

Returns:
tracing segment corresponding to a listener

Implemented in Segment.

Referenced by TracingSegment::getMappedPageListener(), and TracingSegment::notifyAfterPageCheckpointFlush().


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