The format of each log record in the LogBufferElement is the same
as is written to log file in LogAccessFile:
(int) total_length (data[].length + optionaldata[].length)
(long) instant
(byte[]) data+optionaldata
(int) total_length
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private long | |
| private int | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private int | Returns: new positionwhere the bytes are copied from b, int offset in b to start copying from offset, int the position in this LogBufferElement to start copying to pos, int number of bytes to copy from b, starting from offset length)Append a byte[] to this LogBufferElement. |
| protected void | appendLog(long
the instant of the log record that was
added last to this chunk of log greatestInstant, byte[] the chunk of log records log, int offset in log to start copy from logOffset, int number of bytes to copy, starting
from logOffset logLength)Append a chunk of log records to this LogBufferElement. |
| protected int | |
| protected byte[] | |
| protected long | |
| protected void | |
| protected boolean | Returns: true if this LogBufferElement should be reused, i.e. added to freeBuffers after being consumed.
|
| protected void | |
| protected int |
| bufferdata | back to summary |
|---|---|
| private final byte[] bufferdata | |
| greatestInstant | back to summary |
|---|---|
| private long greatestInstant | |
| position | back to summary |
|---|---|
| private int position | |
| recycleMe | back to summary |
|---|---|
| private boolean recycleMe | |
| LogBufferElement | back to summary |
|---|---|
| protected LogBufferElement(int bufferSize) | |
| appendBytes | back to summary |
|---|---|
| private int appendBytes(byte[] b, int offset, int pos, int length) Append a byte[] to this LogBufferElement.
| |
| appendLog | back to summary |
|---|---|
| protected void appendLog(long greatestInstant, byte[] log, int logOffset, int logLength) Append a chunk of log records to this LogBufferElement.
| |
| freeSize | back to summary |
|---|---|
protected int freeSize()
| |
| getData | back to summary |
|---|---|
protected byte[] getData()
| |
| getLastInstant | back to summary |
|---|---|
protected long getLastInstant()
| |
| init | back to summary |
|---|---|
| protected void init() Resets all variables to default values. Should be called before a LogBufferElement is reused. | |
| isRecyclable | back to summary |
|---|---|
protected boolean isRecyclable()
| |
| setRecyclable | back to summary |
|---|---|
| protected void setRecyclable(boolean r) | |
| size | back to summary |
|---|---|
protected int size()
| |