|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.replicator.thl.log.LogIndex
public class LogIndex
Implements an in-memory index showing the starting sequence number of each index file. Index operations are fully synchronized to ensure there are no issues due to concurrent access across threads.
| Constructor Summary | |
|---|---|
LogIndex(java.io.File logDir,
java.lang.String filePrefix,
long retentionMillis,
int bufferSize,
boolean isWritable)
Creates a new in-memory instance on all log files in a particular directory. |
|
| Method Summary | |
|---|---|
void |
addNewFile(long seqno,
java.lang.String fileName)
Adds a new file to the index. |
boolean |
fileNameExists(java.lang.String name)
Returns true if the name of a log file exists in the index. |
long |
getActiveSeqno()
Returns the current active sequence number. |
java.lang.String |
getFile(long seqno)
Locates and returns the file that contains a given sequence number. |
java.lang.String[] |
getFileNames()
Returns an array containing all file names. |
java.lang.String |
getFirstFile()
Returns the first index file or null if no such file exists. |
java.util.List<LogIndexEntry> |
getIndexCopy()
Returns a copy of the index entries in sorted order. |
java.lang.String |
getLastFile()
Returns the last index file or null if no such file exists. |
long |
getMaxIndexedSeqno()
Returns the maximum committed sequence number this index knows about. |
long |
getMinIndexedSeqno()
Returns the minimum sequence number this index knows about. |
boolean |
isEmpty()
Returns true if the index is empty. |
void |
release()
Releases resources in the index. |
void |
removeFile(java.lang.String fileName)
Remove a file from the index. |
void |
setActiveSeqno(long activeSeqno)
Sets the active sequence number, which is the lowest sequence number known to be in use by clients of this log. |
void |
setMaxIndexedSeqno(long seqno)
Sets the maximum sequence number this index knows about by updating the last index entry. |
int |
size()
Returns the number of files in the index. |
java.lang.String |
toString()
|
void |
validate(java.io.File logDir)
Validates the index by ensuring that each file exists and that the log entries have matching start and end dates. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LogIndex(java.io.File logDir,
java.lang.String filePrefix,
long retentionMillis,
int bufferSize,
boolean isWritable)
throws ReplicatorException,
java.lang.InterruptedException
logDir - Log directoryfilePrefix - Prefix for log filesretentionMillis - Amount of time to retain log files before
auto-deletingbufferSize - Buffer size for reading log filesisWritable - True if the log is writable and we can clean up
ReplicatorException - Thrown in the event of an error constructing
the index
java.lang.InterruptedException| Method Detail |
|---|
public long getActiveSeqno()
public void setActiveSeqno(long activeSeqno)
public boolean isEmpty()
public int size()
public void release()
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public void setMaxIndexedSeqno(long seqno)
public long getMaxIndexedSeqno()
public long getMinIndexedSeqno()
public java.lang.String getFile(long seqno)
public boolean fileNameExists(java.lang.String name)
public java.util.List<LogIndexEntry> getIndexCopy()
public java.lang.String getFirstFile()
public java.lang.String getLastFile()
public java.lang.String[] getFileNames()
public void addNewFile(long seqno,
java.lang.String fileName)
seqno - Starting sequence number in the filefileName - Name of the log filepublic void removeFile(java.lang.String fileName)
public void validate(java.io.File logDir)
throws LogConsistencyException
LogConsistencyException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||