Package org.apache.cassandra.io.sstable
Class Descriptor
java.lang.Object
org.apache.cassandra.io.sstable.Descriptor
A SSTable is described by the keyspace and column family it contains data
for, an id (generation - where higher generations contain more recent data) and
an alphabetic version string.
A descriptor can be marked as temporary, which influences generated filenames.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDescriptor(String version, File directory, String ksname, String cfname, SSTableId id, SSTableFormat<?, ?> format) Descriptor(File directory, String ksname, String cfname, SSTableId id) A descriptor that assumes CURRENT_VERSION.Descriptor(File directory, String ksname, String cfname, SSTableId id, SSTableFormat<?, ?> format) Constructor for sstable writers only. -
Method Summary
Modifier and TypeMethodDescriptionbaseFile()static ComponentcomponentFromFile(File file) booleanstatic DescriptorParse a sstable filename into a Descriptor.static Pair<Descriptor,Component> fromFileWithComponent(File file) Parse a sstable filename, extracting both theDescriptorandComponentpart.static Pair<Descriptor,Component> fromFileWithComponent(File file, boolean validateDirs) static Pair<Descriptor,Component> fromFileWithComponent(File file, String keyspace, String table) Parse a sstable filename, extracting both theDescriptorandComponentpart.getComponents(Set<Component> mandatory, Set<Component> optional) Returns the set of components consisting of the provided mandatory components and those optional components for which the corresponding file exists.SSTableFormat<?,?> Return any temporary files found in the directoryinthashCode()booleanstatic booleanisValidFile(File file) relativeFilenameFor(Component component) tmpFileFor(Component component) tmpFileForStreaming(Component component) toString()
-
Field Details
-
EXTENSION
- See Also:
-
TMP_EXT
-
FILENAME_SEPARATOR
public static final char FILENAME_SEPARATOR- See Also:
-
directory
canonicalized path to the directory where SSTable resides -
version
version has the following format:[a-z]+ -
ksname
-
cfname
-
id
-
-
Constructor Details
-
Descriptor
A descriptor that assumes CURRENT_VERSION. -
Descriptor
public Descriptor(File directory, String ksname, String cfname, SSTableId id, SSTableFormat<?, ?> format) Constructor for sstable writers only. -
Descriptor
-
Descriptor
-
-
Method Details
-
tmpFileFor
-
tmpFileForStreaming
- Returns:
- a unique temporary file name for given component during entire-sstable-streaming.
-
fileFor
-
baseFile
-
relativeFilenameFor
-
getFormat
-
getTemporaryFiles
Return any temporary files found in the directory -
getComponents
Returns the set of components consisting of the provided mandatory components and those optional components for which the corresponding file exists. -
isValidFile
-
fromFile
Parse a sstable filename into a Descriptor.SSTables files are all located within subdirectories of the form
<keyspace>/<table>/. Normal sstables are are directly within that subdirectory structure while 2ndary index, backups and snapshot are each inside an additional subdirectory. The file themselves have the form:<version>-<gen>-<format>-<component>.Note that this method will only sucessfully parse sstable files of supported versions.
- Parameters:
file- theFileobject for the filename to parse.- Returns:
- the descriptor for the parsed file.
- Throws:
IllegalArgumentException- if the providedfiledoes point to a valid sstable filename. This could mean either that the filename doesn't look like a sstable file, or that it is for an old and unsupported versions.
-
componentFromFile
-
fromFileWithComponent
Parse a sstable filename, extracting both theDescriptorandComponentpart. The keyspace/table name will be extracted from the directory path.- Parameters:
file- theFileobject for the filename to parse.- Returns:
- a pair of the descriptor and component corresponding to the provided
file. - Throws:
IllegalArgumentException- if the providedfiledoes point to a valid sstable filename. This could mean either that the filename doesn't look like a sstable file, or that it is for an old and unsupported versions.
-
fromFileWithComponent
-
fromFileWithComponent
public static Pair<Descriptor,Component> fromFileWithComponent(File file, String keyspace, String table) Parse a sstable filename, extracting both theDescriptorandComponentpart.- Parameters:
file- theFileobject for the filename to parse.keyspace- The keyspace name of the file. Ifnull, then the keyspace name will be extracted from the directory path.table- The table name of the file. Ifnull, then the table name will be extracted from the directory path.- Returns:
- a pair of the descriptor and component corresponding to the provided
file. - Throws:
IllegalArgumentException- if the providedfiledoes point to a valid sstable filename. This could mean either that the filename doesn't look like a sstable file, or that it is for an old and unsupported versions.
-
getMetadataSerializer
-
isCompatible
public boolean isCompatible()- Returns:
- true if the current Cassandra version can read the given sstable version
-
discoverComponents
-
toString
-
equals
-
hashCode
public int hashCode()
-