TAO_CosNotification  2.2.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
TAO_Notify::Routing_Slip_Persistence_Manager Class Reference

Manage interaction between Routing_Slip and persistent storage. More...

#include <Routing_Slip_Persistence_Manager.h>

Collaboration diagram for TAO_Notify::Routing_Slip_Persistence_Manager:
Collaboration graph

Classes

class  Block_Header
 private: Storage for header information of all persistent block. More...
 
class  Event_Header
 An Event block header. More...
 
class  Overflow_Header
 An overflow block header. More...
 
class  Routing_Slip_Header
 private: Storage for header information for Routing_Slip blocks. More...
 

Public Types

typedef ACE_UINT64 Block_Serial_Number
 A unique identifier for logical blocks in persistent storage. More...
 
typedef ACE_UINT32 Block_Number
 The physical address of a block in persistent storage. More...
 
typedef ACE_UINT16 Block_Size
 The size of a block in persistent storage. More...
 
typedef ACE_UINT16 Block_Type
 A code to indicate the type of block in persistent storage. More...
 

Public Member Functions

 Routing_Slip_Persistence_Manager (Standard_Event_Persistence_Factory *factory)
 The constructor. More...
 
 ~Routing_Slip_Persistence_Manager ()
 The destructor. More...
 
void set_callback (Persistent_Callback *callback)
 Set up callbacks. More...
 
bool store (const ACE_Message_Block &event, const ACE_Message_Block &routing_slip)
 Store an event + routing slip. More...
 
bool update (const ACE_Message_Block &routing_slip)
 Update the routing slip. More...
 
bool remove ()
 Remove our associated event and routing slip from the Persistent_File_Allocator. More...
 
bool reload (ACE_Message_Block *&event, ACE_Message_Block *&routing_slip)
 Call this method to recover data during event reload. More...
 
Routing_Slip_Persistence_Managerload_next ()
 Get next RSPM during reload. More...
 
bool store_root ()
 Commit root data to disk, which should only be done for a root node. More...
 
bool load (Block_Number block_number, Block_Serial_Number expected_serial_number)
 Reload data into this RSPM from the given block/serial#. More...
 
bool is_root () const
 Is this RSPM attached to the root block? More...
 
void release_all ()
 During cleanup for shut down, release all chained RSPMs. More...
 

Private Member Functions

bool store_i (const ACE_Message_Block &event, const ACE_Message_Block &routing_slip)
 
bool update_i (const ACE_Message_Block &routing_slip)
 
bool store_event (const ACE_Message_Block &event)
 
size_t fill_block (Persistent_Storage_Block &psb, size_t offset_into_block, const ACE_Message_Block *data, size_t offset_into_msg)
 
size_t fill_block (Persistent_Storage_Block &psb, size_t offset_into_block, unsigned char *data, size_t data_size)
 
bool build_chain (Persistent_Storage_Block *first_block, Block_Header &first_header, ACE_Unbounded_Stack< size_t > &allocated_blocks, const ACE_Message_Block &data)
 Build a chain of Persistent_Storage_Blocks. More...
 
bool reload_chain (Persistent_Storage_Block *first_block, Block_Header &first_header, ACE_Unbounded_Stack< size_t > &allocated_blocks, ACE_Message_Block *amb, ACE_UINT64 expected_serial_number)
 Reload a chain from persistent store. More...
 
bool update_next_manager (Routing_Slip_Persistence_Manager *next)
 Locked method to do the work of setting the next_manager_. More...
 
bool persisted ()
 Have we been persisted yet? More...
 
size_t write_first_routing_slip_block (bool prepare_only=false)
 Write out our first event block. More...
 
void dllist_push_back ()
 Insert ourselves into a linked list of Routing_Slip_Persistnce_Managers. More...
 
void insert_before (Routing_Slip_Persistence_Manager *node)
 
void remove_from_dllist ()
 Remove ourselves from a linked list of Routing_Slip_Persistence_Managers. More...
 

Private Attributes

TAO_SYNCH_MUTEX lock_
 
bool removed_
 
ACE_UINT64 serial_number_
 
Persistent_File_Allocatorallocator_
 
Standard_Event_Persistence_Factoryfactory_
 
Event_Header event_header_
 
Routing_Slip_Header routing_slip_header_
 
Persistent_Storage_Blockfirst_event_block_
 
Persistent_Storage_Blockfirst_routing_slip_block_
 
Routing_Slip_Persistence_Managerprev_manager_
 We are part of a doubly-linked list. More...
 
Routing_Slip_Persistence_Managernext_manager_
 
ACE_Unbounded_Stack< size_t > allocated_event_blocks_
 
ACE_Unbounded_Stack< size_t > allocated_routing_slip_blocks_
 
Persistent_Callbackcallback_
 
ACE_Message_Blockevent_mb_
 If these are non-zero we own 'em. More...
 
ACE_Message_Blockrouting_slip_mb_
 

Detailed Description

Manage interaction between Routing_Slip and persistent storage.

todo: to complete the strategization of event persistent storage this should become an interface that is implemented differently by different strategies. For now it interacts with Standard_Event_Persistence.

Member Typedef Documentation

The physical address of a block in persistent storage.

A unique identifier for logical blocks in persistent storage.

The size of a block in persistent storage.

A code to indicate the type of block in persistent storage.

Constructor & Destructor Documentation

TAO_Notify::Routing_Slip_Persistence_Manager::Routing_Slip_Persistence_Manager ( Standard_Event_Persistence_Factory factory)

The constructor.

TAO_Notify::Routing_Slip_Persistence_Manager::~Routing_Slip_Persistence_Manager ( )

The destructor.

Member Function Documentation

bool TAO_Notify::Routing_Slip_Persistence_Manager::build_chain ( Persistent_Storage_Block first_block,
Block_Header first_header,
ACE_Unbounded_Stack< size_t > &  allocated_blocks,
const ACE_Message_Block data 
)
private

Build a chain of Persistent_Storage_Blocks.

void TAO_Notify::Routing_Slip_Persistence_Manager::dllist_push_back ( )
private

Insert ourselves into a linked list of Routing_Slip_Persistnce_Managers.

size_t TAO_Notify::Routing_Slip_Persistence_Manager::fill_block ( Persistent_Storage_Block psb,
size_t  offset_into_block,
const ACE_Message_Block data,
size_t  offset_into_msg 
)
private

Fill in a block with data, and return the number of bytes of data remaining to be written.

size_t TAO_Notify::Routing_Slip_Persistence_Manager::fill_block ( Persistent_Storage_Block psb,
size_t  offset_into_block,
unsigned char *  data,
size_t  data_size 
)
private
void TAO_Notify::Routing_Slip_Persistence_Manager::insert_before ( Routing_Slip_Persistence_Manager node)
private
bool TAO_Notify::Routing_Slip_Persistence_Manager::is_root ( ) const

Is this RSPM attached to the root block?

bool TAO_Notify::Routing_Slip_Persistence_Manager::load ( Block_Number  block_number,
Block_Serial_Number  expected_serial_number 
)

Reload data into this RSPM from the given block/serial#.

Returns
false if the reload is not successful.

NOTE: There is no need to worry about guarding anything. We assume that there will be one and only one thread doing the entire reload process.

Routing_Slip_Persistence_Manager * TAO_Notify::Routing_Slip_Persistence_Manager::load_next ( )

Get next RSPM during reload.

After using the data from the reload method, call this method to get the next RSPM. It returns a null pointer when all persistent events have been reloaded.

bool TAO_Notify::Routing_Slip_Persistence_Manager::persisted ( )
private

Have we been persisted yet?

void TAO_Notify::Routing_Slip_Persistence_Manager::release_all ( )

During cleanup for shut down, release all chained RSPMs.

bool TAO_Notify::Routing_Slip_Persistence_Manager::reload ( ACE_Message_Block *&  event,
ACE_Message_Block *&  routing_slip 
)

Call this method to recover data during event reload.

It should not fail under normal circumstances. Caller owns the resulting message blocks and is responsible for deleting them. Reload the event and routing_slip from the Persistent_File_Allocator.

bool TAO_Notify::Routing_Slip_Persistence_Manager::reload_chain ( Persistent_Storage_Block first_block,
Block_Header first_header,
ACE_Unbounded_Stack< size_t > &  allocated_blocks,
ACE_Message_Block amb,
ACE_UINT64  expected_serial_number 
)
private

Reload a chain from persistent store.

bool TAO_Notify::Routing_Slip_Persistence_Manager::remove ( )

Remove our associated event and routing slip from the Persistent_File_Allocator.

void TAO_Notify::Routing_Slip_Persistence_Manager::remove_from_dllist ( )
private

Remove ourselves from a linked list of Routing_Slip_Persistence_Managers.

void TAO_Notify::Routing_Slip_Persistence_Manager::set_callback ( Persistent_Callback callback)

Set up callbacks.

bool TAO_Notify::Routing_Slip_Persistence_Manager::store ( const ACE_Message_Block event,
const ACE_Message_Block routing_slip 
)

Store an event + routing slip.

bool TAO_Notify::Routing_Slip_Persistence_Manager::store_event ( const ACE_Message_Block event)
private
bool TAO_Notify::Routing_Slip_Persistence_Manager::store_i ( const ACE_Message_Block event,
const ACE_Message_Block routing_slip 
)
private
bool TAO_Notify::Routing_Slip_Persistence_Manager::store_root ( )

Commit root data to disk, which should only be done for a root node.

bool TAO_Notify::Routing_Slip_Persistence_Manager::update ( const ACE_Message_Block routing_slip)

Update the routing slip.

We must always overwrite the first block last, and it may not chance. Other blocks should be freed and reallocated.

bool TAO_Notify::Routing_Slip_Persistence_Manager::update_i ( const ACE_Message_Block routing_slip)
private
bool TAO_Notify::Routing_Slip_Persistence_Manager::update_next_manager ( Routing_Slip_Persistence_Manager next)
private

Locked method to do the work of setting the next_manager_.

size_t TAO_Notify::Routing_Slip_Persistence_Manager::write_first_routing_slip_block ( bool  prepare_only = false)
private

Write out our first event block.

Member Data Documentation

ACE_Unbounded_Stack<size_t> TAO_Notify::Routing_Slip_Persistence_Manager::allocated_event_blocks_
private
ACE_Unbounded_Stack<size_t> TAO_Notify::Routing_Slip_Persistence_Manager::allocated_routing_slip_blocks_
private
Persistent_File_Allocator* TAO_Notify::Routing_Slip_Persistence_Manager::allocator_
private
Persistent_Callback* TAO_Notify::Routing_Slip_Persistence_Manager::callback_
private
Event_Header TAO_Notify::Routing_Slip_Persistence_Manager::event_header_
private
ACE_Message_Block* TAO_Notify::Routing_Slip_Persistence_Manager::event_mb_
private

If these are non-zero we own 'em.

Standard_Event_Persistence_Factory* TAO_Notify::Routing_Slip_Persistence_Manager::factory_
private
Persistent_Storage_Block* TAO_Notify::Routing_Slip_Persistence_Manager::first_event_block_
private
Persistent_Storage_Block* TAO_Notify::Routing_Slip_Persistence_Manager::first_routing_slip_block_
private
TAO_SYNCH_MUTEX TAO_Notify::Routing_Slip_Persistence_Manager::lock_
private
Routing_Slip_Persistence_Manager* TAO_Notify::Routing_Slip_Persistence_Manager::next_manager_
private
Routing_Slip_Persistence_Manager* TAO_Notify::Routing_Slip_Persistence_Manager::prev_manager_
private

We are part of a doubly-linked list.

bool TAO_Notify::Routing_Slip_Persistence_Manager::removed_
private
Routing_Slip_Header TAO_Notify::Routing_Slip_Persistence_Manager::routing_slip_header_
private
ACE_Message_Block* TAO_Notify::Routing_Slip_Persistence_Manager::routing_slip_mb_
private
ACE_UINT64 TAO_Notify::Routing_Slip_Persistence_Manager::serial_number_
private

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