Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cassandra.db
Class Directories

    java.lang.Object
      org.apache.cassandra.db.Directories

    public class Directories

extends java.lang.Object

Encapsulate handling of paths to the data files. The directory layout is the following: //ks/cf1/ks-cf1-hb-1-Data.db /cf2/ks-cf2-hb-1-Data.db ... In addition, more that one 'root' data directory can be specified so that potentially represents multiple locations. Note that in the case of multiple locations, the manifest for the leveled compaction is only in one of the location. Snapshots (resp. backups) are always created along the sstables thare are snapshoted (resp. backuped) but inside a subdirectory named 'snapshots' (resp. backups) (and snapshots are furter inside a subdirectory of the name of the snapshot). This class abstracts all those details from the rest of the code.

Nested Class Summary
`class` | `Directories.SSTableLister`

Field Summary
`static java.lang.String` | `BACKUPS_SUBDIR`
`static java.io.File[]` | `dataFileLocations`
`static char` | `SECONDARY_INDEX_NAME_SEPARATOR`
`static java.lang.String` | `SNAPSHOT_SUBDIR`

Method Summary
`void` | `clearSnapshot(java.lang.String snapshotName)`
`static Directories` | `create(java.lang.String tablename, java.lang.String cfname)`
`static java.io.File` | `getBackupsDirectory(Descriptor desc)`
`java.io.File` | `getDirectoryForNewSSTables(long estimatedSize)`
`java.io.File` | `getLocationWithMaximumAvailableSpace(long estimatedSize)`
`java.io.File` | `getOrCreateLeveledManifest()`
`static java.io.File` | `getSnapshotDirectory(Descriptor desc, java.lang.String snapshotName)`
`static void` | `migrateSSTables()` Move sstables from the pre-#2749 layout to their new location/names.
`boolean` | `snapshotExists(java.lang.String snapshotName)`
`void` | `snapshotLeveledManifest(java.lang.String snapshotName)`
`Directories.SSTableLister` | `sstableLister()`
`static boolean` | `sstablesNeedsMigration()` To check if sstables needs migration, we look at the System directory.
`java.io.File` | `tryGetLeveledManifest()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BACKUPS_SUBDIR

    public static final java.lang.String BACKUPS_SUBDIR

See Also:
  Constant Field Values

### SNAPSHOT_SUBDIR

    public static final java.lang.String SNAPSHOT_SUBDIR

See Also:
  Constant Field Values

### SECONDARY_INDEX_NAME_SEPARATOR

    public static final char SECONDARY_INDEX_NAME_SEPARATOR

See Also:
  Constant Field Values

### dataFileLocations

    public static final java.io.File[] dataFileLocations

Method Detail

### create

    public static Directories create(java.lang.String tablename,
                                     java.lang.String cfname)

### getDirectoryForNewSSTables

    public java.io.File getDirectoryForNewSSTables(long estimatedSize)

### getLocationWithMaximumAvailableSpace

    public java.io.File getLocationWithMaximumAvailableSpace(long estimatedSize)

### getSnapshotDirectory

    public static java.io.File getSnapshotDirectory(Descriptor desc,
                                                    java.lang.String snapshotName)

### getBackupsDirectory

    public static java.io.File getBackupsDirectory(Descriptor desc)

### sstableLister

    public Directories.SSTableLister sstableLister()

### tryGetLeveledManifest

    public java.io.File tryGetLeveledManifest()

### getOrCreateLeveledManifest

    public java.io.File getOrCreateLeveledManifest()

### snapshotLeveledManifest

    public void snapshotLeveledManifest(java.lang.String snapshotName)
                                 throws java.io.IOException

  Throws:
    `java.io.IOException`

### snapshotExists

    public boolean snapshotExists(java.lang.String snapshotName)

### clearSnapshot

    public void clearSnapshot(java.lang.String snapshotName)
                       throws java.io.IOException

  Throws:
    `java.io.IOException`

### sstablesNeedsMigration

    public static boolean sstablesNeedsMigration()

  To check if sstables needs migration, we look at the System directory. If it contains a directory for the status cf, we'll attempt a sstable migration. Note that it is mostly harmless to try a migration uselessly, except maybe for some wasted cpu cycles.

### migrateSSTables

    public static void migrateSSTables()

  Move sstables from the pre-#2749 layout to their new location/names. This involves: - moving each sstable to their CF specific directory - rename the sstable to include the keyspace in the filename Note that this also move leveled manifests, snapshots and backups.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 The Apache Software Foundation