public class TransactionLog extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
class |
TransactionLog.FSReverseReader |
class |
TransactionLog.LogCodec |
class |
TransactionLog.LogReader |
class |
TransactionLog.ReverseReader |
class |
TransactionLog.SortedLogReader |
Modifier and Type | Field and Description |
---|---|
protected boolean |
deleteOnClose |
static String |
END_MESSAGE |
Modifier | Constructor and Description |
---|---|
protected |
TransactionLog() |
Modifier and Type | Method and Description |
---|---|
protected void |
addGlobalStrings(Collection<String> strings) |
void |
close() |
void |
closeOutput()
Move to a read-only state, closing and releasing resources while keeping the log available for reads
|
void |
decref() |
protected void |
endRecord(long startRecordPosition) |
boolean |
endsWithCommit() |
void |
finish(UpdateLog.SyncLevel syncLevel) |
void |
forceClose() |
long |
getLogSize() |
TransactionLog.LogReader |
getReader(long startingPos)
Returns a reader that can be used while a log is still in use.
|
TransactionLog.ReverseReader |
getReverseReader()
Returns a single threaded reverse reader
|
TransactionLog.LogReader |
getSortedReader(long startingPos) |
void |
incref() |
Object |
lookup(long pos) |
int |
numRecords()
Returns the number of records in the log (currently includes the header and an optional commit).
|
long |
position()
returns the current position in the log file
|
void |
rollback(long pos) |
long |
snapshot()
takes a snapshot of the current position and number of records
for later possible rollback, and returns the position
|
String |
toString() |
boolean |
try_incref() |
long |
write(AddUpdateCommand cmd,
int flags)
Writes an add update command to the transaction log.
|
long |
write(AddUpdateCommand cmd,
long prevPointer,
int flags)
Writes an add update command to the transaction log.
|
long |
writeCommit(CommitUpdateCommand cmd,
int flags) |
long |
writeData(Object o) |
long |
writeDelete(DeleteUpdateCommand cmd,
int flags) |
long |
writeDeleteByQuery(DeleteUpdateCommand cmd,
int flags) |
protected void |
writeLogHeader(TransactionLog.LogCodec codec) |
public static final String END_MESSAGE
protected volatile boolean deleteOnClose
public int numRecords()
public boolean endsWithCommit() throws IOException
IOException
public long snapshot()
public void rollback(long pos) throws IOException
IOException
public long writeData(Object o)
protected void addGlobalStrings(Collection<String> strings)
protected void writeLogHeader(TransactionLog.LogCodec codec) throws IOException
IOException
protected void endRecord(long startRecordPosition) throws IOException
IOException
public long write(AddUpdateCommand cmd, int flags)
write(AddUpdateCommand, long, int)
.
(The previous pointer (applicable for in-place updates) is set to -1 while writing
the command to the transaction log.)cmd
- The add update command to be writtenflags
- Options for writing the command to the transaction logwrite(AddUpdateCommand, long, int)
public long write(AddUpdateCommand cmd, long prevPointer, int flags)
cmd
- The add update command to be writtenprevPointer
- The pointer in the transaction log which this update depends
on (applicable for in-place updates)flags
- Options for writing the command to the transaction logpublic long writeDelete(DeleteUpdateCommand cmd, int flags)
public long writeDeleteByQuery(DeleteUpdateCommand cmd, int flags)
public long writeCommit(CommitUpdateCommand cmd, int flags)
public Object lookup(long pos)
public void incref()
public boolean try_incref()
public void decref()
public long position()
public void closeOutput()
public void finish(UpdateLog.SyncLevel syncLevel)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void forceClose()
public long getLogSize()
public TransactionLog.LogReader getReader(long startingPos)
public TransactionLog.LogReader getSortedReader(long startingPos)
public TransactionLog.ReverseReader getReverseReader() throws IOException
IOException
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.