#include <Filecache.h>
Collaboration diagram for ACE_Filecache_Handle:
Public Types | |
enum | { ACE_SUCCESS = 0, ACE_ACCESS_FAILED, ACE_OPEN_FAILED, ACE_COPY_FAILED, ACE_STAT_FAILED, ACE_MEMMAP_FAILED, ACE_WRITE_FAILED } |
These come from ACE_Filecache_Object, which is an internal class. More... | |
Public Member Functions | |
ACE_Filecache_Handle (const ACE_TCHAR *filename, ACE_Filecache_Flag mapit=ACE_MAPIT) | |
ACE_Filecache_Handle (const ACE_TCHAR *filename, int size, ACE_Filecache_Flag mapit=ACE_MAPIT) | |
~ACE_Filecache_Handle (void) | |
Closes any open handles, release acquired file. | |
void * | address (void) const |
Base address of memory mapped file. | |
ACE_HANDLE | handle (void) const |
A handle (e.g., UNIX file descriptor, or NT file handle). | |
int | error (void) const |
Any associated error in handle creation and acquisition. | |
ACE_OFF_T | size (void) const |
The size of the file. | |
Protected Member Functions | |
ACE_Filecache_Handle (void) | |
Default do nothing constructor. Prevent it from being called. | |
void | init (void) |
Common initializations for constructors. | |
Private Attributes | |
ACE_Filecache_Object * | file_ |
A reference to the low level instance. | |
ACE_HANDLE | handle_ |
A 'd version of the one from . | |
int | mapit_ |
This is a cached filesystem implementation based loosely on the implementation of JAWS_File. The interfaces will be nearly the same. The under-the-hood implementation should hopefully be a much faster thing. These will be given their own implementations later. For now, we borrow the implementation provided by JAWS. On creation, the cache is checked, and reference count is incremented. On destruction, reference count is decremented. If the reference count is 0, the file is removed from the cache. E.g. 1, { ACE_Filecache_Handle foo("foo.html"); this->peer ().send (foo.address (), foo.size ()); } E.g. 2, { ACE_Filecache_Handle foo("foo.html"); io->transmitfile (foo.handle (), this->peer ().handle ()); } E.g. 3, { ACE_Filecache_Handle foo("foo.html", content_length); this->peer ().recv (foo.address (), content_length); } TODO:
Definition at line 73 of file Filecache.h.
|
These come from ACE_Filecache_Object, which is an internal class.
Definition at line 131 of file Filecache.h.
00132 { 00133 ACE_SUCCESS = 0, 00134 ACE_ACCESS_FAILED, 00135 ACE_OPEN_FAILED, 00136 ACE_COPY_FAILED, 00137 ACE_STAT_FAILED, 00138 ACE_MEMMAP_FAILED, 00139 ACE_WRITE_FAILED 00140 }; |
|
Query cache for file, and acquire it. Assumes the file is being opened for reading. Definition at line 64 of file Filecache.cpp. References ACE_TCHAR, ACE_Filecache::fetch(), file_, init(), and ACE_Filecache::instance().
00066 : file_ (0), handle_ (0), mapit_ (mapit) 00067 { 00068 this->init (); 00069 // Fetch the file from the Virtual_Filesystem let the 00070 // Virtual_Filesystem do the work of cache coherency. 00071 00072 // Filecache will also do the acquire, since it holds the lock at 00073 // that time. 00074 this->file_ = ACE_Filecache::instance ()->fetch (filename, mapit); 00075 } |
|
Create new entry, and acquire it. Presence of SIZE assumes the file is being opened for writing. If SIZE is zero, assumes the file is to be removed from the cache. Definition at line 77 of file Filecache.cpp. References ACE_TCHAR, ACE_Filecache::create(), file_, init(), ACE_Filecache::instance(), and ACE_Filecache::remove().
00080 : file_ (0), handle_ (0), mapit_ (mapit) 00081 { 00082 this->init (); 00083 00084 if (size == 0) 00085 ACE_Filecache::instance ()->remove (filename); 00086 else 00087 { 00088 // Since this is being opened for a write, simply create a new 00089 // ACE_Filecache_Object now, and let the destructor add it into CVF 00090 // later 00091 00092 // Filecache will also do the acquire, since it holds the lock at 00093 // that time. 00094 this->file_ = ACE_Filecache::instance ()->create (filename, size); 00095 } 00096 } |
|
Closes any open handles, release acquired file.
Definition at line 98 of file Filecache.cpp. References ACE_OS::close(), ACE_Filecache::finish(), and ACE_Filecache::instance().
00099 { 00100 if (this->handle_ != ACE_INVALID_HANDLE) 00101 // this was dup ()'d 00102 ACE_OS::close (this->handle_); 00103 00104 ACE_Filecache::instance ()->finish (this->file_); 00105 } |
|
Default do nothing constructor. Prevent it from being called.
Definition at line 58 of file Filecache.cpp. References init().
|
|
Base address of memory mapped file.
Definition at line 108 of file Filecache.cpp. References ACE_Filecache_Object::address(), and file_.
|
|
Any associated error in handle creation and acquisition.
Definition at line 126 of file Filecache.cpp. References ACE_Filecache_Object::error(), and file_.
|
|
A handle (e.g., UNIX file descriptor, or NT file handle).
Definition at line 114 of file Filecache.cpp. References ACE_OS::dup(), file_, and handle_.
00115 { 00116 if (this->handle_ == ACE_INVALID_HANDLE && this->file_ != 0) 00117 { 00118 ACE_Filecache_Handle *mutable_this = 00119 const_cast<ACE_Filecache_Handle *> (this); 00120 mutable_this->handle_ = ACE_OS::dup (this->file_->handle ()); 00121 } 00122 return this->handle_; 00123 } |
|
Common initializations for constructors.
Definition at line 52 of file Filecache.cpp. References file_. Referenced by ACE_Filecache_Handle().
|
|
The size of the file.
Definition at line 135 of file Filecache.cpp. References file_, and ACE_Filecache_Object::size().
|
|
A reference to the low level instance.
Definition at line 144 of file Filecache.h. Referenced by ACE_Filecache_Handle(), address(), error(), handle(), init(), and size(). |
|
A 'd version of the one from .
Definition at line 147 of file Filecache.h. Referenced by handle(). |
|
Definition at line 149 of file Filecache.h. |