com::cosylab::logging::client::cache::MultiFileTableRecord Class Reference

Collaboration diagram for com::cosylab::logging::client::cache::MultiFileTableRecord:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MultiFileTableRecord () throws LogCacheException
int getNumOfLogs ()
long getFileSize () throws IOException
void addLog (ILogEntry log, int key) throws LogCacheException
int getMinLogIdx ()
int getMaxLogIdx ()
ILogEntry getLog (Integer key) throws LogCacheException
void flushBuffer () throws LogCacheException
void deleteLog (Integer key) throws LogCacheException
void clear () throws LogCacheException
boolean isEmpty ()
Integer getFirstLog ()
Integer getLastLog ()
int getFirstLogs (int n, Collection< Integer > keys)
Set< Integer > keySet ()
void replaceLog (Integer key, ILogEntry log) throws LogCacheException

Private Attributes

LogBufferedFileCache lbfc
int minLogIdx
int maxLogIdx

Detailed Description

This class defines a data set providing information on a single LogBufferedFileCache object. Each time a new file is created we also create an instance of this class.

LogFileTableRecord objects are organized in a vector to form the log file table used to retrieve the logs according to the user's defined keyword.

Author:
mcomin

Constructor & Destructor Documentation

com::cosylab::logging::client::cache::MultiFileTableRecord::MultiFileTableRecord (  )  throws LogCacheException [inline]

Build a new object

Exceptions:
LogCacheException 

References lbfc, maxLogIdx, and minLogIdx.


Member Function Documentation

void com::cosylab::logging::client::cache::MultiFileTableRecord::addLog ( ILogEntry  log,
int  key 
) throws LogCacheException [inline]

Add a log to the cache and updates the max and min indexes

Parameters:
log The log to add to the cache
key The key of the new log
Exceptions:
LogCacheException If an error happens while adding the log

References com::cosylab::logging::client::cache::LogBufferedFileCache::add(), lbfc, maxLogIdx, and minLogIdx.

Referenced by com::cosylab::logging::client::cache::LogMultiFileCache::add().

void com::cosylab::logging::client::cache::MultiFileTableRecord::clear (  )  throws LogCacheException [inline]

Remove all the logs and free the resources by delegating to the LogBufferedFileCache

Exceptions:
<code>LogCacheException</code> in case of error clearing the buffer

References com::cosylab::logging::client::cache::LogBufferedFileCache::clear(), lbfc, maxLogIdx, and minLogIdx.

Referenced by com::cosylab::logging::client::cache::LogMultiFileCache::deleteLog().

void com::cosylab::logging::client::cache::MultiFileTableRecord::deleteLog ( Integer  key  )  throws LogCacheException [inline]

Delete the log with the given key

Parameters:
key The not null key of identifying the log
Exceptions:
<code>LogCacheException</code> in case of error deleting the log

References com::cosylab::logging::client::cache::LogBufferedFileCache::deleteLog(), lbfc, and minLogIdx.

Referenced by com::cosylab::logging::client::cache::LogMultiFileCache::deleteLog().

void com::cosylab::logging::client::cache::MultiFileTableRecord::flushBuffer (  )  throws LogCacheException [inline]

Flush the buffer on disk delegating to the LogBufferedFileCache

Exceptions:
LogCacheException In case of error flushing on disk

References com::cosylab::logging::client::cache::LogBufferedFileCache::flushBuffer(), and lbfc.

Referenced by com::cosylab::logging::client::cache::LogMultiFileCache::add().

long com::cosylab::logging::client::cache::MultiFileTableRecord::getFileSize (  )  throws IOException [inline]
Integer com::cosylab::logging::client::cache::MultiFileTableRecord::getFirstLog (  )  [inline]

Return the key of the first log in this record

Returns:
The key of the first log in this record
See also:
ILogMap

References com::cosylab::logging::client::cache::LogBufferedFileCache::getFirstLog(), isEmpty(), lbfc, and minLogIdx.

Referenced by com::cosylab::logging::client::cache::LogMultiFileCache::getFirstLog().

int com::cosylab::logging::client::cache::MultiFileTableRecord::getFirstLogs ( int  n,
Collection< Integer >  keys 
) [inline]

Append at most n keys from the first valid logs to the collection. First here means first in the FIFO policy.

The number of added keys can be less then n if the cache doesn't contain enough logs.

See also:
com.cosylab.logging.client.cache.ILogMap

References com::cosylab::logging::client::cache::LogBufferedFileCache::getFirstLogs(), and lbfc.

Integer com::cosylab::logging::client::cache::MultiFileTableRecord::getLastLog (  )  [inline]

Return the key of the last log in this record

Returns:
The key of the last log in this record
See also:
ILogMap

References com::cosylab::logging::client::cache::LogBufferedFileCache::getLastLog(), isEmpty(), lbfc, and minLogIdx.

Referenced by com::cosylab::logging::client::cache::LogMultiFileCache::getLastLog().

ILogEntry com::cosylab::logging::client::cache::MultiFileTableRecord::getLog ( Integer  key  )  throws LogCacheException [inline]

Return the log with the given key

Parameters:
key The not null key of identifying the log
Returns:
the log with the given key

References com::cosylab::logging::client::cache::LogBufferedFileCache::getLog(), lbfc, maxLogIdx, and minLogIdx.

Referenced by com::cosylab::logging::client::cache::LogMultiFileCache::getLog().

int com::cosylab::logging::client::cache::MultiFileTableRecord::getMaxLogIdx (  )  [inline]
int com::cosylab::logging::client::cache::MultiFileTableRecord::getMinLogIdx (  )  [inline]
int com::cosylab::logging::client::cache::MultiFileTableRecord::getNumOfLogs (  )  [inline]
boolean com::cosylab::logging::client::cache::MultiFileTableRecord::isEmpty (  )  [inline]
Returns:
true if the record contains no log

References com::cosylab::logging::client::cache::LogBufferedFileCache::getSize(), and lbfc.

Referenced by getFirstLog(), and getLastLog().

Set<Integer> com::cosylab::logging::client::cache::MultiFileTableRecord::keySet (  )  [inline]
void com::cosylab::logging::client::cache::MultiFileTableRecord::replaceLog ( Integer  key,
ILogEntry  log 
) throws LogCacheException [inline]

Replace the log with the given key

Parameters:
key The key of the log to replace
log The new log
See also:
com.cosylab.logging.client.cache.ILogMap

References lbfc, minLogIdx, and com::cosylab::logging::client::cache::LogBufferedFileCache::replaceLog().

Referenced by com::cosylab::logging::client::cache::LogMultiFileCache::replaceLog().


Member Data Documentation

Minimum and maximum log keys stored in the LogBufferedFileCache These two numbers are used to locate a given log by its keyword.

NOTE: These numbers are updated only while adding logs i.e. if a log is deleted it can happen that is not in the record even if its key is in the range [minLogIdx,maxLogIdx]

Referenced by addLog(), clear(), deleteLog(), getFirstLog(), getLastLog(), getLog(), getMinLogIdx(), keySet(), MultiFileTableRecord(), and replaceLog().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2