NAME

ACE_Filecache_Handle - Abstraction over a real file. This is meant to be the entry point into the Cached Virtual Filesystem.

SYNOPSIS

#include <ace/Filecache.h>

class ACE_Filecache_Handle { public: ACE_Filecache_Handle ( const char *filename, ACE_Filecache_Flag mapit = MAPIT ); ACE_Filecache_Handle ( const char *filename, int size, ACE_Filecache_Flag mapit = MAPIT ); ~ACE_Filecache_Handle (void); void *address (void) const; ACE_HANDLE handle (void) const; int error (void) const; size_t size (void) const; enum{ SUCCESS = 0, ACCESS_FAILED, OPEN_FAILED, COPY_FAILED, STAT_FAILED, MEMMAP_FAILED, WRITE_FAILED }; protected: ACE_Filecache_Handle (void); void init (void); private: ACE_Filecache_Object *file_; ACE_HANDLE handle_; int mapit_; };

DESCRIPTION

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:

PUBLIC MEMBERS

ACE_Filecache_Handle (
    const char *filename,
    ACE_Filecache_Flag mapit = MAPIT
    );

ACE_Filecache_Handle (
    const char *filename,
    int size,
    ACE_Filecache_Flag mapit = MAPIT
    );

~ACE_Filecache_Handle (void);

void *address (void) const;

ACE_HANDLE handle (void) const;

int error (void) const;

size_t size (void) const;

PROTECTED MEMBERS

ACE_Filecache_Handle (void);

void init (void);

PRIVATE MEMBERS

ACE_Filecache_Object *file_;

ACE_HANDLE handle_;

int mapit_;

AUTHOR

James Hu

Forward declarations.

LIBRARY

ace