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:
Closeable,DataOutput,Flushable,AutoCloseable,DataOutputPlus,Transactional
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classClass to hold a mark to the position of the fileprotected classNested classes/interfaces inherited from class org.apache.cassandra.io.util.SequentialWriter
SequentialWriter.BufferedFileWriterMarkNested 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, option, runPostFlushFields inherited from class org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
bufferFields inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
channel -
Constructor Summary
ConstructorsConstructorDescriptionCompressedSequentialWriter(File file, File offsetsFile, File digestFile, SequentialWriterOption option, CompressionParams parameters, MetadataCollector sstableMetadataCollector) Create CompressedSequentialWriter without digest file. -
Method Summary
Modifier and TypeMethodDescriptionintReturns how many bytes are left in the page.voidflush()protected voidOverride this method instead of overriding flush()longGet a quick estimation on how many bytes have been written to disk It should for the most part be exactly the same as getOnDiskFilePointer()longReturns the current file pointer of the underlying on-disk file.mark()intReturns the number of bytes that a page can take at maximum.open(long overrideLength) longReturns the next padded position.voidPad this with zeroes until the next page boundary.voidresetAndTruncate(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.TransactionalProxytxnProxy()Methods inherited from class org.apache.cassandra.io.util.SequentialWriter
abort, close, commit, current, doFlush, finish, getFile, getLastFlushOffset, getPath, hasPosition, isOpen, length, position, prepareToCommit, resetBuffer, setPostFlushListener, skipBytes, sync, syncDataOnlyInternal, syncInternal, truncate, writeDirectlyToChannelMethods inherited from class org.apache.cassandra.io.util.BufferedDataOutputStreamPlus
allocate, order, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeMostSignificantBytes, writeShort, writeUTFMethods inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus
newDefaultChannel, retrieveTemporaryBufferMethods inherited from class java.io.OutputStream
nullOutputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.io.util.DataOutputPlus
write, writeUnsignedVInt, writeUnsignedVInt, writeUnsignedVInt32, writeVInt, writeVInt, writeVInt32
-
Constructor Details
-
CompressedSequentialWriter
public CompressedSequentialWriter(File file, File offsetsFile, File digestFile, SequentialWriterOption option, CompressionParams parameters, MetadataCollector sstableMetadataCollector) Create CompressedSequentialWriter without digest file.- Parameters:
file- File to writeoffsetsFile- File 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 Details
-
getOnDiskFilePointer
public long getOnDiskFilePointer()Description copied from class:SequentialWriterReturns 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:
getOnDiskFilePointerin 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:
getEstimatedOnDiskBytesWrittenin classSequentialWriter
-
flush
public void flush()- Specified by:
flushin interfaceFlushable- Overrides:
flushin classBufferedDataOutputStreamPlus
-
flushData
protected void flushData()Description copied from class:SequentialWriterOverride this method instead of overriding flush()- Overrides:
flushDatain classSequentialWriter
-
open
-
mark
- Overrides:
markin classSequentialWriter
-
resetAndTruncate
Description copied from class:SequentialWriterDrops 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:
resetAndTruncatein classSequentialWriter
-
maxBytesInPage
public int maxBytesInPage()Description copied from interface:DataOutputPlusReturns the number of bytes that a page can take at maximum.- Specified by:
maxBytesInPagein interfaceDataOutputPlus- Overrides:
maxBytesInPagein classSequentialWriter
-
padToPageBoundary
public void padToPageBoundary()Description copied from interface:DataOutputPlusPad this with zeroes until the next page boundary. If the destination position is already at a page boundary, do not do anything.- Specified by:
padToPageBoundaryin interfaceDataOutputPlus- Overrides:
padToPageBoundaryin classSequentialWriter
-
bytesLeftInPage
public int bytesLeftInPage()Description copied from interface:DataOutputPlusReturns how many bytes are left in the page.- Specified by:
bytesLeftInPagein interfaceDataOutputPlus- Overrides:
bytesLeftInPagein classSequentialWriter
-
paddedPosition
public long paddedPosition()Description copied from interface:DataOutputPlusReturns the next padded position. This is either the current position (if already padded), or the start of next page.- Specified by:
paddedPositionin interfaceDataOutputPlus- Overrides:
paddedPositionin classSequentialWriter
-
txnProxy
- Overrides:
txnProxyin classSequentialWriter
-