TAO_Notify::Standard_Event_Persistence_Factory Class Reference

Standard (i.e. default) implementation of Event_Persistence_Factory interface. More...

#include <Standard_Event_Persistence.h>

Inheritance diagram for TAO_Notify::Standard_Event_Persistence_Factory:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify::Standard_Event_Persistence_Factory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Standard_Event_Persistence_Factory ()
 Constructor.
virtual ~Standard_Event_Persistence_Factory ()
 Destructor.
bool open (const ACE_TCHAR *filename, ACE_UINT32 block_size=512)
virtual Routing_Slip_Persistence_Managercreate_routing_slip_persistence_manager (Persistent_Callback *callback)
 Create a Persistence Manager.
virtual Routing_Slip_Persistence_Managerfirst_reload_manager ()
void done_reloading (Persistent_Storage_Block *next_psb, ACE_UINT64 current_serial_number)
 reloading process complete. Where should the chain continue?
void preallocate_next_record (ACE_UINT64 &current_serial_number, Persistent_Storage_Block *&current_psb, ACE_UINT64 &next_serial_number, ACE_UINT32 &next_block_number)
void get_preallocated_pointer (ACE_UINT64 &next_serial_number, ACE_UINT32 &next_block_number)
Persistent_File_Allocatorallocator ()
Routing_Slip_Persistence_Managerroot ()

Public Attributes

TAO_SYNCH_MUTEX lock

Private Attributes

Persistent_File_Allocator allocator_
Routing_Slip_Persistence_Manager root_
Persistent_Storage_Blockpsb_
ACE_UINT64 serial_number_
bool is_reloading_

Detailed Description

Standard (i.e. default) implementation of Event_Persistence_Factory interface.

Definition at line 39 of file Standard_Event_Persistence.h.


Constructor & Destructor Documentation

TAO_Notify::Standard_Event_Persistence_Factory::Standard_Event_Persistence_Factory (  ) 

Constructor.

Definition at line 115 of file Standard_Event_Persistence.cpp.

00116   : allocator_()
00117   , root_(this)
00118   , psb_(0)
00119   , serial_number_(ROUTING_SLIP_ROOT_SERIAL_NUMBER + 1)
00120   , is_reloading_ (false)
00121 {
00122 }

TAO_Notify::Standard_Event_Persistence_Factory::~Standard_Event_Persistence_Factory (  )  [virtual]

Destructor.

Definition at line 143 of file Standard_Event_Persistence.cpp.

References ACE_DEBUG, ACE_TEXT(), allocator_, LM_DEBUG, psb_, TAO_Notify::Routing_Slip_Persistence_Manager::release_all(), root_, TAO_Notify::Persistent_File_Allocator::shutdown(), and TAO_debug_level.

00144 {
00145   if (TAO_debug_level > 0)
00146   {
00147     ACE_DEBUG ((LM_DEBUG,
00148       ACE_TEXT ("(%P|%t) Standard_Event_Persistence_Factory::~Standard_Event_Persistence_Factory\n")
00149     ));
00150   }
00151   this->root_.release_all ();
00152   delete this->psb_;
00153   this->psb_ = 0;
00154   this->allocator_.shutdown();
00155 }


Member Function Documentation

Persistent_File_Allocator * TAO_Notify::Standard_Event_Persistence_Factory::allocator (  ) 

Accessor for file allocator. Intended for use only by the Routing Slip Persistence Manager

Definition at line 218 of file Standard_Event_Persistence.cpp.

References allocator_.

00219 {
00220   return &this->allocator_;
00221 }

Routing_Slip_Persistence_Manager * TAO_Notify::Standard_Event_Persistence_Factory::create_routing_slip_persistence_manager ( Persistent_Callback callback  )  [virtual]

Create a Persistence Manager.

Implements TAO_Notify::Event_Persistence_Factory.

Definition at line 158 of file Standard_Event_Persistence.cpp.

References ACE_NEW_RETURN, and TAO_Notify::Routing_Slip_Persistence_Manager::set_callback().

00160 {
00161   Routing_Slip_Persistence_Manager* rspm = 0;
00162   ACE_NEW_RETURN(rspm, Routing_Slip_Persistence_Manager(this), rspm);
00163   rspm->set_callback(callback);
00164   return rspm;
00165 }

void TAO_Notify::Standard_Event_Persistence_Factory::done_reloading ( Persistent_Storage_Block next_psb,
ACE_UINT64  current_serial_number 
)

reloading process complete. Where should the chain continue?

Definition at line 179 of file Standard_Event_Persistence.cpp.

References ACE_ASSERT, is_reloading_, psb_, and serial_number_.

Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::load_next().

00182 {
00183   ACE_ASSERT (this->psb_ == 0);
00184   this->psb_ = next_psb;
00185   this->serial_number_ = current_serial_number;
00186   this->is_reloading_ = false;
00187 }

Routing_Slip_Persistence_Manager * TAO_Notify::Standard_Event_Persistence_Factory::first_reload_manager (  )  [virtual]

Begin the reload process by returning the first Routing_Slip_Persistence_Manager to continue call Routing_Slip_Persistence_Manager::load_next ()

Implements TAO_Notify::Event_Persistence_Factory.

Definition at line 168 of file Standard_Event_Persistence.cpp.

References TAO_Notify::Routing_Slip_Persistence_Manager::load_next(), and root_.

00169 {
00170   Routing_Slip_Persistence_Manager * result = 0;
00171   if (this->is_reloading_)
00172   {
00173     result = this->root_.load_next();
00174   }
00175   return result;
00176 }

void TAO_Notify::Standard_Event_Persistence_Factory::get_preallocated_pointer ( ACE_UINT64 next_serial_number,
ACE_UINT32 &  next_block_number 
)

Definition at line 206 of file Standard_Event_Persistence.cpp.

References TAO_Notify::Persistent_File_Allocator::allocate(), allocator_, TAO_Notify::Persistent_Storage_Block::block_number(), psb_, and serial_number_.

Referenced by preallocate_next_record(), and TAO_Notify::Routing_Slip_Persistence_Manager::store_root().

00209 {
00210   ++this->serial_number_;
00211   this->psb_ = this->allocator_.allocate();
00212 
00213   next_serial_number = this->serial_number_;
00214   next_block_number = ACE_Utils::truncate_cast<ACE_UINT32> (this->psb_->block_number());
00215 }

bool TAO_Notify::Standard_Event_Persistence_Factory::open ( const ACE_TCHAR filename,
ACE_UINT32  block_size = 512 
)

Open persistence file and initialize. /param filename the fully qualified path/name of the file to contain persistent information. /param block_size the size of a physical block on the device containing the file.

Definition at line 125 of file Standard_Event_Persistence.cpp.

References ACE_ASSERT, allocator_, TAO_Notify::Persistent_File_Allocator::open(), root_, TAO_Notify::ROUTING_SLIP_ROOT_BLOCK_NUMBER, TAO_Notify::ROUTING_SLIP_ROOT_SERIAL_NUMBER, and TAO_Notify::Routing_Slip_Persistence_Manager::store_root().

00127 {
00128   bool result = false;
00129   if (allocator_.open (filename, block_size))
00130   {
00131     this->is_reloading_ = this->root_.load(ROUTING_SLIP_ROOT_BLOCK_NUMBER, ROUTING_SLIP_ROOT_SERIAL_NUMBER);
00132     if (! this->is_reloading_)
00133     {
00134       ACE_ASSERT (this->psb_ == 0);
00135 //      this->psb_ = this->allocator_.allocate();
00136       this->root_.store_root();
00137     }
00138     result = true;
00139   }
00140   return result;
00141 }

void TAO_Notify::Standard_Event_Persistence_Factory::preallocate_next_record ( ACE_UINT64 current_serial_number,
Persistent_Storage_Block *&  current_psb,
ACE_UINT64 next_serial_number,
ACE_UINT32 &  next_block_number 
)

return current serial # and a psb containing current record# allocate new serial # and record number, and return those, too.

Definition at line 190 of file Standard_Event_Persistence.cpp.

References get_preallocated_pointer(), psb_, serial_number_, TAO_Notify::Persistent_Storage_Block::set_allocator_owns(), and TAO_Notify::Persistent_Storage_Block::set_sync().

Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::store_i().

00195 {
00196   // return current serial number and
00197   // a psb containing current record number
00198   current_serial_number = this->serial_number_;
00199   this->psb_->set_allocator_owns(false); // give up ownership
00200   this->psb_->set_sync();
00201   current_psb = this->psb_;
00202   this->get_preallocated_pointer (next_serial_number, next_block_number);
00203 }

Routing_Slip_Persistence_Manager & TAO_Notify::Standard_Event_Persistence_Factory::root (  ) 

Access root record. Intended for use only by the Routing Slip Persistence Manager

Definition at line 224 of file Standard_Event_Persistence.cpp.

References root_.

00225 {
00226   return this->root_;
00227 }


Member Data Documentation

Persistent_File_Allocator TAO_Notify::Standard_Event_Persistence_Factory::allocator_ [private]

Definition at line 92 of file Standard_Event_Persistence.h.

Referenced by allocator(), get_preallocated_pointer(), open(), and ~Standard_Event_Persistence_Factory().

bool TAO_Notify::Standard_Event_Persistence_Factory::is_reloading_ [private]

Definition at line 96 of file Standard_Event_Persistence.h.

Referenced by done_reloading().

TAO_SYNCH_MUTEX TAO_Notify::Standard_Event_Persistence_Factory::lock

Definition at line 89 of file Standard_Event_Persistence.h.

Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::remove(), and TAO_Notify::Routing_Slip_Persistence_Manager::store_i().

Persistent_Storage_Block* TAO_Notify::Standard_Event_Persistence_Factory::psb_ [private]

Definition at line 94 of file Standard_Event_Persistence.h.

Referenced by done_reloading(), get_preallocated_pointer(), preallocate_next_record(), and ~Standard_Event_Persistence_Factory().

Routing_Slip_Persistence_Manager TAO_Notify::Standard_Event_Persistence_Factory::root_ [private]

Definition at line 93 of file Standard_Event_Persistence.h.

Referenced by first_reload_manager(), open(), root(), and ~Standard_Event_Persistence_Factory().

ACE_UINT64 TAO_Notify::Standard_Event_Persistence_Factory::serial_number_ [private]

Definition at line 95 of file Standard_Event_Persistence.h.

Referenced by done_reloading(), get_preallocated_pointer(), and preallocate_next_record().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:46:44 2010 for TAO_CosNotification by  doxygen 1.4.7