#include <Persistent_File_Allocator.h>
Collaboration diagram for TAO_Notify::Persistent_Storage_Block:
Public Member Functions | |
Persistent_Storage_Block (const size_t block_number, const size_t block_size) | |
The constructor. Initializes the callback to NULL. | |
Persistent_Storage_Block (const Persistent_Storage_Block &psb) | |
The copy constructor. Makes a deep copy of the passed in PSB. | |
~Persistent_Storage_Block () | |
The destructor. | |
void | set_no_write () |
bool | get_no_write () |
Find out whether we have data to be written. | |
void | set_sync () |
Set our block to be written as a near-atomic operation. | |
bool | get_sync () const |
Find out whether this block should be written near-atomically. | |
size_t | block_number () const |
Find out our physical block number. | |
unsigned char * | data () const |
Return our data to the user. | |
void | reassign_data (unsigned char *newptr, bool delete_old=false) |
Set our data pointer, and optionally delete it. | |
size_t | detach () |
Return block number and relinquish ownership. | |
void | set_callback (Persistent_Callback *callback) |
Set our callback. | |
Persistent_Callback * | get_callback () const |
Get our callback. | |
void | set_allocator_owns (bool allocator_owns=true) |
Set ownership of this PSB. | |
bool | get_allocator_owns () const |
Get ownership status of this PSB. | |
Private Attributes | |
unsigned char * | data_ |
Our raw data. | |
size_t | block_number_ |
The block number corresponding to our data. | |
bool | no_write_ |
Are we a no-op with just a callback? | |
bool | sync_ |
Write in near-atomic fashion. | |
size_t | block_size_ |
The size of our block. | |
Persistent_Callback * | callback_ |
bool | allocator_owns_ |
Does the allocator obtain ownership of our block? |
Contains the raw data to be written on disk as well as positioning information, synchronization information, and a pointer to a callback.
Definition at line 56 of file Persistent_File_Allocator.h.
TAO_Notify::Persistent_Storage_Block::Persistent_Storage_Block | ( | const size_t | block_number, | |
const size_t | block_size | |||
) |
The constructor. Initializes the callback to NULL.
Definition at line 22 of file Persistent_File_Allocator.cpp.
References ACE_NEW, and ACE_OS::memset().
00024 : block_number_(block_number) 00025 , no_write_(false) 00026 , sync_(false) 00027 , block_size_(block_size) 00028 , callback_(0) 00029 , allocator_owns_(true) 00030 { 00031 ACE_NEW(this->data_, unsigned char[this->block_size_]); 00032 ACE_OS::memset(this->data_, 0, this->block_size_); 00033 00034 }
TAO_Notify::Persistent_Storage_Block::Persistent_Storage_Block | ( | const Persistent_Storage_Block & | psb | ) |
The copy constructor. Makes a deep copy of the passed in PSB.
Definition at line 36 of file Persistent_File_Allocator.cpp.
References ACE_NEW, block_size_, data(), and ACE_OS::memcpy().
00038 : block_number_(psb.block_number_) 00039 , no_write_(psb.no_write_) 00040 , sync_(psb.sync_) 00041 , block_size_(psb.block_size_) 00042 , callback_(psb.callback_) 00043 , allocator_owns_(psb.allocator_owns_) 00044 { 00045 ACE_NEW(this->data_, unsigned char[this->block_size_]); 00046 ACE_OS::memcpy(this->data_, psb.data(), this->block_size_); 00047 }
TAO_Notify::Persistent_Storage_Block::~Persistent_Storage_Block | ( | ) |
size_t TAO_Notify::Persistent_Storage_Block::block_number | ( | ) | const |
Find out our physical block number.
Definition at line 81 of file Persistent_File_Allocator.cpp.
References block_number_.
Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::build_chain(), TAO_Notify::Standard_Event_Persistence_Factory::get_preallocated_pointer(), TAO_Notify::Persistent_File_Allocator::read(), TAO_Notify::Routing_Slip_Persistence_Manager::reload_chain(), TAO_Notify::Persistent_File_Allocator::run(), TAO_Notify::Routing_Slip_Persistence_Manager::store_i(), and TAO_Notify::Persistent_File_Allocator::write().
00082 { 00083 return this->block_number_; 00084 }
unsigned char * TAO_Notify::Persistent_Storage_Block::data | ( | ) | const |
Return our data to the user.
Definition at line 87 of file Persistent_File_Allocator.cpp.
References data_.
Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::Routing_Slip_Header::extract_header(), TAO_Notify::Routing_Slip_Persistence_Manager::Block_Header::extract_header(), TAO_Notify::Routing_Slip_Persistence_Manager::fill_block(), Persistent_Storage_Block(), TAO_Notify::Routing_Slip_Persistence_Manager::Routing_Slip_Header::put_header(), TAO_Notify::Routing_Slip_Persistence_Manager::Block_Header::put_header(), TAO_Notify::Persistent_File_Allocator::read(), TAO_Notify::Routing_Slip_Persistence_Manager::reload_chain(), and TAO_Notify::Persistent_File_Allocator::run().
00088 { 00089 return this->data_; 00090 }
size_t TAO_Notify::Persistent_Storage_Block::detach | ( | ) |
Return block number and relinquish ownership.
bool TAO_Notify::Persistent_Storage_Block::get_allocator_owns | ( | ) | const |
Get ownership status of this PSB.
Definition at line 122 of file Persistent_File_Allocator.cpp.
References allocator_owns_.
Referenced by TAO_Notify::Persistent_File_Allocator::run(), and TAO_Notify::Persistent_File_Allocator::write().
00123 { 00124 return this->allocator_owns_; 00125 }
Persistent_Callback * TAO_Notify::Persistent_Storage_Block::get_callback | ( | ) | const |
Get our callback.
Definition at line 110 of file Persistent_File_Allocator.cpp.
References callback_.
Referenced by TAO_Notify::Persistent_File_Allocator::run().
00111 { 00112 return this->callback_; 00113 }
bool TAO_Notify::Persistent_Storage_Block::get_no_write | ( | ) |
Find out whether we have data to be written.
Definition at line 63 of file Persistent_File_Allocator.cpp.
References no_write_.
Referenced by TAO_Notify::Persistent_File_Allocator::run().
00064 { 00065 return this->no_write_; 00066 }
bool TAO_Notify::Persistent_Storage_Block::get_sync | ( | ) | const |
Find out whether this block should be written near-atomically.
Definition at line 75 of file Persistent_File_Allocator.cpp.
References sync_.
Referenced by TAO_Notify::Persistent_File_Allocator::run().
00076 { 00077 return this->sync_; 00078 }
void TAO_Notify::Persistent_Storage_Block::reassign_data | ( | unsigned char * | newptr, | |
bool | delete_old = false | |||
) |
Set our data pointer, and optionally delete it.
Definition at line 93 of file Persistent_File_Allocator.cpp.
References data_.
Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::reload_chain(), and set_no_write().
00095 { 00096 if (delete_old) 00097 { 00098 delete [] this->data_; 00099 } 00100 this->data_ = newptr; 00101 }
void TAO_Notify::Persistent_Storage_Block::set_allocator_owns | ( | bool | allocator_owns = true |
) |
Set ownership of this PSB.
Definition at line 116 of file Persistent_File_Allocator.cpp.
References allocator_owns_.
Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::load(), TAO_Notify::Standard_Event_Persistence_Factory::preallocate_next_record(), TAO_Notify::Routing_Slip_Persistence_Manager::store_event(), and TAO_Notify::Persistent_File_Allocator::write().
00117 { 00118 this->allocator_owns_ = allocator_owns; 00119 }
void TAO_Notify::Persistent_Storage_Block::set_callback | ( | Persistent_Callback * | callback | ) |
Set our callback.
Definition at line 104 of file Persistent_File_Allocator.cpp.
References callback_.
Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::remove(), TAO_Notify::Routing_Slip_Persistence_Manager::store_i(), and TAO_Notify::Routing_Slip_Persistence_Manager::update_i().
00105 { 00106 this->callback_ = callback; 00107 }
void TAO_Notify::Persistent_Storage_Block::set_no_write | ( | ) |
Set our block to not have any data at all - a no-op. This can be used to implement a checkpoint in the write stream.
Definition at line 56 of file Persistent_File_Allocator.cpp.
References no_write_, and reassign_data().
Referenced by TAO_Notify::Persistent_File_Allocator::allocate_nowrite().
00057 { 00058 this->no_write_ = true; 00059 this->reassign_data(0, true); 00060 }
void TAO_Notify::Persistent_Storage_Block::set_sync | ( | ) |
Set our block to be written as a near-atomic operation.
Definition at line 69 of file Persistent_File_Allocator.cpp.
References sync_.
Referenced by TAO_Notify::Routing_Slip_Persistence_Manager::load(), and TAO_Notify::Standard_Event_Persistence_Factory::preallocate_next_record().
00070 { 00071 this->sync_ = true; 00072 }
bool TAO_Notify::Persistent_Storage_Block::allocator_owns_ [private] |
Does the allocator obtain ownership of our block?
Definition at line 115 of file Persistent_File_Allocator.h.
Referenced by get_allocator_owns(), and set_allocator_owns().
size_t TAO_Notify::Persistent_Storage_Block::block_number_ [private] |
The block number corresponding to our data.
Definition at line 104 of file Persistent_File_Allocator.h.
Referenced by block_number().
size_t TAO_Notify::Persistent_Storage_Block::block_size_ [private] |
The size of our block.
Definition at line 110 of file Persistent_File_Allocator.h.
Referenced by Persistent_Storage_Block().
Our optional callback function, to be used in such things as state transitions.
Definition at line 113 of file Persistent_File_Allocator.h.
Referenced by get_callback(), and set_callback().
unsigned char* TAO_Notify::Persistent_Storage_Block::data_ [private] |
Our raw data.
Definition at line 102 of file Persistent_File_Allocator.h.
Referenced by data(), reassign_data(), and ~Persistent_Storage_Block().
bool TAO_Notify::Persistent_Storage_Block::no_write_ [private] |
Are we a no-op with just a callback?
Definition at line 106 of file Persistent_File_Allocator.h.
Referenced by get_no_write(), and set_no_write().
bool TAO_Notify::Persistent_Storage_Block::sync_ [private] |
Write in near-atomic fashion.
Definition at line 108 of file Persistent_File_Allocator.h.
Referenced by get_sync(), and set_sync().