TAO_CosNotification  2.0.8
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
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
[legend]

List of all members.

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.
typedef ACE_UINT32 Block_Number
 The physical address of a block in persistent storage.
typedef ACE_UINT16 Block_Size
 The size of a block in persistent storage.
typedef ACE_UINT16 Block_Type
 A code to indicate the type of block in persistent storage.

Public Member Functions

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

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.
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.
bool update_next_manager (Routing_Slip_Persistence_Manager *next)
 Locked method to do the work of setting the next_manager_.
bool persisted ()
 Have we been persisted yet?
size_t write_first_routing_slip_block (bool prepare_only=false)
 Write out our first event block.
void dllist_push_back ()
 Insert ourselves into a linked list of Routing_Slip_Persistnce_Managers.
void insert_before (Routing_Slip_Persistence_Manager *node)
void remove_from_dllist ()
 Remove ourselves from a linked list of Routing_Slip_Persistence_Managers.

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.
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.
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

If these are non-zero we own 'em.

We are part of a doubly-linked list.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines