#include <Persistent_File_Allocator.h>
Collaboration diagram for TAO_Notify::Persistent_File_Allocator:
Public Member Functions | |
Persistent_File_Allocator () | |
The constructor. | |
~Persistent_File_Allocator () | |
The destructor. | |
bool | open (const ACE_TCHAR *filename, const size_t block_size=512) |
void | shutdown () |
Wait for pending I/O and terminate our work thread. | |
Persistent_Storage_Block * | allocate () |
Persistent_Storage_Block * | allocate_at (size_t block_number) |
Allocate a new Persistent_Storage_Block at a given address. | |
Persistent_Storage_Block * | allocate_nowrite () |
Allocate a PSB that is marked to not persist. | |
void | used (size_t block_number) |
Mark a block as used, removing it from the free list. | |
void | free (size_t block_number) |
Mark a block number as able to be used again. | |
size_t | block_size () const |
Access block size. | |
bool | read (Persistent_Storage_Block *psb) |
Read data into a PSB. | |
bool | write (Persistent_Storage_Block *psb) |
Write this block to the file,. | |
size_t | file_size () const |
for information (unit test) only. | |
Private Member Functions | |
void | free_block (const size_t block_number) |
Free a previously assigned block. | |
bool | allocate_block (size_t &block_number) |
Find and allocate a free block. | |
void | shutdown_thread () |
Wait for pending I/O to complete and shut our worker thread down safely. | |
void | run () |
The worker's execution thread. | |
Static Private Member Functions | |
ACE_THR_FUNC_RETURN | thr_func (void *arg) |
Private Attributes | |
ACE_Thread_Manager | thread_manager_ |
Random_File | pstore_ |
Bit_Vector | free_blocks_ |
ACE_Unbounded_Queue< Persistent_Storage_Block * > | block_queue_ |
ACE_SYNCH_MUTEX | lock_ |
ACE_SYNCH_MUTEX | free_blocks_lock_ |
ACE_SYNCH_MUTEX | queue_lock_ |
bool | terminate_thread_ |
bool | thread_active_ |
ACE_SYNCH_CONDITION | wake_up_thread_ |
Maintains a free list, write queue, allocations of new blocks, reads, and writes. This class also manages a thread that performs background updating of a Random_File. @todo this is too much for one class to do. It should be refactored. @todo: we shouldn't arbitrarily use a thread.
|
The constructor.
|
|
The destructor.
|
|
Allocate a new Persistent_Storage_Block and initialize it to an unused block of storage. |
|
Allocate a new Persistent_Storage_Block at a given address.
|
|
Find and allocate a free block.
|
|
Allocate a PSB that is marked to not persist.
|
|
Access block size.
|
|
for information (unit test) only.
|
|
Mark a block number as able to be used again.
|
|
Free a previously assigned block.
|
|
|
|
Read data into a PSB. Data will come either from the queue of blocks to be written, or it will be read from the file if there are no queued write requests for this block. |
|
The worker's execution thread.
|
|
Wait for pending I/O and terminate our work thread.
|
|
Wait for pending I/O to complete and shut our worker thread down safely.
|
|
Used during thread startup to cast us back to ourselves and call the run() method. |
|
Mark a block as used, removing it from the free list.
|
|
Write this block to the file,. Add the Persistent_Storage_Block to our write queue and let the worker thread handle writing this to the Random_File. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|