Interface Container<CONTAINERDATA extends ContainerData>

All Known Implementing Classes:
KeyValueContainer

public interface Container<CONTAINERDATA extends ContainerData>
Interface for Container Operations.
  • Method Details

    • create

      void create(VolumeSet volumeSet, VolumeChoosingPolicy volumeChoosingPolicy, String scmId) throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Creates a container.
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • delete

      void delete() throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Deletes the container.
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • hasBlocks

      boolean hasBlocks() throws IOException
      Returns true if container has some block.
      Returns:
      true if container has some block.
      Throws:
      IOException - if was unable to check container status.
    • update

      void update(Map<String,String> metaData, boolean forceUpdate) throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Update the container.
      Parameters:
      metaData -
      forceUpdate - if true, update container forcibly.
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • update

      void update(Map<String,String> metaData, boolean forceUpdate, String containerMetadataPath) throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • updateDataScanTimestamp

      void updateDataScanTimestamp(Instant timestamp) throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • getContainerData

      CONTAINERDATA getContainerData()
      Get metadata about the container.
      Returns:
      ContainerData - Container Data.
    • getContainerState

      org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerDataProto.State getContainerState()
      Get the Container Lifecycle state.
      Returns:
      ContainerLifeCycleState - Container State.
    • markContainerForClose

      void markContainerForClose() throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Marks the container for closing. Moves the container to CLOSING state.
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • markContainerUnhealthy

      void markContainerUnhealthy() throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Marks the container replica as unhealthy.
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • markContainerForDelete

      void markContainerForDelete()
      Marks the container replica as deleted.
    • quasiClose

      void quasiClose() throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Quasi Closes a open container, if it is already closed or does not exist a StorageContainerException is thrown.
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • close

      void close() throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Closes a open/quasi closed container, if it is already closed or does not exist a StorageContainerException is thrown.
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • getContainerType

      org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType getContainerType()
      Return the ContainerType for the container.
    • getContainerFile

      File getContainerFile()
      Returns containerFile.
    • updateDeleteTransactionId

      void updateDeleteTransactionId(long deleteTransactionId)
      updates the DeleteTransactionId.
      Parameters:
      deleteTransactionId -
    • importContainerData

      void importContainerData(InputStream stream, ContainerPacker<CONTAINERDATA> packer) throws IOException
      Import the container from an external archive.
      Throws:
      IOException
    • exportContainerData

      void exportContainerData(OutputStream stream, ContainerPacker<CONTAINERDATA> packer) throws IOException
      Export all the data of the container to one output archive with the help of the packer.
      Throws:
      IOException
    • getContainerReport

      org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReplicaProto getContainerReport() throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
      Returns containerReport for the container.
      Throws:
      org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException
    • updateBlockCommitSequenceId

      void updateBlockCommitSequenceId(long blockCommitSequenceId)
      updates the blockCommitSequenceId.
    • getBlockCommitSequenceId

      long getBlockCommitSequenceId()
      Returns the blockCommitSequenceId.
    • scanMetaData

      check and report the structural integrity of the container.
      Returns:
      A MetadataScanResult encapsulating the result of the scan.
      Throws:
      InterruptedException - if the scanning thread is interrupted before it completes.
    • shouldScanData

      boolean shouldScanData()
      Return if the container data should be checksum verified to detect corruption. The result depends upon the current state of the container (e.g. if a container is accepting writes, it may not be a good idea to perform checksum verification to avoid concurrency issues).
    • scanData

      DataScanResult scanData(org.apache.hadoop.hdfs.util.DataTransferThrottler throttler, org.apache.hadoop.hdfs.util.Canceler canceler) throws InterruptedException
      Perform checksum verification for the container data.
      Parameters:
      throttler - A reference of DataTransferThrottler used to perform I/O bandwidth throttling
      canceler - A reference of Canceler used to cancel the I/O bandwidth throttling (e.g. for shutdown purpose).
      Returns:
      A DataScanResult encapsulating the result of the scan.
      Throws:
      InterruptedException - if the scanning thread is interrupted before it completes.
    • readLock

      void readLock()
      Acquire read lock.
    • readLockInterruptibly

      void readLockInterruptibly() throws InterruptedException
      Acquire read lock, unless interrupted while waiting.
      Throws:
      InterruptedException
    • readUnlock

      void readUnlock()
      Release read lock.
    • hasReadLock

      boolean hasReadLock()
      Check if the current thread holds read lock.
    • writeLock

      void writeLock()
      Acquire write lock.
    • writeLockInterruptibly

      void writeLockInterruptibly() throws InterruptedException
      Acquire write lock, unless interrupted while waiting.
      Throws:
      InterruptedException
    • writeUnlock

      void writeUnlock()
      Release write lock.
    • hasWriteLock

      boolean hasWriteLock()
      Check if the current thread holds write lock.