Interface ContainerPacker<CONTAINERDATA extends ContainerData>

All Known Implementing Classes:
TarContainerPacker

public interface ContainerPacker<CONTAINERDATA extends ContainerData>
Service to pack/unpack ContainerData container data to/from a single byte stream.
  • Method Details

    • unpackContainerData

      byte[] unpackContainerData(Container<CONTAINERDATA> container, InputStream inputStream, Path tmpDir, Path destContainerDir) throws IOException
      Extract the container data to the path defined by the container.

      This doesn't contain the extraction of the container descriptor file.

      Returns:
      the byte content of the descriptor (which won't be written to a file but returned).
      Throws:
      IOException
    • pack

      void pack(Container<CONTAINERDATA> container, OutputStream destination) throws IOException
      Compress all the container data (chunk data, metadata db AND container descriptor) to one single archive.
      Throws:
      IOException
    • unpackContainerDescriptor

      byte[] unpackContainerDescriptor(InputStream inputStream) throws IOException
      Read the descriptor from the finished archive to get the data before importing the container.
      Throws:
      IOException
    • persistCustomContainerState

      default void persistCustomContainerState(Container<? extends ContainerData> container, byte[] descriptorContent, org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerDataProto.State state, Path containerMetadataPath) throws IOException
      Persists the custom state for a container. This method allows saving the container file to a custom location.
      Throws:
      IOException