#include <Random_File.h>
Inheritance diagram for TAO_Notify::Random_File:
Public Member Functions | |
Random_File () | |
The constructor. | |
~Random_File () | |
The destructor, which closes the open file. | |
bool | open (const ACE_TCHAR *filename, size_t block_size=512) |
Open a file with default permissions. | |
size_t | block_size () const |
size_t | size () const |
Return the current file size, in number of blocks. | |
bool | write (const size_t block_number, void *buffer, bool atomic=false) |
bool | read (const size_t block_number, void *buffer) |
Read a block from our file. | |
Private Member Functions | |
bool | seek (const size_t block_number) |
Seek to a given block number, used by reads and writes. | |
bool | sync () |
Synchronize the file to disk, used to implement atomic. | |
Private Attributes | |
size_t | block_size_ |
ACE_SYNCH_MUTEX | lock_ |
Derived from ACE_FILE, this class provides access to a file of fixed-size blocks.
|
The constructor.
|
|
The destructor, which closes the open file.
|
|
Accessor for the block size. Note signed size_t is used to be compatible with ACE_FILE. |
|
Open a file with default permissions.
|
|
Read a block from our file.
|
|
Seek to a given block number, used by reads and writes.
|
|
Return the current file size, in number of blocks.
|
|
Synchronize the file to disk, used to implement atomic.
|
|
Write a block to our file, potentially as an "atomic" write. If the atomic argument is true, then the operating system's write-through cache for this file is flushed both before and after the write. The flush before ensures that any record pointers in this block will point to records that actually appear in the file. The flush after provides the caller with a guarantee that the data will appear in the file even if the system fails immediately after this method returns. |
|
|
|
|