Package org.apache.cassandra.io.compress
Class CompressedSequentialWriter
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.cassandra.io.util.DataOutputStreamPlus
-
- org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
-
- org.apache.cassandra.io.util.SequentialWriter
-
- org.apache.cassandra.io.compress.CompressedSequentialWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataOutput
,java.io.Flushable
,java.lang.AutoCloseable
,DataOutputPlus
,Transactional
public class CompressedSequentialWriter extends SequentialWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
CompressedSequentialWriter.CompressedFileWriterMark
Class to hold a mark to the position of the fileprotected class
CompressedSequentialWriter.TransactionalProxy
-
Nested classes/interfaces inherited from class org.apache.cassandra.io.util.SequentialWriter
SequentialWriter.BufferedFileWriterMark
-
Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Transactional
Transactional.AbstractTransactional
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.io.util.SequentialWriter
bufferOffset, fchannel, lastFlushOffset, runPostFlush
-
Fields inherited from class org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
buffer
-
Fields inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
channel
-
-
Constructor Summary
Constructors Constructor Description CompressedSequentialWriter(java.io.File file, java.lang.String offsetsPath, java.io.File digestFile, SequentialWriterOption option, CompressionParams parameters, MetadataCollector sstableMetadataCollector)
Create CompressedSequentialWriter without digest file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
flush()
protected void
flushData()
Override this method instead of overriding flush()long
getEstimatedOnDiskBytesWritten()
Get a quick estimation on how many bytes have been written to disk It should for the most part be exactly the same as getOnDiskFilePointer()long
getOnDiskFilePointer()
Returns the current file pointer of the underlying on-disk file.DataPosition
mark()
CompressionMetadata
open(long overrideLength)
void
resetAndTruncate(DataPosition mark)
Drops all buffered data that's past the limits of our new file mark + buffer capacity, or syncs and truncates the underlying file to the marked positionprotected SequentialWriter.TransactionalProxy
txnProxy()
-
Methods inherited from class org.apache.cassandra.io.util.SequentialWriter
abort, close, commit, current, doFlush, finish, getLastFlushOffset, getPath, hasPosition, isOpen, length, position, prepareToCommit, resetBuffer, setPostFlushListener, skipBytes, sync, syncDataOnlyInternal, syncInternal, truncate, writeDirectlyToChannel
-
Methods inherited from class org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
order, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Methods inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
newDefaultChannel, retrieveTemporaryBuffer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.io.util.DataOutputPlus
write, writeUnsignedVInt, writeVInt
-
-
-
-
Constructor Detail
-
CompressedSequentialWriter
public CompressedSequentialWriter(java.io.File file, java.lang.String offsetsPath, java.io.File digestFile, SequentialWriterOption option, CompressionParams parameters, MetadataCollector sstableMetadataCollector)
Create CompressedSequentialWriter without digest file.- Parameters:
file
- File to writeoffsetsPath
- File name to write compression metadatadigestFile
- File to write digestoption
- Write option (buffer size and type will be set the same as compression params)parameters
- Compression mparameterssstableMetadataCollector
- Metadata collector
-
-
Method Detail
-
getOnDiskFilePointer
public long getOnDiskFilePointer()
Description copied from class:SequentialWriter
Returns the current file pointer of the underlying on-disk file. Note that since write works by buffering data, the value of this will increase by buffer size and not every write to the writer will modify this value. Furthermore, for compressed files, this value refers to compressed data, while the writer getFilePointer() refers to uncompressedFile- Overrides:
getOnDiskFilePointer
in classSequentialWriter
- Returns:
- the current file pointer
-
getEstimatedOnDiskBytesWritten
public long getEstimatedOnDiskBytesWritten()
Get a quick estimation on how many bytes have been written to disk It should for the most part be exactly the same as getOnDiskFilePointer()- Overrides:
getEstimatedOnDiskBytesWritten
in classSequentialWriter
-
flush
public void flush()
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classBufferedDataOutputStreamPlus
-
flushData
protected void flushData()
Description copied from class:SequentialWriter
Override this method instead of overriding flush()- Overrides:
flushData
in classSequentialWriter
-
open
public CompressionMetadata open(long overrideLength)
-
mark
public DataPosition mark()
- Overrides:
mark
in classSequentialWriter
-
resetAndTruncate
public void resetAndTruncate(DataPosition mark)
Description copied from class:SequentialWriter
Drops all buffered data that's past the limits of our new file mark + buffer capacity, or syncs and truncates the underlying file to the marked position- Overrides:
resetAndTruncate
in classSequentialWriter
-
txnProxy
protected SequentialWriter.TransactionalProxy txnProxy()
- Overrides:
txnProxy
in classSequentialWriter
-
-