FsVolumeSpi (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.datanode.fsdataset, interface: FsVolumeSpi

Package org.apache.hadoop.hdfs.server.datanode.fsdataset

# Interface FsVolumeSpi

All Superinterfaces:
  `Checkable<FsVolumeSpi.VolumeCheckContext,VolumeCheckResult>`

All Known Implementing Classes:
  `FsVolumeImpl`

public interface FsVolumeSpi extends Checkable<FsVolumeSpi.VolumeCheckContext,VolumeCheckResult>
This is an interface for the underlying volume.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `FsVolumeSpi.BlockIterator`
  BlockIterator will return ExtendedBlock entries from a block pool in this volume.
  `static class`
  `FsVolumeSpi.ScanInfo`
  Tracks the files and other information related to a block on the disk Missing file is indicated by setting the corresponding member to null.
  `static class`
  `FsVolumeSpi.VolumeCheckContext`
  Context for the `Checkable.check(K)` call.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `compileReport(String bpid, Collection<FsVolumeSpi.ScanInfo> report, DirectoryScanner.ReportCompiler reportCompiler)`
  Compile a list of `FsVolumeSpi.ScanInfo` for the blocks in the block pool with id `bpid`.
  `long`
  `getAvailable()`
  `URI`
  `getBaseURI()`
  `String[]`
  `getBlockPoolList()`
  `FsDatasetSpi`
  `getDataset()`
  Get the FSDatasetSpi which this volume is a part of.
  `FileIoProvider`
  `getFileIoProvider()`
  `DataNodeVolumeMetrics`
  `getMetrics()`
  `String`
  `getStorageID()`
  `StorageLocation`
  `getStorageLocation()`
  `org.apache.hadoop.fs.StorageType`
  `getStorageType()`
  `org.apache.hadoop.fs.DF`
  `getUsageStats(org.apache.hadoop.conf.Configuration conf)`
  `boolean`
  `isRAMStorage()`
  Returns true if the volume is backed by RAM storage.
  `boolean`
  `isTransientStorage()`
  Returns true if the volume is NOT backed by persistent storage.
  `FsVolumeSpi.BlockIterator`
  `loadBlockIterator(String bpid, String name)`
  Load a saved block iterator.
  `byte[]`
  `loadLastPartialChunkChecksum(File blockFile, File metaFile)`
  Load last partial chunk checksum from checksum file.
  `FsVolumeSpi.BlockIterator`
  `newBlockIterator(String bpid, String name)`
  Create a new block iterator.
  `FsVolumeReference`
  `obtainReference()`
  Obtain a reference object that had increased 1 reference count of the volume.
  `void`
  `releaseLockedMemory(long bytesToRelease)`
  Release reserved memory for an RBW block written to transient storage i.e.
  `void`
  `releaseReservedSpace(long bytesToRelease)`
  Release disk space previously reserved for block opened for write.
  `void`
  `reserveSpaceForReplica(long bytesToReserve)`
  Reserve disk space for a block (RBW or Re-replicating) so a writer does not run out of space before the block is full.

  ### Methods inherited from interface org.apache.hadoop.hdfs.server.datanode.checker.Checkable

  `check`

- ## Method Details

  - ### obtainReference

    FsVolumeReference obtainReference() throws ClosedChannelException
    Obtain a reference object that had increased 1 reference count of the volume. It is caller's responsibility to close `FsVolumeReference` to decrease the reference count on the volume.
    Throws:
      `ClosedChannelException`

  - ### getStorageID

    String getStorageID()
    Returns:
      the StorageUuid of the volume

  - ### getBlockPoolList

    String[] getBlockPoolList()
    Returns:
      a list of block pools.

  - ### getAvailable

    long getAvailable() throws IOException
    Returns:
      the available storage space in bytes.
    Throws:
      `IOException`

  - ### getBaseURI

    URI getBaseURI()
    Returns:
      the base path to the volume

  - ### getUsageStats

    org.apache.hadoop.fs.DF getUsageStats(org.apache.hadoop.conf.Configuration conf)

  - ### getStorageLocation

    StorageLocation getStorageLocation()
    Returns:
      the `StorageLocation` to the volume

  - ### getStorageType

    org.apache.hadoop.fs.StorageType getStorageType()
    Returns:
      the `StorageType` of the volume

  - ### isTransientStorage

    boolean isTransientStorage()
    Returns true if the volume is NOT backed by persistent storage.

  - ### isRAMStorage

    boolean isRAMStorage()
    Returns true if the volume is backed by RAM storage.

  - ### reserveSpaceForReplica

    void reserveSpaceForReplica(long bytesToReserve)
    Reserve disk space for a block (RBW or Re-replicating) so a writer does not run out of space before the block is full.

  - ### releaseReservedSpace

    void releaseReservedSpace(long bytesToRelease)
    Release disk space previously reserved for block opened for write.

  - ### releaseLockedMemory

    void releaseLockedMemory(long bytesToRelease)
    Release reserved memory for an RBW block written to transient storage i.e. RAM. bytesToRelease will be rounded down to the OS page size since locked memory reservation must always be a multiple of the page size.

  - ### newBlockIterator

    FsVolumeSpi.BlockIterator newBlockIterator(String bpid, String name)
    Create a new block iterator. It will start at the beginning of the block set.
    Parameters:
      `bpid` - The block pool id to iterate over.
      `name` - The name of the block iterator to create.
    Returns:
      The new block iterator.

  - ### loadBlockIterator

    FsVolumeSpi.BlockIterator loadBlockIterator(String bpid, String name) throws IOException
    Load a saved block iterator.
    Parameters:
      `bpid` - The block pool id to iterate over.
      `name` - The name of the block iterator to load.
    Returns:
      The saved block iterator.
    Throws:
      `IOException` - If there was an IO error loading the saved block iterator.

  - ### getDataset

    FsDatasetSpi getDataset()
    Get the FSDatasetSpi which this volume is a part of.

  - ### loadLastPartialChunkChecksum

    byte[] loadLastPartialChunkChecksum(File blockFile, File metaFile) throws IOException
    Load last partial chunk checksum from checksum file. Need to be called with FsDataset lock acquired.
    Parameters:
      `blockFile` -
      `metaFile` -
    Returns:
      the last partial checksum
    Throws:
      `IOException`

  - ### compileReport

    void compileReport(String bpid, Collection<FsVolumeSpi.ScanInfo> report, DirectoryScanner.ReportCompiler reportCompiler) throws InterruptedException, IOException
    Compile a list of `FsVolumeSpi.ScanInfo` for the blocks in the block pool with id `bpid`.
    Parameters:
      `bpid` - block pool id to scan
      `report` - the list onto which blocks reports are placed
      `reportCompiler` -
    Throws:
      `InterruptedException`
      `IOException`

  - ### getFileIoProvider

    FileIoProvider getFileIoProvider()

  - ### getMetrics

    DataNodeVolumeMetrics getMetrics()