Package org.apache.cassandra.io.util
Class FileHandle
java.lang.Object
org.apache.cassandra.utils.concurrent.SharedCloseableImpl
org.apache.cassandra.io.util.FileHandle
- All Implemented Interfaces:
AutoCloseable,SharedCloseable
FileHandle provides access to a file for reading, including the ones written by various SequentialWriter
instances, and it is typically used by SSTableReader.
Use FileHandle.Builder to create an instance, and call createReader() (and its variants) to
access the readers for the underlying file.
You can use FileHandle.Builder.complete() several times during its lifecycle with different overrideLength(i.e. early opening file).
For that reason, the builder keeps a reference to the file channel and makes a copy for each FileHandle.Builder.complete() call.
Therefore, it is important to close the FileHandle.Builder when it is no longer needed, as well as any FileHandle
instances.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfigures how the file will be read (compressed, mmapped, use cache etc.) -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTo(Ref.IdentityCollection identities) CreateRandomAccessReaderwith configured method of reading content of the file.createReader(long position) createReader(com.google.common.util.concurrent.RateLimiter limiter) CreateRandomAccessReaderwith configured method of reading content of the file.createReader(com.google.common.util.concurrent.RateLimiter limiter, boolean forScan) longvoiddropPageCache(long before) Drop page cache from start to givenbefore.file()instantiateRebufferer(com.google.common.util.concurrent.RateLimiter limiter) instantiateRebufferer(com.google.common.util.concurrent.RateLimiter limiter, boolean forScan) path()toString()Methods inherited from class org.apache.cassandra.utils.concurrent.SharedCloseableImpl
close, close, isCleanedUp
-
Field Details
-
channel
-
onDiskLength
public final long onDiskLength
-
-
Method Details
-
file
- Returns:
- file this factory is referencing
-
path
-
dataLength
public long dataLength() -
rebuffererFactory
-
compressionMetadata
-
addTo
- Specified by:
addToin interfaceSharedCloseable- Overrides:
addToin classSharedCloseableImpl
-
createReader
CreateRandomAccessReaderwith configured method of reading content of the file.- Returns:
- RandomAccessReader for the file
-
createReaderForScan
-
createReader
CreateRandomAccessReaderwith configured method of reading content of the file. Reading from file will be rate limited by givenRateLimiter.- Parameters:
limiter- RateLimiter to use for rate limiting read- Returns:
- RandomAccessReader for the file
-
createReader
public RandomAccessReader createReader(com.google.common.util.concurrent.RateLimiter limiter, boolean forScan) -
createReader
-
dropPageCache
public void dropPageCache(long before) Drop page cache from start to givenbefore.- Parameters:
before- uncompressed position from start of the file to be dropped from cache. if 0, to end of file.
-
instantiateRebufferer
-
instantiateRebufferer
public Rebufferer instantiateRebufferer(com.google.common.util.concurrent.RateLimiter limiter, boolean forScan) -
toString
-