org.apache.cassandra.io.sstable
Class Descriptor

java.lang.Object
  extended by 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
 java.lang.String cfname
           
static java.lang.String CURRENT_VERSION
           
 java.io.File directory
           
 int generation
           
 boolean hasCompressionRatio
           
 boolean hasEncodedKeys
           
 boolean hasIntRowSize
           
 boolean hasPartitioner
           
 boolean hasStringsInBloomFilter
           
 boolean isLatestVersion
           
 java.lang.String ksname
           
static java.lang.String LEGACY_VERSION
           
 boolean metadataIncludesReplayPosition
           
 boolean temporary
           
 boolean tracksMaxTimestamp
           
 boolean usesOldBloomFilter
           
 java.lang.String version
          version has the following format: [a-z]+
 
Constructor Summary
Descriptor(java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation, boolean temp)
          A descriptor that assumes CURRENT_VERSION.
Descriptor(java.lang.String version, java.io.File directory, java.lang.String ksname, java.lang.String cfname, int generation, boolean temp)
           
 
Method Summary
 Descriptor asTemporary(boolean temporary)
           
 boolean containsTimestamp()
          Versions [h..hc] contained a timestamp value that was computed incorrectly, ignoring row tombstones.
 boolean equals(java.lang.Object o)
           
static java.lang.String extractKeyspaceName(java.io.File directory)
          Extracts the keyspace name out of the directory name.
 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)
          Filename of the form "/-[tmp-][-]-"
static Descriptor fromFilename(java.lang.String filename)
           
 int hashCode()
           
 boolean isCompatible()
           
 boolean isStreamCompatible()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LEGACY_VERSION

public static final java.lang.String LEGACY_VERSION
See Also:
Constant Field Values

CURRENT_VERSION

public static final java.lang.String CURRENT_VERSION
See Also:
Constant Field Values

directory

public final java.io.File directory

version

public final java.lang.String 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

temporary

public final boolean temporary

hasStringsInBloomFilter

public final boolean hasStringsInBloomFilter

hasIntRowSize

public final boolean hasIntRowSize

hasEncodedKeys

public final boolean hasEncodedKeys

isLatestVersion

public final boolean isLatestVersion

usesOldBloomFilter

public final boolean usesOldBloomFilter

metadataIncludesReplayPosition

public final boolean metadataIncludesReplayPosition

tracksMaxTimestamp

public final boolean tracksMaxTimestamp

hasCompressionRatio

public final boolean hasCompressionRatio

hasPartitioner

public final boolean hasPartitioner
Constructor Detail

Descriptor

public Descriptor(java.io.File directory,
                  java.lang.String ksname,
                  java.lang.String cfname,
                  int generation,
                  boolean temp)
A descriptor that assumes CURRENT_VERSION.


Descriptor

public Descriptor(java.lang.String version,
                  java.io.File directory,
                  java.lang.String ksname,
                  java.lang.String cfname,
                  int generation,
                  boolean temp)
Method Detail

filenameFor

public java.lang.String filenameFor(Component component)

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 Pair<Descriptor,java.lang.String> fromFilename(java.io.File directory,
                                                             java.lang.String name)
Filename of the form "/-[tmp-][-]-"

Parameters:
directory - The directory of the SSTable files
name - The name of the SSTable file
Returns:
A Descriptor for the SSTable, and the Component remainder.

extractKeyspaceName

public static java.lang.String extractKeyspaceName(java.io.File directory)
Extracts the keyspace name out of the directory name. Snapshot directories have a slightly different path structure and need to be treated differently. Regular path: "/-[tmp-][-]-" Snapshot path: "/snapshots//-[tmp-][-]-"

Parameters:
directory - a directory containing SSTables
Returns:
the keyspace name

asTemporary

public Descriptor asTemporary(boolean temporary)
Parameters:
temporary - temporary flag
Returns:
A clone of this descriptor with the given 'temporary' status.

isCompatible

public boolean isCompatible()
Returns:
true if the current Cassandra version can read the given sstable version

isStreamCompatible

public boolean isStreamCompatible()
Returns:
true if the current Cassandra version can stream the given sstable version from another node. This is stricter than opening it locally [isCompatible] because streaming needs to rebuild all the non-data components, and it only knows how to write the latest version.

containsTimestamp

public boolean containsTimestamp()
Versions [h..hc] contained a timestamp value that was computed incorrectly, ignoring row tombstones. containsTimestamp returns true if there is a timestamp value in the metadata file; to know if it actually contains a *correct* timestamp, see tracksMaxTimestamp.


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 © 2012 The Apache Software Foundation