28 #define BESCache3_h_ 1
76 static const char BES_CACHE_CHAR =
'#';
82 unsigned long long d_max_cache_size_in_bytes;
84 unsigned long long d_target_size;
87 BESCache3(
BESKeys *keys,
const string &cache_dir_key,
const string &prefix_key,
const string &size_key);
89 BESCache3(
const string &cache_dir,
const string &prefix,
unsigned long size);
96 void m_check_ctor_params();
97 void m_initialize_cache_info();
99 unsigned long long m_collect_cache_dir_info(
CacheFiles &contents);
105 void m_record_descriptor(
const string &file,
int fd);
106 int m_get_descriptor(
const string &file);
109 typedef std::multimap<string, int > FilesAndLockDescriptors;
110 FilesAndLockDescriptors d_locks;
128 virtual bool cache_too_big(
unsigned long long current_size)
const;
136 virtual void dump(ostream &strm)
const ;
139 #endif // BESCache3_h_
virtual void exclusive_to_shared_lock(int fd)
Transfer from an exclusive lock to a shared lock.
virtual void dump(ostream &strm) const
dumps information about this object
std::list< cache_entry > CacheFiles
virtual bool cache_too_big(unsigned long long current_size) const
look at the cache size; is it too large? Look at the cache size and see if it is too big...
virtual void lock_cache_write()
Get an exclusive lock on the 'cache info' file.
virtual void unlock_and_close(const string &target)
Unlock the named file.
Base object for bes objects.
virtual void lock_cache_read()
Get a shared lock on the 'cache info' file.
mapping of key/value pairs defining different behaviors of an application.
Implementation of a caching mechanism for compressed data.
virtual unsigned long long update_cache_info(const string &target)
Update the cache info file to include 'target'.
virtual bool create_and_lock(const string &target, int &fd)
Create a file in the cache and lock it for write access.
virtual bool get_read_lock(const string &target, int &fd)
Get a read-only lock on the file if it exists.
string get_cache_file_name(const string &src)
Build the name of file that will holds the uncompressed data from 'src' in the cache.
virtual void update_and_purge(const string &new_file)
Purge files from the cache.
virtual void unlock_cache()
Unlock the cache info file.
virtual unsigned long long get_cache_size()
Get the cache size.
static BESCache3 * get_instance()
Get an instance of the BESCache3 object.