#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_LOFF_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 63 of file Filecache.cpp. References ACE_TCHAR, ACE_Filecache::fetch(), file_, init(), and ACE_Filecache::instance().
00065 : file_ (0), handle_ (0), mapit_ (mapit) 00066 { 00067 this->init (); 00068 // Fetch the file from the Virtual_Filesystem let the 00069 // Virtual_Filesystem do the work of cache coherency. 00070 00071 // Filecache will also do the acquire, since it holds the lock at 00072 // that time. 00073 this->file_ = ACE_Filecache::instance ()->fetch (filename, mapit); 00074 } |
|
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 76 of file Filecache.cpp. References ACE_TCHAR, ACE_Filecache::create(), file_, init(), ACE_Filecache::instance(), and ACE_Filecache::remove().
00079 : file_ (0), handle_ (0), mapit_ (mapit) 00080 { 00081 this->init (); 00082 00083 if (size == 0) 00084 ACE_Filecache::instance ()->remove (filename); 00085 else 00086 { 00087 // Since this is being opened for a write, simply create a new 00088 // ACE_Filecache_Object now, and let the destructor add it into CVF 00089 // later 00090 00091 // Filecache will also do the acquire, since it holds the lock at 00092 // that time. 00093 this->file_ = ACE_Filecache::instance ()->create (filename, size); 00094 } 00095 } |
|
Closes any open handles, release acquired file.
Definition at line 97 of file Filecache.cpp. References ACE_OS::close(), ACE_Filecache::finish(), and ACE_Filecache::instance().
00098 { 00099 if (this->handle_ != ACE_INVALID_HANDLE) 00100 // this was dup ()'d 00101 ACE_OS::close (this->handle_); 00102 00103 ACE_Filecache::instance ()->finish (this->file_); 00104 } |
|
Default do nothing constructor. Prevent it from being called.
Definition at line 57 of file Filecache.cpp. References init().
|
|
Base address of memory mapped file.
Definition at line 107 of file Filecache.cpp. References ACE_Filecache_Object::address(), and file_.
|
|
Any associated error in handle creation and acquisition.
Definition at line 125 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 113 of file Filecache.cpp. References ACE_OS::dup(), file_, and handle_.
00114 { 00115 if (this->handle_ == ACE_INVALID_HANDLE && this->file_ != 0) 00116 { 00117 ACE_Filecache_Handle *mutable_this = 00118 const_cast<ACE_Filecache_Handle *> (this); 00119 mutable_this->handle_ = ACE_OS::dup (this->file_->handle ()); 00120 } 00121 return this->handle_; 00122 } |
|
Common initializations for constructors.
Definition at line 51 of file Filecache.cpp. References file_. Referenced by ACE_Filecache_Handle().
|
|
The size of the file.
Definition at line 134 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. |