Class ContainerDataYaml
java.lang.Object
org.apache.hadoop.ozone.container.common.impl.ContainerDataYaml
Class for creating and reading .container files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateContainerFile(ContainerData containerData, File containerFile) Creates a .container file in yaml format.static org.yaml.snakeyaml.YamlgetYamlForContainerType(org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType containerType, boolean withReplicaIndex) Given a ContainerType this method returns a Yaml representation of the container properties.static ContainerDatareadContainer(byte[] containerFileContent) Read the yaml file content, and return containerData.static ContainerDatareadContainer(InputStream input) Read the yaml content, and return containerData.static ContainerDatareadContainerFile(File containerFile) Read the yaml file, and return containerData.
-
Method Details
-
createContainerFile
public static void createContainerFile(ContainerData containerData, File containerFile) throws IOException Creates a .container file in yaml format.- Throws:
IOException
-
readContainerFile
Read the yaml file, and return containerData.- Throws:
IOException
-
readContainer
Read the yaml file content, and return containerData.- Throws:
IOException
-
readContainer
Read the yaml content, and return containerData.- Throws:
IOException
-
getYamlForContainerType
public static org.yaml.snakeyaml.Yaml getYamlForContainerType(org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerType containerType, boolean withReplicaIndex) throws org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException Given a ContainerType this method returns a Yaml representation of the container properties.- Parameters:
containerType- type of containerwithReplicaIndex- in the container yaml- Returns:
- Yamal representation of container properties
- Throws:
org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException- if the type is unrecognized
-