public final class BufferingTranslogWriter extends TranslogWriter
TranslogWriter.Type
lastSyncedOffset, operationCounter, readLock, shardId, TRANSLOG_CODEC, VERSION, VERSION_CHECKPOINTS, VERSION_CHECKSUMS, writeLock, writtenOffset
channel, 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, totalOperations
close, compareTo, getFirstOperationOffset, getGeneration, isClosed, newReaderSnapshot, newSnapshot, open, path, read, read, toString
public BufferingTranslogWriter(ShardId shardId, long generation, org.elasticsearch.index.translog.ChannelReference channelReference, int bufferSize) throws IOException
IOException
public Translog.Location add(BytesReference data) throws IOException
TranslogWriter
add
in class TranslogWriter
IOException
protected final void flush() throws IOException
TranslogWriter
flush
in class TranslogWriter
IOException
protected void readBytes(ByteBuffer targetBuffer, long position) throws IOException
TranslogReader
readBytes
in class TranslogWriter
IOException
public boolean syncNeeded()
TranslogWriter
syncNeeded
in class TranslogWriter
public void sync() throws IOException
TranslogWriter
sync
in class TranslogWriter
IOException
public void updateBufferSize(int bufferSize)
TranslogWriter
updateBufferSize
in class TranslogWriter
public long sizeInBytes()
sizeInBytes
in class TranslogWriter
Copyright © 2009–2016. All rights reserved.