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 Summary
Modifier and TypeMethodDescriptionvoidpack(Container<CONTAINERDATA> container, OutputStream destination) Compress all the container data (chunk data, metadata db AND container descriptor) to one single archive.default voidpersistCustomContainerState(Container<? extends ContainerData> container, byte[] descriptorContent, org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerDataProto.State state, Path containerMetadataPath) Persists the custom state for a container.byte[]unpackContainerData(Container<CONTAINERDATA> container, InputStream inputStream, Path tmpDir, Path destContainerDir) Extract the container data to the path defined by the container.byte[]unpackContainerDescriptor(InputStream inputStream) Read the descriptor from the finished archive to get the data before importing the container.
-
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
Compress all the container data (chunk data, metadata db AND container descriptor) to one single archive.- Throws:
IOException
-
unpackContainerDescriptor
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
-