Interface OnDiskFormat

All Known Implementing Classes:
V1OnDiskFormat

public interface OnDiskFormat
An interface to the on-disk format of an index. This provides format agnostic methods to read and write an on-disk format.

The methods on this interface can be logically mapped into the following groups based on their method parameters:

  • Methods taking no parameters. These methods return static information about the format. This can include static information about the per-sstable components
  • Methods taking an IndexDescriptor. These methods interact with the on-disk components, or return objects that will interact with the on-disk components, or return information about the on-disk components. If they take an IndexTermType and/or a IndexIdentifier as well they will be interacting with per-column index files; otherwise they will be interacting with per-sstable index files
  • Methods taking an IndexComponent. These methods only interact with a single index component or set of index components
  • Method Details

    • newPrimaryKeyMapFactory

      PrimaryKeyMap.Factory newPrimaryKeyMapFactory(IndexDescriptor indexDescriptor, SSTableReader sstable)
      Returns a PrimaryKeyMap.Factory for the SSTable
      Parameters:
      indexDescriptor - The IndexDescriptor for the SSTable
      sstable - The SSTableReader associated with the IndexDescriptor
    • newSSTableIndex

      SSTableIndex newSSTableIndex(SSTableContext sstableContext, StorageAttachedIndex index)
      Create a new SSTableIndex for an on-disk index.
      Parameters:
      sstableContext - The SSTableContext holding the per-SSTable information for the index
      index - The StorageAttachedIndex
      Returns:
      the new SSTableIndex for the on-disk index
    • newPerSSTableIndexWriter

      PerSSTableIndexWriter newPerSSTableIndexWriter(IndexDescriptor indexDescriptor) throws IOException
      Create a new PerSSTableIndexWriter to write the per-SSTable on-disk components of an index.
      Parameters:
      indexDescriptor - The IndexDescriptor for the SSTable
      Throws:
      IOException - if the writer couldn't be created
    • newPerColumnIndexWriter

      PerColumnIndexWriter newPerColumnIndexWriter(StorageAttachedIndex index, IndexDescriptor indexDescriptor, LifecycleNewTracker tracker, RowMapping rowMapping)
      Create a new PerColumnIndexWriter to write the per-column on-disk components of an index. The LifecycleNewTracker is used to determine the type of index write about to happen this will either be an OperationType.FLUSH indicating that we are about to flush a MemtableIndex or one of the other operation types indicating that we will be writing from an existing SSTable
      Parameters:
      index - The StorageAttachedIndex holding the current index build status
      indexDescriptor - The IndexDescriptor for the SSTable
      tracker - The LifecycleNewTracker for index build operation.
      rowMapping - The RowMapping that is used to map rowID to PrimaryKey during the write operation
    • isPerSSTableIndexBuildComplete

      boolean isPerSSTableIndexBuildComplete(IndexDescriptor indexDescriptor)
      Returns true if the per-sstable index components have been built and are valid.
      Parameters:
      indexDescriptor - The IndexDescriptor for the SSTable SAI index
    • isPerColumnIndexBuildComplete

      boolean isPerColumnIndexBuildComplete(IndexDescriptor indexDescriptor, IndexIdentifier indexIdentifier)
      Returns true if the per-column index components have been built and are valid.
      Parameters:
      indexDescriptor - The IndexDescriptor for the SSTable SAI index
      indexIdentifier - The IndexIdentifier for the index
    • validatePerSSTableIndexComponents

      void validatePerSSTableIndexComponents(IndexDescriptor indexDescriptor, boolean checksum)
      Validate all the per-SSTable on-disk components and throw if a component is not valid
      Parameters:
      indexDescriptor - The IndexDescriptor for the SSTable SAI index
      checksum - true if the checksum should be tested as part of the validation
      Throws:
      UncheckedIOException - if there is a problem validating any on-disk component
    • validatePerColumnIndexComponents

      void validatePerColumnIndexComponents(IndexDescriptor indexDescriptor, IndexTermType indexTermType, IndexIdentifier indexIdentifier, boolean checksum)
      Validate all the per-column on-disk components and throw if a component is not valid
      Parameters:
      indexDescriptor - The IndexDescriptor for the SSTable SAI index
      indexTermType - The IndexTermType of the index
      indexIdentifier - The IndexIdentifier for the index
      checksum - true if the checksum should be tested as part of the validation
      Throws:
      UncheckedIOException - if there is a problem validating any on-disk component
    • perSSTableIndexComponents

      Set<IndexComponent> perSSTableIndexComponents(boolean hasClustering)
      Returns the set of IndexComponent for the per-SSTable part of an index. This is a complete set of components that could exist on-disk. It does not imply that the components currently exist on-disk.
      Parameters:
      hasClustering - true if the SSTable forms part of a table using clustering columns
    • perColumnIndexComponents

      Set<IndexComponent> perColumnIndexComponents(IndexTermType indexTermType)
      Returns the set of IndexComponent for the per-column part of an index. This is a complete set of components that could exist on-disk. It does not imply that the components currently exist on-disk.
      Parameters:
      indexTermType - the IndexTermType of the index
    • openFilesPerSSTableIndex

      int openFilesPerSSTableIndex(boolean hasClustering)
      Return the number of open per-SSTable files that can be open during a query. This is a static indication of the files that can be held open by an index for queries. It is not a dynamic calculation.
      Parameters:
      hasClustering - true if the SSTable forms part of a table using clustering columns
    • openFilesPerColumnIndex

      int openFilesPerColumnIndex()
      Return the number of open per-column index files that can be open during a query. This is a static indication of the files that can be help open by an index for queries. It is not a dynamic calculation.