Descriptor (apache-cassandra API)
Date: 2018-02-12

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.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Descriptor.Type`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.lang.String` | `cfname`
    `java.io.File` | `directory` canonicalized path to the directory where SSTable resides
    `SSTableFormat.Type` | `formatType`
    `int` | `generation`
    `java.lang.String` | `ksname`
    `Descriptor.Type` | `type`
    `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, Descriptor.Type temp)` A descriptor that assumes CURRENT_VERSION.
    `Descriptor(java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation, Descriptor.Type temp, SSTableFormat.Type formatType)`
    `Descriptor(java.lang.String version, java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation, Descriptor.Type temp, SSTableFormat.Type formatType)`
    `Descriptor(Version version, java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation, Descriptor.Type temp, SSTableFormat.Type formatType)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Descriptor` | `asType(Descriptor.Type type)`
    `java.lang.String` | `baseFilename()`
    `boolean` | `equals(java.lang.Object o)`
    `java.lang.String` | `filenameFor(Component component)`
    `java.lang.String` | `filenameFor(java.lang.String suffix)`
    `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()`
    `int` | `hashCode()`
    `boolean` | `isCompatible()`
    `java.lang.String` | `relativeFilenameFor(Component component)`
    `java.lang.String` | `toString()`
    `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

    - #### 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

    - #### type

          public final Descriptor.Type type

    - #### formatType

          public final SSTableFormat.Type formatType

  - ### Constructor Detail

    - #### Descriptor

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

      A descriptor that assumes CURRENT_VERSION.

    - #### Descriptor

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

    - #### Descriptor

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

    - #### Descriptor

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

  - ### Method Detail

    - #### withGeneration

          public Descriptor withGeneration(int newGeneration)

    - #### withFormatType

          public Descriptor withFormatType(SSTableFormat.Type newType)

    - #### 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()

    - #### filenameFor

          public java.lang.String filenameFor(java.lang.String suffix)

      Parameters:
        `suffix` - A component suffix, such as 'Data.db'/'Index.db'/etc
      Returns:
        A filename for this descriptor with the given suffix.

    - #### 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.

    - #### asType

          public Descriptor asType(Descriptor.Type type)

      Parameters:
        `type` - temporary flag
      Returns:
        A clone of this descriptor with the given 'temporary' status.

    - #### 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