Public Member Functions

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

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

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

Build a new object

Exceptions:
LogCacheException 

Member Function Documentation

void com.cosylab.logging.client.cache.MultiFileTableRecord.addLog ( ILogEntry  log,
int  key 
) throws LogCacheException

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().

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

void com.cosylab.logging.client.cache.MultiFileTableRecord.clear (  )  throws LogCacheException

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().

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

void com.cosylab.logging.client.cache.MultiFileTableRecord.deleteLog ( Integer  key  )  throws LogCacheException

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().

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

void com.cosylab.logging.client.cache.MultiFileTableRecord.flushBuffer (  )  throws LogCacheException

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().

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

long com.cosylab.logging.client.cache.MultiFileTableRecord.getFileSize (  )  throws IOException

return the size of the file on disk

Returns:
The size of the file
Exceptions:
IOException In case of error getting the size of the file

References com.cosylab.logging.client.cache.LogBufferedFileCache.getFileSize().

Referenced by com.cosylab.logging.client.cache.LogMultiFileCache.add(), com.cosylab.logging.client.cache.LogMultiFileCache.getLogFileSize(), and com.cosylab.logging.client.cache.LogMultiFileCache.printFileTableInfo().

Integer com.cosylab.logging.client.cache.MultiFileTableRecord.getFirstLog (  ) 

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(), and com.cosylab.logging.client.cache.MultiFileTableRecord.isEmpty().

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

int com.cosylab.logging.client.cache.MultiFileTableRecord.getFirstLogs ( int  n,
Collection< Integer >  keys 
)

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().

Integer com.cosylab.logging.client.cache.MultiFileTableRecord.getLastLog (  ) 

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(), and com.cosylab.logging.client.cache.MultiFileTableRecord.isEmpty().

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

ILogEntry com.cosylab.logging.client.cache.MultiFileTableRecord.getLog ( Integer  key  )  throws LogCacheException

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().

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

int com.cosylab.logging.client.cache.MultiFileTableRecord.getMaxLogIdx (  ) 
int com.cosylab.logging.client.cache.MultiFileTableRecord.getMinLogIdx (  ) 
int com.cosylab.logging.client.cache.MultiFileTableRecord.getNumOfLogs (  ) 
boolean com.cosylab.logging.client.cache.MultiFileTableRecord.isEmpty (  ) 
Set<Integer> com.cosylab.logging.client.cache.MultiFileTableRecord.keySet (  ) 

The keys in the map

Returns:
The key in the map
See also:
com.cosylab.logging.client.cache.ILogMap

References com.cosylab.logging.client.cache.LogBufferedFileCache.keySet().

void com.cosylab.logging.client.cache.MultiFileTableRecord.replaceLog ( Integer  key,
ILogEntry  log 
) throws LogCacheException

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 com.cosylab.logging.client.cache.LogBufferedFileCache.replaceLog().

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


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties