org.apache.cassandra.io.sstable

## Class Descriptor

- java.lang.Object
- - org.apache.cassandra.io.sstable.Descriptor

-     public class Descriptor
      extends java.lang.Object

  A SSTable is described by the keyspace and column family it contains data for, a 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
    Modifier and Type | Field and Description
    --- | ---
    `java.lang.String` | `cfname`
    `Component` | `digestComponent` digest component - might be `null` for old, legacy sstables
    `java.io.File` | `directory` canonicalized path to the directory where SSTable resides
    `SSTableFormat.Type` | `formatType`
    `int` | `generation`
    `java.lang.String` | `ksname`
    `static java.lang.String` | `TMP_EXT`
    `Version` | `version` version has the following format: `[a-z]+`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Descriptor(java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation)` A descriptor that assumes CURRENT_VERSION.
    `Descriptor(java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation, SSTableFormat.Type formatType)` Constructor for sstable writers only.
    `Descriptor(java.lang.String version, java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation, SSTableFormat.Type formatType)`
    `Descriptor(Version version, java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation, SSTableFormat.Type formatType, Component digestComponent)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `baseFilename()`
    `boolean` | `equals(java.lang.Object o)`
    `java.lang.String` | `filenameFor(Component component)`
    `static Pair<Descriptor,java.lang.String>` | `fromFilename(java.io.File directory, java.lang.String name)`
    `static Pair<Descriptor,java.lang.String>` | `fromFilename(java.io.File directory, java.lang.String name, boolean skipComponent)` Filename of the form is vary by version: <ksname>-<cfname>-(tmp-)?<version>-<gen>-<component> for cassandra 2.0 and before (<tmp marker>-)?<version>-<gen>-<component> for cassandra 3.0 and later If this is for SSTable of secondary index, directory should ends with index name for 2.1+.
    `static Descriptor` | `fromFilename(java.lang.String filename)`
    `static Descriptor` | `fromFilename(java.lang.String filename, boolean skipComponent)`
    `static Descriptor` | `fromFilename(java.lang.String filename, SSTableFormat.Type formatType)`
    `SSTableFormat` | `getFormat()`
    `IMetadataSerializer` | `getMetadataSerializer()`
    `java.util.List<java.io.File>` | `getTemporaryFiles()` Return any temporary files found in the directory
    `int` | `hashCode()`
    `boolean` | `isCompatible()`
    `static boolean` | `isLegacyFile(java.io.File file)`
    `static boolean` | `isValidFile(java.lang.String fileName)`
    `java.lang.String` | `relativeFilenameFor(Component component)`
    `java.lang.String` | `tmpFilenameFor(Component component)`
    `java.lang.String` | `toString()`
    `Descriptor` | `withDigestComponent(Component newDigestComponent)`
    `Descriptor` | `withFormatType(SSTableFormat.Type newType)`
    `Descriptor` | `withGeneration(int newGeneration)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### TMP_EXT

          public static java.lang.String TMP_EXT

    - #### directory

          public final java.io.File directory

      canonicalized path to the directory where SSTable resides

    - #### version

          public final Version version

      version has the following format: `[a-z]+`

    - #### ksname

          public final java.lang.String ksname

    - #### cfname

          public final java.lang.String cfname

    - #### generation

          public final int generation

    - #### formatType

          public final SSTableFormat.Type formatType

    - #### digestComponent

          public final Component digestComponent

      digest component - might be `null` for old, legacy sstables

  - ### Constructor Detail

    - #### Descriptor

          public Descriptor(java.io.File directory,
                            java.lang.String ksname,
                            java.lang.String cfname,
                            int generation)

      A descriptor that assumes CURRENT_VERSION.

    - #### Descriptor

          public Descriptor(java.io.File directory,
                            java.lang.String ksname,
                            java.lang.String cfname,
                            int generation,
                            SSTableFormat.Type formatType)

      Constructor for sstable writers only.

    - #### Descriptor

          public Descriptor(java.lang.String version,
                            java.io.File directory,
                            java.lang.String ksname,
                            java.lang.String cfname,
                            int generation,
                            SSTableFormat.Type formatType)

    - #### Descriptor

          public Descriptor(Version version,
                            java.io.File directory,
                            java.lang.String ksname,
                            java.lang.String cfname,
                            int generation,
                            SSTableFormat.Type formatType,
                            Component digestComponent)

  - ### Method Detail

    - #### withGeneration

          public Descriptor withGeneration(int newGeneration)

    - #### withFormatType

          public Descriptor withFormatType(SSTableFormat.Type newType)

    - #### withDigestComponent

          public Descriptor withDigestComponent(Component newDigestComponent)

    - #### tmpFilenameFor

          public java.lang.String tmpFilenameFor(Component component)

    - #### filenameFor

          public java.lang.String filenameFor(Component component)

    - #### baseFilename

          public java.lang.String baseFilename()

    - #### relativeFilenameFor

          public java.lang.String relativeFilenameFor(Component component)

    - #### getFormat

          public SSTableFormat getFormat()

    - #### getTemporaryFiles

          public java.util.List<java.io.File> getTemporaryFiles()

      Return any temporary files found in the directory

    - #### isLegacyFile

          public static boolean isLegacyFile(java.io.File file)

    - #### isValidFile

          public static boolean isValidFile(java.lang.String fileName)

    - #### fromFilename

          public static Descriptor fromFilename(java.lang.String filename)

      Parameters:
        `filename` - The SSTable filename
      Returns:
        Descriptor of the SSTable initialized from filename
      See Also:
        `fromFilename(File directory, String name)`

    - #### fromFilename

          public static Descriptor fromFilename(java.lang.String filename,
                                                SSTableFormat.Type formatType)

    - #### fromFilename

          public static Descriptor fromFilename(java.lang.String filename,
                                                boolean skipComponent)

    - #### fromFilename

          public static Pair<Descriptor,java.lang.String> fromFilename(java.io.File directory,
                                                                       java.lang.String name)

    - #### fromFilename

          public static Pair<Descriptor,java.lang.String> fromFilename(java.io.File directory,
                                                                       java.lang.String name,
                                                                       boolean skipComponent)

      Filename of the form is vary by version:
      - <ksname>-<cfname>-(tmp-)?<version>-<gen>-<component> for cassandra 2.0 and before
      - (<tmp marker>-)?<version>-<gen>-<component> for cassandra 3.0 and later
      If this is for SSTable of secondary index, directory should ends with index name for 2.1+.
      Parameters:
        `directory` - The directory of the SSTable files
        `name` - The name of the SSTable file
        `skipComponent` - true if the name param should not be parsed for a component tag
      Returns:
        A Descriptor for the SSTable, and the Component remainder.

    - #### getMetadataSerializer

          public IMetadataSerializer getMetadataSerializer()

    - #### isCompatible

          public boolean isCompatible()

      Returns:
        true if the current Cassandra version can read the given sstable version

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

Copyright © 2018 The Apache Software Foundation