TAO_CosNotification
2.1.8
|
Manage interaction between Routing_Slip and persistent storage. More...
#include <Routing_Slip_Persistence_Manager.h>
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_Manager * | load_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_Allocator * | allocator_ |
Standard_Event_Persistence_Factory * | factory_ |
Event_Header | event_header_ |
Routing_Slip_Header | routing_slip_header_ |
Persistent_Storage_Block * | first_event_block_ |
Persistent_Storage_Block * | first_routing_slip_block_ |
Routing_Slip_Persistence_Manager * | prev_manager_ |
We are part of a doubly-linked list. More... | |
Routing_Slip_Persistence_Manager * | next_manager_ |
ACE_Unbounded_Stack< size_t > | allocated_event_blocks_ |
ACE_Unbounded_Stack< size_t > | allocated_routing_slip_blocks_ |
Persistent_Callback * | callback_ |
ACE_Message_Block * | event_mb_ |
If these are non-zero we own 'em. More... | |
ACE_Message_Block * | routing_slip_mb_ |
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.
typedef ACE_UINT32 TAO_Notify::Routing_Slip_Persistence_Manager::Block_Number |
The physical address of a block in persistent storage.
A unique identifier for logical blocks in persistent storage.
typedef ACE_UINT16 TAO_Notify::Routing_Slip_Persistence_Manager::Block_Size |
The size of a block in persistent storage.
typedef ACE_UINT16 TAO_Notify::Routing_Slip_Persistence_Manager::Block_Type |
A code to indicate the type of block in persistent storage.
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.
|
private |
Build a chain of Persistent_Storage_Blocks.
|
private |
Insert ourselves into a linked list of Routing_Slip_Persistnce_Managers.
|
private |
Fill in a block with data, and return the number of bytes of data remaining to be written.
|
private |
|
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#.
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.
|
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.
|
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.
|
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.
|
private |
|
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.
|
private |
|
private |
Locked method to do the work of setting the next_manager_.
|
private |
Write out our first event block.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
If these are non-zero we own 'em.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
We are part of a doubly-linked list.
|
private |
|
private |
|
private |
|
private |