public final class BufferingTranslogWriter extends TranslogWriter
TranslogWriter.TypelastSyncedOffset, operationCounter, readLock, shardId, TRANSLOG_CODEC, VERSION, VERSION_CHECKPOINTS, VERSION_CHECKSUMS, writeLock, writtenOffsetchannel, channelReference, closed, firstOperationOffset, generation, UNKNOWN_OP_COUNT| Constructor and Description |
|---|
BufferingTranslogWriter(ShardId shardId,
long generation,
org.elasticsearch.index.translog.ChannelReference channelReference,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
Translog.Location |
add(BytesReference data)
add the given bytes to the translog and return the location they were written at
|
protected void |
flush()
Flushes the buffer if the translog is buffered.
|
protected void |
readBytes(ByteBuffer targetBuffer,
long position)
reads bytes at position into the given buffer, filling it.
|
long |
sizeInBytes() |
void |
sync()
write all buffered ops to disk and fsync file
|
boolean |
syncNeeded()
returns true if there are buffered ops
|
void |
updateBufferSize(int bufferSize)
change the size of the internal buffer if relevant
|
checkpoint, closeWithTragicEvent, create, ensureOpen, getTragicException, immutableReader, newReaderFromWriter, syncUpTo, totalOperationsclose, compareTo, getFirstOperationOffset, getGeneration, isClosed, newReaderSnapshot, newSnapshot, open, path, read, read, toStringpublic BufferingTranslogWriter(ShardId shardId, long generation, org.elasticsearch.index.translog.ChannelReference channelReference, int bufferSize) throws IOException
IOExceptionpublic Translog.Location add(BytesReference data) throws IOException
TranslogWriteradd in class TranslogWriterIOExceptionprotected final void flush()
throws IOException
TranslogWriterflush in class TranslogWriterIOExceptionprotected void readBytes(ByteBuffer targetBuffer, long position) throws IOException
TranslogReaderreadBytes in class TranslogWriterIOExceptionpublic boolean syncNeeded()
TranslogWritersyncNeeded in class TranslogWriterpublic void sync()
throws IOException
TranslogWritersync in class TranslogWriterIOExceptionpublic void updateBufferSize(int bufferSize)
TranslogWriterupdateBufferSize in class TranslogWriterpublic long sizeInBytes()
sizeInBytes in class TranslogWriterCopyright © 2009–2017. All rights reserved.